Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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



List of 27 messages in thread
TopicAuthorDate
Timer 2 in AT89S8252            01/01/70 00:00      
   most often, a '51 datasheet does not            01/01/70 00:00      
      continuing the above            01/01/70 00:00      
   Timer 2 for PWM...            01/01/70 00:00      
      one caution            01/01/70 00:00      
   PWM example code:            01/01/70 00:00      
   Time 2 problem            01/01/70 00:00      
      you are missing this one            01/01/70 00:00      
         I think I have covered that            01/01/70 00:00      
            RCAP2            01/01/70 00:00      
               Program with changes but still problem            01/01/70 00:00      
                  RCAP2 wrong            01/01/70 00:00      
                     Still no good            01/01/70 00:00      
                        So where do you expect the interrupt to            01/01/70 00:00      
                           why enable UART interrupt??            01/01/70 00:00      
                              sorry, early morning here            01/01/70 00:00      
                                 Is it still too early?            01/01/70 00:00      
                                    no and, please read the datasheet            01/01/70 00:00      
            I highlighted "must be cleared by            01/01/70 00:00      
   Has anyone used it ?            01/01/70 00:00      
      the biggest sin            01/01/70 00:00      
         Are you sure?            01/01/70 00:00      
            Jan is right            01/01/70 00:00      
               so am I            01/01/70 00:00      
            No, of course the datsheets are just nov            01/01/70 00:00      
            the third sin            01/01/70 00:00      
               Does this work on anyone's simulator?            01/01/70 00:00      

Back to Subject List