[英]MPLAB XC8 compiler error:" no identifier in declaration "
我編寫了一個使用Timer0
中斷的程序。
我似乎無法編譯我的代碼,我在第 14 行出現錯誤no identifier in declaration
。
這是整個代碼:
#include<xc.h>
#define _XTAL_FREQ 4000000
#define param_1=0b10001000;
#define param_2=0b10101010;
int counter=0;
void interrupt f1() {
if(TMR0IE && TMR0IF) {
counter++;
INTCONbits.TMR0IF=0;
}
int volatile param_1=0, param_2=0;
void int_tmr0(int conf_int, int conf_T0) {
conf(param_1,param_2);
}
void conf(int p1, int p2) {
T0CON= T0CON || p1;
INTCON= INTCON||p2;
}
int main() {
WDTCONbits.ADSHR=1;
MEMCONbits.EBDIS=1;
TRISD=0x0;
INTCONbits.GIE=1;
INTCONbits.TMR0IE=0;
while(1){
LATD=counter;
}
}
定義常量param_1
和param_2
,丟失=
和;
:
#define param_1 0b10001000
#define param_2 0b10101010
您似乎在函數void interrupt f1()
缺少一個右括號,如果您正確縮進代碼,這將更容易檢測。
此外,常量名稱的標准是大寫。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.