LCD

mark Easterling

New Member
Hi,
Do you know if I can use a LCD05 on my code (08m2)? I am having trouble writing to the LCD using this code? Can some one help please


;output pin9 B3 - row 4
;output pin8 B2 - row 3
;output pin7 B1 - row 2
;output pin6 B0 - row 1

;input pin17 C0 - column 1
;input pin18 C1 - column 2
;input pin1 C2 - column 3
;input pin2 C3 - not used
;input pin3 C4 - resistor to 0V
;input pin4 C5 - not used
;input pin15 C6 - Green LED
;input pin16 C7 - resistor to switch
serout C.1,N2400,(254,1);set B.6, as output for LCD
let dirsC = %01000000 ;set pinsC as inputs or outputs
let dirsB = %11111111 ;set pinsB as inputs or outputs(pin B.0)


; *** reset position to zero ***

init:

pause 500 ; wait for display to initialise
serout C.1,N2400,(254,1) 'clear display
pause 30
serout C.1,N2400,(254,1) 'clear display
pause 30
serout C.1,N2400,(254,133) ; move to end of first line
serout C.1,N2400,("PLEASE") ;first line of code
serout C.1,N2400,(254,195) ; move to end of first line
serout C.1,N2400,("ENTER CODE") ;second line of code
wait 5
goto init
 

Aries

New Member
Look at the manual (serout). The format is
serout pin,baud,data

You are using N2400 - i.e. 2400 baud (the clue is in the name)
You will need to use N9600. If you look at the manual, you will see that the mode is suffixed by "_X" where X is the speed of the Picaxe. If you need 9600 baud, you can't use the default speed of 4 MHz, because there isn't an option for N9600_4. You will need to run at 8 MHz, by using
setfreq m8 at the start of your program (and, if you are using a Picaxe terminal, a speed of 9600 for the terminal).
 
  • Like
Reactions: hex

hippy

Technical Support
Staff member
You will need to use N9600.
Probably T9600 as a MAX232 is required to accept RS232 which will present an idle high signal to the LCD.

That 'let dirsC = %01000000' after the first SEROUT probably needs removing as it will may corrupt the serial line. The correct initialisation should probably be something like -
Code:
dirsC = ...
dirsB = ...
High C.1
Pause 1000
SerOut C.1, T9600_8, (245, 1)
Pause 1000
...
 

mark Easterling

New Member
This is the code I am using and works on the simulator but not on the bread board.
#picaxe 08m2


serout C.1,N2400,(254,1);set B.6, as output for LCD
let dirsC = %00000000 ;set pinsC as inputs or outputs
let dirsB = %11111111 ;set pinsB as inputs or outputs(pin B.0)


; *** reset position to zero ***

init:
High C.1
Pause 1000
SerOut C.1, T9600_8, (245, 1)
Pause 1000

pause 500 ; wait for display to initialise
serout C.1,N2400,(254,1) 'clear display
pause 30
serout C.1,N2400,(254,1) 'clear display
pause 30
serout C.1,N2400,(254,133) ; move to end of first line
serout C.1,N2400,("PLEASE") ;first line of code
serout C.1,N2400,(254,195) ; move to end of first line
serout C.1,N2400,("ENTER CODE") ;second line of code
wait 5
goto init

Does C.1 connect to SCL or SDA pin of the LCD?
Does C.0 have to connect to SDA pin of the LCD?
At the moment I just get black squares on all 16 digits?
 

piclt

Member
Did you read the datasheet for the LCD05......I don't have one to try......but it looks like you are sending the screen codes for the simulator.....You need to send the codes for the LCD05 when picaxe is connected to LCD05 display to see the changes happen on the display
datasheet says 12 is clear display etc etc etc ....and why are your still using N2400..??

from datasheet....
Serial operation
The Serial mode operates over a link with a baud rate of 9600 bps (no parity, 2 stop bits) and 5v signals, Do NOT connect RS232 directly to the module - you will destroy it. Use a MAX232 or equivalent to convert the RS232 levels to 5v. Operation is with the same command set as the I2C mode with an additional set of commands to request data to be sent i.e. the software version
 

Jack Burns

New Member
First off, ensure you have the link fitted on the back of the LCD, as this is required to select serial mode.

I would connect C.1 from the 08m2 to the SCL/RX connection on the LCD, along with a common ground (and power if your sharing the same supply).

Note:
The 254,n commands only apply to the Rev-Ed LCD modules, your module needs different command sequences.
The 08m2 needs to run at 16 MHz to get the 9600 baud.
I have used N9600_16 but that may need changing to T9600_16.

Here is my interpretation of what you need based on the datasheet...
Rich (BB code):
; LCD05 Display Driver
; https://www.robot-electronics.co.uk/htm/Lcd05tech.htm

; Note:
; LCD Simulation will not work correctly as the LCD05 uses different
; commands to the Rev-Ed screens, however it should work on 08m2 + LCD05.

#picaxe 08m2

Init:
  setfreq m16
  Symbol LCD  = C.1
  Symbol Baud = N9600_16 ' MAY NEED CHANGING to T9600_16

  let dirsC = %00000000 ;set pinsC as inputs or outputs
  ; let dirsB = %11111111 ;set pinsB as inputs or outputs(pin B.0)

  ; The next 2 lines may not be required
  High LCD ' was C.1
  Pause 1000


Do
  SerOut LCD,BAUD,(12) ' clear display
  
  pause 1500 ; wait for display to initialise (delay based on your code)
  
  ; probably not needed after a CLS, so rem'd out.
  'serout LCD,BAUD,(1) 'move cursor home
  'pause 30
  
  
  ; command 2 sets cursor position, it is followed by (1-80) or (1-32)
  serout LCD,BAUD,(2,6) ; move to pos 6 on first line
  serout LCD,BAUD,("PLEASE") ;first line of code
  serout LCD,BAUD,(2,24) ; move to pos 4 on second line
  serout LCD,BAUD,("ENTER CODE") ;second line of code
  wait 5
Loop
 
Last edited:

kfjl

Member
I have a couple of LCD modules, neither of them like yours, so I can't be sure this works.
Make sure you're in serial mode, as Jack Burns said above.

You might need to do some wiggling:


and fiddling with contrast/backlight settings.

Oled screens are less trouble and prettier.
 

Flenser

Senior Member
Mark,

My 2c worth.

First, the code you posted in post #1 looks like it was written for one of the RevEd Serial LCDs, like this one: https://picaxe.com/docs/axe133.pdf
You didn't say where you found the code you posted in post #1 but is is not from the Devantech LCD05 website that you gave the link for here https://picaxe.com/docs/axe133.pdf and so it will not work without changes
Arie' post #4 and Hippy's post #5 give you changes that you can make to the code for using it on the Devantech LCD05.

Second, in your post #6 you ask about which pin goes to the I2C SDA and SDL pins on the Devantech LCD05.
The Devantech LCD05 can be configured to use either I2C and Serial but I2C and Serial are two different communication protocols and they are not interchangeable
The code you posted in post #1 uses the Serial protocol so to use this code you will need to set your Devantech LCD05 to use the Serial protocol by fitting the link on the back of the LCD as described in Jack Burns' post #8.

Third, The black squares on all 16 digits you describe in you post #6 indicates that the Devantech LCD05 has not started up correctly.
It's not clear from the link you gave for the Devantech LCD05 whether or not the default is to display startup message "Devantech LCD05" and "16x2 display" when the power is turned on.
However it does not matter what the default is for displaying the startup message because if the LCD is correctly initialized it should either show the startup message or a blank display. My belief is that when it is working correctly it will never show black squares on all 16 digits.
To investigate this I suggest that you try wiggling the connections where the connect to the LCD as described by kfil in post #9 to see if you can get rid of the black squares on all 16 digits.
If wiggling the connections does not get rid of the black squares on all 16 digits then your Devantech LCD05 could be defective and you should go back to the seller to discuss getting their help to solve this problem or to replace it if they cannot.
 

Buzby

Senior Member
The datasheet is unclear as to exactly what happens at switch on, especially as it seems you need to tell the board at startup what kind of LCD is fitted.
See the section in the datasheet called 'Changing display type'.
 

Jack Burns

New Member
As others have pointed out, most lines in post #6 are still using 2400 baud rather than 9600 baud. Hopefully this has been corrected by now, however we need an update from Mark to see if any progress has been made.
 
Top