better fitness

master
Yorick van Pelt 2019-01-09 00:47:30 +01:00
Parent 907625bffb
révision 61e0390ad2
Signé par: yorick
ID de la clé GPG: D8D3CC6D951384DE
1 fichiers modifiés avec 14 ajouts et 12 suppressions

Voir le fichier

@ -21,33 +21,34 @@ __code uint16_t __at (_CONFIG1) __configword = _FOSC_INTOSC & _CLKOUTEN_OFF & _W
// Uncalibrated delay, just waits a number of for-loop iterations
void delay(uint16_t iterations)
{
uint16_t i;
uint16_t i, j;
for (i = 0; i < iterations; i++) {
// Prevent this loop from being optimized away.
for (j = 0; j < 1000; j++) {
__asm nop __endasm;
}
}
}
#define PPSO_PWM1 3
void main(void)
{
//OSCCON = 0xf0;
OSCCON = 0xf0;
TRISC = 0;
//SLRCONC = 0;
LED_PORT = 0;
PWM1CLKCON = 0x00; // From Fosc w/o prescaler
PWM1PRH = PWM1PRL = 0xFF;
PWM1PH = 0;
PWM1DCH = 0xFF;
PWM1DCH = 0x80;
PWM1DCL = 0;
PWM1OF = 0;
PWMLD = 0x07;
PWM1INTE = 0x00; // no interrupts enabled
PWM1INTF = 0x00; // clear interrupt flag
PWM1LDCON = 0x80; // load armed
PWM1OFCON = 0x00; // independent run mode
PWM1CON = 0x40; // enable, standard PWM mode, active high output
PWMEN = 0x07;
PWM1CON = 0x80; // enable, standard PWM mode, active high output
RC5PPS = PPSO_PWM1;
//PWM1OUT = 1;
@ -56,12 +57,13 @@ void main(void)
while (1) {
//LED_PORT = 1; // LED On
PWM1DCH = 1;
PWM1LDCON = 0x80; // load armed
delay(300000);
PWM1DCH = 0x80;
PWMLD = 1;
delay(300);
//LED_PORT = 0; // LED Off
PWM1DCH = 0xff;
PWM1LDCON = 0x80; // load armed
delay(300000);
//PWM1DCH = 0xff;
PWM1DCH = 0x10;
PWMLD = 1;
delay(300);
}
}