电子说
在电子设备的设计中,液晶显示模块是不可或缺的一部分,它为用户提供了直观的信息展示界面。今天,我们就来详细解析Newhaven Display International推出的NHD - 0216K1Z - NSW - FBW - L字符液晶显示模块。
文件下载:NHD-0216K1Z-NSW-FBW-L.pdf
NHD - 0216K1Z - NSW - FBW - L是一款2行×16字符的液晶显示模块,具有多种特性。它采用负性侧白光LED背光的透射式FSTN技术,最佳视角为6:00,适用于宽温度范围,且功耗低至20mA,同时符合RoHS标准。
该模块符合RoHS标准,这意味着它在生产过程中限制了有害物质的使用,更加环保。
| Pin No. | Symbol | External Connection | Function Description |
|---|---|---|---|
| 1 | VSS | Power Supply | Ground |
| 2 | VDD | Power Supply | Supply Voltage for logic (+5.0V) |
| 3 | V0 | Adj Power Supply | Supply Voltage for contrast (approx. 0.5V) |
| 4 | RS | MPU | Register Select signal. RS = 0: Command, RS = 1: Data |
| 5 | R/W | MPU | Read/Write select signal, R/W = 1: Read R/W: = 0: Write |
| 6 | E | MPU | Operation Enable signal. Falling edge triggered. |
| 7 - 10 | DB0 – DB3 | MPU | Four low order bi - directional three - state data bus lines. These four are not used during 4 - bit operation. |
| 11 - 14 | DB4 – DB7 | MPU | Four high order bi - directional three - state data bus lines. |
| 15 | LED+ | Power Supply | Backlight for Anode (+5.0V via on - board resistor) |
| 16 | LED - | Power Supply | Backlight Cathode (Ground) |
推荐使用2.54mm间距的引脚作为LCD连接器,不过文档中未提及背光连接器的相关配对信息。
该模块内置ST7066U控制器,相关规格可从http://www.newhavendisplay.com/app_notes/ST7066U.pdf下载。DDRAM地址分为两行,第一行地址为00H - 0FH,第二行地址为40H - 4FH。
| Instruction | Instruction code | Description | 270 KHZ Execution time (fosc =) |
|---|---|---|---|
| Clear Display | 0 0 0 0 0 0 0 0 0 1 | Write “20H” to DDRAM and set DDRAM address to “00H” from AC | 1.52ms |
| Return Home | 0 0 0 0 0 0 0 0 1 - | Set DDRAM Address to “00H” from AC and return cursor to its original position if shifted. The contents of DDRAM are not changed. | 1.52ms |
| Entry mode Set | 0 0 0 0 0 0 0 1 I/D SH | Sets cursor move direction and specifies display shift. These parameters are performed during data write and read. | 37µs |
| Display ON/ OFF control | 0 0 0 0 0 0 1 D C B | D = 1: Entire display on C = 1: Cursor on B = 1: Blinking cursor on | 37µs |
| Cursor or Display shift | 0 0 0 0 0 1 S/C R/L - - | Sets cursor moving and display shift control bit, and the direction without changing DDRAM data. | 37µs |
| Function set | 0 0 0 0 1 DL N F - - | DL: Interface data is 8/4 bits N: Number of lines is 2/1 F: Font size is 5x11/5x8 | 37µs |
| Set CGRAM Address | 0 0 0 1 - - - - - AC5 AC4 AC3 AC2 AC1 AC0 | Set CGRAM address in address counter | 37µs |
| Set DDRAM Address | 0 0 1 - - - - - - AC6 AC5 AC4 AC3 AC2 AC1 AC0 | Set DDRAM address in address counter. | 37µs |
| Read busy Flag and Address | 0 1 BF - - - - - - AC6 AC5 AC4 AC3 AC2 AC1 AC0 | Whether during internal operation or not can be known by reading BF. The contents of address counter can also be read. | 0s |
| Write data To Address | 1 0 D7 D6 D5 D4 D3 D2 D1 D0 | Write data into internal RAM (DDRAM/CGRAM). | 37µs |
| Read data From RAM | 1 1 D7 D6 D5 D4 D3 D2 D1 D0 | Read data from internal RAM (DDRAM/CGRAM). | 37µs |
从MPU向ST7066U写数据时,Enable Cycle Time(Tc)为1200ns,Enable Pulse Width(TPW)为140ns,Enable Rise/Fall Time(TR,TF)最大为25ns,Address Setup Time(TAS)为0ns,Address Hold Time(TAH)为10ns,Data Setup Time(TDSW)为40ns,Data Hold Time(TH)为10ns。
从ST7066U向MPU读数据时,Enable Cycle Time(Tc)为1200ns,Enable Pulse Width(TPW)为140ns,Enable Rise/Fall Time(TR,TF)最大为25ns,Address Setup Time(TAS)为0ns,Address Hold Time(TAH)为10ns,Data Setup Time(TDDR)最大为100ns,Data Hold Time(TH)为10ns。
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
E = 1;
Delay(1);
Delay(1); //enable pulse width >= 300ns
E = 0; //Clock enable: falling edge
}
void write(char i)
{
E = 0;
P1 = i;
P1 = i; //put data on output Port
D_I = 1;
R_W = 0; //D/I = HIGH : send data //R/W = LOW:Write
E = 1;
Delay(1); //enable pulse width >= 300ns
Delay(1);
E = 0; //Clock enable:falling edge
}
void init()
{
E = 0;
Delay(100);
Delay(100); //Wait >40 msec after power is applied
command(0x30); //command 0x30 = Wake up
command(0x30);
Delay(30);
Delay(30); //must wait 5ms, busy flag not available
command(0x30); //command 0x30 = Wake up #2
Delay(10);
Delay(10); //must wait 160us, busy flag not available
command(0x30); //command 0x30 = Wake up #3
Delay(10);
Delay(10); //must wait 160us, busy flag not available
command(0x38);
command(0x38); //Function set: 8 - bit/2 - line
command(0x10);
command(0x0c);
command(0x06); //Set cursor //Display ON; Cursor ON //Entry mode set
}
void command(char i)
{
P1 = i; //put data on output Port
D_I = 0;
D_I = 0; //D/I = LOW : send instruction
R_W = 0;
Nybble();
i = i < < 4;
P1 = i; //R/W = LOW:Write //Send lower 4bits //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
P1 = i;
D_I = 1; //D/I = HIGH: send data
R_W = 0;
Nybble();
i = i < < 4;
P1 = i;
Nybble(); //R/W = LOW: Write //Clock lower 4 bits //Shift over by 4 bits //put data on output Port //Clock upper 4 bits
}
void Nybble()
{
E = 1;
Delay(1);
Delay(1); //enable pulse width >= 300ns
E = 0; //Clock enable:falling edge
}
void init()
{
P1 = 0;
P3 = 0;
Delay(100);
Delay(100); //Wait >40 msec after power is applied
P1 = 0x30;
P1 = 0x30; //put 0x30 on the output port
Delay(30); //must wait 5ms, busy flag not available
Delay(30);
Nybble(); //command 0x30 = Wake up
Delay(10);
Delay(10); //must wait 160us, busy flag not available
Nybble(); //command 0x30 = Wake up #2
Delay(10);
Delay(10); //must wait 160us, busy flag not available
Nybble(); //command 0x30 = Wake up #3
Delay(10);
Delay(10); //can check busy flag now instead of delay
P1 = 0x20; //put 0x20 on the output port
P1 = 0x20;
Nybble(); //Function set: 4 - bit interface
Nybble();
command(0x28);
command(0x28); //Function set: 4 - bit/2 - line
command(0x10);
command(0x0F); //Set cursor
command(0x0F); //Display ON; Blinking cursor
command(0x06); //Entry Mode set
}
该模块经过了多项质量测试,包括高温存储、低温存储、高温操作、低温操作、高温/湿度操作、热冲击抵抗、振动测试和静电测试等,以确保其在不同环境下的可靠性。
使用LCD/LCM时,需参考www.newhavendisplay.com/specs/precautions.pdf中的注意事项。同时,关于保修信息和条款可访问http://www.newhavendisplay.com/index.php?main_page=terms。
在实际设计中,工程师们需要根据具体的应用场景,合理利用该模块的各项特性,确保系统的稳定运行。大家在使用这款液晶显示模块时,有没有遇到过什么问题呢?或者对于其初始化程序,你有什么优化的想法吗?欢迎在评论区分享。
全部0条评论
快来发表一下你的评论吧 !