使用PIC-C Compiler编译PIC24FJ256GA410代码时的警告与错误排查求助
PIC-C Compiler编译PIC24FJ256GA410代码时的警告与错误排查求助
各位好,我现在在用PIC-C Compiler编译针对PIC24FJ256GA410的代码时,碰到了一个警告和一个错误,折腾半天也没搞明白原因,想请大家帮忙看看。
我的硬件配置是:G0引脚接了一个LED,G13引脚接了上拉电阻。我原本期望代码里的循环能一直运行,直到G13引脚电平变低(之后我计划把上拉电阻换成下拉电阻),但现在编译环节就卡壳了。
下面是编译时的输出信息:
Compiling C:\Users\uslucas1\OneDrive - ABB\Documents\CCS C Projects\testing port on 14-Nov-24 at 12:44 >>> Warning 204 "C:\Users\uslucas1\OneDrive - ABB\Documents\CCS C Projects\testing port.c" Line 11(1,1): Condition always FALSE PORTG *** Error 12 "C:\Users\uslucas1\OneDrive - ABB\Documents\CCS C Projects\testing port.c" Line 11(20,21): Undefined identifier 1 Errors, 1 Warnings.
我的代码如下:
#include "24FJ256GA410.h" #define PORTG_TRIS set_tris_g(0xE008) // All pins are output except G3, G13-15 outputs low #define MVI_SELECT (PORTG & 0x2000) // Check if bit 13 of PORTG is high void main() { PORTG_TRIS; // Set direction of PORTG pins while(MVI_SELECT) { output_high(PIN_G0); // Set PIN_G0 high } }
备注:内容来源于stack exchange,提问作者yeluissss
相关产品推荐
相关产品推荐

