diff --git a/elec/spice/pwm/PWM.net b/elec/spice/pwm/PWM.net deleted file mode 100644 index e0b939e..0000000 --- a/elec/spice/pwm/PWM.net +++ /dev/null @@ -1,16 +0,0 @@ -* U:\3MIC\s2\BE-CHTI\assembleur\chti23\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_StepDeb_2/BacASable.uvoptx b/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx index 8f59c84..bde3f4b 100644 --- a/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx +++ b/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx @@ -75,7 +75,7 @@ 1 0 - 1 + 0 18 @@ -316,7 +316,7 @@ 1 0 - 0 + 1 18 @@ -409,7 +409,7 @@ 0 1 - 1 + 0 0 0 0 diff --git a/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx b/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx index e77bfc6..f01d9e2 100644 --- a/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx +++ b/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx @@ -424,7 +424,7 @@ CibleSondeKEIL 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index bb3b731..fe51332 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -3,7 +3,7 @@ IMPORT LongueurSon IMPORT PeriodeSonMicroSec IMPORT Son - + IMPORT PWM_Set_Value_TIM3_Ch3 EXPORT CallbackSon ; ====================== zone de réservation de données, ====================================== @@ -15,7 +15,8 @@ area maram,data,readwrite SortieSon dcw 0 - +Index dcd 0 + EXPORT SortieSon ; =============================================================================================== @@ -24,19 +25,25 @@ SortieSon dcw 0 ;Section ROM code (read only) : area moncode,code,readonly -; écrire le code ici +; écrire le code ici + CallbackSon proc ;; 1. Il faut pouvoir utiliser SortieSon comme index d'iteration dans le tableau bruitverre - push {r4,r5,r6} + push {r4,r5,r6,r7,lr} ldr r1,=SortieSon ;sortie - ldr r2,=LongueurSon ;nb de sons + ldr r2,=LongueurSon ;nb de sons + ldr r2,[r2] ldr r3,=Son ;adresse du tableau de sons - mov r4,#0 ;compteur + ldr r7,=Index + ldr r4,[r7] ;compteur + cmp r4,r2 + moveq r4,#0 mov r5,#(1<<15) ;registre pour operations mov r6,#719 ;sauvegarde de 719 calcul + ldrsh r0, [r3,r4,lsl #1] ;faire +32768, ensuite x719, puis diviser par 2^16 add r0,r5 @@ -44,10 +51,16 @@ calcul lsr r0,#16 str r0,[r1] add r4,#1 - cmp r2,r4 - bne calcul + str r4,[r7] + push {r1,r2,r3} + bl PWM_Set_Value_TIM3_Ch3 + pop {r1,r2,r3} + ;add r4,#1 + ;cmp r2,r4 + ;bne calcul - pop {r4,r5,r6} + pop {r4,r5,r6,r7,lr} + bx lr endp END \ No newline at end of file diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index 4cd54f3..395a26e 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -6,6 +6,7 @@ extern void CallbackSon(void); extern int PeriodeSonMicroSec; + int main(void) { @@ -16,15 +17,16 @@ 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, (1/PeriodeSonMicroSec*0.000001) ); +PWM_Init_ff(TIM3, 3, 720); +GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); + +Timer_1234_Init_ff(TIM4, 91*72); Active_IT_Debordement_Timer( TIM4, 2, CallbackSon ); -//Timer_1234_Init_ff(TIM3, 720 ); -char GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); -PWM_Init_ff(TIM3,3,720); -PWM_Set_Value_TIM3_Ch3(720); + + //============================================================================ diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index 608ab4e..a0a2757 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -75,7 +75,7 @@ 1 0 - 1 + 0 18 @@ -153,40 +153,7 @@ -U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) - - - 0 - 0 - 42 - 1 -
134220588
- 0 - 0 - 0 - 0 - 0 - 1 - .\Src\GestionSon.s - - \\StepSon\Src/GestionSon.s\42 -
- - 1 - 0 - 38 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - .\Src\GestionSon.s - - -
-
+ 0 @@ -196,19 +163,29 @@ 1 1 - r3 + r0 2 1 - r0 + (portb & 0x00000001) + + + 3 + 1 + r4 + + + 4 + 1 + Index 1 - 0 - r3 + 265 + 0x200000A2 0 @@ -282,7 +259,12 @@ 0 `SortieSon - FF0000000000000000000000000000000078864000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000001000000000000000000F03F1000000000000000000000000000000000000000C40A0008 + FF0000000000000000000000000000000078864000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000001000000000000000000E03F1400000000000000000000000000000000000000C40A0008 + + + 1 + ((portb & 0x00000001) & 0x1) >> 0 + 00008000000000000000000000000000E0FFEF400100000000000000000000000000000028706F72746220262030783030303030303031290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000FFFFFFFFFFFFDF3F1400000000000000000000000000000000000000D20A0008 @@ -349,7 +331,7 @@ 1 0 - 0 + 1 18 @@ -428,6 +410,13 @@ + + + 0 + 1 + r0 + + 1 @@ -436,6 +425,30 @@ 0 + + + 2 + 0 + r6 + 0 + + + + + 3 + 0 + r4 + 0 + + + + + 4 + 0 + r5 + 0 + + 0 @@ -456,7 +469,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -746,6 +759,18 @@ 0 0 + + 3 + 4 + 5 + 0 + 0 + 0 + .\Driver\DriverJeuLaser.inc + DriverJeuLaser.inc + 0 + 0 + @@ -756,7 +781,7 @@ 0 4 - 4 + 5 2 0 0 @@ -768,7 +793,7 @@ 4 - 5 + 6 2 0 0 diff --git a/soft/PjtKEIL_StepSon/StepSon.uvprojx b/soft/PjtKEIL_StepSon/StepSon.uvprojx index 2849fe6..3144de9 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvprojx +++ b/soft/PjtKEIL_StepSon/StepSon.uvprojx @@ -408,6 +408,11 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc + @@ -434,7 +439,7 @@ CibleSondeKEIL 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -832,6 +837,11 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc + @@ -1325,6 +1335,11 @@ 4 .\Driver\DriverJeuLaser.lib + + DriverJeuLaser.inc + 5 + .\Driver\DriverJeuLaser.inc +