fin 11-04

This commit is contained in:
Leopold Lanard 2023-04-11 18:17:17 +02:00
parent 73e9252cfe
commit ae92c45251
3 changed files with 29 additions and 8 deletions

16
elec/spice/pwm/PWM.net Normal file
View file

@ -0,0 +1,16 @@
* U:\Bureau\grpD_Lanard_ElKhatiri\elec\spice\pwm\PWM.asc
V1 Compteur 0 PULSE(0 3.3 0 5u 0 0 5u)
C1 Filtre 0 10n
R1 Filtre PWM 3.9k
V2 CompValue 0 SINE(1.65 1 2k)
B1 PWM 0 V=if(V(CompValue)>V(Compteur),3.3,0)
;ac dec 100 1 10meg
.tran 0 1.5m 0 0.01u
* Compteur de l'unité Timer
* Partie PWM de l'unité Timer
* TIMER3
* PB0
* Chanel 3
* STM32F103
.backanno
.end

View file

@ -16,13 +16,14 @@
; =============================================================================================== ; ===============================================================================================
include DriverJeuLaser.lib
export CallbackSon export CallbackSon
export SortieSon export SortieSon
extern LongueurSon extern LongueurSon
extern Son extern Son
Index DCW 0 Index DCD 0
SortieSon DCD 0 SortieSon DCW 0
;Section ROM code (read only) : ;Section ROM code (read only) :
area moncode,code,readonly area moncode,code,readonly
@ -31,6 +32,8 @@ SortieSon DCD 0
CallbackSon proc CallbackSon proc
ldr r0,=Index ldr r0,=Index
ldr r1,[r0] ldr r1,[r0]
ldr r2,=Son ldr r2,=Son
@ -56,14 +59,15 @@ notEqual
ldr r6,=SortieSon ldr r6,=SortieSon
strh r5,[r6] strh r5,[r6]
add r1, #1
str r0,[r4] add r1, #2
str r1,[r0]
pop{r6} pop{r6}
pop {r4} pop {r4}
pop {r5} pop {r5}
bx lr
bx lr

View file

@ -14,10 +14,11 @@ 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, 91); Timer_1234_Init_ff( TIM4, 6552);
Timer_1234_Init_ff( TIM3,720);
Active_IT_Debordement_Timer( TIM4, 2, CallbackSon); Active_IT_Debordement_Timer( TIM4, 2, CallbackSon);
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
PWM_Init_ff( TIM3, 3, 720);
//============================================================================ //============================================================================