PDA

View Full Version : Serial LCD



Tobias
- 14th November 2007, 04:34
First off, I got my ICSP sorted out. Much thanks to the forum. While looking for a few components, I found a serial LCD from my STAMP days. I tried to attach a ZIP file of the spec sheet but it is over the attachment size limit. I thought to myself that this would be pretty handy to debug a new board and/or code. I can insert a few lines of code into my program, solder one wire to a free pin, provide the LCD with 5v and ground, then be sorting out a new program much quicker using this display.

So I am testing this on a PIC18F4523. I looked up the SerOut command and came up with the following code. I also set the serial LCD up for a baud rate of 9600 using the DIP switches on the back of its housing.
-----------------------------------------------
include "bs2defs.bas"
define OSC 40
ADCON1 = 7 ' Set PORTA and PORTE to digital
LCD var PortA.2
high LCD

SEROUT LCD,N9600, ["Grace",10 ] ' Display "Grace"
------------------------------------------------

The results of the code is just an underscore in the first space on the the first line. I think the underscore is like a default when no data is received though.

I know one variable is if I am getting the 'mode' correct in the SEROUT command. I have tried the other three X9600 with the same results.

I would have imagined this would be a pretty easy crossover from STAMP to PIC with this serial LCD. Please clue me in on what I am missing.

Thanks

mackrackit
- 14th November 2007, 18:55
include "modedefs.bas"

I con 254 'instruction
CLR con 1 'clear screen
L1 con 128 'line 1
L2 con 192 'line 2
L3 con 144 'line 3
L4 con 208 'line4

Serout2 LCD,16468,[I,CLR]
PAUSE 1
Serout2 LCD,16468,[I,L1,"MACKRACKIT"]




include "bs2defs.bas" 'DO NOT NEED
define OSC 40
ADCON1 = 7 ' Set PORTA and PORTE to digital
LCD var PortA.2
high LCD 'DO NOT DO THIS

mister_e
- 15th November 2007, 02:42
include "bs2defs.bas" 'DO NOT NEED
--- Yes needed unless he manually define
the value of N9600
define OSC 40
ADCON1 = 7 ' Set PORTA and PORTE to digital
LCD var PortA.2
high LCD 'DO NOT DO THIS
--- Yes do it for true mode unless
the first character might be screwed up.
with N9600, use LOW instead. Not
a bad idea to add a few mSec delay after


And you ADCON1 setting is false, the way you have set it gives...
AN<12:8> digital
AN<7:0> analog

so you want to open the datasheet section 19.0, register 19-2, pdf page 230 and use
ADCON1=$0F
<hr>
In case it doesn't work, there's some missing information here... configuration fuses, crystal speed etc etc (yeah i know 40Mhz is the end results... but PLL or not etc etc).... you know all annoying stuff to post but how much useful for us ;)

mackrackit
- 15th November 2007, 08:31
The code I gave works for running the LCD. The things I said are not needed or do not do is if you use the code for the LCD as I gave.

Sorry for any confusion.