89c52单片机程序,移植到stc12c5a60s2上,不知道出了什么问题
#include <./Atmel/AT89X52.H>#include "tm1618.h"
#define uchar unsigned char //255
#define uint unsigned int //65535
unsigned char code tab[]={
0x3F // 0
,0x06 // 1
,0x5B // 2
,0x4F // 3
,0x66 // 4
,0x6D // 5
,0x7D // 6
,0x07 // 7
,0x7F // 8
,0x6F // 9
,0x77 // A
,0x7C // b
,0x39 // C
,0x5E // d
,0x79 // E
,0x71 // F
,0x40 // -
,0x80 // .
,0 // 全灭
};
void delay100ms(void) //误差 0us
{
unsigned char a,b,c;
for(c=19;c>0;c--)
for(b=20;b>0;b--)
for(a=130;a>0;a--);
}
main()
{
uchar i = 0;
uchar num[4] = {0};
init_TM1618();
for(i=0;i<18;i++)
{
Write_num(0,tab[i]);
Write_num(2,tab[i]);
Write_num(4,tab[i]);
Write_num(6,tab[i]);
delay100ms();
}
while(1)
{
i = Read_key();
while(Read_key() == i)//等待按键释放
{
}
num[i]++;
if(num[i] >15)
{
num[i]=0;
}
Write_num(i*2,tab[num[i]]);
}
}