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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/26/05 04:39
Read: times


 
#102951 - Timer 2 for PWM...
Responding to: ???'s previous message
U Kaz said:
Forum members
I am trying to use timer 2 of AT89S8252 to generate PWM, I have read the data sheet but could not get enough information, I was wondering if you guys can help,

AT89S8252s timer 2 is same as AT89C52s. This means that it can not support hardware PWM. You can generate software PWM, but you will be unable to generate high frequency PWM by software.
U Kaz said:

what is Timer 2 Interrupt vector address?

For External interrupt 0 the vector address is 0003H
So just go on adding 08 to get the next vector location
For Timer 0 interrupt the vector address is 000BH
For External interrupt 1 the vector address is 0013H
For Tomer 1 interrupt the vector address is 001BH
For Serial interrupt the vector address is 0023H
For Timer 2 interrupt the vector address is 002BH
U Kaz said:

If I want to specify Timer2 as in "auto-reload timer" mode, can I do it simply with this command

MOV T2CON,#00H

and then I can start/stop timer by controlling TR2.

Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. The type of operation is selected by bit C/T2 in the SFR T2CON. Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by bits in T2CON.
Timer 2 in timer mode is auto reload only unlike T0 and T1. RCAP2H and RCAP2L are the resistors which hold the auto reload values of timer 2. So if you want to change the count, you have to modify these resistor contents and they will be auto reloaded in timer mode after each roll over.

U Kaz said:

how much role TMOD register has to play in initialising Time 2.


None. It is for T0 and T1.




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