From 6d36e9c037a13db58aab2d9018b8f93b01182af6 Mon Sep 17 00:00:00 2001 From: Enzo Slamnia Date: Wed, 12 Apr 2023 12:43:02 +0200 Subject: [PATCH] fonction de mise a l'echelle --- soft/PjtKEIL_StepDeb_1/BacASable.uvoptx | 31 ++++++- soft/PjtKEIL_StepDeb_2/Src/Cligno.s | 2 +- soft/PjtKEIL_StepSon/Src/GestionSon.s | 49 +++++++++- soft/PjtKEIL_StepSon/Src/principal.c | 5 +- soft/PjtKEIL_StepSon/StepSon.uvoptx | 117 ++++++++++++++++++++++-- soft/PjtKEIL_StepSon/StepSon.uvprojx | 56 ++++++++++-- 6 files changed, 235 insertions(+), 25 deletions(-) diff --git a/soft/PjtKEIL_StepDeb_1/BacASable.uvoptx b/soft/PjtKEIL_StepDeb_1/BacASable.uvoptx index 172486d..9742fc6 100644 --- a/soft/PjtKEIL_StepDeb_1/BacASable.uvoptx +++ b/soft/PjtKEIL_StepDeb_1/BacASable.uvoptx @@ -153,7 +153,24 @@ -U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) - + + + 0 + 0 + 44 + 1 +
134218704
+ 0 + 0 + 0 + 0 + 0 + 1 + .\Src\Delay.s + + \\BacASable\Src/Delay.s\44 +
+
0 @@ -165,10 +182,18 @@ 1 0 - 0x20000000 + VarTime 0 + + + 2 + 0 + r0 + 0 + + 0 @@ -189,7 +214,7 @@ 0 0 0 - 1 + 0 0 0 0 diff --git a/soft/PjtKEIL_StepDeb_2/Src/Cligno.s b/soft/PjtKEIL_StepDeb_2/Src/Cligno.s index 4807e07..8b9e8d8 100644 --- a/soft/PjtKEIL_StepDeb_2/Src/Cligno.s +++ b/soft/PjtKEIL_StepDeb_2/Src/Cligno.s @@ -26,7 +26,7 @@ FlagCligno dcd 0 callback proc push {lr} - ldr r1,=FlagCligno + ldr r1,=FlagCligno ; *r1 = FlagCligno ldr r2,[r1] cmp r2, #1 beq allume_led diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index 8a75b7a..493b83b 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -1,6 +1,10 @@ PRESERVE8 THUMB + IMPORT LongueurSon + IMPORT PeriodeSonMicroSec + IMPORT Son + EXPORT CallbackSon ; ====================== zone de réservation de données, ====================================== ;Section RAM (read only) : @@ -10,8 +14,9 @@ ;Section RAM (read write): area maram,data,readwrite +SortieSon dcw 0 - + EXPORT SortieSon ; =============================================================================================== @@ -21,10 +26,44 @@ area moncode,code,readonly ; écrire le code ici +CallbackSon proc + ;; 1. Il faut pouvoir utiliser SortieSon comme index d'iteration dans le tableau bruitverre + push {r4,r5,r6,r7} + ldr r7,=SortieSon + ldr r1,=LongueurSon + ldr r2,=Son + mov r3,#0 + mov r4,#719 + lsr r4,r4,#1 + +calcul + ldrsh r0, [r2,r3,lsl #1] + ;cmp r0,#0x00007FFF + ;bgt calcul_neg + ;faire +32768, ensuite x719, puis diviser par 2^16 + mov r5,#32767 + udiv r6,r5,r4 + mul r0,r6 + add r0,r4 + str r0,[r7] + add r3,#1 + cmp r1,r3 + bne calcul + bl fin + +calcul_neg + mov r5,#32768 + udiv r6,r4,r5 + mul r0,r6 + sub r0,r4 + lsl r5,r0,#1 + sub r0,r5 + str r0,[r7] + add r3,#1 + cmp r1,r3 + bne calcul - - - - +fin + pop {r4,r5,r6,r7} END \ No newline at end of file diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index d09be75..9d3e7c3 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -1,7 +1,8 @@ #include "DriverJeuLaser.h" - +extern void CallbackSon(void); +extern int PeriodeSonMicroSec; int main(void) @@ -14,6 +15,8 @@ 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, (1/PeriodeSonMicroSec*0.000001) ); +Active_IT_Debordement_Timer( TIM4, 2, CallbackSon ); diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index a13d7da..765bc55 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -10,7 +10,7 @@ *.s*; *.src; *.a* *.obj; *.o *.lib - *.txt; *.h; *.inc + *.txt; *.h; *.inc; *.md *.plm *.cpp 0 @@ -75,7 +75,7 @@ 1 0 - 0 + 1 18 @@ -153,7 +153,78 @@ -U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) - + + + 0 + 0 + 37 + 1 +
134220580
+ 0 + 0 + 0 + 0 + 0 + 1 + .\Src\GestionSon.s + + \\StepSon\Src/GestionSon.s\37 +
+
+ + + 0 + 1 + SortieSon + + + 1 + 1 + r3 + + + 2 + 1 + r0 + + + 3 + 1 + r7 + + + + + 1 + 0 + r7 + 0 + + + + + 2 + 0 + r6 + 0 + + + + + 3 + 0 + r4 + 0 + + + + + 4 + 0 + r5 + 0 + + 0 @@ -174,7 +245,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -199,8 +270,8 @@ 0 - ((portb & 0x00000002) >> 1 & 0x2) >> 1 - FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F160000000000000000000000000000000000000096020008 + `SortieSon + FF0000000000000000000000000000000080864000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000001000000000000000000F03F1000000000000000000000000000000000000000C40A0008 @@ -460,7 +531,7 @@ 1 0 - 1 + 0 18 @@ -666,6 +737,38 @@ + + Son + 1 + 0 + 0 + 0 + + 4 + 4 + 2 + 0 + 0 + 0 + .\Src\bruitverre.asm + bruitverre.asm + 0 + 0 + + + 4 + 5 + 2 + 0 + 0 + 0 + .\Src\GestionSon.s + GestionSon.s + 0 + 0 + + + ::CMSIS 0 diff --git a/soft/PjtKEIL_StepSon/StepSon.uvprojx b/soft/PjtKEIL_StepSon/StepSon.uvprojx index d0b5c10..2849fe6 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvprojx +++ b/soft/PjtKEIL_StepSon/StepSon.uvprojx @@ -10,7 +10,7 @@ Simu 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -410,6 +410,21 @@ + + Son + + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.s + 2 + .\Src\GestionSon.s + + + ::CMSIS @@ -819,6 +834,21 @@ + + Son + + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.s + 2 + .\Src\GestionSon.s + + + ::CMSIS @@ -897,7 +927,7 @@ CibleSondeST 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -1297,6 +1327,21 @@ + + Son + + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.s + 2 + .\Src\GestionSon.s + + + ::CMSIS @@ -1322,12 +1367,7 @@ - <Project Info> - - - - - + StepSon 0 1