From 5ae9a914691882382b04f53b1729f088a0247008 Mon Sep 17 00:00:00 2001 From: Jules-Ian Barnavon Date: Mon, 27 Mar 2023 10:52:01 +0200 Subject: [PATCH] TP 3 --- PjtKEIL_StepSon/Src/GestionSon.s | 51 ++++++++++++++++++++++++++++---- PjtKEIL_StepSon/Src/principal.c | 27 +++++++++++++---- PjtKEIL_StepSon/StepSon.uvprojx | 10 +++---- 3 files changed, 72 insertions(+), 16 deletions(-) diff --git a/PjtKEIL_StepSon/Src/GestionSon.s b/PjtKEIL_StepSon/Src/GestionSon.s index 8a75b7a..df3c5a1 100644 --- a/PjtKEIL_StepSon/Src/GestionSon.s +++ b/PjtKEIL_StepSon/Src/GestionSon.s @@ -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 \ No newline at end of file + END \ No newline at end of file diff --git a/PjtKEIL_StepSon/Src/principal.c b/PjtKEIL_StepSon/Src/principal.c index fed0338..a1ea3a8 100644 --- a/PjtKEIL_StepSon/Src/principal.c +++ b/PjtKEIL_StepSon/Src/principal.c @@ -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++; +// } diff --git a/PjtKEIL_StepSon/StepSon.uvprojx b/PjtKEIL_StepSon/StepSon.uvprojx index aab446b..34bc328 100644 --- a/PjtKEIL_StepSon/StepSon.uvprojx +++ b/PjtKEIL_StepSon/StepSon.uvprojx @@ -10,7 +10,7 @@ Simu 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -357,7 +357,7 @@ - + .\Driver @@ -434,7 +434,7 @@ CibleSondeKEIL 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -781,7 +781,7 @@ - + .\Driver @@ -927,7 +927,7 @@ CibleSondeST 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0