Author Topic: Hi everyone!/some LCD module troubleshooting  (Read 4368 times)

0 Members and 1 Guest are viewing this topic.

Offline SasjaTopic starter

  • Contributor
  • Posts: 49
  • Country: 00
Hi everyone!/some LCD module troubleshooting
« on: October 14, 2013, 04:00:09 pm »
Hi everyone, first post so first of all i've got to say that i really enjoyed this forum since i know it and i learned a lot here. Thanks to everyone that has been contributing to this!  :-+
Today i've almost wasted a whole day trying to get a lcd-module working and i'm out of ideas so here i am. I've read that datasheets for lcd-module tend to be a bit crappy and this one seems no exception (attachment). I'm using a PIC16F1788 and i'm pretty sure i got the code right as everything works fine with another LCD module. Actually there are two things that confuse me most at the moment,
A) with my other module, when i lower Vo (contrast) down to GND the whole display goes black, but with the problematic one, changing Vo to anything between Vdd (5V) and Vss doenst do anything on the display. Does this mean the module is dead or is that behaviour just different for each module?
B) there is some example code for initializing the module in 8-bit mode, but not in 4-bit mode in the datasheet. And i need the 4-bit mode as i cant spare any more pins. As there is no example code for 4-bit initialization in the datasheet i looked up the datasheet of the lcd-controller used in the module (attachment) but this confused me even more. There is a nice flowchart in that datasheet for 4-bit mode initialization (page 25) but some bits just seem wrong and contradictory to the instruction set table (page 15). (the "display ON/OFF" as well as the "Entry Mode Set" instruction seems wrong as there is no leading 1 before D C B and I/D S bits)
Of course i tried what is written is the datasheet, as well as what i think it should be, with no success. I also tried writing to the LCD memory and reading it back to check if it was maybe just a contrast-problem and maybe the controller was working fine but it didn't work. Then i did the same thing on the other LCD module to see if my code was allright and it was! ugh! I checked the pin connections again and again, checked for shorts, measured the voltages at the module pins... what can i do more?

anyone has an idea? or should i ditch these modules and go for other ones? did i do something :o stuuupiiiidd? (i have a nasty feeling i did) Anyway i'll add some pictures and some code in a minute as you'll ask for it anyway, and rightly so...

heres some relevant code used to initialize the thing, i used a lot of #defines, should make it readable
Code: [Select]
void lcd_sendInstr(uint8_t instr){
    uint8_t hi = instr>>4;
    uint8_t lo = instr & 0x0F;
    LAT_lcdRS = 0;
    LAT_lcdRW = 0;
    LAT_lcdData &= 0xF0;
    LAT_lcdData |= hi;
    LAT_lcdE = 1;
    __delay_us(1);
    LAT_lcdE = 0;
    NOP();
    LAT_lcdData &= 0xF0;
    LAT_lcdData |= lo;
    LAT_lcdE = 1;
    __delay_us(1);
    LAT_lcdE = 0;
    NOP();
}

void lcd_sendData(uint8_t data){
    uint8_t hi = data>>4;
    uint8_t lo = data & 0x0F;
    LAT_lcdRS = 1;
    LAT_lcdRW = 0;
    LAT_lcdData &= 0xF0;
    LAT_lcdData |= hi;
    LAT_lcdE = 1;
    __delay_us(1);
    LAT_lcdE = 0;
    NOP();
    LAT_lcdData &= 0xF0;
    LAT_lcdData |= lo;
    LAT_lcdE = 1;
    __delay_us(1);
    LAT_lcdE = 0;
    NOP();
}

void lcd_init(void){
    __delay_ms(100);

    LAT_lcdRS = 0;
    LAT_lcdRW = 0;
    LAT_lcdData &= 0xF0;
    LAT_lcdData |= 0b0011;
    LAT_lcdE = 1;
    __delay_us(1);
    LAT_lcdE = 0;
    __delay_ms(100);

    LAT_lcdE = 1;
    __delay_us(1);
    LAT_lcdE = 0;
    __delay_ms(10);

    LAT_lcdE = 1;
    __delay_us(1);
    LAT_lcdE = 0;
    __delay_ms(10);

    LAT_lcdData &= 0xF0;
    LAT_lcdData |= 0b0010;
    LAT_lcdE = 1;
    __delay_us(1);
    LAT_lcdE = 0;
    __delay_ms(10);

    lcd_sendInstr(0b00101000);
    __delay_ms(1);

    lcd_sendInstr(0b00001111);
    __delay_ms(1);

    lcd_sendInstr(0b00000001);
    __delay_ms(5);

    lcd_sendInstr(0b00000110);
    __delay_ms(1);
}
« Last Edit: October 14, 2013, 04:21:45 pm by Sasja »
 

Offline casinada

  • Frequent Contributor
  • **
  • Posts: 599
  • Country: us
Re: Hi everyone!/some LCD module troubleshooting
« Reply #1 on: October 14, 2013, 05:07:13 pm »
The module on your protoboard looks like the regular 1602 / HD44780  16 x 2 character lcd display type. The one on your perfboard looks different. Please post the model number, brand and specifications of that display. The pinout could be totally different. I would put a socket on the perfborad and try the LCD you have on the protoboard first and the opposite as well.  :)
 

Offline SasjaTopic starter

  • Contributor
  • Posts: 49
  • Country: 00
Re: Hi everyone!/some LCD module troubleshooting
« Reply #2 on: October 14, 2013, 05:22:26 pm »
thanks for having a look!
the one on my perfboard is a NHD-CO216AZ-FSW-GBW from Newhaven Display, the datasheet is attached to the original post. The other one is a GE-C1602B-TFH-JT/R from Gleichmann and i'll attach the datasheet to this post.
they are both 16x2 character displays, the only difference in pinout seems to be Vo and Vdd wich are swapped (pin 2 and 3).
A socket might have been usefull as i had to bend the pins to plug in the perboard, anyway i measured continuity from PIC to module for each pin and checked for shorts.
 

Offline geraldjhg

  • Regular Contributor
  • *
  • Posts: 61
  • Country: ar
Re: Hi everyone!/some LCD module troubleshooting
« Reply #3 on: October 14, 2013, 05:35:38 pm »
hi
ive used theese displays wh1602 etc
that have 14+2 pins and are ALLWAYS in the same standar place if they use hd44780 mcu
beware than pins 15 an 16 (backlight power) are before pin #1
dont use any other as it complicates things
first get the contrast right, put an r from the pot to +5v
so as to lower the top of the pot to 1vdc
then adjust the contrast
i dont use c it is far to complicated
but you are in the right direction if you can get it all black and clear


this is how its done in bascomavr
Config Lcdpin = Pin , Db4 = Porta.4 , Db5 = Porta.5 , Db6 = Porta.6 , Db7 = Porta.7 , E = Portc.7 , Rs = Portc.6
Config Lcd = 16 * 2

and to use it

Cls                                                         'clear the LCD display
Lcd "Hello world."                                         'display this at the top line
lowerline                                                   'select the lower line
Lcd "Shift this."

saludos










G E R A L D
 

Offline SasjaTopic starter

  • Contributor
  • Posts: 49
  • Country: 00
Re: Hi everyone!/some LCD module troubleshooting
« Reply #4 on: October 14, 2013, 05:58:32 pm »
hi geraldjhg,
backlight power is on a separate set of pins on the side in my module and the backlight is actually the only thing that i get working properly :)
maybe i should have indeed chosen a more standard module, but i needed it to be small so i chose this chip on glass module (COG). If i compare with datasheets from regular non COG modules however its seems to use the same standard interface/protocol. Or am i overlooking something else?
 

Offline SasjaTopic starter

  • Contributor
  • Posts: 49
  • Country: 00
Re: Hi everyone!/some LCD module troubleshooting
« Reply #5 on: October 14, 2013, 08:11:21 pm »
anybody else any idea what i could try before ditching these modules and trying my luck with other ones?  :-//
 

Offline Jon Chandler

  • Frequent Contributor
  • **
  • Posts: 539
    • Throw Away PIC
Re: Hi everyone!/some LCD module troubleshooting
« Reply #6 on: October 14, 2013, 08:21:14 pm »
Some LCDs require a negative voltage on the Ve contrast pin.  If you can't see any change in contrast, you might give that a try.
 

Offline SasjaTopic starter

  • Contributor
  • Posts: 49
  • Country: 00
Re: Hi everyone!/some LCD module troubleshooting
« Reply #7 on: October 14, 2013, 08:30:47 pm »
good suggestion, i tried pulling Vo down to -5V on a spare module not in the circuit to see if it would bring something up, nope. Anyway the datasheet clearly states 0.3 V as an optimal Vo voltage for good contrast (it also states "supply for contrast" Vdd-Vo Typ. 4.7V) and suggests getting Vo from a voltage divider pot between Vss and Vdd. I was hoping to see at least something by pulling it further down even below Vss as the other module (the big not COG-one) goes totally dark when Vo is pulled to low. But no success with the COG one...
 

Offline alxnik

  • Regular Contributor
  • *
  • Posts: 81
  • Country: 00
Re: Hi everyone!/some LCD module troubleshooting
« Reply #8 on: October 14, 2013, 08:39:04 pm »
Hello Sasja,

You seem to have done a lot of homework on this one.
Quote
Today i've almost wasted a whole day trying to get a lcd-module working
As an old programmer friend says: You haven't wasted time, now you have the valuable information that nothing you tried works.

Quote
i'm pretty sure i got the code right as everything works fine with another LCD module.

If the code works fine on another LCD with the same controller, then you should start thinking if the module is busted. Try increasing the delays a little, in case it is a timing issue.

Quote
Actually there are two things that confuse me most at the moment,
A) with my other module, when i lower Vo (contrast) down to GND the whole display goes black, but with the problematic one, changing Vo to anything between Vdd (5V) and Vss doenst do anything on the display. Does this mean the module is dead or is that behaviour just different for each module?

Different behaviour seems strange to be honest, this increases the possiblity that one of them is busted. If you have an oscilloscope/logic analyser, you should start looking for signals of life from the one you can't interface with. If you don't have either, try connecting both displays in parallel on the circuit you know works (this might need some fiddling to do), then try to interface with them - just be sure to only write to the displays, not read from them. If one works and the other doesn't on the same circuit and the same program, at the same time, I think you have your answer  :o
 

Offline SasjaTopic starter

  • Contributor
  • Posts: 49
  • Country: 00
Re: Hi everyone!/some LCD module troubleshooting
« Reply #9 on: October 14, 2013, 09:03:19 pm »
hi alxnik,
thanks for the advice :) if i figure it out i wouldnt consider it a wasted day! So i'll work at it for a while.
Maybe my desciprtion was a bit confusing but i actually have 3 modules, the first i've had for a while and have been using it for experimenting on a breadboard  (it's the big one on the breadboard picture in my first post). Recently i also bought 2 new ones of another type that i wanted to put into my next project (they are the slim chip on glass type, picture of the protoboard), none of those two new ones seem to work. The old one always worked as it should. It's the second type of lcd modules i use and the first time i do it in 4-bit mode so i tested it first on my trusty chunky LCD-module, that worked so i then tried to translate it to my new COG modules. Of course i checked for pinout differences and adapted the circuit accordingly and checked for timing differences and even increased delays well beyond the minimum values, no success. So i guess its probably me doing something wrong in talking to these modules or wiring them up incorectly or i blew both up somehow.... Anyway its 11PM now here so i'll call it a day and tomorow i'll follow your advice to check for any signs of life using what i've got (that would be my old trusty analog hameg :). I'll post my findings and it would be awesome to hear what you think of it!
« Last Edit: October 14, 2013, 09:10:08 pm by Sasja »
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8134
  • Country: de
  • A qualified hobbyist ;)
Re: Hi everyone!/some LCD module troubleshooting
« Reply #10 on: October 14, 2013, 09:39:38 pm »
I think that the datasheet for the COG module is wrong regarding V_0 and V_DD. V_DD is shown to be pin 3 in the table but the diagrams below the table show V_DD being the second pin which is the standard.
 

Offline SasjaTopic starter

  • Contributor
  • Posts: 49
  • Country: 00
Re: Hi everyone!/some LCD module troubleshooting
« Reply #11 on: October 14, 2013, 10:31:49 pm »
thanks for having a look madires, good point, i measured the current draw when putting 5V to pin 3 (cfr the datasheet) which was about 1mA which is exactly what is specified in the datasheet, current draw on pin 2 was zero on my multimeter. So the datasheet looks right after all on that part.
I just made this adapter with my other module (attachment) wich will allow me to do some basic stuff on the breadboard tomorrow (its 0:30 AM now, i need to quit). Well at least the current draw seems right, so now i got some progress today! :P
maybe better luck tomorrow, and thanks for all your suggestions everyone!
 

Offline SasjaTopic starter

  • Contributor
  • Posts: 49
  • Country: 00
Re: Hi everyone!/some LCD module troubleshooting
« Reply #12 on: October 15, 2013, 12:04:41 pm »
Solved! One of the two COG modules was indeed broken, i suppose i messed it up when bending the pins to cram it in the perfboard the first time...
First i managed to get my spare COG module working in a breadboard setup. That proved that indeed you cant get anything visible at all (like a black screen) with this module until you manage to initialize correctly. It also confirmed that mistake on the lcd-controller datasheet i mentioned in my first post. A useful thing to do i found was to measure current draw of the module while sending each initialization instruction one at a time witch a few seconds in between. Every instruction i sent changed the current draw slightly providing me witch some feedback that the module was at least accepting my instructions and actually doing something at all.

thx to everyone that took some time to look at it  :-+! Its the first time i actually break something so i guess i ruled that option out to quickly (and maybe it was wishfull thinking as i didnt feel like desoldering it and soldering in the other unit, a socket would have been handy...)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf