1、实验环境:win732位系统,keil2,proteus7.5sp3。
2、实验目的:学习通过编程单片机时钟0设计时钟并在LCD1602上显示。
3、实验连接图。
4、实验代码。
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit rs=P3^5;
sbit lcden=P3^4;
uchar count,shi,fen,miao;
uchar code table[]="2020-11-22 Sun";
uchar code table1[]="00:00:00";
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
rs=0;
lcden=0;
P0=com;