??? 10/27/05 08:33 Read: times |
#103014 - Program with changes but still problem Responding to: ???'s previous message |
Dennis Welbourn said:
I don't see in your initialization that you loaded the desired value into RCAP2L/H, which is where the timer gets its reload value. I agree, I have made the changes in the code below, but it still does not work, Also, while you set TF2 so you would cause the first interrupt, you aren't resetting TF2 in your ISR (as was stated above by Oleg) so as soon as you leave the ISR, it's called again. Dennis I have also cleared TF2 in the ISR now, but for some reason it still isn't working, could please someone point out that I have initialised the timer 2 and timer2 interrupt correctly. its not a huge program and i can't see the reason that why is interrupt not being called on setting TF2.please have a look on code below, ORG 00H LJMP MAIN ORG 002BH LJMP T2ISR MAIN: MOV P1,#0FFH MOV T2MOD,#02H ;timer 2 initialisation MOV T2CON,#04H MOV IE,#0A0H ;interrupt enable MOV RCAP2L,#-1000 MOV RCAP2H,#-1000 ;auto reload values SETB TF2 ;forcing timer2 interrupt (which SJMP $ is not working) T2ISR: CLR TR2 ;timer2 stoped and flag cleared CLR TF2 CPL P1.5 SETB TR2 ;timer2 started again RETI END regards Kaz |