Morgan, Check the data sheets. If I recall correctly, the current operation is completed prior to the interrupt routine being invoked. But, if you are worried about such things, just disable the global interrupt enable, use BSF to set the individual interrupt bit you want, enable the proper interrupt enable bit, and then re-enable the global interrupt enable bit. Fr. Tom McGahee ----- Original Message ----- From: Morgan Olsson To: Sent: Tuesday, October 19, 1999 8:01 AM Subject: Software interrupt How is software interrupt best generated on a PIC? Most reliable seem to make a pheripheral generate an interrupt i.e by loading a timer so it will wrap immediately/very soon, or manipulate the RB0/INT pin so that generates an i nterrupt. But I need the timers for other tasks, and manipulating RB0/INT violates the int errupt on change functions. An idea might be to directly set a pending flag (and of course the enable bit) f or an else unused interrupt source. The manuals tell some of them are read/write :) My worry about that is that the BSF command is a read-modify-write opeartion, an d what will happen if an interrupt flag get set by hardware between the read and write of the BSF. Probably that interrupt flag will be overwrittten with the previous state! Are there more reliable solutions? Some experience? Regards /Morgan Morgans Reglerteknik, Hdllekes, 277 35 KIVIK, SWEDEN tel +46(0)414-446620, fax -70331, mrt@iname.com