> I am using a PIC18 and a MCP2510 in order to communicate with other > systems through the CAN bus. > > When the MCP2510 receives a message, the PIC gets the CAN message from > the MPC2510, processes it and sends back the answer. The PIC does all > that in the interrupt service routine. This could take a while and the > PIC also have to serve other interrupts (like send and receive > characters via usart). > > So I am undecided between prioritized interrupts, or single interrupt > priority using a flag to do the CAN communication outside the ISR. The right tradeoff depends a lot on system particulars, so there is no one right answer for all cases. However, in general, I try to have my interrupt handler do the immediate handling of the interrupt condition, then leave state lying around so that as much of the related processing as possible can be done by the foreground event handler. Almost all of my projects have a priority event handler loop at the foreground code. See the QQQ_MAIN.ASPIC module, or the HAL and HOS probjects at http://www.embedinc.com/pic as examples. Also beware of errata related to asynchronous high priority interrupts when both priorities are enabled on some 18 family parts. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.