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,12 +1,19 @@
PRESERVE8 PRESERVE8
THUMB THUMB
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++;
; }
;}
import Son
import PeriodeSonMicroSec
import LongueurSon
include Driver/DriverJeuLaser.inc
; ====================== zone de réservation de données, ====================================== ; ====================== zone de réservation de données, ======================================
@ -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;
;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} push {lr}
ldr r0,=son ; tableau de données ldr r0,=i
ldr r1,=SortieSon ; resultat ldr r1, [r0]
ldr r2,LongueurSon
cmp r2, r1
; if(i < 5512)
ble fin
ldr r2,[r1,#LongueurSon] ; point fini ldr r3,=Son
ldr r3,[r1,#Index] ; position actuelle 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
add r3,#1 fin
cmp r2,r3 ;if on n'arrive pas la fin de tableau, on continue pop {pc}
beq FIN ; if oui on quitte le prog ENDFUNC
; ldr r4,
; ldrsh []
FIN
mov r3,#0
ENDP
END END