2023-03-14 16:21:55 +01:00
|
|
|
|
PRESERVE8
|
|
|
|
|
THUMB
|
2023-04-14 15:31:33 +02:00
|
|
|
|
|
|
|
|
|
export CallbackSon
|
|
|
|
|
export index
|
|
|
|
|
export SortieSon
|
2023-04-19 11:29:35 +02:00
|
|
|
|
export StartSon
|
2023-04-14 15:31:33 +02:00
|
|
|
|
import LongueurSon
|
|
|
|
|
import Son
|
2023-04-14 18:12:13 +02:00
|
|
|
|
import PWM_Set_Value_TIM3_Ch3
|
2023-03-14 16:21:55 +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-04-14 15:31:33 +02:00
|
|
|
|
SortieSon dcw 0
|
|
|
|
|
index dcd 0
|
2023-03-14 16:21:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; ===============================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
|
|
|
area moncode,code,readonly
|
2023-04-14 15:31:33 +02:00
|
|
|
|
; <20>crire le code ici
|
2023-03-14 16:21:55 +01:00
|
|
|
|
|
2023-04-14 15:31:33 +02:00
|
|
|
|
CallbackSon proc
|
2023-04-14 17:34:45 +02:00
|
|
|
|
push {lr,r4-r7}
|
2023-04-14 15:31:33 +02:00
|
|
|
|
ldr r4,=LongueurSon
|
|
|
|
|
ldr r4,[r4]
|
|
|
|
|
ldr r2,=index
|
2023-04-19 11:29:35 +02:00
|
|
|
|
ldr r7,[r2] ;r7 = valeur de index
|
2023-04-14 15:31:33 +02:00
|
|
|
|
cmp r4,r7
|
|
|
|
|
|
|
|
|
|
bne alors
|
|
|
|
|
|
|
|
|
|
sinon
|
|
|
|
|
b finsi
|
2023-03-14 16:21:55 +01:00
|
|
|
|
|
2023-04-14 15:31:33 +02:00
|
|
|
|
alors
|
|
|
|
|
ldr r3,=SortieSon
|
|
|
|
|
ldr r1,=Son
|
|
|
|
|
|
2023-04-14 17:34:45 +02:00
|
|
|
|
ldrsh r0,[r1,r7,lsl#1] ; R0 = *(R1+2*R7 ) R0 = R1[R7]
|
2023-04-14 15:31:33 +02:00
|
|
|
|
|
2023-04-14 17:34:45 +02:00
|
|
|
|
mov r5,#32768
|
|
|
|
|
add r0,r5
|
|
|
|
|
|
|
|
|
|
mov r6,#719
|
|
|
|
|
mul r0,r6
|
|
|
|
|
;ldr r6,=23560192 ;719*32768
|
2023-05-24 15:21:32 +02:00
|
|
|
|
asr r0,#16 ; d<>calage de 16
|
2023-04-14 17:34:45 +02:00
|
|
|
|
;add r0,r6
|
2023-04-14 15:31:33 +02:00
|
|
|
|
|
2023-04-14 17:34:45 +02:00
|
|
|
|
; mise <20> jour de SortieSon
|
|
|
|
|
strh r0,[r3]
|
|
|
|
|
;ldr r3,[r0]
|
2023-04-14 18:12:13 +02:00
|
|
|
|
; mettre <20> jour la PWM
|
|
|
|
|
bl PWM_Set_Value_TIM3_Ch3 ;on appelle la fonction avec r0 en param<61>tre
|
2023-04-14 15:31:33 +02:00
|
|
|
|
|
|
|
|
|
add r7,#1 ;index=index+1
|
|
|
|
|
str r7,[r2] ; *R2 = R7
|
2023-03-14 16:21:55 +01:00
|
|
|
|
|
|
|
|
|
|
2023-04-14 15:31:33 +02:00
|
|
|
|
finsi
|
2023-04-14 17:34:45 +02:00
|
|
|
|
pop {lr,r4-r7}
|
2023-04-14 15:31:33 +02:00
|
|
|
|
bx lr
|
|
|
|
|
endp
|
2023-03-14 16:21:55 +01:00
|
|
|
|
|
2023-04-19 11:29:35 +02:00
|
|
|
|
StartSon proc
|
|
|
|
|
ldr r0,=index
|
|
|
|
|
ldr r1,[r0]
|
|
|
|
|
mov r1,#0
|
|
|
|
|
str r1,[r0]
|
|
|
|
|
bx lr
|
|
|
|
|
endp
|
|
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|