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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/02/03 14:09
Read: times


 
#53888 - RE: PCA/PWM: Raghunathan
Responding to: ???'s previous message
If you need exact duty cycles this will not work. Example: 13kHz == 769.2 x 100nsec you choose 769

256/13=19.7 --> 769/19.7=39.05 you choose 39 / 730

High Speed mode:

in interrupt pseudo code:

if(P1_3) {
CCAP0 += 730; // direct addition will not work!
wNextCCAP0=CCAP0+39;
} else {
CCAP0 += 39; // you may have a time problem here
}

this will produce your desired 13/243 duty cycle on Port 1.3

you can enhance the timing like this:

if(P1_3) {
CCAP0 += 730; // direct addition will not work!
wNextCCAP0=CCAP0+39;
} else {
CCAP0=wNextCCAP0;
}

you may still have a timing problem here, since interrupt routine needs a couple of usecs

Werner

List of 13 messages in thread
TopicAuthorDate
PCA/PWM: only fixed freqs?            01/01/70 00:00      
   RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      
      RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      
   RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      
      RE: PCA/PWM: Raghunathan            01/01/70 00:00      
         RE: PCA/PWM: Raghunathan            01/01/70 00:00      
            RE: PCA/PWM: Raghunathan            01/01/70 00:00      
   RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      
   RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      
      RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      
         RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      
            RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      
               RE: PCA/PWM: only fixed freqs?            01/01/70 00:00      

Back to Subject List