NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem
Hello everyone,
I am using NHD-0420H1Z-FL-GBW-33V3 with NXP LPC1774 an coding in C. When I initialize the LCD as described in the datasheet I cannot display anything, but if I try to use it in 1-line mode, it displays characters to the 1st and 3rd lines only.
So far, I tried:
- 3 (and more) wake up calls with 0x30 and then sending 0x38
- Putting exaggerated delays between init commands
- working in 1-line mode and addressing with 2-line addresses (0xC0 command for second line)
- using another unused screen
If anywhere in the code I use 0x38 command, I get blank screen.
If anyone had the same problem and/or knows the solution could you please help me with this.
Thank you very much in advance,
Kind regards
Gunay
-
Hi,
Any chance you would be able to post your initialization sequence, along with how you are changing the line you are writing to?
The display moves onto line 3 because of the addressing, you can find the address table for the display on page 5 of the display specification here: https://newhavendisplay.com/content/specs/NHD-0420H1Z-FL-GBW-33V3.pdf
Here are links to example codes we have available on our website for this controller:
https://newhavendisplay.com/content/app_notes/8_bit_character_C.txthttps://newhavendisplay.com/content/app_notes/8_bit_character.txt
https://newhavendisplay.com/content/app_notes/4_bit_character.txt
I also have another code for this display in 4bit mode using an arduino if you would be interested in that please email nhtech@newhavendisplay.com0 -
Hello,
Thank you for the swift reply.
I am adding the code parts so you can see the initialization.void initLCD(void){
OPENABLE;
delay(6);
writeInstruction(FUNCTIONSET1LINE);
delay(110);
writeInstruction(FUNCTIONSET1LINE);
delay(11);
writeInstruction(FUNCTIONSET1LINE);
delay(11);
//writeInstruction(FUNCTIONSET2LINES);
writeInstruction(CURSORSHIFT);
writeInstruction(DISPLAYON);
writeInstruction(ENTRYMODESET);
writeInstruction(CLEARDISPLAY);
}// Screen Definitions
#define SCREENCMD LPC_GPIO2->CLR |= 0x00000001
#define SCREENDATA LPC_GPIO2->SET |= 0x00000001
#define READMODE LPC_GPIO2->SET |= 0x00000002
#define WRITEMODE LPC_GPIO2->CLR |= 0x00000002
#define OPENABLE LPC_GPIO2->CLR |= 0x00000004
#define OPDISABLE LPC_GPIO2->SET |= 0x00000004
#define FUNCTIONSET2LINES 0x38 //default: 0x38
#define FUNCTIONSET1LINE 0x30 //default: 0x38
#define DISPLAYON 0x0C
#define DISPLAYOFF 0x08
#define CURSORSHIFT 0x10
#define CLEARDISPLAY 0x01
#define ENTRYMODESET 0x06
#define SECONDLINEADDRESS 0xC0void writeInstruction(unsigned int inst){
instructionToDataBus(inst);
SCREENCMD;
OPDISABLE;
WRITEMODE;
delay(1);
OPENABLE;
}void writeString(char *str){
int i = 0;
SCREENDATA;
WRITEMODE;
while(str[i] != '\0'){
while(i<40 && (str[i] != '\0')){
OPDISABLE;
charToDataBus(str[i]);
delay(20);
OPENABLE;
delay(20);
i++;
}
if(i>39){
writeInstruction(SECONDLINEADDRESS);
SCREENDATA;
WRITEMODE;
while((str[i] != '\0') && i<80){
OPDISABLE;
charToDataBus(str[i]);
delay(20);
OPENABLE;
delay(20);
i++;
}
}
}
}With these codes, I print numbers to the screen by these lines in main:
delay(1000);
configureScreenPins();
delay(1000);
initLCD();
writeString("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33");The problem is, whenever I use 2 line mode command, I see nothing on the screen but the backlight. If I remove it, it works for 1st and 3rd lines with a loss of 40 characters as expected. I suppose the problem is with the wake-up routine but I followed the example codes and similar posts in the forum.
ps. delay function is a ms delay function.0 -
The initialization seems to be fine.
The only thing i can imagine is that the when you are sending the 0x38 command to set 2 line mode it changing it from 1line mode, which could possibly blank out the screen.
If you would be able to email me at sbaxi@newhavendisplay.com I can give you the code i wrote to test these displays. It is made for an arduino and it will work for all of our character displays that use the ST7066U controller.0 -
Hello again,
With Saurabh's help I realized that I did not reset the internal logic. When I used "Initializing by Reset Circuit" I was able to switch to 2-line mode. However, contrast is almost gone in this mode. In 1-line mode I applied 132mV with a voltage divider of 2k-47k from 3.3V. I measure it, it is fine. When I measure it in 2-line mode it becomes 700mV. How is this even possible?
Thank you very much in advance.
Gunay.0 -
Dear all,
I have solved the problem, and would like to give to solution so anyone else having similar problems can solve them.
1. To switch to the 2-line mode, it is better to use the internal reset circuitry wake up routine which you can find in the lcd chip datasheet.
2. When you switch to the 2-line mode, duty cycle drops so does the contrast.
3. If you are not using trimmer for contrast, mind that in the LCD screen, there is an 8.8k ohm resistance between VCC and V0. This dramatically affects your voltage division ratio. Do your calculations accordingly.
Have a nice day
Gunay0 -
Well thank you for the heads up.
0
Please sign in to leave a comment.
Comments
6 comments