Lucian Copat wrote: > void CANSendMessage() { > > //fill the 100-byte buffer > > while (CANPut()); > } > > In the ISR I have: > > if (can TX interrupt) { > while (CANPut()); > } > > Until here am I correct ? Basically, yes. I think such a "while (CANPut())" is not really good (in an ISR and in general)... it should work in both cases the first time. If it doesn't, there is an error that needs to be handled. > The compiler will give: CANPut() is called from different.... - > reentrant code. How to solve this depends on the compiler you're using. You didn't say which one you're using. RTFM (topics "interrupts", "reentrancy") -- this is a common problem, and probably the manual says how to deal with it -- and then come back if necessary, stating which compiler you're using. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist