作者evogtrrx7 (聪明如我)
看板ASM
标题[问题]pic16f877a 组译出现错误...
时间Sat Sep 26 13:13:17 2009
跑出
Cannot open file (Include File "p16f877a.h" not found)
Illegal opcode
Symbol not previously defined
Missing argument
这些字样....
请问是问题大概错在哪呢?
---------------------------------------------
程式
#include <p16f877a.h>
char ECGbufh,ECGbufl,Wbufh,Wbufl,Tmrh,Tmrl,Alltmr,breathebufh,breathebufl;
int IDX;
void SYSTEMinit(void); //副程式
void Delay_x_mS(int); //定义延迟副程式
void Delay_1mS(void);
char TMR1H_Cary=0;
double OK;
char ex_int_flag=0; //中断旗标
void interrupt isr_Sevr ( void )
{
if(INTF==1) //中断触发
{
INTF=0;
if(ex_int_flag==0) //
{
TMR1ON=1; //1=启用Timer1
ex_int_flag=1 //
}
else
{
TMR1ON=0; //Timer1归回初始值
ex_int_flag=0;
Tmrh=TMR1H;
Tmrl=TMR1L;
Alltmr=TMR1H_Cary;
TMR1H=0x00;
TMR1L=0x00;
TMR1H_Cary=0X00;
}
}
else if(TMR1IF==1)
{
TMR1IF=0;
TMR1H_Cary++;
if(TMR1H_Cary==0x00)
{
TMR1H=0X00;
TMR1L=0X00;
ex_int_flag=0;
TMR1ON=0;
}
}
}
void main (void) //主程式
{
SYSTEMinit(); //晶片初始化设定
while(OK < 1000)
{ Delay_x_mS(2);
ADCON1=0x80; //Channel-0(AN0);0=A/D转换模块关闭和不消耗工作电流
ADCON0=0x89; //Channel-1(AN1);1=A/D转换模块通电
IDX=0X00;
Delay_x_mS(2);
ADGO=1; //开始A/D转换
while(!(ADIF==1 && IDX==0));
Wbufh=ADRESH; //Wbufh=A/D转换结果存到暂存器高位元
Wbufl=ADRESL; //Wbufh=A/D转换结果存到暂存器低位元
ADIF=0;
while(!(ADIF==0 && IDX==0));
ADCON0=0x91; //Channel-2(AN2);1=A/D转换模块通电
Delay_x_mS(2);
ADGO=1; //开始A/D转换
while (!(IDX==0 && TRMT==1));
TXREG=0xF0; //送档头传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=0xFF; //档头传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=Wbufh; //将Wburf高位元资料传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=Wbufl; //将Wbuef低位元资料传到TXREG
IDX=0X01; //
OK++;
ADIF=0;
}
while(1)
{
ADCON1=0x80; //Channel-0(AN0);0=A/D转换模块关闭
ADCON0=0x81; //Channel-2(AN2);1=A/D转换模块通电
Delay_x_mS(2);
ADGO=1; //开始A/D转换
IDX=0X00;
while(!(ADIF==1 && IDX==0));
ECGbufh=ADRESH; //暂存器高位元传到ECGbufh
ECGbufl=ADRESL; //暂存器低位元传到ECGbufl
ADIF=0;
while (!(IDX==0 && TRMT==1));
TXREG=0xF1; //将档头传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=0xFF; //将档头传到传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=ECGbufh; //将ECG高位元资料传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=ECGbufl; //将ECG低位元资料传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=breathebufh; //将呼吸高位元资料传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=breathebufl; //将呼吸低位元资料传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=Tmrh; //将计时器高位元资料传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=Tmrl; //将计时器低位元资料传到TXREG
while(!(IDX==0 && TRMT==1));
TXREG=Alltmr;
IDX=0X01;
ADIF=0;
}
}
void SYSTEMinit(void)
{
OK=0x00;
IDX=0X00;
TRISA=0XFF;
TRISB0=1;
SPBRG=0x23;
TXSTA=0x24;
RCSTA=0x80;
SYNC=0;
BRGH=1;
SPEN=1;
TXEN=1;
Tmrh=0X00;
Tmrl=0X00;
Alltmr=0x00;
ECGbufh=0x00;
ECGbufl=0x00;
Wbufh=0x00;
Wbufl=0x00;
INTCON=0XD0;
TMR1IE=1;
TMR1H=0X00;
TMR1L=0X00;
T1CON=0X30;
}
void Delay_x_mS(int N_mS)
{
int Loop_mS ;
for ( Loop_mS = 0 ; Loop_mS < N_mS ; Loop_mS++ )
{
Delay_1mS();
}
}
//*** Delay 1mS with 16MHz crystal
void Delay_1mS(void)
{
int Del_1mS;
for (Del_1mS = 0 ; Del_1mS < 199 ; Del_1mS ++ )
{
asm("nop");
asm("nop");
}
}
--
人生总会遇到畜生?!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.68.164.58
※ 编辑: evogtrrx7 来自: 203.68.164.58 (09/26 13:14)
1F:推 ruemann:就编译器找不到 p16f877a.h 09/26 14:25