求知道pic16f877a編譯程序錯在哪裡
程序如下:
#include<pic.h>
void delay();
void Display(unsigned int iData);
__CONFIG(0x1832);
void main()
{
unsigned int iData=1234;
TRISC=0X00;
TRISD=0X00;
PORTD=0X00;
PORTC=0X00;
while(1)
{
DisplayData( iData);
}
}
void DisplayData( unsigned int iData)
{
const char Seg7TableN[]={0x3F,0X06,0X5B,0X4F,0X66,0X6D,0X7D,0X07,0X7F,0X6F};
int i=0,j=0,k=0,Numstr[]={0,0,0,0,0};
Numstr[1]=(iData)/1000;
Numstr[2]=(iData%1000)/100;
Numstr[3]=(iData%100)/10;
Numstr[4]=iData%10;
for(i=0;i<10;i++)
{
PORTD=k=0X01;
for(j=1;j<=4;j++)
{
PORTD=k;
PORTC=Seg7TableN[Numstr[j]];
delay();
k=k<<1;
}
}
}
void delay()
{
int a;
for(a=0;a<500;a++);
}
該程序是用數碼管顯示一個4位數字,可編譯總還是通不過并提示如下:
Build C:\test\seg_4\seg_4 for device 16F877AUsing driver C:\Program Files\HI-TECH Software\PICC\9.80\bin\picc.exeMake: The target "C:\test\seg_4\seg_4.p1" is out of date.Executing: "C:\Program Files\HI-TECH Software\PICC\9.80\bin\picc.exe" --pass1 C:\test\seg_4\seg_4.c -q --chip=16F877A -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s" Warning [361] C:\test\seg_4\seg_4.c; 16.1 function declared implicit intError [984] C:\test\seg_4\seg_4.c; 22.1 type redeclaredError [1098] C:\test\seg_4\seg_4.c; 22.1 conflicting declarations for variable "DisplayData" (C:\test\seg_4\seg_4.c:16)********** Build failed! ********** |