diff --git a/elec/spice/pwm/PWM.net b/elec/spice/pwm/PWM.net new file mode 100644 index 0000000..b7769d7 --- /dev/null +++ b/elec/spice/pwm/PWM.net @@ -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 diff --git a/soft/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/GestionSon.s index bec8416..4977af3 100644 --- a/soft/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/GestionSon.s @@ -16,13 +16,14 @@ ; =============================================================================================== + include DriverJeuLaser.lib export CallbackSon export SortieSon extern LongueurSon extern Son -Index DCW 0 -SortieSon DCD 0 +Index DCD 0 +SortieSon DCW 0 ;Section ROM code (read only) : area moncode,code,readonly @@ -31,6 +32,8 @@ SortieSon DCD 0 CallbackSon proc + + ldr r0,=Index ldr r1,[r0] ldr r2,=Son @@ -56,14 +59,15 @@ notEqual ldr r6,=SortieSon strh r5,[r6] - add r1, #1 - str r0,[r4] + add r1, #2 + + str r1,[r0] pop{r6} pop {r4} pop {r5} - bx lr + bx lr diff --git a/soft/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/principal.c index 4944ddd..af42510 100644 --- a/soft/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/principal.c @@ -14,10 +14,11 @@ int main(void) // Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers 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); - +GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); +PWM_Init_ff( TIM3, 3, 720); //============================================================================