#include"includes.h"
uchar code tab[] ={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80, //数字 0~9
0x90,0x08,0x00,0x46,0x21,0x06,0x0e,0x10};
uchar tab1[] = {8,9,0x0c,5,1};
uchar tab2[] = {0,0,0,0,0};
sbit dout = P2^0;
sbit clk = P2^1;
void main(void)
{
uchar i,j;
uchar temp;
for(i = 0;i < 5;i++)
{
tab2[i] = tab[tab1[i]];
}
for(i = 0; i < 5;i++)
{
temp = tab2[i];
for(j = 0;j < 8;j++)
{
}
}
}
/*共阳
#include"includes.h"
uchar code tab[] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,
0x90,0x08,0x00,0x46,0x21,0x06,0x0e,0x10};
void main(void)
{
uchar ge,shi;
uchar sec;
while(1)
{
delay1s();
if(++sec == 60)
{
sec = 0;
}
ge = sec % 10;
shi = sec / 10;
P2 = tab[shi];
P3 = tab[ge];
}*/
/* 加驱动
#include"includes.h"
void main(void)
{
uchar ge,shi;
uchar sec;
while(1)
{
delay1s();
if(++sec == 60)
{
sec = 0;
}
ge = sec % 10;
shi = sec / 10;
P2 = shi;
P3 = ge;
}
}*/
|