600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 数字时钟单片机程序c语言 单片机数字时钟C语言程序

数字时钟单片机程序c语言 单片机数字时钟C语言程序

时间:2024-05-13 19:00:28

相关推荐

数字时钟单片机程序c语言 单片机数字时钟C语言程序

单片机程序

/********************************************************/

#include // 包含51单片机寄存器定义的头文件

unsigned char Tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x7f,0xff}; //control shape

unsigned char port[8]={0xfe,0xfd,0xfb,0xf7};

#define uchar unsigned char

#define uint unsigned int

uchar int_time,second,minute,hour;year,month,daytime;

int a=0;

sbit K1=P3^4; sbit K2=P3^5; sbit K3=P3^6;

/

void delay(uint z)//延时函数

{uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--);}

/********************************************************/

void Displayhourminute(uchar h,m)//显示小时分钟的子程序

{

P2=0xfe; P0=Tab[h/10];delay(1);

P2=0xfd; P0=Tab[h%10];delay(1);

P2=0xfd; P0=Tab[10];delay(1);

P2=0xfb; P0=Tab[m/10];delay(1);

P

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。