0
问答首页 最新问题 热门问题 等待回答标签广场
我要提问

新手求大神指导!!

使用MPLAB8.7 Hi-TECH9.81编译器。PIC16F1827芯片。出现了以下错误
Error   [1098] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 103.7 conflicting declarations for variable "TRISB1" (D:\Program Files\HI-TECH Software\PICC\9.81\include\pic16f1827.h:601)
Warning [374] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 104.7 missing basic type; int assumed
Error   [984] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 104.7 type redeclared
Error   [1098] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 104.7 conflicting declarations for variable "ANSELA" (D:\Program Files\HI-TECH Software\PICC\9.81\include\pic16f1827.h:1480)
Warning [374] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 105.6 missing basic type; int assumed
Error   [984] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 105.6 type redeclared
Error   [1098] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 105.6 conflicting declarations for variable "ANSB1" (D:\Program Files\HI-TECH Software\PICC\9.81\include\pic16f1827.h:1509)
Warning [374] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 106.7 missing basic type; int assumed
Error   [984] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 106.7 type redeclared
Error   [1098] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 106.7 conflicting declarations for variable "ADCON1" (D:\Program Files\HI-TECH Software\PICC\9.81\include\pic16f1827.h:1004)
Error   [194] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 107.7 ")" expected
Error   [984] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 107.9 type redeclared
Error   [1098] F:\aBiShe\chengxu\HI_TECH\chengxu.c; 107.9 conflicting declarations for variable "delay" (F:\aBiShe\chengxu\HI_TECH\chengxu.c:83)

对应的程序是这样的

void ad_init();//采集端口
{
        TRISA=0x18;//0b00011000设置RA3,RA4为输入AN3,AN4(AD采集端口)
        TRISB1=1;//设置RB1为输入 AN11
        ANSELA=0x18;
        ANSB1=1;
        ADCON1=0X90;
        delay(1);
}
void delay(uint x)//5ms延时函数
{
        uint y,k;
        for(y=0;y                for(k=0;k<200;k++);
}
重新创建一个工程,单独调用这俩个子函数,却可以编译成功。
这是哪里出问题了???求大神指导
提问者:wrsffwrss 地点:- 浏览次数:4477 提问时间:07-10 12:24
我有更好的答案
提 交
撰写答案
提 交
1 / 3
1 / 3