> -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf > Of solarwind > Sent: 31 March 2009 20:56 > To: Microcontroller discussion list - Public. > Subject: [PIC] Overloading interrupts... > > What happens when interrupts are received faster than the time > required for the ISR to complete? > > For example, let's say I'm interrupting on UART receive, every time I > receive a byte, so I can process it. However, the ISR may take a > considerable amount of time to complete (hypothetical situation). > Since there may be a possibility of receiving data really fast, the > interrupt will be "hit" multiple times before the ISR has time to > complete. What happens in this case? Does the ISR reset and go back to > the beginning? Or does nothing happen until the ISR has completed? Other have explained what would happen, but something to be aware of in the case of the UART is that you will start losing data once the hardware FIFO buffer is full. The bottom line is that ISR's should in most cases be designed to run as quickly as possible. In the case of a comms interrupt you would normally just take the data out of the UART register and add it to a circular buffer. Your main program loop can than take data out of the buffer when it needs to. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist