用定时器即可实现精准时钟荔枝
https://img-mid.csdnimg.cn/release/static/image/mid/ask/665327742786188.png
```
这是1602驱动荔枝,在有人机交互之后,添加任意功能都可以通过显示器辅助实现
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit RS=P2^0;
sbit RW=P2^1;
sbit E=P2^2;
uchar code table[]="Welcome to china";
void delay(ms){
uint i,j;
for(i=0;i<ms;i++)
for(j=0;j<123;j++);
}
void write_com_data(uchar com,uchar x){
E=RW=0;RS=x;
delay(1);
P0=com;
E=1;delay(1);
E=0;
}
void init(){
write_com(0x38,0);
write_com(0x0c,0);
write_com(0x06,0);
write_com(0x01,0);
}
void main(){
uint i;
init();
write_com_data(0x80,0);
for(i=0;i<16;i++){
write_com_data(table[i],1);
}write_com_data(0xc0,0);
for(i=0;i<16;i++){
write_com_data(table[i],1);
}
while(1);
}
```
作者在 2023-06-20 16:44:39 发布以下内容