modification de callBackSon

This commit is contained in:
Oussama El-Jid 2023-04-11 00:15:52 +02:00
parent a6fff18f67
commit dc3df714a8

View file

@ -1,14 +1,21 @@
PRESERVE8 PRESERVE8
THUMB THUMB
EXPORT CallbackSon
import Son EXPORT SortieSon
import PeriodeSonMicroSec EXPORT i
import LongueurSon IMPORT Son
IMPORT LongueurSon
INCLUDE DriverJeuLaser.inc
include Driver/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, ====================================== ; ====================== zone de réservation de données, ======================================
;Section RAM (read only) : ;Section RAM (read only) :
area mesdata,data,readonly area mesdata,data,readonly
@ -17,58 +24,48 @@
;Section RAM (read write): ;Section RAM (read write):
area maram,data,readwrite area maram,data,readwrite
i dcd 0
SortieSon dcw 0 SortieSon dcw 0
EXPORT SortieSon
Offset equ 32768
Intervalle equ 360
Index equ 0
EXPORT CallbackSon
; =============================================================================================== ; ===============================================================================================
;Section ROM code (read only) : ;Section ROM code (read only) :
area moncode,code,readonly area moncode,code,readonly
; écrire le code ici ; écrire le code ici
;short int SortieSon; CallbackSon proc
;int LongueurSon 5512
;int i;
;if not i == LongueurSon
;lire[i] str
;i++
;
;360*(SortieSon+32768)/32768
import son
import LongueurSon
CallbackSon proc
push {lr} push {lr}
ldr r0,=son ; tableau de données ldr r0,=i
ldr r1,=SortieSon ; resultat ldr r1, [r0]
ldr r2,LongueurSon
ldr r2,[r1,#LongueurSon] ; point fini cmp r2, r1
ldr r3,[r1,#Index] ; position actuelle ; if(i < 5512)
ble fin
add r3,#1
cmp r2,r3 ;if on n'arrive pas la fin de tableau, on continue ldr r3,=Son
beq FIN ; if oui on quitte le prog ldrsh r2, [r3,r1, LSL#1]
add r2, #32768
; ldr r4, mov r12, #719
; ldrsh [] 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
END
FIN
mov r3,#0
ENDP
END