connecting and programming lcd displays connected to a picaxe 18m

peter howarth

New Member
I have followed the instructions in the help files of pe6 to the letter of how to connect and program lcd displays with a picaxe 18m, but it doesnt work, keeps hiccupping on syntax errors, even before downloading to the picaxe 18m..

Has anyone been successful at connecting and programming an lcd display unit with a picaxe device, the instructions from revolution education do not work !!

All i want to do is connect/program an lcd unit, get a message onto its screen, then once that is done, then have different messages displayed from different inputs.. The axe 133 lcd display is no longer available in australia..
 

AllyCat

Senior Member
Hi,

I'm afraid we must have more information. Firstly, is it a PICaxe 18M , or the more modern 18M2 (or the most recent 18M2+ ) ?

Then, please give an example of a program you've tried, and examples of the Syntax Errors.

Finally, what is the type of "LCD"? The AXE133 is a complete PCB module which carries a PICaxe (18M2) and a "Parallel LCD". That has some "intelligence" and normally receives (serial) ASCII data and control bytes from another PICaxe. The majority of ebay-listed LCDs are "dumb" and have either a 14-16 pin parallel connection or a 4-pin I2C "Backpack". We can help you drive any of these types if necessary.

Cheers, Alan.
 

Flenser

Senior Member
Peter,

Are you trying to follow the instructions in PE -> Help -> Manual 3 - Interfacing Circuits -> Advanced Interfacing 1 - LCD Display?
 

Technoman

Senior Member
A long time ago , done using AXE033.

More recently, I had students programming Grove lcd rgb backlight very easily using Blockly within PE6. They can even change the colour of the backlight! (included a picture of the more recent prototype) Thanks to RevEd ; the use of modules around an AXE300 is really great for education purpose.

24371
 

kfjl

Member
I have followed the instructions in the help files of pe6 to the letter
They all say that!

keeps hiccupping on syntax errors
Are they a secret, or can you share them?

Has anyone been successful at connecting and programming an lcd display unit with a picaxe device
Probably everyone who didn't buy stupid lcd's... :)

All i want to do is connect/program an lcd unit, get a message onto its screen, then once that is done, then have different messages displayed from different inputs
Then have a look at this thread

Mortifyu's emphasis that his code DOES work leads me to think he couldn't get mine to work.

I did:


The 08M2_lcd-PCF8574T.bas also works, but it just displays the static text: "Bonjour enfin!".

Wouldn't make much of a video, would it?

I only use 08M2's and 20X2's so you may have to change the pin numbers to suit your 18M chip.
 

inglewoodpete

Senior Member
The 18M had only 256 bytes of program space: very restrictive when you have 18 (actually 14, from my memory) pins to play with.

It has a slightly different (older) code syntax to the current M2s and X2s, which is likely to be causing your current problems. Port B is output-only, with pins named 0, 1, 2, 3... (Not B.0, B.1, B.2...). Port C is input-only, with just 5 input pins, called pin0, pin1, pin2, pin6 and pin7. Refer to PICAXE manual 1 for more details. Better still, buy and couple of 18M2+ chips - far superior!

Start from the ground up: a simple loop which flashes an LED on and off to get the hang of the older style syntax. Try it in the simulator!
Eg:
Rich (BB code):
#PICAXE 18M

Do
   High 1
   Pause 500
   Low 1
   Pause 500
Loop
 

Flenser

Senior Member
Peter,

Basic text is the easiest to drive one of these character LCD displays but I imagine it could be done relatively easily using blocky or flowhart as well but all the programs I know of are in basic. I've never seen one of these programs in blocky or flowchart but I've never looked for one.

Some background info.

The character LCDs have a parallel bus with 8 pins D0 - D7 and 3 control pins. For just writing characters to the LCD we wire one control pin to 0V and use the other 2 control pins and the LCD also has a mode where you can use just the 4 data pins D4-D7 so that means the chip you use to drive the LCD must have at least 6 outputs.

The point I want to make here is that to write to the LCD you need 6 outputs so you will not be able to drive a character LCD directly using an 18M chip.

It is common for people to want to run their program on a PICAXE chip and use a serial pin to write characters to the LCD, for example using SEROUT, so the layout becomes like this:
24376

The PICAXE chip on the left is sending SEROUT commands to a FRM010 chip in the middle that reads the serial characters from the PICAXE and writes the characters to the LCD using the 4 data pins D4-D7 plus the two control pins RS and E.

The FRM010 chip was sold by Rev-Ed but it can by any chip programmed to read serial characters in and write them out to the LCD.
The Rev-Ed AXE133 LCD you mentioned does exactly this. It has the LCD display plus a pre programmed 18M2 PICAXE chip.
24377

Rev-Ed also make the axe133.bas program available to download here axe133 together with the AXE133 datasheet which has a circuit diagram showing you how to connect the programmed 18M2 to the LCD so you can build your own AXE133 if you choose to.

The advantage of this setup is that the PICAXE chip on the left in the diagram only needs to use one output pin to send serial characters and the program only needs to have SEROUT commands which take relatively little program space.
The disadvantage is that you have to pay for another PICAXE chip to do the serial to parallel LCD conversion.

Another opton is to use an I2C "Backpack" in the middle. This is most often a cheap PCF8574T serial to parallel chip. It is not a real I2C chip but you can write a basic program for the PICAXE that drives it using the PICAXE I2C coammands.
This has the advantages that it is cheaper than using a PICAXE chip to do the serial to parallel LCD conversion and it only uses 2 pins on the left hand PICAXE but it has the disadvantage that the program in the left hand side PICAXE is more complicated and so larger.
If you see "16X2 LCD Display for IIC/I2C/TWI/SPI Serial Interface Module For Arduino" on ebay then it is an LCD that has one of these PCF8574T based I2C Backpacks on the back:
24378

I have not used one of these PCF8574T based I2C Backpacks so I can't tell you how complicated they are to use or how much code it adds to the program in the left hand PICAXE.

Do you have any other PICAXE chips?
There is a very straightforward basic program written by the forum member marks for the 20X2 @marks PICAXE 20X2 driver code that could be easily converted for the 14M2, 18M2 or 20M2 chips.
 

AllyCat

Senior Member
Hi,

IMHO Basic Text, and you will certainly get more help from the forum because that's what we nearly all use. Some things can ONLY be done within the PE (text). Blockly can be helpful for "simple" educational projects, but IMHO the code produced by the flowchart software is (worse than) "useless".

But PLEASE answer at least some of the questions we've asked! We can't help until we know what you're using and have done so far.

Cheers, Alan.
 

peter howarth

New Member
Hi,

IMHO Basic Text, and you will certainly get more help from the forum because that's what we nearly all use. Some things can ONLY be done within the PE (text). Blockly can be helpful for "simple" educational projects, but IMHO the code produced by the flowchart software is (worse than) "useless".

But PLEASE answer at least some of the questions we've asked! We can't help until we know what you're using and have done so far.

Cheers, Alan.
what is imho?

the axe133 unit is no longer sold in australia, and so the axe133 is simply not an option..I have found the flowchart method quite useful, been handy to get my head around programming in text after conversion to see how the 2 methods relate..I have the 08m, the 14m, the 20m and the 28x2 chips that I can use straight away , so any of these should do the trick..The frm010 isnt available in australia..Regards Peter
 

AllyCat

Senior Member
Hi,

Sorry, "In My (Humble) Opinion" ;) . Which Australian supplier do you use, or Rev Ed will probably ship to Australia from UK as quickly as most Chinese sellers? Or if you post a link to any on-line LCD we'll "cast an eye over it" and make some suggestions.

So you only have "M" chips (not M2) and a 28X2? I've never used any of those chips myself and was surprised by IWP's comment that the 18M had only 256 bytes of program memory. That is likely to be "insufficient" for what you've described, but a "two processor" approach might be appropriate (one to drive the LCD like the AXE133 does, the other as the I/O and ASCII characters control program).

Flowcharts are a good way to show the overall "logic" (and of course the "flow") of a program, but IMHO the flowchart software produces really BAD examples of how a program should be written. No meaningful "Symbol" names, nor Comments, nor the preferred "Structured" software commands (DO .. LOOP, etc) , but just horrible "GOTO"s. I'm not against GOTOs as such, but those used by the flowchart software are so "artificial".

Cheers, Alan.
 

kfjl

Member
IMHO = In My Humble Opinion.

It's usually used by people who know what they're talking about but don't want to sound cocky. It's not a humble opinion at all, it's the statement of a fact.

I don't have a humble opinion. I intervene here when I've done what the asker wants to do.

The best picaxe is your 28X2 and the best display is the one with the backpack. You can buy both displays (with and without the backpack) on aliexpress or ebay for a couple of dollars.

Once you've got those working, you'll have some criteria for making up your own mind.
 

Technoman

Senior Member
After some time spent reading the different posts, it seems the Picaxe users are belonging to 3 categories :
  • professionals
  • hobbyists
  • educators
After being a professional for a while (assembler, C) then an educator, the goal to be achieved is very different. In the first case I 'll have to write the better code in terms of functionality and reliability, not forgetting the documentation for maintenance.
In the second, I'll teach a group of students what is a system with its inputs (sensors) and outputs (actuators). The program will process the informations coming from the sensors to command actuators. The students can modify their code as many times they want and see how the system react : there is nothing magic!
Until recently, in France, teachers were not allowed to use basic language before 15. Why? The reason is probably because in the eighties, when the first computers arrived in school, most people were using basic language ending into a spaghetti style code. The language itself is not the cause but the ignorance of structured coding.
As Allycat pointed it out,
Flowcharts are a good way to show the overall "logic" ...
. It's a very important point in education which is probably the biggest market for RevED. Please, don't convert it into basic unless you need to check a specific point! So many GOTOs !
After 2016, as my maths colleagues were teaching using Scratch, I switched to Blockly ; an other graphical way of coding. I would say that Blockly is closer to a language like basic. For the students I noticed, in some cases, it was more difficult to organize blocks. Drawing a flowchart was a good way to make them understand... The code after conversion from Blockly is quite clean.
Beside basic, flowchart and Blockly I'd like to see, one day, a new tab were you can graphically draw a FSM (states, transitions) then convert it into basic in a click.
 

B4Lamb

Member
The best picaxe is your 28X2 and the best display is the one with the backpack. You can buy both displays (with and without the backpack) on aliexpress or ebay for a couple of dollars.

Once you've got those working, you'll have some criteria for making up your own mind.
I would prefer to agree with your conclusion that a display with a Pseudo I2C backpack (cheap due to the Arduino fan base) and a higher power X2 chip is the way to go. I'm eager to get one of the 2 line 16 character displays working with a 20X2 as I means of a cheap (ish) backbone for a number of projects. I'm locking for some pre worked PicAxe Basic code for the I2C LCD back packs for cursor positioning and writing lines of text and numerical data as well as scrolling. and erasing. Can you point me to some code examples that deal with these tasks?

Cheers
B4Lamb
 

kfjl

Member
@B4Lamb:

This is where the "Bonjour Enfin!!" (LCD with backpack on 08M2) program came from:

http://electromag1.wifeo.com/lcd-i2c-expandeur-pcf8574.php

The site is in french, but google translate should be able to handle that. There's a program for reading and displaying potentiometer values in the pages that follow the first one.

For an LCD without the backpack, I used the example from the picaxe manual 3 with a 20X2. (There's also an example for scrolling).

As I said in a previous post, I've never actually used these displays (except for the asterisk worm doing a figure-of-eight in the video). There are much prettier displays around these days, for pennies.

Good luck!
 

mortifyu

New Member
Mortifyu's emphasis that his code DOES work leads me to think he couldn't get mine to work.

Nope, Mort didn't try your code. I just chimed in with my own experiences that I know work.

But while on the subject (but not to hijack this thread) in my code 'Initialize and setup LCD' in this thread, can anyone with a single line LINK point me to where Hippy came up with these addresses and what each line is actually commanding LCD? I only know I needed all these lines in the 'setup' for the LCD to operate correctly. (I do know the last one 'Clears the entire LCD screen). I ask because I can't seem to find any usable list of direct commands anywhere online to provide these explanations.


Regards,
Mort.
 

lbenson

Senior Member
where Hippy came up with these addresses and what each line is actually commanding LCD?
From hippy's 14M-LCD code (without the I2C module), there's this:
Code:
        ' Nibble commands - To initialise 4-bit mode

        EEPROM 0,( $33 )    ; %0011---- %0011----   8-bit / 8-bit
        EEPROM 1,( $32 )    ; %0011---- %0010----   8-bit / 4-bit

        ' Byte commands - To configure the LCD

        EEPROM 2,( $28 )    ; %00101000 %001LNF00   Display Format
        EEPROM 3,( $0C )    ; %00001100 %00001DCB   Display On
        EEPROM 4,( $06 )    ; %00000110 %000001IS   Cursor Move

                            ; L : 0 = 4-bit Mode    1 = 8-bit Mode
                            ; N : 0 = 1 Line        1 = 2 Lines
                            ; F : 0 = 5x7 Pixels    1 = N/A
                            ; D : 0 = Display Off   1 = Display On
                            ; C : 0 = Cursor Off    1 = Cursor On
                            ; B : 0 = Cursor Steady 1 = Cursor Flash
                            ; I : 0 = Dec Cursor    1 = Inc Cursor
                            ; S : 0 = Cursor Move   1 = Display Shift

        EEPROM 5,( $01 )    ; Clear Screen
From hippy's code in post 4, here: https://picaxeforum.co.uk/threads/14m-to-lcd-how.9662
 

AllyCat

Senior Member
Hi,
....I can't seem to find any usable list of direct commands anywhere online to provide these explanations.
There are numerous "copies" of the original design now, but I think the basic command set dates back to the Hitachi HD44780 LCD controller chip, for example as described by Wikipedia. That shows the Instruction Set table, which is still to be found largely unchanged in the OLED controllers from Winstar, etc..

Cheers, Alan.
 

tmfkam

Senior Member
Nope, Mort didn't try your code. I just chimed in with my own experiences that I know work.

But while on the subject (but not to hijack this thread) in my code 'Initialize and setup LCD' in this thread, can anyone with a single line LINK point me to where Hippy came up with these addresses and what each line is actually commanding LCD? I only know I needed all these lines in the 'setup' for the LCD to operate correctly. (I do know the last one 'Clears the entire LCD screen). I ask because I can't seem to find any usable list of direct commands anywhere online to provide these explanations.


Regards,
Mort.
If you can search for Ron Hackett, PicAxe Primer, Taming Unruly LCDs, you may be able to locate some of his articles from Nuts & Volts Magazine dating from around 2009. He included (from fading memory!) some excellent explanations of the requirements to initialise the displays.
 

zorgloub

Member
Hello everyone.
If we are talking about the Serial_LCD/OLED-AXE133/134 module, I had bought and then made a slightly different module based on the open-source programme made available by Picaxe.

I realised that the manual was not complete.
So I published my conclusions and test programs on my page ---> http://www.alpmn.byethost32.com/serial_lcd.htm.

I have added codes to create our own graphic characters and, above all, to be able to use all the characters stored in the four tables of the OLED WS0010.
The module is configurable and manages, in addition, three leds and backlighting.

Enjoy ... (with Google translator or DeepL if you don't master my French language)
 
Top