From 6d6f9a112f646b03a973b63f57df5b4c366b49b6 Mon Sep 17 00:00:00 2001 From: Cedric Date: Wed, 22 Mar 2023 14:36:53 +0100 Subject: [PATCH] Interrupt Begin --- ProjetsKEIL/Projet_1/Driver_interruptions.h | 0 ProjetsKEIL/Projet_1/Src/Principal.c | 13 +++++++++++ ProjetsKEIL/Projet_1/TP.uvoptx | 26 ++++++--------------- ProjetsKEIL/Projet_1/TP.uvprojx | 12 +--------- 4 files changed, 21 insertions(+), 30 deletions(-) create mode 100644 ProjetsKEIL/Projet_1/Driver_interruptions.h diff --git a/ProjetsKEIL/Projet_1/Driver_interruptions.h b/ProjetsKEIL/Projet_1/Driver_interruptions.h new file mode 100644 index 0000000..e69de29 diff --git a/ProjetsKEIL/Projet_1/Src/Principal.c b/ProjetsKEIL/Projet_1/Src/Principal.c index 2caf31d..c7aae95 100644 --- a/ProjetsKEIL/Projet_1/Src/Principal.c +++ b/ProjetsKEIL/Projet_1/Src/Principal.c @@ -38,7 +38,14 @@ int main ( void ) Timer_500ms.PSC = 7200; //(1/72Mhz)/7200=0.1ms Timer_500ms.ARR = 5000; //0.1*5000 = 500ms timer_init(&Timer_500ms); + + + TIM2->DIER|=1<<0; //Interruption périph + NVIC->ISER[0] |= 1>>TIM2_IRQn; //Interruption Coeur + NVIC->IP[TIM2_IRQn] = 2 <<4; + MyTimer_Start(&Timer_500ms); + while(1) @@ -61,3 +68,9 @@ int main ( void ) } + + + void TIM2_IRQHandler (void){ + MyGPIO_Toggle(GPIOA, 5); + TIM2->SR &= ~(1<<0); + } diff --git a/ProjetsKEIL/Projet_1/TP.uvoptx b/ProjetsKEIL/Projet_1/TP.uvoptx index db28d83..4f8d21b 100644 --- a/ProjetsKEIL/Projet_1/TP.uvoptx +++ b/ProjetsKEIL/Projet_1/TP.uvoptx @@ -75,7 +75,7 @@ 1 0 - 0 + 1 18 @@ -125,7 +125,7 @@ 0 DLGDARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=-1,-1,-1,-1,0)(121=-1,-1,-1,-1,0)(122=-1,-1,-1,-1,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=942,144,1363,571,0)(121=-1,-1,-1,-1,0)(122=-1,-1,-1,-1,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) 0 @@ -145,7 +145,7 @@ 0 1 - 1 + 0 0 0 0 @@ -159,7 +159,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -245,7 +245,7 @@ 1 0 - 1 + 0 18 @@ -290,7 +290,7 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=703,344,1124,749,0)(121=931,445,1352,850,0)(122=409,446,830,851,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=963,134,1557,828,1)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=703,344,1124,749,0)(121=931,445,1352,850,0)(122=409,446,830,851,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=963,134,1557,828,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) 0 @@ -406,7 +406,7 @@ 2 2 1 - 0 + 1 0 0 ..\Drivers\Driver_GPIO.c @@ -426,18 +426,6 @@ 0 0 - - 2 - 4 - 1 - 0 - 0 - 0 - .\Driver_interruptions.c - Driver_interruptions.c - 0 - 0 - diff --git a/ProjetsKEIL/Projet_1/TP.uvprojx b/ProjetsKEIL/Projet_1/TP.uvprojx index 735189b..2462298 100644 --- a/ProjetsKEIL/Projet_1/TP.uvprojx +++ b/ProjetsKEIL/Projet_1/TP.uvprojx @@ -339,7 +339,7 @@ - .\Include + .\Include;..\Drivers @@ -403,11 +403,6 @@ 1 ..\Drivers\Driver_timers.c - - Driver_interruptions.c - 1 - .\Driver_interruptions.c - @@ -815,11 +810,6 @@ 1 ..\Drivers\Driver_timers.c - - Driver_interruptions.c - 1 - .\Driver_interruptions.c -