You need to use the following lcd_pin_map structure:
Code:
struct lcd_pin_map
{
int unusedA0_A4 : 5; // Pins A0-A4 are not used
BOOLEAN enable : 1; // Pin A5 = LCD Enable
int unusedA6_A7 : 2; // Pins A6,A7 are not used
int unusedB; // Port B is not used
int unusedC; // Port C is not used
int data : 4; // Pins D0-D3 = LCD Data (LCD pins DB4-DB7)
BOOLEAN rs : 1; // Pin D4 = LCD rs
BOOLEAN rw : 1; // Pin D5 = LCD rw
int unusedD : 2; // Pins D6,D7 are not used
} lcd;
The TRIS map must also be changed to the following:
Code:
struct lcd_tris_map
{
int unusedA0_A4 : 5; // Pins A0-A4 are not used
BOOLEAN enable : 1; // Pin A5 = LCD Enable
int unusedA6_A7 : 2; // Pins A6,A7 are not used
int unusedB; // Port B is not used
int unusedC; // Port C is not used
int data : 4; // Pins D0-D3 = LCD data (LCD pins DB4-DB7)
BOOLEAN rs : 1; // Pin D4 = LCD rs
BOOLEAN rw : 1; // Pin D5 = LCD rw
int unusedD : 2; // Pins D6-D7 are not used
} lcdtris;
Important Note:
When you operate the LCD in 4-bit data bus mode, it's the upper 4 bits
of the LCD data bus that are used -- pins DB4 to DB7. So you must
connect the LCD data pins to the PIC as follows:
Code:
LCD pin PIC pin
DB4 D0
DB5 D1
DB6 D2
DB7 D3
Silver
Joined: 10 Jun 2005 Posts: 4 Location: Italy
Posted: Wed Jun 15, 2005 10:17 am
Thank you for the code!!! Now my lcd works properly
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