Microchip
直播中

王丽丽

8年用户 169经验值
私信 关注
[问答]

使用PIC24H从I/O端口读PIN代码示例不显示怎么办

零件号是PIC24HJ128GP502插入MICROStiCKIII已经做了太多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;
}

回帖(17)

张娜

2018-9-14 09:46:28
当然,我会用这个:

以上来自于百度翻译


      以下为原文

    Just to be sure, I'd use this:
 
LATBbits.LATB5 ^= 1; // lemme know
举报

杨玲

2018-9-14 10:03:38
您禁用了PIN上的任何模拟功能吗?

以上来自于百度翻译


      以下为原文

    Have you disabled any analog features on that pin?
举报

王鑫

2018-9-14 10:18:42
谢谢,我以前见过这个答案…我该怎么做呢?

以上来自于百度翻译


      以下为原文

    jtemples,  thanks, I've seen this answer before... how would I do that?
举报

王鑫

2018-9-14 10:29:04
谢谢,我以前看过这个答案,我如何禁用那个引脚上的模拟特性?

以上来自于百度翻译


      以下为原文

    jtemples, thanks, I've seen this answer before, how do I disable analog features on that pin?
举报

更多回帖

发帖
×
20
完善资料,
赚取积分