普中c51的板子,我用的别人的代码,数码管显示的例程,编译没错误,但是到了板子上就出错,数码管管脚基本一致,下面是普中的板子的管脚设置
#include<reg52.h>
u8;
u16;
#define SMG_A_DP_PORT P0
sbit LSA=P2^2;
sbit LSB=P2^3;
sbit LSC=P2^4;
u8 SMG_A_DP_PORT_Tab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07
,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void SMG_A_DP_PORT_Display(u16 val);
void main()
{
while(1)
{
SMG_A_DP_PORT_Display(12345);
}
}
void SMG_A_DP_PORT_Display(u16 val)
{
static u8 i=4;
u8 j,dis_data;
i++;
if(i>4)
i=0;
for(j=0;j<=i;j++)
{
dis_data=val%10;
val=val/10;
}
P0=0;
P0=SMG_A_DP_PORT_Tab[dis_data];
P1=i;
}
求帮忙看看怎么解决