Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lcd 4 bit Problem with 18f45k50
25-02-2015, 09:42 PM, (This post was last modified: 25-02-2015, 10:21 PM by gtcbreizh.)
#13
RE: Lcd 4 bit Problem with 18f45k50
I understood the problem , you modified 
 for(i=0; i<4; i++){
digitalWrite(2+i, (c >> i) & 0x01);
}

in
for(i=25; i<29; i++){
digitalWrite(i, (c >> i) & 0x01);
}
This is not correct because of (c >> i). The good configuration is to shift the c character 0 or 1 or 2 or 3 bits. You shift it 25 or 26 or 27 or 28 bits  Huh.

I propose : 
#define LCD_RS 26

#define LCD_E 27
//R/W to ground
//pins 28-31 to D4-D7
The advantages of pins #26-31, the 6 bits are contiguous in register D and it is easy to wire.
then :
 for(i=0; i<4; i++){

digitalWrite(28+i, (c >> i) & 0x01);
}
The attached pde works !!!
Your solution with the correction :
 for(i=0; i<4; i++){

digitalWrite(25+i, (c >> i) & 0x01);
}

is good too. I verified it

Bye
André


Attached Files
.pde   LCD4bits_45k50.pde (Size: 1.79 KB / Downloads: 3)
Reply


Messages In This Thread
Lcd 4 bit Problem with 18f45k50 - by psteve - 23-02-2015, 11:00 AM
RE: Lcd 4 bit Problem with 18f45k50 - by derf158 - 24-02-2015, 02:23 AM
RE: Lcd 4 bit Problem with 18f45k50 - by psteve - 24-02-2015, 03:35 AM
RE: Lcd 4 bit Problem with 18f45k50 - by psteve - 24-02-2015, 10:13 AM
RE: Lcd 4 bit Problem with 18f45k50 - by psteve - 24-02-2015, 11:43 AM
RE: Lcd 4 bit Problem with 18f45k50 - by psteve - 24-02-2015, 02:33 PM
RE: Lcd 4 bit Problem with 18f45k50 - by psteve - 25-02-2015, 10:08 AM
RE: Lcd 4 bit Problem with 18f45k50 - by gtcbreizh - 25-02-2015, 09:42 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)