请教各位大神,下面代码为啥报错
#include<reg52.h>
typedef unsigned char u8;
typedef unsigned int u16;
u8 code Seg7_Tab[ ] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}
void Seg7_Display(u16 val,u8 DEC_HEX)
{
static u8 i = 4,j = 0;
static u16 pre_val=0;
static u8 dis_data[5]={0};
if(val != pre_val)
{
pre_val=val;
for(j=0;j<5;j++)
{
dis_data[j] = val%DEC_HEX;
val=val/DEC_HEX;
}
}
i++;
if(i>4) //i的范围[0,4]
i=0;
P0 = 0;
P0 = Seg7_Tab[dis_data[ i]];
P1 = i;
}
|