Subversion Repositories Code-Repo

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 201

/PIC Stuff/Cerebot_32MX7_LED_Cube/PWM2.c
0,0 → 1,23
#include <xc.h>
#include <plib.h>
#include "defines.h"
#include "PWM2.h"
 
void PWM2_Init(void) {
OC2CON = 0x0000;
OC2R = 0x0001; // PWM initial duty cycle
OC2RS = 0x0001; // PWM duty cycle
OC2CON = 0x0006; // PWM off, 16-bit, timer 2, fault pin disabled
 
IFS0CLR = 0x00000100; // Disable Timer 2 interrupt
T2CONSET = 0x8000; // Turn on Timer 2
PR2 = 0x0003; // PWM period ~ 16-20Mhz
}
 
void PWM2_Start(void) {
OC2CONSET = 0x8000;
}
 
void PWM2_Stop(void) {
OC2CONCLR = 0x8000;
}