|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
LCD driver |
Posted: Wed Jun 01, 2005 4:44 pm |
|
|
I am using a developing board easyPIC and 16f877a, the development board has port B connected with a 2x16 LCD,
They are connected this way
Code: | port b LCD
B0
B1
B2 rs
B3 enable
B4 D4
B5 D5
B6 D6
B7 D7 |
rw connected to ground
I am using the driver from CCS LCD.c if I uncomment the following line
Code: | #define use_portb_lcd TRUE |
but the connection of this one is
Code: |
B0 enable
B1 rs
B2 rw
B3
B4 D4
B5 D5
B6 D6
B7 D7 |
Code: |
struct lcd_pin_map { // This structure is overlayed
BOOLEAN enable; // on to an I/O port to gain
BOOLEAN rs; // access to the LCD pins.
BOOLEAN rw; // The bits are allocated from
BOOLEAN unused; // low order up. ENABLE will
int data : 4; // be pin B0.
} lcd; |
How I can modify this driver to let it work for the easyPIC development board. |
|
|
Guest
|
|
Posted: Wed Jun 01, 2005 5:03 pm |
|
|
I tried to modified like this way, I just saw the upper part with black on the LCD screen:
Code: |
struct lcd_pin_map { // This structure is overlayed
BOOLEAN unused; // on to an I/O port to gain
BOOLEAN rw; // access to the LCD pins.
BOOLEAN rs; // The bits are allocated from
BOOLEAN enable; // low order up. ENABLE will
int data : 4; // be pin B0.
} lcd; |
Anything else that I need to change?
please help |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jun 01, 2005 10:34 pm |
|
|
Quote: |
I am using a developing board easyPIC and 16f877a, the development board has port B connected with a 2x16 LCD.
They are connected this way
port b LCD
B0
B1
B2 rs
B3 enable
B4 D4
B5 D5
B6 D6
B7 D7 |
The lcd_pin_map structure has to match the same bit order as shown
above. You should change it to look like this:
Code: | struct lcd_pin_map
{
BOOLEAN unused_0;
BOOLEAN unused_1;
BOOLEAN rs;
BOOLEAN enable;
int data : 4; .
} lcd; |
Because the RW signal is grounded, it means the LCD becomes a
write-only device. So none of the functions in the CCS driver that
read from the LCD will work anymore. Also, the CCS driver reads
the "busy" bit from the LCD to determine when it's OK to write to the
LCD. However, that's not possible anymore, because we can't read
from the LCD. The standard work-around is to use a fixed delay time.
The delay value is determined from the LCD data sheet. A typical
delay value is something like 43 us or 46 us for the 'write data' to lcd
command. So we could use 50 us (or more) to be safe.
The easiest way to change the CCS driver to work with a grounded RW
signal is to modify the lcd_read_byte() routine. We just put the 50us
delay in that routine, and also we have it return a zero. This emulates
checking the status byte. Example:
Code: | BYTE lcd_read_byte()
{
delay_us(50);
return(0);
} |
Finally, there are two lines in the CCS driver that refer to the rw signal.
They're in the lcd_init() and lcd_send_byte() functions. They need to be
commented out, like this:
I don't have your exact hardware, so I can't completely test this, but
those changes should probably be enough to make it work. |
|
|
|
|
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
|