??? 10/02/08 12:36 Read: times |
#158763 - I am somewhat puzzeled... Responding to: ???'s previous message |
Sunreet:
You have shown in your header file the following: //LCD Registers addresses
#define EN 0x80 #define RS 0x20 First off, as you have attempted to use these definitions, these are not "Register addresses" but would be more correctly referred to as "register bit definitions". Secondly when you show the code as below I see the use of some constant LCD_EN that is not shown in your header file: void lcd_reset()
{ lcd_port = 0xFF; delayms(20); lcd_port = 0x03+LCD_EN; lcd_port = 0x03; Next you showed some example code as below that introduces yet another constant LEN not shown in the header file. i'll give you an example
lcd_port = (((dat >> 4) & 0x0F)|LEN|RS); Lastly I may suggest that you may want to just give the following change a try. Change your typical code as here: void lcd_data (unsigned char dat)
{ lcd_port = (((dat >> 4) & 0x0F)|EN|RS); lcd_port = (((dat >> 4) & 0x0F)|RS); ....to something like this: void lcd_data (unsigned char dat)
{ lcd_port = (((dat >> 4) & 0x0F)|RS); lcd_port = (((dat >> 4) & 0x0F)|EN|RS); lcd_port = (((dat >> 4) & 0x0F)|RS); Michael Karas |