1024手机基地看电影,午夜福利视频导航,国产精品福利在线一区,亚洲欧美日韩另类成人,在线观看午夜日本理论片,成年超爽免费网站,国产精品成人免费,精品动作一级毛片,成人免费观看网站,97精品伊人久久大香蕉

標題: 數碼管顯示時間 [打印本頁]

作者: 小文185    時間: 2018-5-21 17:51
標題: 數碼管顯示時間
#include<reg52.h>
#include<intrins.h>
#include<stdio.h>
typedef unsigned int u8;
typedef unsigned char u16;
#define uchar unsigned char
#define uint unsigned int
#define SECOND 2000
uint count;
struct time{
uchar hour;
uchar min;
uchar sec;
};
struct time clocktime;
uchar dg[8]={0,0,16,0,0,16,0,0};
u8 code SEG[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
     0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x40};
void delay()
{
uint i;
for(i=0;i<500;i++);
}
void update(struct time dtime)
{
dg[0]=dtime.hour/10;
dg[1]=dtime.hour%10;
dg[3]=dtime.min/10;
dg[4]=dtime.min%10;
dg[6]=dtime.sec/10;
dg[7]=dtime.sec%10;
}
void timer0()interrupt 1 using 2
{
if(++count==SECOND)
{
count=0;
update(clocktime);
if(++clocktime.sec==60)
{
clocktime.sec=0;
if(++clocktime.min==60)
{
clocktime.min=0;
if(++clocktime.hour==24)
{
clocktime.hour=1;
}
}
}
}





歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1