tarun0xe
Member level 2
- Joined
- Jul 25, 2011
- Messages
- 47
- Helped
- 8
- Reputation
- 16
- Reaction score
- 8
- Trophy points
- 1,298
- Location
- India
- Activity points
- 1,812
hello friends. in my assembly program the microcontroller has to do two tasks. it should keep complementing P2.0 and when timer0 interrupt is generated(at delay of approx. 71msec),it should complement P1.3 and then jump back to main program and start complementing P2.0 again. in this way it should generate a square wave of T=142msecs at P1.3 and another square wave of T=2.17microsecs at P2.0.
now the problem is it works correctly with interrupt alone, i.e if I remove the function of complementing P2.0 and replace by an indefinite stay like
here: SJMP here it works fine but soon I put there that complementing function or any other(like sending some data to P2) It only serves that function and doesn't generate square wave at P1.3. code is given below
ORG 0000H
LJMP MAIN
;-------------------------------ISR FOR TIMER0----------------------------------------
ORG 000BH
CPL P1.3; complement P1.3 to generate square wave of T=142ms(approx)
RETI
MAIN: MOV TMOD,#01H
MOV TH0,#00H
MOV TL0,#00H
MOV IE,#82H
SETB TR0
;back:CPL P2.0
stay:SJMP stay
END
i.e it is working fine currently but soon I make it jump to 'back' to serve complementing function of P2.0 too, it only does that and not generate square wave at P1.3 further. I couldn't find any error in code.any help is highly appreciated. thanks in advance
now the problem is it works correctly with interrupt alone, i.e if I remove the function of complementing P2.0 and replace by an indefinite stay like
here: SJMP here it works fine but soon I put there that complementing function or any other(like sending some data to P2) It only serves that function and doesn't generate square wave at P1.3. code is given below
ORG 0000H
LJMP MAIN
;-------------------------------ISR FOR TIMER0----------------------------------------
ORG 000BH
CPL P1.3; complement P1.3 to generate square wave of T=142ms(approx)
RETI
MAIN: MOV TMOD,#01H
MOV TH0,#00H
MOV TL0,#00H
MOV IE,#82H
SETB TR0
;back:CPL P2.0
stay:SJMP stay
END
i.e it is working fine currently but soon I make it jump to 'back' to serve complementing function of P2.0 too, it only does that and not generate square wave at P1.3 further. I couldn't find any error in code.any help is highly appreciated. thanks in advance
Last edited: