帮我看看这段代码!
#include<reg51.h>
char code seg[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char i;
void test(char tmp,char j)
{
i=0xff;
P2=j;
P0=seg[tmp];
while(i--);
}
void main()
{
while(1)
{
test(1,0xfe);
test(2,0xfd);
}
}
编译没有问题,在Keil下调试也没有问题,烧到单片机里就有问题,为什么?
如果只是调用一次test就不会有问题!帮帮我 急!!!