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

Back to Subject List

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


 
Msg Score: +1
 +1 Good Answer/Helpful
#176387 - Thanks for that typo, More for 8KHz with 50% duty cycle
Responding to: ???'s previous message
Thanks for that typo pointed out.

Calculations for 8KHz T0 ISR tick:
11059200 / 12 cycles = 921600
921600 / 8000 = 115.2 round to 115
65536 - 115 = 65421 or 0xFF8D
reload values
TL0 = 0x8D;
TH0 = 0xFF;

Try the above reload values and the Timer T0 ISR will tick aprox at about 8KHz.
Achived 921600 / 115 = 8013,91 Hz

If the required signal on the specified pin has to be at 8KHz
with duty cycle 50% then the frequency required should be twice, at 16KHz:

11059200 / 12 cycles = 921600
921600 / 16000 = 57.6 round to 58
65536 - 58 = 65478 or 0xFFC6
reload values
TL0 = 0xC6;
TH0 = 0xFF;

By these reload values the T0 ISR will tick aprox at 16KHz,
that is twice the required frequency and if you change the state
of the MCU pin at this rate then you have a signal with 50% duty cycle
at 8KHz.
Achived 921600 / 58 = 15889.66 Hz

K.L.Angelis


List of 16 messages in thread
TopicAuthorDate
80C52 Timer0            01/01/70 00:00      
   where is the EA initialize?            01/01/70 00:00      
      EA initialize            01/01/70 00:00      
         no reason in what you show            01/01/70 00:00      
            TL0 and TH0            01/01/70 00:00      
               Calculations for Timer T0 at 8KHz: have you tried 0xFF8D ???            01/01/70 00:00      
                  correction            01/01/70 00:00      
                     Yeah - 0x8D            01/01/70 00:00      
                        Thanks for that typo, More for 8KHz with 50% duty cycle            01/01/70 00:00      
                           Put the compiler to work...            01/01/70 00:00      
                              fine, but            01/01/70 00:00      
                              T0 overflows at 65535+1, don't overlook this            01/01/70 00:00      
                                 right answer, wrong premise            01/01/70 00:00      
                                    Exact calculations require semantics            01/01/70 00:00      
                                       you are welcome to find out            01/01/70 00:00      
                                 Thanks for the correction...            01/01/70 00:00      

Back to Subject List