PDA

View Full Version : Commands for serial LCD



Szczepaniec
- 27th February 2012, 06:55
This seems like the most basic of problems and it is probably just the frustration of trying it for hours that is keeping me from the obvious answer. I have a New Haven Display Serial LCD 20x4 display (datasheet attached) and I am attempting to use it with a PIC12F615. I can get it to print text all day long but cannot get it to do any of the commands such as "Clear Screen." I have tried every variation of sending Hex code that I can think of as well as exhausting the search feature on this forum as well as the forum for New Haven. Any help would be greatly appreciated. Here is the last version of the code I tried. The LCD is 9600 baud and there is an LED on pin 1 just so that I know the PIC is running properly and in time.

DEFINE OSC 8
pause 50
high 1


pause 1000
serout2 2, 84, ["Hello"]

do
high 1
pause 500
low 1
pause 500
serout2 2, 84, [$FE,$51]
loop
end

Tobias
- 28th February 2012, 05:02
I use the display often here are some lines from my code.


Prefix con $FE ' needed before each command
LcdCls CON $51 ' clear LCD (use PAUSE 5 after)
CursorPS con $45 'Cursor Position
Backlight con $53 ' Backlighting 1-8
Contrast con $52 ' Contrast 1-50

SEROUT2 LCD,84, [Prefix,CursorPS,0, "Print Text Here"]
pause 2000
Serout2 LCD, 84, [Prefix,LcdCLS]'Clears screen

Szczepaniec
- 28th February 2012, 16:43
Thank you for the help. The issue was with me doing something I should have known not to do. I was using the internal osc at 8 Mhz to run it. I switched to and EC and everything is fine. I thought because of all the text that was showing up fine that everything was good. Another easy lesson learned the hard way. Thanks again for the help.