On 21 Apr 2012 at 9:31, Goran Hosinsky wrote: > Can do a GOTO from an interrupt and continue in another part of the main= =20 > program - or will the return > from interrupt mix up the program? >=20 > I spend most of the time in __delay_ms with delays of 30 seconds. In=20 > case of an UART interrupt I need to > get out of the delay routine, do some housekeeping (closing ports) and=20 > go elsewhere in main where I will > handle the rs232 data. Hi Goran. No problem with the interrupt interrupting the delay routine... i= nterrupts=20 are made for interrupting, so that part is ok. But yes you will have major = problems if=20 you try to use a GOTO to get back to some other part of the main program fr= om the=20 interrupt routine. One method would be to get the Interrupt routine to set a flag when RS232 d= ata has=20 been received. In some of my applications the interrupt routine also does s= ome=20 basic parsing/filtering of the data, taking care not to spend too much time= in the=20 interrupt routine so it can be rady to respond to the next received charact= er, and=20 then the flag is only set when valid data has been received. You mentioned = in=20 another post that your 30 second delay is a loop of smaller delays. Somewhe= re=20 within the delay loop you could check for the received data flag, perhaps e= xiting the=20 delay altogether to process the data and do whatever else needs to be done. --=20 Brent Brown, Electronic Design Solutions 9 Titoki Place, Pukete, Hamilton 3200, New Zealand Ph: +64 7 849 0069 Fax: +64 7 849 0071 Cell: +64 27 433 4069 eMail: brent.brown@clear.net.nz --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .