Microchip PIC 18f8722 USART2 Interrupt Problem


Hi,
Microchip PIC 18f8722 USART2 Interrupt is not working - I have USART1
working fine with interrupts but cannot get interrupt on usart2 - the
RC2IF interrupt flag never gets set although data is coming into the
rcreg2 register and i can read from it.
Is there any special considerations I need to take into account?
Global INT flag is enabled as well as all INTs on High priority. Code
is exactly the same as that of usart1 but usart2 INT flag never gets
set?!
Any help greatly appreciated!
Thanks,
GI.
Reply to
gary.ireland
Loading thread data ...
How do you know that the interrupt flag is not being set? Generally speaking, on PICs the interrupt flags are set regardless of whether the interrupt is enabled. IOW, RC2IF should get set when data arrives because there is nothing that you can configure to prevent it from happening. Do you have the RC2IE flag set? You have to have the peripheral interrupts enabled as well, but you must have or the other USART wouldn't be working. How about the priority level assignment in IPR3?
IMO, the PIC is not seeing any data or you don't actually have the interrupt enabled. Generally speaking again, PICs will refuse to receive data on a USART if there is an error flag set such as "receive overrun" or "framing error". Either that or your problem lies in PIR3, PIE3, or IPR3.
Reply to
Anthony Fremont

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.