pic16f690 writing to LCD

Status
Not open for further replies.

Mr.Owl

New Member
I have a PIC kit 2 that I bought and it came with the 16f690 micro. I've used Micro Code Studio to write my code and compiled it with the PIC Basic Pro compiler. So far I've just monitored inputs and blinked LEDs but I'd like to write to an LCD now. I bought a Robokits serial LCD https://www.electro-tech-online.com/custompdfs/2010/02/Robokits20Serial20LCD.pdf and thought that I should just be able to connect the TX pin of the 16f690 to the RX pin on the display correct? Of course I've connected power and ground to the display also. It looks like at the bottom of page 143 of the data sheet, there are instructions for setting up asynchronous transmission. This would be what I want correct? Is there any sample code showing how to initialize the proper registers and write to an LCD over a single wire?
 
The PDF you posted looks like it has everything you need. Did you try it? You'll need to check your compiler's documentation for how to setup UART communication, set the transfer rate to 9600bps, and send data. You'd only use the PIC datasheet if you're writing the code in assembly, or if your compiler doesn't already have routines setup.
 
I have tried the following code and I think according to the data sheet, SPBRG = 12 is correct if the 16f690 is running at the default 8MHz clock rate and I want to set the baud rate for 9600. Not sure where I've gone wrong though as all I get is a blank LCD screen.

TRISB.6 = 1 ' p. 133 of data sheet says to set low?
TRISB.7 = 0 ' set TX to output, p.133 of data sheet says to set to 1

RCSTA = %10000000 ' Enable serial port
TXSTA = %00100000 ' Enable transmit and asynchronous mode
SPBRG = 12 ' Set baud rate to 9600 (p.139 of data sheet)
SPBRGH = 0 ' set baud rate high to low

loop:

Lcdout $fe, 1 ' Clear screen
Pause 1000 ' Wait .5 second

Lcdout "Hello" ' Display "Hello"
Pause 1000 ' Wait .5 second

goto loop
 

hi,
Look at these two images. Download the free, Mister E PicCalc.

 
Hi, EricGibbs

Halas, Steve is out of the business for more than two years and his Mr E's site down for same time ...

Last ( bad ) news of him let suppose he won't come back to programming so soon.

But Some copies of this still on the web ... see Melab's PicBasic site ( @ Crownhill ) i.e

Alain
 
If you really do have PIC Basic Pro like you said, you need to read the manual. There are serial commands built in that take care of all the low level stuff.
 
Hi,

There are two things here ... Serial comms and LCD.

If LCD doesn't work, it could be a wiring problem ( R/W pin tied to ground ??? ... ), a PIC Port problem ( pins have been configured as digital ??? ) or a startup problem ( I do not see any settling pause for the LCD @ power up ...) or a commands timing problem ( DEFINE LCD_COMMANDUS 2000 and DEFINE LCD_DATAUS 50 )

OR simply ... the contrast pot setting ( !!! )

for comms ...

RCSTA and TXSTA do not look "so good " to me ... but I do not work with the '690 ... so, I can't be sure !!!

Alain
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…