void delay(unsigned int xms) //@12.00MHZ
{
unsigned char i, j;
while(xms--)
{
i = 2;
j = 239;
do
{
while (--j);
} while (--i);
}
}
STC89c52RC
void delay(unsigned int xms) // 晶振11.0592误差 -0.651041666667us
{
unsigned char a,b;
while(xms--)
{
for(b=4;b>0;b--)
for(a=113;a>0;a--);
}
}
void Delay10us() //@11.0592MHz 10us 10微妙 10的-2毫秒
{
unsigned char i;
i = 2;
while (--i);
}
void delay(unsigned int a)
{
unsigned int i, j;
for (i = 0; i < a; i++)
for (j = 0; j < 120; j++)
;
}
nixie管
unsigned char nixienum []={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};
void nixie(unsigned char location,i)
{
switch(location)
{
case 1:P2_4=1;P2_3=1;P2_2=1;break;
case 2:P2_4=1;P2_3=1;P2_2=0;break;
case 3:P2_4=1;P2_3=0;P2_2=1;break;
case 4:P2_4=1;P2_3=0;P2_2=0;break;
case 5:P2_4=0;P2_3=1;P2_2=1;break;
case 6:P2_4=0;P2_3=1;P2_2=0;break;
case 7:P2_4=0;P2_3=0;P2_2=1;break;
case 8:P2_4=0;P2_3=0;P2_2=0;break;
}
P0= nixienum[i] ;
}
...
...