本帖最后由 云深不知处 于 2023-3-22 10:02 编辑
#include
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 24=0 23=0 22=0;break; case 1 24=0 23=0 22=1;break; case 2 24=0 23=1 22=0;break; case 3 24=0 23=1 22=1;break; case 4 24=1 23=0 22=0;break; case 5 24=1 ;P23=0 ;P22=1;break; case 6 24=1 ;P23=1 ;P22=0;break; case 7 24=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); } } |