From f8a510b4dbc51ca027fe74937a22fde78258717e Mon Sep 17 00:00:00 2001 From: Raph Date: Fri, 14 Apr 2023 18:12:13 +0200 Subject: [PATCH] pwm --- soft/PjtKEIL_StepSon/Src/GestionSon.s | 3 ++ soft/PjtKEIL_StepSon/Src/principal.c | 9 ++-- soft/PjtKEIL_StepSon/StepSon.uvoptx | 60 ++++++++++++++++++++++----- soft/PjtKEIL_StepSon/StepSon.uvprojx | 30 ++++++++++++++ 4 files changed, 89 insertions(+), 13 deletions(-) diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index 13ab48b..5e2087a 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -6,6 +6,7 @@ export SortieSon import LongueurSon import Son + import PWM_Set_Value_TIM3_Ch3 ; ====================== zone de réservation de données, ====================================== ;Section RAM (read only) : @@ -58,6 +59,8 @@ alors ; mise à jour de SortieSon strh r0,[r3] ;ldr r3,[r0] + ; mettre à jour la PWM + bl PWM_Set_Value_TIM3_Ch3 ;on appelle la fonction avec r0 en paramètre add r7,#1 ;index=index+1 str r7,[r2] ; *R2 = R7 diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index 41da6a4..75ab9e0 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -1,12 +1,13 @@ - #include "DriverJeuLaser.h" + //extern u32 * PeriodeSonMicroSec; extern void CallbackSon(void); int main(void) + { // =========================================================================== @@ -15,8 +16,10 @@ int main(void) // Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers CLOCK_Configure(); - -Timer_1234_Init_ff( TIM4, 1000000/11025); //Calcul de la periode de 91 microsec +GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); +PWM_Init_ff( TIM3, 3, 720); +PWM_Set_Value_TIM3_Ch3(360); +Timer_1234_Init_ff( TIM4, 91*72); //Calcul de la periode de 91 microsec *72 Mhz Active_IT_Debordement_Timer( TIM4, 2, CallbackSon ); diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index 5128606..e071cc9 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -157,9 +157,9 @@ 0 0 - 47 + 63 1 -
134219980
+
134220492
0 0 0 @@ -168,14 +168,30 @@ 1 .\Src\GestionSon.s - \\StepSon\Src/GestionSon.s\47 + \\StepSon\Src/GestionSon.s\63 +
+ + 1 + 0 + 32 + 1 +
134220448
+ 0 + 0 + 0 + 0 + 0 + 1 + .\Src\GestionSon.s + + \\StepSon\Src/GestionSon.s\32
1 266 - R5 + R3 0 @@ -224,13 +240,13 @@ 0 - ((portb & 0x00000002) >> 1 & 0x2) >> 1 - FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F130000000000000000000000000000000000000096020008 + `SortieSon + 008000000000000000000000000000000070864000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F150000000000000000000000000000000000000094080008 1 - `SortieSon - 0080000000000000000000000000E0FFFFFFEF4100000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F130000000000000000000000000000000000000094080008 + ((portb & 0x00000001) & 0x1) >> 0 + 00008000000000000000000000000000E0FFEF400100000000000000000000000000000028706F72746220262030783030303030303031290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F150000000000000000000000000000000000000092080008 @@ -694,6 +710,30 @@ 0 0 + + 3 + 4 + 5 + 0 + 0 + 0 + .\Driver\DriverJeuLaser.h + DriverJeuLaser.h + 0 + 0 + + + 3 + 5 + 5 + 0 + 0 + 0 + .\Driver\DriverJeuLaser.inc + DriverJeuLaser.inc + 0 + 0 + @@ -704,7 +744,7 @@ 0 4 - 4 + 6 2 0 0 @@ -716,7 +756,7 @@ 4 - 5 + 7 2 0 0 diff --git a/soft/PjtKEIL_StepSon/StepSon.uvprojx b/soft/PjtKEIL_StepSon/StepSon.uvprojx index 2849fe6..c356ffc 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvprojx +++ b/soft/PjtKEIL_StepSon/StepSon.uvprojx @@ -408,6 +408,16 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.h + 5 + .\Driver\DriverJeuLaser.h + + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc + @@ -832,6 +842,16 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.h + 5 + .\Driver\DriverJeuLaser.h + + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc + @@ -1325,6 +1345,16 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.h + 5 + .\Driver\DriverJeuLaser.h + + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc +