81 lines
No EOL
1.3 KiB
ArmAsm
Executable file
81 lines
No EOL
1.3 KiB
ArmAsm
Executable file
PRESERVE8
|
|
THUMB
|
|
|
|
|
|
; ====================== zone de réservation de données, ======================================
|
|
;Section RAM (read only) :
|
|
area mesdata,data,readonly
|
|
|
|
extern Son
|
|
extern PWM_Set_Value_TIM3_Ch3
|
|
extern Active_IT_Debordement_Timer
|
|
|
|
extern Run_Timer
|
|
extern Bloque_Timer
|
|
extern TIM4
|
|
|
|
;Section RAM (read write):
|
|
area maram,data,readwrite
|
|
|
|
|
|
|
|
; ===============================================================================================
|
|
|
|
export SortieSon
|
|
SortieSon DCW 0
|
|
offset DCD 11024
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
area moncode,code,readonly
|
|
; écrire le code ici
|
|
|
|
export CallbackSon
|
|
CallbackSon proc
|
|
push {lr}
|
|
ldr r0, =Son
|
|
ldr r3, =offset
|
|
ldr r2, [r3] ; r2 contient l'offset
|
|
ldrsh r0, [r0, r2] ; r0 contient l'adresse à lire
|
|
|
|
ldr r1, =11024
|
|
cmp r2, r1
|
|
bgt stop
|
|
add r2, #2
|
|
push {r2}
|
|
|
|
; Normalisation
|
|
mov r2, #91
|
|
sdiv r0, r0, r2
|
|
add r0, #360
|
|
|
|
; Output
|
|
ldr r3, =SortieSon
|
|
strh r0, [r3]
|
|
bl PWM_Set_Value_TIM3_Ch3
|
|
|
|
pop {r2}
|
|
|
|
return
|
|
ldr r3, =offset
|
|
str r2, [r3]
|
|
pop {pc}
|
|
|
|
stop
|
|
b return
|
|
|
|
endp
|
|
|
|
|
|
export StartSon
|
|
StartSon proc
|
|
push{lr}
|
|
mov r2, #0
|
|
ldr r3, =offset
|
|
str r2, [r3]
|
|
bl CallbackSon
|
|
pop{pc}
|
|
|
|
endp
|
|
|
|
END
|