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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/07/04 07:11
Read: times


 
#62058 - RE: PWM assembly code for 5 PWM signals
Responding to: ???'s previous message
Well, first, why limit yourself to the classic 8051, given e.g. variants with 6 PCA channels that can easily be set to do PWM? Or, is this a homework assignment? Regardless, you'll find the "gimme code" schtick to have gotten kinda old hereabouts...

Anyhow, the basic software approach is to first determine the atom of granularity of your interval timing, e.g. 1 ms, 10 ms, whatever. Set your hardware timer to auto-rollover at this rate. From its rollover, maintain 5 sets of software timers, one for each channel. A set would have a timer for the period, one for the "on" duration (or one each for the high & low parts of the cycle), and perhaps a third timer if you need some kind of phase alignment between the channels and/or something else.

You can do all this at the base level, via polling for rollover. If, however, your requirements are small with respect to your base level processing load, do it in the timer ISR instead.

Now, was that so hard?

David


List of 24 messages in thread
TopicAuthorDate
PWM assembly code for 5 PWM signals            01/01/70 00:00      
   RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
      RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
   RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
      RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
   What was wrong with the answer on Keil?            01/01/70 00:00      
      RE: What was wrong with the answer on Keil?            01/01/70 00:00      
         RE: What was wrong with the answer on Keil?            01/01/70 00:00      
         RE: What was wrong with the answer on Keil?            01/01/70 00:00      
   RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
   RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
      RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
         RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
            RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
               RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
                  RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
                     RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
                     RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
   RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
      RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
         RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
            RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
               RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      
                  RE: PWM assembly code for 5 PWM signals            01/01/70 00:00      

Back to Subject List