#include <STC89C5xRC.H>
unsigned char NixieTable[]={0X3F,0X06,0X5B,0X4F,0X66,0X6D,0X7D,0X07,0X7F,0X6F};
void Delay(unsigned int xms)
{
unsigned char i, j;
while(xms--)
{
i = 2;
j = 239;
do
{
while (--j);
} while (--i);
}
}
void Nixie(unsigned char Location,Number)
{
switch(Location)
{
case 0:P24=0;P23=0;P22=0;break;
case 1:P24=0;P23=0;P22=1;break;
case 2:P24=0;P23=1;P22=0;break;
case 3:P24=0;P23=1;P22=1;break;
case 4:P24=1;P23=0;P22=0;break;
case 5:P24=1;P23=0;P22=1;break;
case 6:P24=1;P23=1;P22=0;break;
case 7:P24=1;P23=1;P22=1;break;
}
P0=NixieTable[Number];
Delay(1);
P0=0X00;
}
void main()
{
while(1)
{
//ÏûÓ°
Nixie(7,5);
// Delay(20);
Nixie(6,2);
// Delay(20);
Nixie(5,0);
// Delay(20);
Nixie(4,1);
Nixie(3,3);
Nixie(2,1);
Nixie(1,4);
Nixie(0,0);
}
}
标签:case,5201314,51,Nixie,break,数码管,P23,P22,P24 From: https://blog.51cto.com/u_15865347/6004789