to get a small test picbasic program to write to this LCD, what port/pin should one use on the 16f88? this LCD has on a Rx pin to receive data. i was thinking the pin would be RB5/PORTB.5.
would that be correct?
to get a small test picbasic program to write to this LCD, what port/pin should one use on the 16f88? this LCD has on a Rx pin to receive data. i was thinking the pin would be RB5/PORTB.5.
would that be correct?
You can use just about any pin as long as it is not configured for analog for the serial output.
Dave
Always wear safety glasses while programming.
should this code work to get the parallax to display a string?
'===============================
'' pic16f88
INCLUDE "modedefs.bas"
'DEFINE OSC 10 ' 4MHz doesn't work try others
TRISB = %00000000 ' PORTB all outputs
ADCON1 = %00000111 ' Disable A/D converter
ANSEL = %00000000 ' all analog pins to digital
'================================
PinOut VAR PORTB.5 ' Tx on RB5
Led3On VAR PORTB.3 ' turn on LED if Tx
'================================
BAUD con 16780 ' 2400 Baud, inverted, NoParity: conservative for testing
'================================
PinOut = 0 ' set to a norm state
PAUSE 100 ' a little wait time
HIGH PinOut
HIGH Led3On
Pause 5000 ' LCD start up delay
SEROUT2 PinOut, BAUD,["STR-1 012345678",13,10]
LOW Led3On
PAUSE 5000
'================================
Loop:
HIGH Led3On
SEROUT2 PinOut, BAUD, ["STR-2 012345678",13,10]
PAUSE 5000
LOW Led3On
SEROUT2 PinOut, BAUD, ["STR-3 012345678",13,10]
goto Loop
END
No, you are missing a bit here and there. Serial LCDs have their own command set. I went to this page and think these are the ones for you.
http://www.parallax.com/Store/Access...%2cProductName
This should work.Code:LcdBkSpc CON $08 ' move cursor left LcdRt CON $09 ' move cursor right LcdLF CON $0A ' move cursor down 1 line LcdCls CON $0C ' clear LCD (use PAUSE 5 after) LcdCR CON $0D ' move pos 0 of next line LcdBLon CON $11 ' backlight on LcdBLoff CON $12 ' backlight off LcdOff CON $15 ' LCD off LcdOn1 CON $16 ' LCD on; cursor off, blink off LcdOn2 CON $17 ' LCD on; cursor off, blink on LcdOn3 CON $18 ' LCD on; cursor on, blink off LcdOn4 CON $19 ' LCD on; cursor on, blink on LcdLine1 CON $80 ' move to line 1, column 0 LcdLine2 CON $94 ' move to line 2, column 0 LcdCC0 CON $F8 ' define custom char 0 LcdCC1 CON $F9 ' define custom char 1 LcdCC2 CON $FA ' define custom char 2 LcdCC3 CON $FB ' define custom char 3 LcdCC4 CON $FC ' define custom char 4 LcdCC5 CON $FD ' define custom char 5 LcdCC6 CON $FE ' define custom char 6 LcdCC7 CON $FF ' define custom char 7
Try a test program with all of the above.Code:SEROUT2 PinOut, BAUD,[LcdBLoff, LcdOn1, LcdCls] SEROUT2 PinOut, BAUD,["HELLO WORLD"]
Dave
Always wear safety glasses while programming.
thanks for the tip. i dl'd two of the code samples from that page, mixed and matched and it still didn't work. i looked too at the melabs pages for the diff's of BS2 and PBP, just in case. but i did get it to work ,,,
0. without setting the values for these, OSC and OSCCON, could not get anything written to the LCD. i set them for 8MHz, as 4MHz would not work. so i looked at section 4.6.1 of the datasheet and set the following...
DEFINE OSC 8
OSCCON= %01110100 ' internal RTC Oscillator freq select
' [bits 6-4 = 8MHz], [bit 2] INTOSC freq stable bit set
1. configuration was set as HS, WDT_ON, PWRT_ON, BOD_ON, MCLR_OFF, PROTECT_OFF
2. the baud rate set using these values, "396 or 16780" didn't work for me. but t2400 does.
thanks for your help!!!!
I do not have the same LCD as you have to test, so I am not positive the commands are correct.
BUT...I now see some other problems.
First, with out changing any of your settings make an LED blink at say one second on and one second off and see if the timing is correct.
When you see it is not, here is why.Code:LOOP: HIGH PORT?.? PAUSE 1000 LOW PORT?.? PAUSE 1000 GOTO LOOP
In your config settings HS is for an external OSC, you need "_INTRC_IO"
Wait a minute ... Did you get it working???
2. the baud rate set using these values, "396 or 16780" didn't work for me. but t2400 does.
Dave
Always wear safety glasses while programming.
yes, i did get it to work. and yes, i am able to get a LED to blink from PORTB.3 and get string of char's to display on the LCD now.
and, this is whether i set INTRC_OSC or EXTRC_OSC. although i am not using an external OSC!
for my current code, at least from the process of elimination, having these two values, "DEFINE OSC x" and "OSCCON= x" set correctly made the difference along with the baud rate.
thanks!
Hey Mackrackit,
forgot to mention this...SEROUT2 vs SEROUT. i.e., SEROUT2 didn't work for me. once i switched to SEROUT, along with the other modifications, it has worked well. looks like some diff with the "true" or "inverted" mods with baud?? as i'm new to this hard to say for sure...
thanks!
SEROUT2 396 worked
>>But maybe that is why MELABS has SEROUT so it works with Stamp stuff??
they are similar to the BS2 commands according to the PBP docs:
http://www.melabs.com/resources/pbpmanual/5_61-5_64.htm
i think, in my case, not getting the OSC & OSCCON defined correctly was throwing my troubleshooting off, and thus, at times, incorrectly thinking SEROUT2 was not working.
Bookmarks