No, all interrupts should be handled in sequence. How you set which one you check first is up to you. In my code, I do something like:
if IO Interrupt flag set then
...do IO interrupt code
clear IO interrupt flag
endif
if Timer interrupt flag set then
...do timer code
clear Timer interrupt flag
endif
if PIR1.RXIF = 1 then
...do UART code
end if
exit interrupt routine.
You can also do it by just having multiple "IF" statements at the start of the interrupt routine, and jump to the first one you detect, but I find my method easier, as I check all interrupt flags every time through the interrupt routine. The extra "IF" statements, if nothing is set, adds very little time to the overall interrupt routine.
With a method with multiple IFs at the start of the interrupt routine, one has to eventually branch back to the start to check other flags before exiting, to see if anything else has to be processed.
My method is a straight linear processing method, and the order in which you put the code determines the "priority" in which you process the interrupts (do not confuse with high/low priority interrupt settings). Each of those interrupt routines should be as short as possible. Process the interrupt, set flags or indicators, then exit that routine.
if IO Interrupt flag set then
...do IO interrupt code
clear IO interrupt flag
endif
if Timer interrupt flag set then
...do timer code
clear Timer interrupt flag
endif
if PIR1.RXIF = 1 then
...do UART code
end if
exit interrupt routine.
You can also do it by just having multiple "IF" statements at the start of the interrupt routine, and jump to the first one you detect, but I find my method easier, as I check all interrupt flags every time through the interrupt routine. The extra "IF" statements, if nothing is set, adds very little time to the overall interrupt routine.
With a method with multiple IFs at the start of the interrupt routine, one has to eventually branch back to the start to check other flags before exiting, to see if anything else has to be processed.
My method is a straight linear processing method, and the order in which you put the code determines the "priority" in which you process the interrupts (do not confuse with high/low priority interrupt settings). Each of those interrupt routines should be as short as possible. Process the interrupt, set flags or indicators, then exit that routine.