[問題]pic16f877a 組譯出現錯誤...
跑出
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)
推
09/26 14:25, , 1F
09/26 14:25, 1F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
ASM 近期熱門文章
PTT數位生活區 即時熱門文章