diff --git a/BE-chti C/soft/PjtKEIL_StepSon/Src/GestionSon.s b/BE-chti C/soft/PjtKEIL_StepSon/Src/GestionSon.s index 80001ee..a605b9e 100644 --- a/BE-chti C/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/BE-chti C/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -1,14 +1,21 @@ PRESERVE8 THUMB - - import Son - import PeriodeSonMicroSec - import LongueurSon - - - include Driver/DriverJeuLaser.inc - - + EXPORT CallbackSon + EXPORT SortieSon + EXPORT i + IMPORT Son + IMPORT LongueurSon + INCLUDE DriverJeuLaser.inc +;void CallbackSon(void){ +; static int i = 0; +; if(i < 5512){ +;0 SortieSon = (Son[i] + 32768) * 719 / 65535; +; i++; +; } +;} + + + ; ====================== zone de réservation de données, ====================================== ;Section RAM (read only) : area mesdata,data,readonly @@ -17,58 +24,48 @@ ;Section RAM (read write): area maram,data,readwrite - +i dcd 0 SortieSon dcw 0 - EXPORT SortieSon - -Offset equ 32768 -Intervalle equ 360 -Index equ 0 - - 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 +CallbackSon proc push {lr} - - 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 [] + + ldr r0,=i + ldr r1, [r0] + ldr r2,LongueurSon + cmp r2, r1 +; if(i < 5512) + ble fin + + ldr r3,=Son + ldrsh r2, [r3,r1, LSL#1] + add r2, #32768 + mov r12, #719 + mul r2, r12 + mov r12, #65535 + udiv r2, r12 +; i++; + add r1, #1 + str r1, [r0] +; On stocke enfin la sortie son + ldr r0, =SortieSon + strh r2, [r0] + mov r0, r2 + bl PWM_Set_Value_TIM3_Ch3 + +fin + pop {pc} + ENDFUNC - - -FIN - mov r3,#0 - - ENDP - - END \ No newline at end of file + END \ No newline at end of file