Rev 231 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#include "defines.h"#include "PWM2.h"void PWM2_Init(void) {OC2CON = 0x0000;OC2R = 0x0001; // PWM initial duty cycleOC2RS = 0x0001; // PWM duty cycleOC2CON = 0x0006; // PWM off, 16-bit, timer 2, fault pin disabledIFS0CLR = 0x00000100; // Disable Timer 2 interruptT2CONSET = 0x8000; // Turn on Timer 2PR2 = 0x0003; // PWM period ~ 16-20Mhz}void PWM2_Start(void) {OC2CONSET = 0x8000;}void PWM2_Stop(void) {OC2CONCLR = 0x8000;}