Hi everyone!/some LCD module troubleshooting - Page 1
Forum section: electronics / beginners

author: Sasja
author_rank: Contributor
timestamp: October 14, 2013, 04:00:09 pm
content: 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 somethingstuuupiiiidd? (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 readableCode: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);}

author: casinada
author_rank: Frequent Contributor
timestamp: October 14, 2013, 05:07:13 pm
content: 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.

author: Sasja
author_rank: Contributor
timestamp: October 14, 2013, 05:22:26 pm
content: 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.

author: geraldjhg
author_rank: Regular Contributor
timestamp: October 14, 2013, 05:35:38 pm
content: hiive used theese displays wh1602 etcthat have 14+2 pins and are ALLWAYS in the same standar place if they use hd44780 mcubeware than pins 15 an 16 (backlight power) are before pin #1dont use any other as it complicates thingsfirst get the contrast right, put an r from the pot to +5vso as to lower the top of the pot to 1vdcthen adjust the contrasti dont use c it is far to complicatedbut you are in the right direction if you can get it all black and clearthis is how its done in bascomavrConfig Lcdpin = Pin , Db4 = Porta.4 , Db5 = Porta.5 , Db6 = Porta.6 , Db7 = Porta.7 , E = Portc.7 , Rs = Portc.6Config Lcd = 16 * 2and to use itCls 'clear the LCD displayLcd "Hello world." 'display this at the top linelowerline 'select the lower lineLcd "Shift this."saludos

author: Sasja
author_rank: Contributor
timestamp: October 14, 2013, 05:58:32 pm
content: 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 properlymaybe 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?

author: Sasja
author_rank: Contributor
timestamp: October 14, 2013, 08:11:21 pm
content: anybody else any idea what i could try before ditching these modules and trying my luck with other ones?

author: Jon Chandler
author_rank: Frequent Contributor
timestamp: October 14, 2013, 08:21:14 pm
content: 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.

author: Sasja
author_rank: Contributor
timestamp: October 14, 2013, 08:30:47 pm
content: 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...

author: alxnik
author_rank: Regular Contributor
timestamp: October 14, 2013, 08:39:04 pm
content: Hello Sasja,You seem to have done a lot of homework on this one.QuoteAs an old programmer friend says: You haven't wasted time, now you have the valuable information that nothing you tried works.QuoteIf 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.QuoteDifferent 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

author: Sasja
author_rank: Contributor
timestamp: October 14, 2013, 09:03:19 pm
content: hi alxnik,thanks for the adviceif 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!

author: madires
author_rank: Super Contributor
timestamp: October 14, 2013, 09:39:38 pm
content: 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.

author: Sasja
author_rank: Contributor
timestamp: October 14, 2013, 10:31:49 pm
content: 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!maybe better luck tomorrow, and thanks for all your suggestions everyone!

author: Sasja
author_rank: Contributor
timestamp: October 15, 2013, 12:04:41 pm
content: 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...)