This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Converting 10kHz PWM into 2kHz PWM codes

Hi

Here is my pseduo-code:

// In my CAPCOM1 initalisation

CC1_T0REL=0xF830; // Generate 10kHz PWM

// Produce 50% duty cycle
Offset=(0xFFFF-CC1_T0REL)>>1;

// This will produce 50% duty cycle of 10kHz  PWM

CC1_CC2=CC1_T0REL+Offset;


Note: I use 100uS for Timer 0 Interrupt

Now I need to convert 10kHz PWM into 2kHz PWM but I am totally lost at the moment. However I tried to divide it by 5 but it doesn't work at all. I would be very very grateful to hear your suggestion or tip.

Kind regards

AJ

0