Jump to content
  • 0

ChipKit Pro MX4 Change Notification Interrupt


dmar

Question

Hello,

I have tried unsuccessfully to get several interrupts working on the PIC, and I'm not sure whether it's a coding issue, or, I've read some material suggesting that the design of the board itself may be blocking some functionality of the pins. I am attempting to get a change notification interrupt with pins RG6/CN8, RG7/CN9, RG8/CN10, and RG9/CN11 but nothing I try triggers the interrupt. I've attached the code and would appreciate any insight into the issue.

Thanks,

Dave

code.c

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hi @dmar,

I'm not certain how much of a difference it will make in your code (or how you have provided inputs to your pins JB1 through JB4 on the Pmod port), but I noticed that you did not enable any of the pull-up resistors for those pins via the CNPUE register (page 20 on section 12 of the family reference manual), since they use those pull-up resistors as part of their example shown on page 32.

You may also want to try using the debugger in MPLAB X so that you can step through the code and see where/when the registers are changing to give some better insight on to what is being detected. A logic analyzer/oscilloscope may help give some additional insight as well to your inputs.

Thanks,
JColvin

Link to comment
Share on other sites

Thank you for your reply. I apologize for the wait, I'm new to MPLAB and had to teach myself how to use the debugger. The inputs are your company's own PMOD expansion card that interfaces four IR sensors to the chipKit. I don't believe they require the pull ups, however I've tried either way with no success.

I did find a few syntactic errors in the code, which I corrected. The program, according to the MPLAB debugger/simulator does set the registers correctly. When applying stimulus to any of the pins, the program never exits the while loop to execute the interrupt code.

I noticed when I stimulate a pin in the simulator, PORT doesn't change. But googling seems to bring up that it's a known issue. Maybe that's why it isn't working in the simulator.

Anyhow, I'm at a dead end. Any help would be appreciated. I've attached the updated code.

Thanks,

Dave

ir_sense.c

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...