分钟显示程序

时间:2018-04-30 18:49:13
【文件属性】:
文件名称:分钟显示程序
文件大小:37KB
文件格式:RAR
更新时间:2018-04-30 18:49:13
显示 分钟走时程序#include sbit duan=P2^6; sbit wei=P2^7; #define shuju P0 void delay_ms(unsigned int ms) { unsigned int j; while(ms--) for(j=0;j<120;j++); } unsigned char duanma[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40,0x00}; unsigned char weima[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe}; //void led_show_delay_us(us) // { // while(us--); // } void led_show_number(unsigned char shi,unsigned char fen,unsigned char miao) { unsigned char n; unsigned char temp[8]; temp[7]=shi/10; temp[6]=shi; temp[5]=10; temp[4]=fen/10; temp[3]=fen; if(miao%2==0) { temp[2]=10; }else { temp[2]=11; } temp[1]=miao/10; temp[0]=miao; for(n=0;n<8;n++) { wei=1; duan=0; P0=weima[n]; wei=0; duan=1; P0=duanma[temp[n]]; delay_ms(1); } } void main() { unsigned char tt=0,shi=0,fen=0,miao=0; while(1) { led_show_number(shi,fen,miao); tt++; if(tt==100) { tt=0; miao++; if(miao==60) { miao=0; fen++; if(fen==35) { fen=0; } } } } }
【文件预览】:
分钟显示程序
----分钟显示程序.OBJ(3KB)
----分钟显示程序.lnp(56B)
----分钟显示程序(3KB)
----51最小系统带4X4按键数码管.PWI(742B)
----分钟显示程序.plg(2KB)
----分钟显示程序.c(1014B)
----分钟显示程序_uvproj.bak(0B)
----分钟显示程序_uvopt.bak(54KB)
----分钟显示程序.M51(5KB)
----分钟显示程序.LST(3KB)
----分钟显示程序.hex(1001B)
----分钟显示程序.uvopt(54KB)
----分钟显示程序.uvproj(13KB)
----51最小系统带4X4按键数码管.DSN(159KB)

网友评论