Lucian Copat wrote: > My question regards the E-CAN module in PIC18F4680. I have a routine > which loads a message (100 bytes max) into a temporary sending buffer. You know that a single CAN message can only have 8 bytes payload, right? > I would like that after loading this buffer, when I activate the TX > interrupts, the ISR to be called if there are some free buffers. E-CAN > module does generate an interrupt only when a buffer _becomes_ empty, > which means I should load it first. If I load it first and also in ISR, > I would have reentrant code. Is there any method to pass this problem ? You would typically disable the TX interrupt in the ISR when it sees that there are no more bytes. Then, after initiating the next tx sequence, you reenable it. This way, there's no problem with reentrance. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist