void testCapturePwm() { pwmDemarreCapture(0, 0); pwmCompleteCapture(0, 80); pwmDemarreCapture(1, 10000); pwmCompleteCapture(1, 10090); testeEgaliteEntiers("PWMC01a", pwmValeur(0), 80); testeEgaliteEntiers("PWMC01b", pwmValeur(1), 90); pwmDemarreCapture(0, 65526); pwmCompleteCapture(0, 80); pwmDemarreCapture(1, 65516); pwmCompleteCapture(1, 80); testeEgaliteEntiers("PWMC02a", pwmValeur(0), 90); testeEgaliteEntiers("PWMC02b", pwmValeur(1), 100); }
/** * Point d'entrée des interruptions basse priorité. */ void recepteurInterruptions() { unsigned char p1, p3; if (PIR1bits.TMR2IF) {// Débordement du timer 2 (Interruption : drapeau =1) PIR1bits.TMR2IF = 0; // On remet le drapeau à 0 if (pwmEspacement()) { p1 = pwmValeur(0); p3 = pwmValeur(1); CCPR3L = p3; CCPR1L = p1; } else { CCPR3L = 0; CCPR1L = 0; } } if (PIR4bits.CCP4IF) { if (PORTBbits.RB0) { pwmDemarreCapture(1, CCPR4); CCP4CONbits.CCP4M = CAPTURE_FLANC_DESCENDANT; } else { pwmCompleteCapture(1, CCPR4); CCP4CONbits.CCP4M = CAPTURE_FLANC_MONTANT; } PIR4bits.CCP4IF = 0; } if (PIR4bits.CCP5IF) { if (PORTAbits.RA4) { pwmDemarreCapture(0, CCPR5); CCP5CONbits.CCP5M = CAPTURE_FLANC_DESCENDANT; } else { pwmCompleteCapture(0, CCPR5); CCP5CONbits.CCP5M = CAPTURE_FLANC_MONTANT; } PIR4bits.CCP5IF = 0; } }