This commit is contained in:
Jules-Ian Barnavon 2023-03-27 10:52:01 +02:00
parent dc8fe7ec38
commit 5ae9a91469
3 changed files with 72 additions and 16 deletions

View file

@ -1,6 +1,20 @@
PRESERVE8
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++;
; }
;}
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
@ -10,6 +24,8 @@
;Section RAM (read write):
area maram,data,readwrite
i dcd 0
SortieSon dcw 0
; ===============================================================================================
@ -21,10 +37,35 @@
area moncode,code,readonly
; écrire le code ici
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
fin
pop {pc}
ENDFUNC
END
END

View file

@ -2,7 +2,16 @@
#include "DriverJeuLaser.h"
# define PERIODE 6552
# define PERIODE_PWM 720
//int modulation(int i);
//void CallbackSon(void);
//extern short int Son [];
//extern short int LongueurSon;
//short int SortieSon;
extern void CallbackSon(void);
int main(void)
{
@ -18,20 +27,26 @@ CLOCK_Configure();
Timer_1234_Init_ff(TIM4,PERIODE);
Active_IT_Debordement_Timer(TIM4, 2, CallbackSon);
//Timer_1234_Init_ff(TIM3,PERIODE_PWM);
PWM_Init_ff( TIM3, 3, 720);
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
//============================================================================
while (1)
{
//PWM_Set_Value_TIM3_Ch3(SortieSon);
}
}
void CallbackSon(void){
static int i = 0;
}
//void CallbackSon(void){
//static int i = 0;
//if(i < LongueurSon){
// SortieSon = (Son[i] + 32768) * 719 / 65535;
// i++;
// }

View file

@ -10,7 +10,7 @@
<TargetName>Simu</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060750::V5.06 update 6 (build 750)::.\ARMCC</pCCUsed>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
@ -357,7 +357,7 @@
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
<IncludePath>.\Driver</IncludePath>
</VariousControls>
</Aads>
<LDads>
@ -434,7 +434,7 @@
<TargetName>CibleSondeKEIL</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060750::V5.06 update 6 (build 750)::.\ARMCC</pCCUsed>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
@ -781,7 +781,7 @@
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
<IncludePath>.\Driver</IncludePath>
</VariousControls>
</Aads>
<LDads>
@ -927,7 +927,7 @@
<TargetName>CibleSondeST</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060750::V5.06 update 6 (build 750)::.\ARMCC</pCCUsed>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>