|
|
View previous topic :: View next topic |
Author |
Message |
buster22 Guest
|
HD44780 Problems |
Posted: Mon Sep 28, 2009 4:30 pm |
|
|
I'm using the following code to test my HD44780 display:
Code: |
/* PIC18F4550 LCD Display
---------- --------
| RD4|----11-|D4 |
| RD5|----12-|D5 |
| RD6|----13-|D6 |
| RD7|----14-|D7 |
| RD3|-----6-|EN |
| RD2|-----4-|RS |
| | --------
| |
| |
| |
----------
**********************************************************/
#include <18F4550.h>
#fuses HSPLL,USBDIV,PLL5,CPUDIV1,VREGEN,NOWDT,NOPROTECT,NOLVP,NODEBUG
#use delay(clock=48000000)
#include <lcd.c> // LCD driver file within CCS
void main(void)
{
delay_ms(1500);
lcd_init();
delay_ms(1500);
lcd_putc("\f Hello ");
lcd_gotoxy(1,2);
lcd_putc(" World! ");
while(1);
}
|
The wires are configured as shown at the top of the code. I get the LCD to power up and can change the contrast but nothing else, what am I missing? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Sep 28, 2009 4:55 pm |
|
|
The CCS lcd.c driver doesn't have an option to work without the R/W pin.
Use the Flex driver in the code library if you want to use only a 6-pin
lcd interface (as shown in your schematic):
http://www.ccsinfo.com/forum/viewtopic.php?t=24661
It has instructions on how to do this. |
|
|
buster22098
Joined: 29 Sep 2009 Posts: 8
|
|
Posted: Tue Sep 29, 2009 5:39 pm |
|
|
Thanks! |
|
|
gober Guest
|
lcd r/w pin |
Posted: Thu Oct 29, 2009 12:50 am |
|
|
The r/w pin of the lcd is for read or write mode. As shown in ur connection u did not connect it, which should directly mean that u r just writing to the lcd not reading and writing. For that just tie the r/w pin to ground so the pin won't be floating (not knowing if high(for reading) or low(for writing). Now u can forget about it in the lcd.c file. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Oct 29, 2009 1:46 pm |
|
|
Quote: |
For that just tie the r/w pin to ground so the pin won't be floating (not
knowing if high(for reading) or low(for writing).
Now u can forget about it in the lcd.c file.
|
That's not true. The CCS lcd.c file tests the busy flag, as shown below:
Quote: |
void lcd_send_byte(BYTE address, BYTE n)
{
.
while (bit_test(lcd_read_byte(),7) ) ;
.
}
|
The HD44780u data sheet says the busy flag can only be read if the
R/W pin goes high:
Quote: | Busy Flag (BF)
When the busy flag is 1, the HD44780U is in the internal operation
mode, and the next instruction will not be accepted. When RS = 0
and R/W = 1 (Table 1), the busy flag is output to DB7. The
next instruction must be written after ensuring that the busy flag is 0.
|
Your instructions say to connect R/W to ground. Which means you can't
read the Busy bit. The DB7 bit on the LCD has an internal pull-up on it,
which means it will always read as a '1' if the LCD can't drive DB7, which
is the case if R/W is grounded.
Therefore, the CCS lcd.c driver will hang on the line that reads the busy
bit. It won't work. Also, if you run the LCD in no r/w mode, you need
to have fixed delays in the driver to allow for the amount of time required
to complete an LCD command.
You need to use the Flex lcd driver in "no r/w pin" mode, to do this. |
|
|
|
|
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
|