It's depending on which flag the uC jumps to the interrupt vector. To leave the interrupt vector, you MUST clear the flag! ;Clear Timer interrupt flags ld A,TBSR ;ld A,TBIC1LR ;clear ICF1 flag ld A,TBOC1LR ;clear OCF1 flag ld A,TBCLR ;clear TOF flag ld A,TBIC2LR ;clear ICF2 flag ld A,TBOC2LR ;clear OCF2 flag iret ;back to main program
It is well working. The C code used is this: PCDDR=0x02; PCOR=0x02; TBCC1=1; TBOLVL1=0; TBOLVL2=1; TBTOIE=1; TBOC1E=1; TBOC2HR=0x02;//period 1.3KHz TBOC2LR=0xe2; TBOC1HR=0x01;//duty cycle 50% TBOC1LR=0x71; TBPWM=1; You see the interrupt in timer_b on flag TBICF1 I hope it is helpful for you