电子说
在电子设备的设计中,液晶显示模块是人机交互的重要组成部分。今天我们来详细解析Newhaven Display International公司的NHD - 0220GZ - FSW - GBW - L字符液晶显示模块,看看它有哪些特点和技术细节。
NHD - 0220GZ - FSW - GBW - L是一款2行x20字符的液晶显示模块,型号中的各个部分都有特定含义:
该模块内置ST7066U控制器,采用+5.0V电源供电,具有1/16 duty、1/5 bias的驱动方式。
| 引脚编号 | 符号 | 外部连接 | 功能描述 |
|---|---|---|---|
| 1 | VSS | 电源 | 接地 |
| 2 | VDD | 电源 | 逻辑供电电压(+5.0V) |
| 3 | V0 | 调节电源 | 对比度供电电压(约0.5V) |
| 4 | RS | MPU | 寄存器选择信号,RS = 0为命令,RS = 1为数据 |
| 5 | R/W | MPU | 读写选择信号,R/W = 1为读,R/W = 0为写 |
| 6 | E | MPU | 操作使能信号,下降沿触发 |
| 7 - 10 | DB0 – DB3 | MPU | 四位低阶双向三态数据总线,4位操作时不使用 |
| 11 - 14 | DB4 – DB7 | MPU | 四位高阶双向三态数据总线 |
| 15 | LED+ | 电源 | 背光阳极(通过板载电阻接+5.0V) |
| 16 | LED- | 电源 | 背光阴极(接地) |
推荐使用2.54mm间距的引脚作为LCD连接器。
模块内置ST7066U控制器,其详细规格可从http://www.newhavendisplay.com/app_notes/ST7066U.pdf下载。
该模块的显示字符地址代码如下: 第一行:00 - 13 第二行:40 - 53
| 模块提供了一系列命令,用于控制显示和操作,例如: | 指令 | 指令代码 | 描述 | 270KHZ执行时间(fOSC = ) |
|---|---|---|---|---|
| 清屏 | 0 0 0 0 0 0 0 0 0 1 | 将“20H”写入DDRAM并将DDRAM地址从AC设置为“00H” | 1.52ms | |
| 返回主页 | 0 0 0 0 0 0 0 0 1 - | 将DDRAM地址从AC设置为“00H”,如果光标移动则返回原始位置,DDRAM内容不变 | 1.52ms | |
| 输入模式设置 | 0 0 0 0 0 0 0 1 I/D SH | 设置光标移动方向并指定显示移位 | 37µs | |
| 显示开/关控制 | 0 0 0 0 0 0 1 D C B | D = 1显示开启,C = 1光标开启,B = 1光标闪烁开启 | 37µs |
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; //D/I=HIGH : send data
R_W = 0; //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=LOW : send instruction
R_W = 0;
Nybble();
i = i < < 4; //R/W=LOW:Write //Send Upper 4bits
i = i < < 4; //Shift over by 4 bits
Nybble();
P1 = i; //put data on output Port //Send Lower 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 Upper 4 bits //Shift over by 4 bits //put data on output Port //Clock Lower 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条评论
快来发表一下你的评论吧 !