What I'm looking for is a simple free running PWM that I can change the frequency of as quickly as possible.
- Code: Select all
// Initialize PWM output
TMR4 = 0x6D; // Set for 1600 Hz
TRISC |= 0x02; // Disable CCP output
CCPTMRS0bits.C1TSEL = 1; // Use timer 4
PR4 = 0x6D; // Period Register
CCP4CON = 0x0C;
CCPR4L = 0x36; // Compare register
T4CON = 0x24; // /1 prescaler /5 postscaler TMR on
TRISC &= ~0x02; // Enable CCP output
Can anyone tell me what I'm doing wrong?
The output at pin 35 is low and never moves.