change notification CN in dsPIC

Status
Not open for further replies.

faysal_002299

New Member
Dear All,
I am working with the change notification CN pins of the dsPIC30F30. Even though, I am giving a PWM signal as input to the CN5 pin, I am not getting any response from the CN ISR. Please take a look at my code & circuitry and let me know if there is anything wrong there.


Code:
void InitICandCN(void)
{            
       TRISB = 0x38;             // Ensure the CN pins to be input
       CNPU1 = 0;                 // Disable all CN pull ups
       CNEN1 = 0x20;            // Enable CN5
       IFS0bits.CNIF = 0;       // Clear interrupt flag
       IEC0bits.CNIE = 1;       // Enable interrupts on CN5
       return;
}
 
void __attribute__((interrupt, no_auto_psv)) _CNInterrupt (void)
{
       IFS0bits.CNIF = 0;           // Clear interrupt flag
       SendData('U');                // Sending data to PC using UART communication
       return;
}


I am using the attached circuitry.

Thanks in advance

NB: My SendData function works properly, I checked it in other ways
 

Attachments

  • Untitled.jpg
    6.7 KB · Views: 212
Have you tried polling the pin to verify that you can read state transitions?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…