|
|
View previous topic :: View next topic |
Author |
Message |
Natalia Guest
|
Anyone used a serial LCD with a PIC? |
Posted: Mon Dec 23, 2002 11:15 am |
|
|
In particular, I'm trying to use one of the ones that Parallax sells. I'm a bit confused as to how to connect it and how to write to it.
The docs that come with it, have an example of connecting it to a general purpose I/O pin of a Basic Stamp -- not the UART! Is this correct? Even though this is a serial device?
Also, I'm assuming that I can't use the CCS C LCD functions because they are for a parallel interface LCD?
Any info is greatly appreciated!
-- Natalia
___________________________
This message was ported from CCS's old forum
Original Post ID: 10217 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Anyone used a serial LCD with a PIC? |
Posted: Mon Dec 23, 2002 1:52 pm |
|
|
:=In particular, I'm trying to use one of the ones that Parallax sells. I'm a bit confused as to how to connect it and how to write to it.
:=
:=The docs that come with it, have an example of connecting it to a general purpose I/O pin of a Basic Stamp -- not the UART! Is this correct? Even though this is a serial device?
:=
:=Also, I'm assuming that I can't use the CCS C LCD functions because they are for a parallel interface LCD?
-----------------------------------------------------------
No one else has answered this. Maybe they're on vacation this
week.
I assume you're using a LCD from Scott Edwards Electronics.
At this link, there's a schematic which shows how to connect
it to a PIC. Apparently, it only requires +5v, GND, and one
serial transmit wire from the PIC.
<a href="http://www.mastincrosbie.com/mark/electronics/pic/lcdtest.jpg" TARGET="_blank">http://www.mastincrosbie.com/mark/electronics/pic/lcdtest.jpg</a>
In your case, I assume you're using a 16F877, or a similar PIC
since you said you have a USART. So instead of using RA1
you can use PIN C6, which is the Tx pin for the hardware USART.
They have some sample code in this document. It's written
in BASIC.
<a href="http://www.seetron.com/pdf/bpi_bpk.pdf" TARGET="_blank">http://www.seetron.com/pdf/bpi_bpk.pdf</a>
I translated the first part of it into a simple CCS C program.
I can't test it because I don't have the LCD module.
But it can at least get you started.
#include "c:\program files\picc\devices\16F877.h"
#fuses HS,NOWDT,NOPROTECT,PUT,BROWNOUT, NOLVP
#use Delay(clock=8000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#define I 254
#define CLR 1
#define LINE1 128
#define LINE2 192
void main(void)
{
putc(I);
putc(CLR);
putc(I);
putc(LINE1);
printf("Hello World!");
while(1); // Prevent PIC from going to sleep
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 10233 |
|
|
Natalia Guest
|
Re: Anyone used a serial LCD with a PIC? |
Posted: Mon Dec 23, 2002 1:56 pm |
|
|
Thanks for the help. Will I need to use the INVERT option of #use RS232 if I'm not using a MAX232 and just hooking this device directly?
Thanks again for the help...
-- Natalia
___________________________
This message was ported from CCS's old forum
Original Post ID: 10234 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Anyone used a serial LCD with a PIC? |
Posted: Mon Dec 23, 2002 2:11 pm |
|
|
:=Thanks for the help. Will I need to use the INVERT option of #use RS232 if I'm not using a MAX232 and just hooking this device directly?
:=
------------------------------------------------------
If you use the hardware USART pin on the PIC, you will
need to invert the signals. But the hardware USART has no
built-in option to do this inversion. The INVERT directive
doesn't work with the hardware USART. You will need an
external MAX232 chip.
You could use a free i/o pin, as shown in the example drawing
that I posted earlier. Then you can use the INVERT option
in your #use RS232 statement. That's because the inversion
is done in software when you specify a normal i/o pin for
RS-232 output, with the CCS compiler.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10235 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|