程序一:
#include<pic.h>
__CONFIG(WDTDIS);
#define delay_i 4
#define delay_j 10000
void delays()
{
int i=0;
int j=0;
for(i=0;i<=delay_i;i++)
{
for(j=0;j<=delay_j;j++)
;
}
}
void main(void)
{
int i=0;
char NUM[]={0b00111111,0b00000110,0b01011011,0b01001111,0b01100110,0b01101101,0b01011111,0b00000111,0b01111111,0b01101111};
TRISC=0;
while(1)
{
for(i=0;i<=9;i++)
{
delays();
PORTC=NUM[i];
}
}
}
程序二:
#include 因为上边顺序的不同,造成编译时出错不断, Clean: Deleting intermediary and output files.
__CONFIG(WDTDIS);
#define delay_i 4
#define delay_j 10000
void delays()
{
int i=0;
int j=0;
for(i=0;i<=delay_i;i++)
{
for(j=0;j<=delay_j;j++)
;
}
}
void main(void)
{
TRISC=0;
int i=0;
char NUM[]={0b00111111,0b00000110,0b01011011,0b01001111,0b01100110,0b01101101,0b01011111,0b00000111,0b01111111,0b01101111};
while(1)
{
for(i=0;i<=9;i++)
{
delays();
PORTC=NUM[i];
}
}
}
Clean: Deleted file "F:PICC04S044S044.obj".
Clean: Deleted file "F:PICC04S044S044.cce".
Clean: Deleted file "S044.cof".
Clean: Done.
Executing: "C:Program FilesHI-TECH SoftwarePICC9.50binpicc.exe" -C -E"S044.cce" "S044.C" -O"S044.obj" -Zg9 -O -ASMLIST -Q -MPLAB -16F877A
Advisory[1209] : An old MPLAB tool suite plug-in was detected. Some options may not work correctly
Advisory[1210] : Visit www.htsoft.com or contact support@htsoft.com for an update
Warning[176] F:PICC04S044S044.C 37 : missing newline
Warning[349] F:PICC04S044S044.C 11 : non-prototyped function declaration for "delays"
Error[249] F:PICC04S044S044.C 26 : probable missing "}" in previous block
Error[285] F:PICC04S044S044.C 29 : no identifier in declaration
Warning[374] F:PICC04S044S044.C 29 : missing basic type; int assumed
Error[314] F:PICC04S044S044.C 29 : ";" expected
Warning[374] F:PICC04S044S044.C 31 : missing basic type; int assumed
Error[314] F:PICC04S044S044.C 31 : ";" expected
Warning[374] F:PICC04S044S044.C 31 : missing basic type; int assumed
Error[314] F:PICC04S044S044.C 31 : ";" expected
Warning[374] F:PICC04S044S044.C 34 : missing basic type; int assumed
Error[983] F:PICC04S044S044.C 34 : storage class redeclared
Error[984] F:PICC04S044S044.C 34 : type redeclared
Error[239] F:PICC04S044S044.C 34 : identifier "PORTC" redefined (from line 26)
Error[188] F:PICC04S044S044.C 34 : constant expression required
Error[285] F:PICC04S044S044.C 35 : no identifier in declaration
Warning[374] F:PICC04S044S044.C 35 : missing basic type; int assumed
Error[314] F:PICC04S044S044.C 35 : ";" expected
Error[285] F:PICC04S044S044.C 36 : no identifier in declaration
Warning[374] F:PICC04S044S044.C 36 : missing basic type; int assumed
Error[314] F:PICC04S044S044.C 36 : ";" expected
Warning[337] F:PICC04S044S044.C 36 : line does not have a newline on the end
Error[285] F:PICC04S044S044.C 37 : no identifier in declaration
Warning[374] F:PICC04S044S044.C 37 : missing basic type; int assumed
Error[314] F:PICC04S044S044.C 37 : ";" expected
Halting build on first failure as requested.
BUILD FAILED: Mon Sep 26 11:58:20 2011
找了很久都找不出问题所在,只好挨条删除测试,最后终于发现问题所在,是由于引脚初始化与定义变量顺序的问题,写出来以供参考。
上一篇:PICC编译错误undefined symbo
下一篇:PIC16F887 串口 LCD1602 按键
推荐阅读
史海拾趣



XC6406PP60DL






京公网安备 11010802033920号