chti23_grpC_Aittaleb_Barnavon/PjtKEIL_StepSon/Src/GestionSon.s

71 lines
1.1 KiB
ArmAsm
Raw Normal View History

2023-03-24 17:46:09 +01:00
PRESERVE8
THUMB
2023-03-27 10:52:01 +02:00
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++;
; }
;}
2023-03-24 17:46:09 +01:00
; ====================== zone de r<>servation de donn<6E>es, ======================================
;Section RAM (read only) :
area mesdata,data,readonly
;Section RAM (read write):
area maram,data,readwrite
2023-03-27 10:52:01 +02:00
i dcd 0
SortieSon dcw 0
2023-03-24 17:46:09 +01:00
; ===============================================================================================
;Section ROM code (read only) :
area moncode,code,readonly
; <20>crire le code ici
2023-03-27 10:52:01 +02:00
CallbackSon proc
push {lr}
; static int i = 0;
ldr r0,=i
ldr r1, [r0]
ldr r2,LongueurSon
cmp r2, r1
; if(i < 5512)
ble fin
;0 SortieSon = (Son[i] + 32768) * 719 / 65535;
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
2023-03-24 17:46:09 +01:00
2023-03-27 10:52:01 +02:00
fin
pop {pc}
ENDFUNC
2023-03-24 17:46:09 +01:00
2023-03-27 10:52:01 +02:00
END