C library for working with NHD-02161Z-FSY-YBW-C display (ST7066U controller)
Hello!
I´m an engineer from Trovan company.
In one of our projects (RFID pocket reader) we decided to use your display. Estimated number of products is 2000-3000 per year, but we cannot launch them
Do you have a library (in C language) for working in 4-bit mode with the NHD-02161Z-FSY-YBW-C display. I can't initiate and configure it to work
-
Hi,
Thank you for waiting on us. Please visit our GitHub page for our NHD-Character-LCD-Library.
0 -
yes, I visited. It written under Arduino. That's why I asked you - "library in C". Do you have one?
0 -
Hi Dmitrii,
The other code available is found on page 11 of the NHD-02161Z-FSY-YBW-C datasheet.
4-bit Initialization:
/**********************************************************/
void command(char i)
{
P1 = i; //put data on output Port
D_I = 0; //D/I=LOW : send instruction
R_W = 0; //R/W=LOW : Write
Nybble(); //Send upper 4 bits
i = I << 4; //Shift over by 4 bits
P1 = i; //put data on output Port
Nybble(); //Send upper 4 bits
}
/**********************************************************/
void write(char i)
{
P1 = i; //put data on output Port
D_I = 1; //D/I=HIGH : send data
R_W = 0; //R/W=LOW : Write
Nybble(); //Clock upper 4 bits
i = I << 4; //Shift over by 4 bits
P1 = i; //put data on output Port
Nybble(); //Clock upper 4 bits
}
/**********************************************************/
void Nybble()
{
E = 1;
Delay(1); //enable pulse width >= 300ns
E = 0; //Clock enable: falling edge
}
/**********************************************************/
void init()
{
P1 = 0;
P3 = 0;
Delay(100); //Wait >40 msec after power is applied
P1 = 0x30; //put 0x30 on the output port
Delay(30); //must wait 5ms, busy flag not available
Nybble(); //command 0x30 = Wake up
Delay(10); //must wait 160us, busy flag not available
Nybble(); //command 0x30 = Wake up #2
Delay(10); //must wait 160us, busy flag not available
Nybble(); //command 0x30 = Wake up #3
Delay(10); //can check busy flag now instead of delay
P1 = 0x20; //put 0x20 on the output port
Nybble(); //Function set: 4-bit interface
command(0x28); //Function set: 4-bit/2-line
command(0x10); //Set cursor
command(0x0F); //Display ON; Blinking cursor
command(0x06); //Entry Mode set
}
/**********************************************************/Could you please confirm you are providing the correct power?
0
Please sign in to leave a comment.
Comments
3 comments