ETC JHD164A

JHD164A SERIES
█CHARACTERISTICS:
DISPLAY CONTENT:16 CHAR x 4ROW
CHAR. DOTS:5 x 8
DRIVING MODE:1/16D
AVAILABLE TYPES:
TN,STN(YELLOW GREEN、GREY、B/W)
REFLECTIVE、WITH EL OR LED BACKLIGHT
EL/100VAC,400HZ
LED/4.2VDC
█PARAMETER (VDD=5.0V±10%,VSS=0V,Ta=25℃)
Parameter
Supply voltage
Testing
Standard Values
Symbol
Criteria
Min.
Typ.
Max
Unit
VDD-V
-
4.5
5.0
5.5
V
SS
Input high voltage
VIH
-
2.2
-
VDD
V
Input low voltage
VIL
-
-0.3
-
0.6
V
Output high voltage
VOH
-IOH=02mA
2.4
-
-
V
Output low voltage
VOL
IOL=1.2mA
-
-
0.4
V
Operating voltage
IDD
VDD=5.0V
-
2.0
4.0
mA
█APPLICATION CIRCUIT
█DIMENSIONS/DISPLAY CONTENT
█PIN CONFIGURATION
1
2
3
4
VSS
VCC
VEE
RS
5
6
7
8
9
10
11
12
13
14
15
16
R/W
E
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
LED+
LED-
AC Characteristics Read Mode Timing Diagram
Write Mode Timing Diagram
Timing
Connection
Example
#include <reg51.h>
#include <intrins.h>
LCD 的
21*/
RS
sbit rw=0xa1;
/*P2.1 LCD 的R/W 22*/
LCD 的
25*/
sbit cs=0xa4;
/*P2.4
E
sfr lcdbus=0x80;
/*p0LCD 数据 D0=P0.0*/
unsigned int sys10mscounter;
unsigned char syslimitcounter;
char path1[8]={0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f};/*自定义符号
sbit dc=0xa0;
/*P2.0
char path2[8]={0x1f,0x00,0x1f,0x00,0x1f,0x00,0x1f,0x00};/*自定义符号
char pats1[8]={0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15};/*自定义符号
char pats2[8]={0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a};/*自定义符号
void soft_nop(){}
void soft_10ms()/***********12MHZ 提供10MS 软件延时************/
{
register int i;
for(i=0;i<711;i++);
横1*/
横
2*/
竖1*/
竖
2*/
}
void soft_20ms()/***********12MHZ 提供20MS 软件延时************/
{
Soft_10ms();
soft_10ms();
}
void hard_10ms(unsigned int delaytime) /*基于10MS 的硬件延时*/
{
sys10mscounter=delaytime;
while(sys10mscounter);
}
unsigned char data lcdcounter;
bit lcdusing1,lcdusing2;
bit lcd_checkbusy()/*检查LCD 忙*/
{
register lcdstate;
dc=0;
/*dc=1为数据,=0 为命令.*/
rw=1;
/*rw=1为读,=0 为写.*/
cs=1;
/*cs=1选通.*/
soft_nop();
Lcdstate=lcdbus;
cs=0;
return((bit)(lcdstate&0x80));
}
void lcd_wrcmd(unsigned char lcdcmd) /*写LCD 命令*/
{
lcdusing1=1;
while(lcd_checkbusy());
lcdbus=lcdcmd;
Dc=0;
/*dc=1为数据,=0 为命令.*/
Rw=0;
Cs=1;
soft_nop();
/*rw=1为读,=0 为写.*/
/*cs=1选通.*/
cs=0;
lcdbus=0xff;
lcdusing1=0;
}
void lcd_moveto(char position) /*移动光标到指定位.0-79*/
{ register cmd=0x80;
lcdcounter=position;
if (position > 59)
position += 0x18;
else
{
if (position > 39)position -= 0x14;
else
{
if (position > 19)position += 0x2c;
}
}
cmd=cmd|position;
lcd_wrcmd(cmd); } void lcd_wrdata(char lcddata) /*在当前显示位置显示数据*/ { char i;
lcdusing2=1;
while(lcd_checkbusy());
if(lcdcounter==20){
lcd_moveto(20);
while(lcd_checkbusy());
}
if(lcdcounter==40){
lcd_moveto(40);
while(lcd_checkbusy());
}
if(lcdcounter==60){
lcd_moveto(60);
while(lcd_checkbusy());
}
if(lcdcounter==80){
lcd_moveto(0);
while(lcd_checkbusy());
lcdcounter=0;
} /*为通用而如此*/
lcdcounter++;
lcdbus=lcddata;
dc=1; /*dc=1为数据,=0 为命令.*/
rw=0; /*rw=1为读,=0 为写.*/
cs=1; /*cs=1选通.*/
soft_nop();
cs=0;
lcdbus=0xff;
lcdusing2=0; } void lcd_string(char *strpoint) /*在当前显示位置显示LCD 字符串*/
{ register i=0;
while(strpoint[i]!=0){
lcd_wrdata(strpoint[i]);
i++;
}
} void lcd_init()/*初始化*/
{
lcd_wrcmd(0x38);
lcd_wrcmd(0x0c);
lcd_wrcmd(0x06);
lcd_wrcmd(0x01);
lcdcounter=0;
/*设置8 位格式,2 行,5*7*/
/*整体显示,关光标,不闪烁*/
/*设定输入方式,增量不移位*/
/*清除显示*/
}
void lcd_cls()/*清除显示*/ { lcd_wrcmd(0x01);
lcdcounter=0; } void timer0(void) interrupt 1 /*T0 中断*/ { TH0=0xd8; /*12M,10ms*/
TL0=0xf6;
TR0=1;
if(sys10mscounter!=0)sys10mscounter--; /*定时器10ms*/
if(syslimitcounter!=0)syslimitcounter--; /*定时器10ms*/
}
main()
{
unsigned char j;
IE=0;P0=0xff;P1=0xff;P2=0xff;P3=0xff; /*初始化T*/
lcd_init();soft_20ms();
TMOD=0x51;
TH0=0xd8; /*12M,10ms*/
TL0=0xf6;
TR0=1;ET0=1;EA=1;
while(1)
{
/*全黑横一横二竖一竖二U Q ABCD... */
lcd_init(); /*全黑*/
for(j=0;j<80;j++){lcd_wrdata(0xff);}
hard_10ms(50);
lcd_init(); /*横一可参考自行设计符号*/
lcd_wrcmd(0x40);
for(j=0;j<8;j++)lcd_wrdata(path1[j]);
for(j=0;j<100;j++)lcd_wrdata(0);
hard_10ms(50);
lcd_init(); /*横二*/
lcd_wrcmd(0x40);
for(j=0;j<8;j++)lcd_wrdata(path2[j]);
for(j=0;j<100;j++)lcd_wrdata(0);
hard_10ms(50);
lcd_init(); /*竖一*/
lcd_wrcmd(0x40);
for(j=0;j<8;j++)lcd_wrdata(pats1[j]);
for(j=0;j<100;j++)lcd_wrdata(0);
hard_10ms(50);
lcd_init(); /*竖二*/
lcd_wrcmd(0x40);
for(j=0;j<8;j++)lcd_wrdata(pats2[j]);
for(j=0;j<100;j++)lcd_wrdata(0);
hard_10ms(50);
lcd_init();
lcd_string("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
UUUUUUUUUUUUUUUUUUUUUUUU
UUUUU"); hard_10ms(50); lcd_init();
lcd_string("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
QQQQQQQQQQQQQQQQQQQQQQQQ
QQQQQ"); hard_10ms(50); lcd_init();
lcd_string("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwx
yz0123456789+-!
#$%&?"); hard_10ms(50); }
}