Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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
    Untitled.jpg
    6.7 KB · Views: 211
Are other interrupts working? Do you have Global Interrupt enabled?
 
Have you tried polling the pin to verify that you can read state transitions?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top