diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index ba97e0f..9ed1fa5 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -1,7 +1,7 @@ PRESERVE8 THUMB - + ; ====================== zone de réservation de données, ====================================== ;Section RAM (read only) : area mesdata,data,readonly @@ -10,58 +10,63 @@ ;Section RAM (read write): area maram,data,readwrite - -SortieSon dcw 0 - EXPORT SortieSon - -Offset equ 32768 -Intervalle equ 360 -Index equ 0 - - EXPORT CallbackSon - +Offset equ 32768 +SortieSon equ 0 +Index equ 0 + + import LongueurSon + import Son + import PWM_Set_Value_TIM3_Ch3 + export CallBackSon ; =============================================================================================== + + ;Section ROM code (read only) : area moncode,code,readonly ; écrire le code ici -;short int SortieSon; -;int LongueurSon 5512 -;int i; -;if not i == LongueurSon -;lire[i] str -;i++ -; -;360*(SortieSon+32768)/32768 - import son - import LongueurSon +CallBackSon proc + ldr r0, =Index + ldr r1, [r0] + + ldr r2, =LongueurSon + ldr r2, [r2] -CallbackSon proc - push {lr} + cmp r1, r2 + bne FIN_Son - ldr r0,=son ; tableau de données - ldr r1,=SortieSon ; resultat - ldr r2,[r1,#LongueurSon] ; point fini - ldr r3,[r1,#Index] ; position actuelle - - add r3,#1 - cmp r2,r3 ;if on n'arrive pas la fin de tableau, on continue - beq FIN ; if oui on quitte le prog - -; ldr r4, -; ldrsh [] - - + mov r0, #0 + ldr r2, =SortieSon + str r0, [r2] + bx lr - -FIN - mov r3,#0 - - ENDP +FIN_Son + add r1, #1 + str r1, [r0] + sub r1, #1 + ldr r3, =Son + ldrsh r3, [r3,r1,LSL #1] + add r3, #Offset + mov r0, #360 + mul r3,r0 + ldr r0,=Offset + udiv r3, r0 + + + ldr r0, =SortieSon + str r3, [r0] + mov r0, r3 + + bl PWM_Set_Value_TIM3_Ch3 + + bx lr + + endp + END \ No newline at end of file diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index f6eae85..1f80186 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -2,14 +2,12 @@ #include "DriverJeuLaser.h" -extern void CallbackSon(void); - - - +extern void CallBackSon(void); int main(void) { + // =========================================================================== // ============= INIT PERIPH (faites qu'une seule fois) ===================== @@ -17,13 +15,21 @@ 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, 65520000); -Active_IT_Debordement_Timer(TIM4, 2, CallbackSon); -Run_Timer(TIM4); + Timer_1234_Init_ff( TIM4, 6552); + + + + Active_IT_Debordement_Timer( TIM4, 2, CallBackSon ); + + PWM_Init_ff( TIM3, 3, 720); + + GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); + + + //============================================================================ @@ -31,4 +37,3 @@ while (1) { } } - diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index 299ecc4..cea4e8b 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -75,7 +75,7 @@ 1 0 - 0 + 1 18 @@ -153,7 +153,80 @@ -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 + 53 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\Src\GestionSon.s + + +
+ + 1 + 0 + 54 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\Src\GestionSon.s + + +
+ + 2 + 0 + 55 + 1 +
134220486
+ 0 + 0 + 0 + 0 + 0 + 1 + .\Src\GestionSon.s + + \\StepSon\Src/GestionSon.s\55 +
+ + 3 + 0 + 52 + 1 +
134220476
+ 0 + 0 + 0 + 0 + 0 + 1 + .\Src\GestionSon.s + + \\StepSon\Src/GestionSon.s\52 +
+
+ + + 1 + 266 + r3 + 0 + + 0 @@ -460,7 +533,7 @@ 1 0 - 1 + 0 18 @@ -538,40 +611,7 @@ -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 - 8 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - .\Src\principal.c - - -
- - 1 - 0 - 7 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - .\Src\principal.c - - -
-
+ 1 diff --git a/soft/PjtKEIL_StepSon/StepSon.uvprojx b/soft/PjtKEIL_StepSon/StepSon.uvprojx index 839c3b9..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