Hello,
It seems that all I have are problems . I just got an 8-bit interface working with an LCD and I'm trying to convert it to 4-bit. I think I have the initialization down and I'm trying to print messages. This is my LCDdata code to write letters.
I guess the code sort of works, but I can't find the problem. It prints gibberish. When I tell it to print the string "K.-ds>$" ( just because the bits are more random) it doesn't transfer correctly.
K.-ds>$ in hex turns out to be "4b 2e 2d 64 73 3e 24"
my display prints gibberish = "b2 e2 d6 47 33 e2"
It seems that the first 4 bits of the first letter don't get through. Is it a delay problem? Can someone help me fix this?
---
I am using the PICkit2 with PIC18f4525 and Microchip C18 compiler along with 2x16 LCD that seems to be compatible to the Hitachi 47780.
--
Thanks
-George
It seems that all I have are problems . I just got an 8-bit interface working with an LCD and I'm trying to convert it to 4-bit. I think I have the initialization down and I'm trying to print messages. This is my LCDdata code to write letters.
Code:
void LCDdata(unsigned char value)
{
char temp = 0xf0 & value; // get the upper 4 bits
temp = temp >> 4; // shift it right 4 times
ldata = temp; // put it on the pins
rs = 1;
rw = 0;
en = 1;
MSDelay(10); // delay 10
en = 0;
temp = 0x0f & value; // get the lower 4 bits
ldata = temp; // put it on the pins
rs = 1;
rw = 0;
en = 1;
MSDelay(10); // delay 10
en = 0;
}
I guess the code sort of works, but I can't find the problem. It prints gibberish. When I tell it to print the string "K.-ds>$" ( just because the bits are more random) it doesn't transfer correctly.
K.-ds>$ in hex turns out to be "4b 2e 2d 64 73 3e 24"
my display prints gibberish = "b2 e2 d6 47 33 e2"
It seems that the first 4 bits of the first letter don't get through. Is it a delay problem? Can someone help me fix this?
---
I am using the PICkit2 with PIC18f4525 and Microchip C18 compiler along with 2x16 LCD that seems to be compatible to the Hitachi 47780.
--
Thanks
-George
Last edited: