admin管理员组

文章数量:1794759

简易时钟keil代码

简易时钟keil代码

#include <REGX51.H> sbit RS=P3^0; sbit RW= P3^1; sbit E= P3^2; unsigned char s[]={\"0123456789\"}; unsigned char s0[]={\"CLOCK\"}; unsigned char count=0,sec=22,min=22,hour=5; void delay(unsigned int n) { unsigned int i=0,j=0; for(i=0;i<n;i++) { for(j=0;j<120;j++); } } void writecom(unsigned char com) { RS=0; RW=0; E=0; P2=com; delay(5); E=1; E=0; } void writedat(unsigned char dat) { RS=1; RW=0; E=0; P2=dat; delay(5); E=1; E=0; } void initlcd() { writecom(0x38); writecom(0x0c); writecom(0x06); writecom(0x01); } void display() { unsigned int i=0; unsigned temp0=0,temp1=0,temp2=0,temp3=0,temp4=0,temp5=0; temp0=hour/10; temp1=hour%10; temp2=min/10; temp3=min%10; temp4=sec/10; temp5=sec%10; writecom(0x80); delay(5); while(s0[i]!=&#

本文标签: 时钟简易代码keil