> = > A nice way to solve this (and if the I/O pins do not have to > e switched fast, such as e.g. indicator LEDs), is to only > BSF/BCF the "shadow" bits in the main code, and only copy > to the port in the ISR. That way you can manipulate the > indicator-LED bits wherever there is a need, and have a > safe update of the PORTx register in a single place in the > ISR. > = > Jan-Erik. > = > = Yes, and to make things even easier in the code and not need to bother abou= t = atomic operations there could be several shadow registers which each holds = just = a group of bits or even single bits (flags) where each shadow register is = manipulated by different parts of the code, both isr and non isr code. The = (timer-) isr then combines all shadow registers to one single byte and writ= es = them all at once to the port. /Ruben =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D Ruben J=F6nsson AB Liros Electronic Box 9124, 200 39 Malm=F6, Sweden TEL INT +46 40142078 FAX INT +46 40947388 ruben@pp.sbbs.se =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist