Using the #27977 dislay
elabudde
Posts: 6
Hi all, newbie here. I just purchased a #27977 LCD display because it has a one wire interface.
I have programmed a 16F88 with Great Cow Basic see: http://gcbasic.sourceforge.net/
It has syntax similar to Pic Basic.
I use this to set up the USART: InitSer 1, r2400, 1, 8, 1, none, invert.
I use invert so as to reproduce the waveform shown here for the letter “K” (see: http://en.wikipedia.org/wiki/RS-232).
I can send this data using sersend 1, 75 (dec value for “K”[noparse];)[/noparse] or serprint 1, “K” . I have verified that both commands are identical and exactly the same as see on Wiki
The LCD display prints out mostly HiHiHi and a few * and \. The funny thing is that it never puts out the same character twice! Question: is the format for the display normal or inverted? Is it 2400, 1, 8, 1 no parity? I have tried all combinations of parity (none, even, odd) and normal and inverted nothing works! Any suggestions as to what I am doing wrong?
Much thanks, Ed.
Here is the code:
#chip 16F88, 8
#config INTRC_IO
#define SendAHigh Set PORTB.2 on
#define SendALow Set PORTB.2 off
#define Button PORTA.0
Dir Button In 'pin 17
Dir PORTB.2 Out 'pin 8
Wait 150 ms
InitSer 1, r2400, 1, 8, 1, none, invert
Do
SerSend 1, 75
wait 100 ms
serprint 1, "K"
Wait 100 ms
Loop
I have programmed a 16F88 with Great Cow Basic see: http://gcbasic.sourceforge.net/
It has syntax similar to Pic Basic.
I use this to set up the USART: InitSer 1, r2400, 1, 8, 1, none, invert.
I use invert so as to reproduce the waveform shown here for the letter “K” (see: http://en.wikipedia.org/wiki/RS-232).
I can send this data using sersend 1, 75 (dec value for “K”[noparse];)[/noparse] or serprint 1, “K” . I have verified that both commands are identical and exactly the same as see on Wiki
The LCD display prints out mostly HiHiHi and a few * and \. The funny thing is that it never puts out the same character twice! Question: is the format for the display normal or inverted? Is it 2400, 1, 8, 1 no parity? I have tried all combinations of parity (none, even, odd) and normal and inverted nothing works! Any suggestions as to what I am doing wrong?
Much thanks, Ed.
Here is the code:
#chip 16F88, 8
#config INTRC_IO
#define SendAHigh Set PORTB.2 on
#define SendALow Set PORTB.2 off
#define Button PORTA.0
Dir Button In 'pin 17
Dir PORTB.2 Out 'pin 8
Wait 150 ms
InitSer 1, r2400, 1, 8, 1, none, invert
Do
SerSend 1, 75
wait 100 ms
serprint 1, "K"
Wait 100 ms
Loop
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Still ket a bunch of erratic nonsense on the screen! Regards, Ed.
1. For reals, have you read the datasheet and manual for the serial display? If not, hit the books, then come back.
2. Triple-check the no-brainer stuff -- are your connections correct, power correct, etc. Hook up an LED to your serial pin (LCD disconnected) and load some code to toggle the led on and off (in other words, makes sure the pin works).
3. can't help with PIC code, sorry, but are you sure your uart is correct? Seems to be on pin1 but you set pin2 to be the output for serial in your defs? Maybe someone else w/PIC experience can chime in here.
4. check your dipswitch baud setting on the LCD (see step 1).
5. convert the sample parallax code (it's Stamp-based but should be simple to change). Note that the serial pin is set high immediately and then the program waits, before trying to send any serial code. Note also the Parallax example is 19.2k baud (not sure what default settings ship on the baud dipswitch).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
1. For reals, have you read the datasheet and manual for the serial display? If not, hit the books, then come back.
Read it 2-3 times!!
2. Triple-check the no-brainer stuff -- are your connections correct, power correct, etc. Hook up an LED to your serial pin (LCD disconnected) and load some code to toggle the led on and off (in other words, makes sure the pin works).
Have used this pic for numerous experiments, The pin works, I have an oscilloscope hooked up to it and can see it sending out the bits very 100 ms
3. can't help with PIC code, sorry, but are you sure your uart is correct? Seems to be on pin1 but you set pin2 to be the output for serial in your defs? Maybe someone else w/PIC experience can chime in here.
I am using the sample code from the GCBasic help file That is the way they set it up. PortB.2 is serial channel 1
4. check your dipswitch baud setting on the LCD (see step 1).
Checked it several times!
5. convert the sample parallax code (it's Stamp-based but should be simple to change). Note that the serial pin is set high immediately and then the program waits, before trying to send any serial code. Note also the Parallax example is 19.2k baud (not sure what default settings ship on the baud dipswitch).
"SEROUT TxPin, Baud19200, [noparse][[/noparse]"Hello, this text will wrap."]
GCBasic for this command is serprint 1, "Hello, this test will wrap" The baud is set by the initser command to 2400
This does not work either!! I am really stumped! regards, Ed.
And it is set to 2400 baud to match your UART? Yeh, seems like it should work, then. I'll presume you have a resonator/crystal or other accurate clock source for the PIC?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
From here: http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Serial_LCD
Turn on the LCD by placing the communication pin high for 100mS
output_high(PIN_A0);
delay_ms(100);
Send the LCD a character to initialize the screen. A list of characters (0-255) and what they do appears in the manual. It is a good idea to add a slight delay after outputting to the LCD to avoid the LCD missing signals.
putc(25); //turn lcd on, cursor on and character blink
delay_ms(1);
putc(17); //backlight on
delay_ms(1);
I will try this tomorrow, I put my stuff away, and it is Gin & Tonic time! Best regards, Ed.
I have verified the pulse train sent out is for the commands is correct to the RS-232 protocol for the command numbers I am sending out, and the timing (pulse time) is correct as well. I send it the 100 ms high before transmitting: serprint 1, "Hello World"
Still does not work! BTW is it necessary to send out the high for 100 ms for evry write or just the first one?
I can not proceed as my programmer went on the fritz!
When I get more data I will reprt back. Ed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php