Guys, What should I do if T0IF =3D 0 ? nop ? counting btfss INTCON,T0IF ;is timer0 interrupt flag true ? * nop** * bcf INTCON,T0IF ;if T0IF=3Dfalse=20 clear timer0 interrupt flag decf LedTimer,1 ;if T0IF=3Dtrue reduce=20 the counter ;check if LedTimer =3D 0 ? btfsc STATUS, Z ;Z bit is set to 1=20 if W was 00 - skip next instruction if not 00 ;LedTimer=3D0 goto next_state ;from btfsc if it's 1,=20 go to next state ;LedTimer!=3D0 goto counting ;from btfsc if it's 0=20 keep counting interrupt next_state incf LedState,1 ; if 00 increase=20 the state, for the next state return On 4/07/2013 7:36 AM, IVP wrote: >> yes that's right I need the flag from my timer.asm, how can do that ? > Many of my programs will use a register called 'flags', and I'll define > each bit as an indicator that something needs attending to, eg > > #define motor_stalled flags,0 > #define reverse flags,1 > > Just check with btfss etc and gotos for action, eg > > btfsc motor_stalled ;skip if motor running OK > goto power_off ;else cut power > > Joe > > PS, please trim your posts by quoting only what you need to --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .