mon message
This commit is contained in:
parent
4770d1824e
commit
fba418888f
6 changed files with 180 additions and 24 deletions
|
@ -74,19 +74,6 @@ BoucleTempo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int tab Son
|
|
||||||
int index
|
|
||||||
short sortieSon
|
|
||||||
|
|
||||||
int callBack {
|
|
||||||
distance = abs(min(index)) + abs(max(index))
|
|
||||||
miseAEchelle = 761/distance
|
|
||||||
if(index < LongueurSon) {
|
|
||||||
sortieSon = (Son[index] - min(index)))*miseAEchelle
|
|
||||||
|
|
||||||
index += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,101 @@
|
||||||
PRESERVE8
|
PRESERVE8
|
||||||
THUMB
|
THUMB
|
||||||
|
|
||||||
|
include DriverJeuLaser.inc
|
||||||
|
|
||||||
; ====================== 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;Section RAM (read write):
|
;Section RAM (read write):
|
||||||
area maram,data,readwrite
|
area maram,data,readwrite
|
||||||
|
|
||||||
|
SortieSon dcw 0
|
||||||
|
Index dcd 0
|
||||||
|
Res dcw 719
|
||||||
|
|
||||||
export CallbackSon
|
export CallbackSon
|
||||||
extern Son
|
extern Son
|
||||||
|
extern LongueurSon
|
||||||
|
EXPORT SortieSon
|
||||||
|
EXPORT Index
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ===============================================================================================
|
; ===============================================================================================
|
||||||
|
|
||||||
SortieSon dcw 0
|
|
||||||
Index dcd 0
|
|
||||||
|
|
||||||
|
|
||||||
;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
|
||||||
|
|
||||||
|
|
||||||
|
;int tab Son
|
||||||
|
;int index
|
||||||
|
;short sortieSon
|
||||||
|
|
||||||
|
;int callBack
|
||||||
|
; int decalage = 1<<15;
|
||||||
|
; double echelle = 719/(1<<16) //decalage*2
|
||||||
|
; if(index < LongueurSon) {
|
||||||
|
; sortieSon = (Son[index] +decalage)*echelle
|
||||||
|
;
|
||||||
|
; index += 1;
|
||||||
|
; }
|
||||||
|
|
||||||
|
; return sortieSon
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
;CallbackSon mov r0,=Son
|
;CallbackSon mov r0,=Son
|
||||||
CallbackSon proc
|
CallbackSon proc
|
||||||
|
; On récupère l'adresse du tableau Son et de l'index
|
||||||
|
push {lr}
|
||||||
ldr r0,=Son
|
ldr r0,=Son
|
||||||
ldr r2,=Index
|
ldr r2,=Index
|
||||||
ldr r3,[r2]
|
ldr r3,[r2]
|
||||||
ldr r1, [r0,r3] ; On li la valeur dans le tableau à la case Index
|
|
||||||
|
; if(index < LongueurSon)
|
||||||
|
push {r0}
|
||||||
|
ldr r0,=LongueurSon
|
||||||
|
cmp r0, r2
|
||||||
|
bge exit
|
||||||
|
pop{r0}
|
||||||
|
|
||||||
|
; sortieSon = (Son[index] +decalage)*echelle
|
||||||
|
; On lit Son[index]
|
||||||
|
ldrsh r1, [r0,r3]
|
||||||
ldr r0,=SortieSon
|
ldr r0,=SortieSon
|
||||||
str r1,[r0] ; On écrit cette valeur dans SortieSon
|
|
||||||
add r3,r3,2
|
;mise à echelle
|
||||||
|
push {r0,r2,r3}
|
||||||
|
; Variable décalage
|
||||||
|
mov r3,#1
|
||||||
|
lsl r0,r3,#15
|
||||||
|
add r1,r1,r0
|
||||||
|
;Calcul mise à l'échelle (719/2^16)
|
||||||
|
ldr r2,=Res
|
||||||
|
ldrh r2,[r2]
|
||||||
|
mul r1,r1,r2
|
||||||
|
lsr r1,r1,#16
|
||||||
|
pop {r0,r2,r3}
|
||||||
|
;fin mise à échelle
|
||||||
|
|
||||||
|
strh r1,[r0] ; On écrit cette valeur dans SortieSon
|
||||||
|
mov r0,r1
|
||||||
|
bl PWM_Set_Value_TIM3_Ch3
|
||||||
|
; index += 1;
|
||||||
|
add r3,r3,#2
|
||||||
str r3,[r2] ; On ajoute 2 à l'index
|
str r3,[r2] ; On ajoute 2 à l'index
|
||||||
bx lr
|
|
||||||
|
|
||||||
|
exit pop {pc}
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
export PeriodeSonMicroSec
|
export PeriodeSonMicroSec
|
||||||
export Son
|
export Son
|
||||||
|
|
||||||
DCD 5512
|
LongueurSon DCD 5512
|
||||||
PeriodeSonMicroSec DCD 91
|
PeriodeSonMicroSec DCD 91
|
||||||
Son
|
Son
|
||||||
DCW -6911
|
DCW -6911
|
||||||
|
|
|
@ -14,11 +14,13 @@ int main(void)
|
||||||
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
|
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
|
||||||
CLOCK_Configure();
|
CLOCK_Configure();
|
||||||
|
|
||||||
Timer_1234_Init_ff( TIM4, 100000*91 );
|
Timer_1234_Init_ff( TIM4, 6552 );
|
||||||
|
PWM_Init_ff(TIM3,3,720);
|
||||||
|
|
||||||
GPIO_Configure(GPIOB, 1, OUTPUT, OUTPUT_PPULL);
|
GPIO_Configure(GPIOB, 1, OUTPUT, OUTPUT_PPULL);
|
||||||
|
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
|
||||||
|
|
||||||
|
PWM_Set_Value_TIM3_Ch3( 720);
|
||||||
Active_IT_Debordement_Timer( TIM4, 2, CallbackSon );
|
Active_IT_Debordement_Timer( TIM4, 2, CallbackSon );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -422,6 +422,44 @@
|
||||||
<FileName>GestionSon.s</FileName>
|
<FileName>GestionSon.s</FileName>
|
||||||
<FileType>2</FileType>
|
<FileType>2</FileType>
|
||||||
<FilePath>.\Src\GestionSon.s</FilePath>
|
<FilePath>.\Src\GestionSon.s</FilePath>
|
||||||
|
<FileOption>
|
||||||
|
<CommonProperty>
|
||||||
|
<UseCPPCompiler>2</UseCPPCompiler>
|
||||||
|
<RVCTCodeConst>0</RVCTCodeConst>
|
||||||
|
<RVCTZI>0</RVCTZI>
|
||||||
|
<RVCTOtherData>0</RVCTOtherData>
|
||||||
|
<ModuleSelection>0</ModuleSelection>
|
||||||
|
<IncludeInBuild>2</IncludeInBuild>
|
||||||
|
<AlwaysBuild>2</AlwaysBuild>
|
||||||
|
<GenerateAssemblyFile>2</GenerateAssemblyFile>
|
||||||
|
<AssembleAssemblyFile>2</AssembleAssemblyFile>
|
||||||
|
<PublicsOnly>2</PublicsOnly>
|
||||||
|
<StopOnExitCode>11</StopOnExitCode>
|
||||||
|
<CustomArgument></CustomArgument>
|
||||||
|
<IncludeLibraryModules></IncludeLibraryModules>
|
||||||
|
<ComprImg>1</ComprImg>
|
||||||
|
</CommonProperty>
|
||||||
|
<FileArmAds>
|
||||||
|
<Aads>
|
||||||
|
<interw>2</interw>
|
||||||
|
<Ropi>2</Ropi>
|
||||||
|
<Rwpi>2</Rwpi>
|
||||||
|
<thumb>2</thumb>
|
||||||
|
<SplitLS>2</SplitLS>
|
||||||
|
<SwStkChk>2</SwStkChk>
|
||||||
|
<NoWarn>2</NoWarn>
|
||||||
|
<uSurpInc>2</uSurpInc>
|
||||||
|
<useXO>2</useXO>
|
||||||
|
<ClangAsOpt>0</ClangAsOpt>
|
||||||
|
<VariousControls>
|
||||||
|
<MiscControls></MiscControls>
|
||||||
|
<Define></Define>
|
||||||
|
<Undefine></Undefine>
|
||||||
|
<IncludePath>.\Driver</IncludePath>
|
||||||
|
</VariousControls>
|
||||||
|
</Aads>
|
||||||
|
</FileArmAds>
|
||||||
|
</FileOption>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
68
git/PjtKEIL_StepSon/spice/PWM.asc
Normal file
68
git/PjtKEIL_StepSon/spice/PWM.asc
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
Version 4
|
||||||
|
SHEET 1 1084 820
|
||||||
|
WIRE 208 16 96 16
|
||||||
|
WIRE 784 16 208 16
|
||||||
|
WIRE 944 16 864 16
|
||||||
|
WIRE 1008 16 944 16
|
||||||
|
WIRE -368 80 -512 80
|
||||||
|
WIRE 96 96 96 16
|
||||||
|
WIRE 944 144 944 16
|
||||||
|
WIRE -512 176 -512 80
|
||||||
|
WIRE 96 224 96 176
|
||||||
|
WIRE 944 256 944 208
|
||||||
|
WIRE -512 304 -512 256
|
||||||
|
WIRE 96 384 -48 384
|
||||||
|
WIRE -48 480 -48 384
|
||||||
|
WIRE -48 608 -48 560
|
||||||
|
FLAG -512 304 0
|
||||||
|
FLAG -368 80 Compteur
|
||||||
|
FLAG 944 256 0
|
||||||
|
FLAG 1008 16 Filtre
|
||||||
|
FLAG -48 608 0
|
||||||
|
FLAG 96 384 CompValue
|
||||||
|
FLAG 208 16 PWM
|
||||||
|
FLAG 96 224 0
|
||||||
|
SYMBOL voltage -512 160 R0
|
||||||
|
WINDOW 3 -372 78 Left 2
|
||||||
|
WINDOW 123 0 0 Left 0
|
||||||
|
WINDOW 39 0 0 Left 0
|
||||||
|
SYMATTR Value PULSE(0 3.3 0 5u 0 0 5u)
|
||||||
|
SYMATTR InstName V1
|
||||||
|
SYMBOL cap 928 144 R0
|
||||||
|
SYMATTR InstName C1
|
||||||
|
SYMATTR Value 10n
|
||||||
|
SYMBOL res 880 0 R90
|
||||||
|
WINDOW 0 0 56 VBottom 2
|
||||||
|
WINDOW 3 32 56 VTop 2
|
||||||
|
SYMATTR InstName R1
|
||||||
|
SYMATTR Value 3.9k
|
||||||
|
SYMBOL voltage -48 464 R0
|
||||||
|
WINDOW 3 49 61 Left 2
|
||||||
|
WINDOW 123 0 0 Left 0
|
||||||
|
WINDOW 39 0 0 Left 0
|
||||||
|
SYMATTR Value SINE(1.65 1 2k)
|
||||||
|
SYMATTR InstName V2
|
||||||
|
SYMBOL bv 96 80 R0
|
||||||
|
SYMATTR InstName B1
|
||||||
|
SYMATTR Value V=if(V(CompValue)>V(Compteur),3.3,0)
|
||||||
|
TEXT 272 256 Left 2 !;ac dec 100 1 10meg
|
||||||
|
TEXT 272 296 Left 2 !.tran 0 1.5m 0 0.01u
|
||||||
|
TEXT -880 40 Left 2 ;Compteur de l'unité Timer
|
||||||
|
TEXT -96 -24 Left 2 ;Partie PWM de l'unité Timer
|
||||||
|
TEXT -904 -56 Left 4 ;TIMER3
|
||||||
|
TEXT 688 80 Left 4 ;PB0
|
||||||
|
TEXT 480 0 Left 2 ;Chanel 3
|
||||||
|
TEXT 384 -168 Left 5 ;STM32F103
|
||||||
|
LINE Normal 688 48 752 -16
|
||||||
|
LINE Normal 688 -16 688 48
|
||||||
|
LINE Normal 752 48 688 -16
|
||||||
|
LINE Normal 752 48 752 48
|
||||||
|
LINE Normal 720 -208 720 -16
|
||||||
|
LINE Normal 256 -208 720 -208
|
||||||
|
LINE Normal 720 784 720 48
|
||||||
|
LINE Normal 720 784 720 784
|
||||||
|
LINE Normal 720 816 720 784
|
||||||
|
RECTANGLE Normal -192 352 -912 16 2
|
||||||
|
RECTANGLE Normal 592 656 -128 -48 2
|
||||||
|
RECTANGLE Normal 640 736 -976 -96
|
||||||
|
RECTANGLE Normal 752 48 688 -16
|
Loading…
Reference in a new issue