/********************SU**************************/
/****************QQ774145445*********************/
/***********STC15W408AS@四位数码管***************/
#include<stc15.h>
#define B0 0x01
#define B1 0x02
#define B2 0x04
#define B3 0x08
#define B4 0x10
#define B5 0x20
#define B6 0x40
#define B7 0x80
sbit a =P1^1;
sbit b =P1^0;
sbit c =P3^7;
sbit d =P3^6;
sbit e =P3^5;
sbit f =P3^4;
sbit g =P3^3;
sbit h =P3^2;
sbit yi =P1^5;
sbit er =P1^6;
sbit san =P1^7;
sbit si =P5^4;
sbit jiechuqi =P5^5;
sbit tantou =P1^4;
void yanshi(unsigned int xa);
void xianshi(unsigned char shuju);
void xian1();
unsigned char zi[]={0x03,0x9f,0x25,0x0d,0x99,0x49,
0x41,0x1f,0x01,0x09,0xff};
unsigned char fen,miao;
void main()
{
unsigned char aa;
P5M1 &=~B5;
P5M0 |=B5;
yi=0;
er=0;
san=0;
si=0;
for(;;)
{
if(tantou==1)
{
jiechuqi=1;
}
if(tantou==0)
{
jiechuqi=0;
}
xian1();
yanshi(2000);
aa++;
if(aa>9)
{aa=0;}
}
}
void yanshi(unsigned int xa)
{
unsigned int xb;
for(xa;xa>0;xa--)
for(xb=500;xb>0;xb--);
}
void xianshi(unsigned char shuju)
{
if(shuju&B7)a=1;else{a=0;}
if(shuju&B6)b=1;else{b=0;}
if(shuju&B5)c=1;else{c=0;}
if(shuju&B4)d=1;else{d=0;}
if(shuju&B3)e=1;else{e=0;}
if(shuju&B2)f=1;else{f=0;}
if(shuju&B1)g=1;else{g=0;}
if(shuju&B0)h=1;else{h=0;}
}
void xian1()
{
yi=0;er=1;san=1;si=1;
xianshi(fen/10%10);
yi=1;er=0;san=1;si=1;
xianshi(fen/1%10);
yi=1;er=1;san=0;si=1;
xianshi(miao/10%10);
yi=1;er=1;san=1;si=0;
xianshi(miao/1%10);
}