Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lcd 4 bit Problem with 18f45k50
25-02-2015, 10:08 AM,
#11
RE: Lcd 4 bit Problem with 18f45k50
I ran several tests with ide11, but also with your example, the display does not work.
My card uses different pins, you can see if my changes are correct?

One last thing, my pc has windows 7.

I want a test even with linux as soon as possible


Attached Files
.zip   LCD4bits.zip (Size: 872 bytes / Downloads: 1)
Reply
25-02-2015, 07:42 PM,
#12
RE: Lcd 4 bit Problem with 18f45k50
There is indeed a problem of choice with the pins. I unsuccessfully tried your configuration (#23-28).
I tried again my configuration (#0-5) and it works but I spent a lot of time before succeeding. I changed the cables, the LCD16x2. I powered the LCD externally and finally it was the breadboard in error, bad contacts ? Really not easy to work with a LCD !
I would like you try my configuration to reassure me. Is it possible ?
I am going to search what pins (and why) lead into troubles.
Bye
André
Reply
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: 2)
Reply
25-02-2015, 10:27 PM,
#14
RE: Lcd 4 bit Problem with 18f45k50
I attach your solution for HelloWorld.pde


Attached Files
.pde   HelloWorld_45k50.pde (Size: 1.71 KB / Downloads: 1)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)