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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/31/05 12:32
Read: times


 
#103170 - Does this work on anyone's simulator?
Responding to: ???'s previous message
Thanks a lot Jan for directing me in the right direction, I have been to this page
http://www.atmel.com/dyn/resou...oc4345.pdf

"page 77, 3.3.1 Mode 16 bits up/down Auto reload Timer"

and have tried exactly the same technique outlined by manufacturer to use timer2 as 16 bit up/down timer. everything works except it does not generate interrupt even thats what example is supposed to do. I could see the TF2 flag getting set on overflow but interrupt is not generated. I wanted to ask can anyone please use this code on their compiler/simulator and see if it works , there might be something wrong with my simulator (which to be honest is unlikely) but who knows. I am pasting the program below if someone wants to have a try. I am also adding comments where my compiler gave me errors.
#define MSB_reload_value 0x36
#define LSB_reload_value 0x36
$include (reg_c51.inc)


my compliler (Pinnacle52) does not recongnise "#define" and does not open "include" fine, so I have moved reload values in main program and have omitted $include (reg_c51.inc), which I think is for Keil software

ORG 00H
LJMP BEGIN
ORG 002BH
LJMP IT_TIMER2
ORG 0100H

BEGIN:
ANL T2MOD,#0FCH
ORL T2MOD,#01H
CLR EXF2
CLR TCLK
CLR RCLK
CLR EXEN2

MOV TH2,#036H
MOV TL2,#036H
MOV RCAP2H,#036H
MOV RCAP2L,#036H

CLR C_T2
CLR CP_RL2

my compliler does not allow me to clear C_T2, and CP_RL2
using "CLR C_T2/CP_RL2", so I have used "MOV T2CON,#00H" command as all bits are zero for this mode and omitted "CLR C_T2" and "CLR CP_RL2" lines from main program


MOV T2CON,#00H
SETB EA
SETB ET2
SETB TR2
JMP $

IT_TIMER2:

CLR TF2
CPL P1.2
RETI

END


could you please point out, why program is not going into interrupt routine on overflow?

I hope this post does not creat any confusion and is easy to understand, if not, please let us know and I will try again,

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