PICAXE and LCD

photo_0.jpg (143123Bytes)

I have looked over CtCs post regarding similar issues with his LCD, but still can get mine to budge. I was hoping to get some guidance on my issue. The issue being I can't get the LCD to work or interface with my PICAXE. Like Ctc, I am using the serial backpack from SparkFun. Here is my code:

pause 1000
setfreq m8

pause 2000
serout 1,T9600_8,(124, 4) 'Sets 20 char (3) |
pause 200
serout 1,T9600_8,(124, 6) 'Sets 4 line (5) |


pause 1000
serout 1,T9600_8,(0x7c, 128) 'Sets backlight full on (128-157 '128 is full on

pause 1000
serout 1,T9600_8,(254, $01) 'Clear Screen


main:

pause 200
serout 1,T9600_8,(254, 128) 'Sets line 1 position 1
pause 200
serout 1,T9600_8,("line 1")

pause 200
serout 1,T9600_8,(254, 192) 'Sets line 2 position 1
pause 200
serout 1,T9600_8,("line 2")

goto main

 

If I turn the 10k trim pot on the back to adjust the contrast, for a moment I see "blocks", but not text. Any clues?

did you check all the obvious?

Like firmware?

Which Picaxe?

printing just plain ascii 65 through 65 + 26 (A-Z)?

I am not the coding whiz on the picaxe, so let someone else give you the obvious checks on that one…

Looking at your code above

Looking at your code above here is what I gather:

 

1. You have sent commands to set the controller up as a 16 character by 2 line display:

serout 1,T9600_8,(124, 4)

serout 1,T9600_8,(124, 6)

 

2. You actually turned the backlight off in the following command:

serout 1,T9600_8,(0x7c, 128)

It should be serout 1,T9600_8,(0x7c, 157) or serout 1,T9600_8,(124, 157) to set backlight at 100%

 

3. To clear the display try this:

serout 1,T9600_8,(254, 1) 'Clear Screen

Yep
Yeah, I am using a 16x2 LCD

Take a look at the command I
Take a look at the command I posted for the backlight control. If you look at the datasheet for the SparkFun LCD Backpack, 128 will turn off the backlight so you won’t see any text on the screen although it will be there. 157 is full on. Try that and see what you get

Did it

I cranked it up to 157 and nothing.

I did eliminate baud rate communiucation from the list. I set a loop to adjust the backlight from 128 to 157 and it flashes as expected. Yet no text back there.

 

Just to be clear,

serout 1,T9600_8,(254, 128) 'Sets line 1 position 1
pause 200
serout 1,T9600_8,(“line 1”)

should display t ext “line 1” correct?

Are you using your PicAxe at
Are you using your PicAxe at 4MHz or 8MHz? Also, are you still using the 28x1?

28x1 @ 8mhz

Here is what I have thus far:

setfreq m8

serout 1,T9600_8,(124, 4)
serout 1,T9600_8,(124, 6)
serout 1,T9600_8,(124, 150)

main:

serout 1,T9600_8,(254, 128)
serout 1,T9600_8,("77")
pause 2000


goto main
end

If you are using 8MHZ clock,

If you are using 8MHZ clock, try the below:

serout 1,N9600_8,("Line 1")

You are not using a MAX232 so you should be using inverted output instead of true output. Try the above code

 

Also, what pin on the PicAxe are you using as the serial pin? In your code you have 1 so I assume that means output 1.

Hammer

Yeah, nothin.

I think I’ll just smash this thing with a hammer instead…

Unless you have any other suggestions.

Did you try changing T9600_8
Did you try changing T9600_8 to N9600_8?

Yes
Yes. Same result.

When you send the command to

When you send the command to change the backlight is that working? If so then we know at least that you are setup correctly for serial. I’m working this straight from the SparkFun and PicAxe datasheets as I don’t have a PicAxe to test out. Sorry if I’m not being much help to you.

Don’t let yourself get frustrated. As soon as we figure out all the stuff that doesn’t work all that is left are those that do work.

Yeah
Yes the backlight works and as I mentioned, I can flash it in a loop. I was assuming that meant baud rates were correct, etc. Just not sure though.

Pin7
Pin 7 is the serial pin. Leg 7, which I am using, is out 7.

Shouldn’t you be using the
Shouldn’t you be using the serial pin for the serial communications? Or, can you set up any I/O pin as a serial pin? Check CTC’s code in the post you referenced above; he is using the serial pin 7. Also, did you test the last bit of code I posted?

Yep
Yep, you can send serial data out of any pin. I did try the last chunk of code, no go, but thanks.

Update

The LCD was trash. I got a new LCD and LCD backback today, used the original code and everything works fine.

Thanks to all for your assistance.