forked from acco/chti23
TP 3
This commit is contained in:
parent
dc8fe7ec38
commit
5ae9a91469
3 changed files with 72 additions and 16 deletions
|
@ -1,5 +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++;
|
||||||
|
; }
|
||||||
|
;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ====================== zone de réservation de données, ======================================
|
; ====================== zone de réservation de données, ======================================
|
||||||
|
@ -10,6 +24,8 @@
|
||||||
;Section RAM (read write):
|
;Section RAM (read write):
|
||||||
area maram,data,readwrite
|
area maram,data,readwrite
|
||||||
|
|
||||||
|
i dcd 0
|
||||||
|
SortieSon dcw 0
|
||||||
|
|
||||||
|
|
||||||
; ===============================================================================================
|
; ===============================================================================================
|
||||||
|
@ -21,10 +37,35 @@
|
||||||
area moncode,code,readonly
|
area moncode,code,readonly
|
||||||
; écrire le code ici
|
; é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
|
|
@ -2,7 +2,16 @@
|
||||||
|
|
||||||
#include "DriverJeuLaser.h"
|
#include "DriverJeuLaser.h"
|
||||||
# define PERIODE 6552
|
# 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)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
@ -18,20 +27,26 @@ CLOCK_Configure();
|
||||||
Timer_1234_Init_ff(TIM4,PERIODE);
|
Timer_1234_Init_ff(TIM4,PERIODE);
|
||||||
Active_IT_Debordement_Timer(TIM4, 2, CallbackSon);
|
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)
|
while (1)
|
||||||
{
|
{
|
||||||
|
//PWM_Set_Value_TIM3_Ch3(SortieSon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallbackSon(void){
|
//void CallbackSon(void){
|
||||||
static int i = 0;
|
//static int i = 0;
|
||||||
|
//if(i < LongueurSon){
|
||||||
|
// SortieSon = (Son[i] + 32768) * 719 / 65535;
|
||||||
}
|
// i++;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<TargetName>Simu</TargetName>
|
<TargetName>Simu</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<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>
|
<uAC6>0</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
|
@ -357,7 +357,7 @@
|
||||||
<MiscControls></MiscControls>
|
<MiscControls></MiscControls>
|
||||||
<Define></Define>
|
<Define></Define>
|
||||||
<Undefine></Undefine>
|
<Undefine></Undefine>
|
||||||
<IncludePath></IncludePath>
|
<IncludePath>.\Driver</IncludePath>
|
||||||
</VariousControls>
|
</VariousControls>
|
||||||
</Aads>
|
</Aads>
|
||||||
<LDads>
|
<LDads>
|
||||||
|
@ -434,7 +434,7 @@
|
||||||
<TargetName>CibleSondeKEIL</TargetName>
|
<TargetName>CibleSondeKEIL</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<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>
|
<uAC6>0</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
|
@ -781,7 +781,7 @@
|
||||||
<MiscControls></MiscControls>
|
<MiscControls></MiscControls>
|
||||||
<Define></Define>
|
<Define></Define>
|
||||||
<Undefine></Undefine>
|
<Undefine></Undefine>
|
||||||
<IncludePath></IncludePath>
|
<IncludePath>.\Driver</IncludePath>
|
||||||
</VariousControls>
|
</VariousControls>
|
||||||
</Aads>
|
</Aads>
|
||||||
<LDads>
|
<LDads>
|
||||||
|
@ -927,7 +927,7 @@
|
||||||
<TargetName>CibleSondeST</TargetName>
|
<TargetName>CibleSondeST</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<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>
|
<uAC6>0</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
|
|
Loading…
Reference in a new issue