Files
CITISE1/IUT/Info2/TP/Chap2/chapitre5/CHAP5/Sources/interruption_timer.c
2026-04-08 20:11:20 +02:00

29 lines
632 B
C

#include "derivative.h"
#include "defines.h"
#include "tempo.h"
void interrupt 7 depassement_compteur(void)
{
if (SW1) {
if (PTBD == 0xFF && retard_cycle_droite == 0) {
retard_cycle_droite = 1;
} else if (retard_cycle_droite == 1 || PTBD == 0) {
retard_cycle_droite = 0;
PTBD = 1;
} else {
PTBD |= (PTBD << 1); // Allumage
}
} else if (SW2) {
if (PTBD == 0xFF && retard_cycle_gauche == 0) {
retard_cycle_gauche = 1;
} else if (retard_cycle_gauche == 1 || PTBD == 0) {
retard_cycle_gauche = 0;
PTBD = 0x80;
} else {
PTBD |= (PTBD >> 1); // Allumage
}
}
TPMSC = TPMSC & 0b01111111;
}