22 lines
413 B
C
22 lines
413 B
C
|
#include <detpic32.h>
|
||
|
|
||
|
int main() {
|
||
|
T3CONbits.TCKPS = 2;
|
||
|
PR3 = 49999;
|
||
|
TMR3 = 0;
|
||
|
T3CONbits.TON = 1;
|
||
|
|
||
|
// tON = 0.25 * (1 / 100) = 2.5ms
|
||
|
// fOutPreScaler = 20MHz / 4 = 5MHz
|
||
|
// tOutPreScaler = 1 / 5MHz = 200ns
|
||
|
// OC1RS = (2.5 * 10^-3) / (200 * 10^-9) = 12500
|
||
|
OC1CONbits.OCM = 6;
|
||
|
OC1CONbits.OCTSEL = 1;
|
||
|
OC1RS = 12500;
|
||
|
OC1CONbits.ON = 1;
|
||
|
|
||
|
while (1);
|
||
|
|
||
|
return 0;
|
||
|
}
|