View previous topic :: View next topic |
Author |
Message |
Acme Guest
|
8Bit initialization for LCD |
Posted: Mon Jan 30, 2006 12:12 pm |
|
|
Hi, I'm looking for an 8-bit initialization routine for Pic-C PCWH. I've look everywhere but could not find any routines for C language. Could someone here provide me a working routine for 8 bits ??? I have pleanty for 4 bit but no 8 bit.
Thank's
Acme
P.S. Please send me private message |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
|
Guest
|
|
Posted: Mon Jan 30, 2006 11:12 pm |
|
|
I know how to initialize in assembler I'm looking for initialization routine in C language, a working 8 bit initialization routine in C for CCS PicC. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Mon Jan 30, 2006 11:47 pm |
|
|
Okay.
So you know how to do it in assembly. What information in the link was for assembly only?
I'll spell it out. This is from the lcd.c driver that comes with the compiler:
Code: | #define lcd_type 2 // 0=5x7, 1=5x10, 2=2 lines
#define lcd_line_two 0x40 // LCD RAM address for the second line
BYTE const LCD_INIT_STRING[4] = {0x20 | (lcd_type << 2), 0xc, 1, 6};
// These bytes need to be sent to the LCD
// to start it up. |
The LCD_INIT_STRING is sent to the lcd during initialization. The first parameter to be sent is 0x20 | (lcd_type << 2). In other words, 0x28.
So according to the web page I pointed you to, 0x28 sets the lcd to 4 bit interface, 2 lines. Huh.
I wonder what you'll have to change it to to get it to start up in 8 bit mode? Hint: it's the first entry in the table in the linked page. If you can't find the compiler's own lcd.c driver, there have been many examples posted here. Search. |
|
|
|