零件号是PIC24HJ128GP502插入MICROS
tiCKIII已经做了太多RTFM,我想我需要从I/O端口应用笔记。即使App Note告诉你读PIN,代码示例也不显示它。这个中断没有发生,而且我有一个漂亮的3.3V方波在针上敲击。我也尝试过CN13,这里的代码例子是CN14。如果有人看到我看不到的东西,我很感激,谢谢。
以上来自于百度翻译
以下为原文
part number is PIC24HJ128GP502 plugged into the MicrostickII
I've done as much RTFM as I think I need from the I/O Ports App Notes. Even though the App Note tells you to read the pin, the code examples don't show it.
This interrupt just is not occurring, and I've got a nice 3.3V square wave banging away on the pin. I've tried CN13 as well, the code example here is CN14. Grateful if someone sees what I'm not seeing, thank you.
void __attribute__ ((__interrupt__, no_auto_psv)) _CNInterrupt(void)
{
if (T1CONbits.TON) // timer is running
bitcounter++;
IFS1bits.CNIF = 0; //clear this interrupt
LATBbits.LATB5 = 1; // lemme know
bitstate = PORTBbits.RB12; // same as CN14
}
void setup_changenotification(void)
{
int bitstate;
CNEN1bits.CN14IE = 1; //interrupt on CN14
CNPU1bits.CN14PUE = 1; //use a pull up on CN14
IPC4bits.CNIP = 3; // priority 3
TRISBbits.TRISB12 = 1; //same as change notification pin CN14
IEC1bits.CNIE = 1; // enable CN interrupt
IFS1bits.CNIF = 0; // clear int flag
bitstate = PORTBbits.RB12;
}