Author Topic: NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem  (Read 3271 times)

gnyturan

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem
« on: October 24, 2015, 07:37:01 PM »
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

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 10
    • View Profile
Re: NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem
« Reply #1 on: October 26, 2015, 10:31:31 AM »
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: http://www.newhavendisplay.com/specs/NHD-0420H1Z-FL-GBW-33V3.pdf


Here are links to example codes we have available on our website for this controller:
http://www.newhavendisplay.com/app_notes/8_bit_character_C.txt
http://www.newhavendisplay.com/app_notes/8_bit_character.txt
http://www.newhavendisplay.com/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.com
« Last Edit: October 26, 2015, 10:33:13 AM by Saurabh_B »

gnyturan

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem
« Reply #2 on: October 26, 2015, 10:48:31 AM »
Hello,

Thank you for the swift reply.

I am adding the code parts so you can see the initialization.

Code: [Select]
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);
}

Code: [Select]
// 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 0xC0

Code: [Select]
void writeInstruction(unsigned int inst){
instructionToDataBus(inst);
SCREENCMD;
OPDISABLE;
WRITEMODE;
delay(1);
OPENABLE;
}

Code: [Select]
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:

Code: [Select]
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.


Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 10
    • View Profile
Re: NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem
« Reply #3 on: October 27, 2015, 03:12:30 PM »
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.


gnyturan

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem
« Reply #4 on: October 28, 2015, 05:03:41 AM »
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.

gnyturan

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem
« Reply #5 on: October 29, 2015, 08:45:55 AM »
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 :)
Gunay

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 10
    • View Profile
Re: NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem
« Reply #6 on: October 29, 2015, 01:23:58 PM »
Well thank you for the heads up.


 

NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem

Started by hbcelebiBoard TFTs

Replies: 9
Views: 4213
Last post Today at 02:24:11 AM
by tolikkk
Working on NHD‐2.4‐240320SF‐CTXL#‐FTN1, have problem in initialization

Started by sli25Board TFTs

Replies: 6
Views: 3811
Last post June 04, 2015, 09:52:25 PM
by sli25
Problem in bringing up NHD‐2.4‐240320SF‐CTXL#‐FTN1 on Renesas RL78/G14

Started by sli25Board TFTs

Replies: 3
Views: 3079
Last post May 28, 2015, 02:59:03 PM
by Michael_L
problem with NHD‐2.23‐12832UCB3

Started by luisvalsecaBoard OLEDs

Replies: 1
Views: 904
Last post January 24, 2017, 02:52:53 PM
by Saurabh_B
Problem setting "function select c" register

Started by jonmon6691Board OLEDs

Replies: 3
Views: 2304
Last post May 04, 2016, 02:44:37 PM
by Saurabh_B