diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index a81ce4c..283f96d 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -1,3 +1,5 @@ + import PWM_Set_Value_TIM3_Ch3 + PRESERVE8 THUMB @@ -15,6 +17,7 @@ area maram,data,readwrite + SortieSon dcw 0 Index dcw 0 @@ -45,19 +48,26 @@ timer_callback_son proc cmp r0, r1 beq fin + ldr r3,=SortieSon ldr r2,=Son ldrsh r1,[r2,r0, lsl #1] - add r1,#32768 + add r1,#32768 ; (1<<16) mov r2, #720 mul r1,r2 asr r1,#16 - str r1, [r3] - mov r3, r0 + mov r4, r0 + mov r0, r1 + bl PWM_Set_Value_TIM3_Ch3 + ;str r1, [r3] ;Mise à jour sortie son pas PWM + str r0, [r3] ;Mise à jour sortie son PWM + mov r0, r4 + + mov r3, r0 add r3, #1 str r3, [r4] diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index 23f8b08..02cdac4 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -1,5 +1,3 @@ - - #include "DriverJeuLaser.h" extern void timer_callback_son(void); @@ -17,6 +15,19 @@ CLOCK_Configure(); // configuration du Timer 4 en débordement 91 microsecondes Timer_1234_Init_ff( TIM4, 91*72); + Timer_1234_Init_ff( TIM3, 91*72); + + int Periode_ticks = 720; + + PWM_Init_ff(TIM3, 3, Periode_ticks); + + /* Calcul fPWM */ + int fPWM ; + fPWM = (1/Periode_ticks)*72000000 ; + + GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); + + Active_IT_Debordement_Timer( TIM4, 2, timer_callback_son ); diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index a6f7da5..486c71c 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -75,7 +75,7 @@ 1 0 - 1 + 0 18 @@ -154,11 +154,18 @@ + + + 0 + 1 + SortieSon + + 1 265 - r3 + &SortieSon 0 @@ -207,8 +214,8 @@ 0 - `SortieSon - 008000000000000000000000000000000080864000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F00000001000000000000000000F03F0D00000000000000000000000000000000000000AE080008 + (SortieSon & 0xFFFF) >> 0 + 008000000000000000000000000000000000894000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000001000000000000000000F03F1400000000000000000000000000000000000000AE080008 @@ -275,7 +282,7 @@ 1 0 - 0 + 1 18 @@ -382,7 +389,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -672,6 +679,18 @@ 0 0 + + 3 + 4 + 5 + 0 + 0 + 0 + .\Driver\DriverJeuLaser.inc + DriverJeuLaser.inc + 0 + 0 + @@ -682,7 +701,7 @@ 0 4 - 4 + 5 2 0 0 @@ -694,7 +713,7 @@ 4 - 5 + 6 2 0 0 diff --git a/soft/PjtKEIL_StepSon/StepSon.uvprojx b/soft/PjtKEIL_StepSon/StepSon.uvprojx index 8e2853b..7a3fdbf 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvprojx +++ b/soft/PjtKEIL_StepSon/StepSon.uvprojx @@ -408,6 +408,11 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc + @@ -434,7 +439,7 @@ CibleSondeKEIL 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -832,6 +837,11 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc + @@ -1325,6 +1335,11 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc +