diff --git a/soft/PjtKEIL_StepDeb_1/BacASable.uvoptx b/soft/PjtKEIL_StepDeb_1/BacASable.uvoptx
index ed76561..c1cf44c 100644
--- a/soft/PjtKEIL_StepDeb_1/BacASable.uvoptx
+++ b/soft/PjtKEIL_StepDeb_1/BacASable.uvoptx
@@ -10,7 +10,7 @@
*.s*; *.src; *.a*
*.obj; *.o
*.lib
- *.txt; *.h; *.inc
+ *.txt; *.h; *.inc; *.md
*.plm
*.cpp
0
@@ -75,7 +75,7 @@
1
0
- 1
+ 0
18
@@ -154,6 +154,21 @@
+
+
+ 0
+ 1
+ VarTime
+
+
+
+
+ 1
+ 0
+ 0x20000000
+ 0
+
+
0
@@ -174,7 +189,7 @@
0
0
0
- 0
+ 1
0
0
0
@@ -196,6 +211,18 @@
+
+
+ 0
+ ((portb & 0x00000002) >> 1 & 0x2) >> 1
+ 00000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F240000000000000000000000000000000000000004010008
+
+
+ 1
+ VarTime >> 1
+ FF00000000000000000000000000000080842E410000000000000000000000000000000056617254696D65000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000002000000000000000000E03F2400000000000000000000000000000000000000D8030008
+
+
1
0
@@ -260,7 +287,7 @@
1
0
- 0
+ 1
18
@@ -353,7 +380,7 @@
0
1
- 1
+ 0
0
0
0
diff --git a/soft/PjtKEIL_StepDeb_1/BacASable.uvprojx b/soft/PjtKEIL_StepDeb_1/BacASable.uvprojx
index 9c192f5..2318c0c 100644
--- a/soft/PjtKEIL_StepDeb_1/BacASable.uvprojx
+++ b/soft/PjtKEIL_StepDeb_1/BacASable.uvprojx
@@ -10,7 +10,7 @@
Simu
0x4
ARM-ADS
- 5060750::V5.06 update 6 (build 750)::.\ARMCC
+ 5060960::V5.06 update 7 (build 960)::.\ARMCC
0
@@ -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
@@ -1338,11 +1338,6 @@
<Project Info>
-
-
-
-
-
0
1
diff --git a/soft/PjtKEIL_StepDeb_1/Src/Delay.s b/soft/PjtKEIL_StepDeb_1/Src/Delay.s
index bf49175..b88d54f 100644
--- a/soft/PjtKEIL_StepDeb_1/Src/Delay.s
+++ b/soft/PjtKEIL_StepDeb_1/Src/Delay.s
@@ -10,17 +10,16 @@
;Section RAM (read write):
area maram,data,readwrite
-VarTime dcd 0
-
+VarTime dcd 0 ; adresse
; ===============================================================================================
;constantes (équivalent du #define en C)
-TimeValue equ 900000
+TimeValue equ 900000 ; valeur
EXPORT Delay_100ms ; la fonction Delay_100ms est rendue publique donc utilisable par d'autres modules.
-
+ export VarTime
;Section ROM code (read only) :
area moncode,code,readonly
@@ -41,19 +40,19 @@ TimeValue equ 900000
Delay_100ms proc
- ldr r0,=VarTime
+ ldr r0,=VarTime ; r0=VarTime(VarTime est une adresse)
- ldr r1,=TimeValue
- str r1,[r0]
+ ldr r1,=TimeValue ; r1=TimeValue (TimeValue est une valeur)
+ str r1,[r0] ; TimeValue est stockée dans l'adresse stockée dans R0, c'est-à-dire dans VarTime
BoucleTempo
- ldr r1,[r0]
+ ldr r1,[r0] ; r1 = *r0 r1 = VarTime en C
- subs r1,#1
- str r1,[r0]
- bne BoucleTempo
+ subs r1,#1 ; r1 = r1 - 1
+ str r1,[r0] ; *r0 = r1 VarTime = r1 en C
+ bne BoucleTempo ; boucle while
- bx lr
+ bx lr ; on retourne à l'adresse stockée dans le registre lr
endp
diff --git a/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx b/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx
index f1315bb..4113915 100644
--- a/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx
+++ b/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx
@@ -10,7 +10,7 @@
*.s*; *.src; *.a*
*.obj; *.o
*.lib
- *.txt; *.h; *.inc
+ *.txt; *.h; *.inc; *.md
*.plm
*.cpp
0
@@ -75,7 +75,7 @@
1
0
- 1
+ 0
18
@@ -153,7 +153,24 @@
-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
+ 27
+ 1
+ 134220352
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ .\Src\Cligno.s
+
+ \\BacASable\Src/Cligno.s\27
+
+
0
@@ -174,7 +191,7 @@
0
0
0
- 0
+ 1
0
0
0
@@ -267,7 +284,7 @@
1
0
- 0
+ 1
18
@@ -374,7 +391,7 @@
0
0
0
- 0
+ 1
0
0
0
diff --git a/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx b/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx
index d99d0f0..f01d9e2 100644
--- a/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx
+++ b/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx
@@ -10,7 +10,7 @@
Simu
0x4
ARM-ADS
- 5060750::V5.06 update 6 (build 750)::.\ARMCC
+ 5060960::V5.06 update 7 (build 960)::.\ARMCC
0
@@ -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
@@ -1338,11 +1338,6 @@
<Project Info>
-
-
-
-
-
0
1
diff --git a/soft/PjtKEIL_StepDeb_2/Src/Cligno.s b/soft/PjtKEIL_StepDeb_2/Src/Cligno.s
index 8a75b7a..f1b671a 100644
--- a/soft/PjtKEIL_StepDeb_2/Src/Cligno.s
+++ b/soft/PjtKEIL_StepDeb_2/Src/Cligno.s
@@ -1,7 +1,9 @@
PRESERVE8
THUMB
-
+ include Driver/DriverJeuLaser.inc
+
+ export timer_callback
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
area mesdata,data,readonly
@@ -9,7 +11,7 @@
;Section RAM (read write):
area maram,data,readwrite
-
+FlagCligno dcd 0
; ===============================================================================================
@@ -19,12 +21,25 @@
;Section ROM code (read only) :
area moncode,code,readonly
-; écrire le code ici
+; écrire le code ici
-
-
-
-
-
-
- END
\ No newline at end of file
+timer_callback
+ push {LR}
+ ldr r1, =FlagCligno
+ ldr r1,[r1]
+ MOV r0, #1
+ CMP r1, #0
+ BEQ si_zero ;boucle si =1
+ BL GPIOB_Set
+ MOV r1, #0
+ B fin
+
+si_zero BL GPIOB_Clear
+ MOV r1, #1
+
+fin ldr r2, =FlagCligno
+ str r1, [r2]
+ pop {LR}
+ BX LR
+
+ END
\ No newline at end of file
diff --git a/soft/PjtKEIL_StepDeb_2/Src/principal.c b/soft/PjtKEIL_StepDeb_2/Src/principal.c
index 4d726a1..27387a4 100644
--- a/soft/PjtKEIL_StepDeb_2/Src/principal.c
+++ b/soft/PjtKEIL_StepDeb_2/Src/principal.c
@@ -17,7 +17,8 @@ CLOCK_Configure();
// configuration du Timer 4 en débordement 100ms
//** Placez votre code là ** //
-
+ Timer_1234_Init_ff(TIM4,7200000);
+ Active_IT_Debordement_Timer(TIM4,2, timer_callback);
// Activation des interruptions issues du Timer 4
@@ -42,20 +43,5 @@ while (1)
}
}
-char FlagCligno;
-void timer_callback(void)
-{
- if (FlagCligno==1)
- {
- FlagCligno=0;
- GPIOB_Set(1);
- }
- else
- {
- FlagCligno=1;
- GPIOB_Clear(1);
- }
-
-}
diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.h b/soft/PjtKEIL_StepSon/Src/GestionSon.h
new file mode 100644
index 0000000..735639e
--- /dev/null
+++ b/soft/PjtKEIL_StepSon/Src/GestionSon.h
@@ -0,0 +1,5 @@
+#define GestionSon
+
+void CallbackSon (void)
+void StartSon (void)
+
diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s
index 8a75b7a..c59930d 100644
--- a/soft/PjtKEIL_StepSon/Src/GestionSon.s
+++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s
@@ -1,7 +1,13 @@
PRESERVE8
THUMB
-
+ include Driver/DriverJeuLaser.inc
+
+ export CallbackSon
+ export StartSon
+ import Son
+ import LongueurSon
+ export SortieSon
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
area mesdata,data,readonly
@@ -9,7 +15,9 @@
;Section RAM (read write):
area maram,data,readwrite
-
+SortieSon dcw 0
+Index dcd LongueurSon
+
; ===============================================================================================
@@ -21,10 +29,46 @@
area moncode,code,readonly
; écrire le code ici
+CallbackSon ; corps de la fonction Callback
+ push {LR}
+ push {r4-r7}
+ ldr r0, =Son ; L'adresse du tableau de sons est stockée dans r0
+ ldr r1, =Index ; L'adresse de l'index de table est stockée dans r1
+ ldr r2, [r1] ; L'index actuel est stocké dans r2
+ ldr r3, =LongueurSon ; L'adresse de la taille du tableau est stockée dans r3-
+ ldr r4, [r3] ; La valeur de la taille du tableau est stockée dans r4
+
+ cmp r2, r4 ; on vérifie qu'on n'est pas à la fin du tableau
+ beq fin
+
+ ldr r5, =SortieSon ; L'adresse de sortie est stockée dans r5
+ ldrsh r6, [r0, r2, lsl #1] ; La valeur de l'échantillon pointée par l'index est stockée dans r6
+ mov r7, #720 ; Mise à l'échelle
+ mul r6, r7
+ asr r6, #16
+ add r6, #360
+ mov r0, r6
+ add r2, r2, #1 ; Incrémentation de l'index
+ str r2, [r1] ; la nouvelle valeur de l'index est envoyée dans index
+ str r6, [r5] ; la valeur de l'échantillon est stockée dans SortieSon
+ bl PWM_Set_Value_TIM3_Ch3 ; Mise à jour du rapport cyclique dans le cas de l'utilisation de la PWM
+
+fin pop {r4-r7}
+ pop {LR}
+ bx LR
+
+StartSon ; corps de la fonction StartSon
+ ldr r1, =Index ; L'adresse de l'index de table est stockée dans r1
+ mov r2, #0 ; Mise à 0
+ str r2, [r1] ; La nouvelle valeur de l'index (0) est envoyée dans index
+ bx LR
+
-
+ END
-
- END
\ No newline at end of file
+; 8. Signal PWM à l'état haut (3,3V) si CompValue est supérieure au Compteur
+; Signal PWM à l'état bas (0V) si CompValue est inférieur au Compteur
+
+;15. Fc = 1/(2*pi*RC). On choisit R=1,8 kOhms et on trouve après calcul C=22,1 nF
\ No newline at end of file
diff --git a/soft/PjtKEIL_StepSon/Src/bruitverre.asm b/soft/PjtKEIL_StepSon/Src/bruitverre.asm
index bf5ba29..3cbf878 100644
--- a/soft/PjtKEIL_StepSon/Src/bruitverre.asm
+++ b/soft/PjtKEIL_StepSon/Src/bruitverre.asm
@@ -9,7 +9,7 @@
export Son
LongueurSon DCD 5512
-PeriodeSonMicroSec DCD 91
+PeriodeSonMicroSec DCD 91
Son
DCW -6911
DCW 20666
diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c
index d09be75..a74ad51 100644
--- a/soft/PjtKEIL_StepSon/Src/principal.c
+++ b/soft/PjtKEIL_StepSon/Src/principal.c
@@ -2,8 +2,9 @@
#include "DriverJeuLaser.h"
-
-
+void CallbackSon(void); //définie en langage d'assemblage
+extern void StartSon(void);
+ int bouton =0 ;
int main(void)
{
@@ -14,15 +15,27 @@ int main(void)
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
CLOCK_Configure();
-
+//Configuration timer 4
+ Timer_1234_Init_ff(TIM4,6552);
+ Active_IT_Debordement_Timer(TIM4,2, CallbackSon);
+
+//Configuration PWM
+ PWM_Init_ff (TIM3, 3, 720); // Fréquence de la PWM = PeriodeSonMicroSec / 720
+GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
+
+StartSon();
//============================================================================
while (1)
{
+ if(bouton==1){
+ StartSon();
+ bouton=0;
+ }
}
}
diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx
index a13d7da..99e0f92 100644
--- a/soft/PjtKEIL_StepSon/StepSon.uvoptx
+++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx
@@ -10,7 +10,7 @@
*.s*; *.src; *.a*
*.obj; *.o
*.lib
- *.txt; *.h; *.inc
+ *.txt; *.h; *.inc; *.md
*.plm
*.cpp
0
@@ -154,6 +154,14 @@
+
+
+ 1
+ 0
+ 0x200000A0
+ 0
+
+
0
@@ -174,7 +182,7 @@
0
0
0
- 0
+ 1
0
0
0
@@ -199,8 +207,13 @@
0
- ((portb & 0x00000002) >> 1 & 0x2) >> 1
- FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F160000000000000000000000000000000000000096020008
+ ((portb & 0x00000001) & 0x1) >> 0
+ 00800000000000000000000000000000E0FFEF400100000000000000000000000000000028706F72746220262030783030303030303031290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F1700000000000000000000000000000000000000B40A0008
+
+
+ 1
+ `SortieSon
+ FF0000000000000000000000000000000000894000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000002000000000000000000E03F1700000000000000000000000000000000000000B40A0008
@@ -267,7 +280,7 @@
1
0
- 0
+ 1
18
@@ -346,6 +359,13 @@
+
+
+ 0
+ 1
+ bouton
+
+
1
@@ -374,7 +394,7 @@
0
0
0
- 0
+ 1
0
0
0
@@ -460,7 +480,7 @@
1
0
- 1
+ 0
18
@@ -666,6 +686,38 @@
+
+ Son
+ 1
+ 0
+ 0
+ 0
+
+ 4
+ 4
+ 2
+ 0
+ 0
+ 0
+ .\Src\bruitverre.asm
+ bruitverre.asm
+ 0
+ 0
+
+
+ 4
+ 5
+ 2
+ 0
+ 0
+ 0
+ .\Src\GestionSon.s
+ GestionSon.s
+ 0
+ 0
+
+
+
::CMSIS
0
diff --git a/soft/PjtKEIL_StepSon/StepSon.uvprojx b/soft/PjtKEIL_StepSon/StepSon.uvprojx
index d0b5c10..33cf5aa 100644
--- a/soft/PjtKEIL_StepSon/StepSon.uvprojx
+++ b/soft/PjtKEIL_StepSon/StepSon.uvprojx
@@ -10,7 +10,7 @@
Simu
0x4
ARM-ADS
- 5060750::V5.06 update 6 (build 750)::.\ARMCC
+ 5060960::V5.06 update 7 (build 960)::.\ARMCC
0
@@ -410,6 +410,21 @@
+
+ Son
+
+
+ bruitverre.asm
+ 2
+ .\Src\bruitverre.asm
+
+
+ GestionSon.s
+ 2
+ .\Src\GestionSon.s
+
+
+
::CMSIS
@@ -419,7 +434,7 @@
CibleSondeKEIL
0x4
ARM-ADS
- 5060750::V5.06 update 6 (build 750)::.\ARMCC
+ 5060960::V5.06 update 7 (build 960)::.\ARMCC
0
@@ -819,6 +834,21 @@
+
+ Son
+
+
+ bruitverre.asm
+ 2
+ .\Src\bruitverre.asm
+
+
+ GestionSon.s
+ 2
+ .\Src\GestionSon.s
+
+
+
::CMSIS
@@ -897,7 +927,7 @@
CibleSondeST
0x4
ARM-ADS
- 5060750::V5.06 update 6 (build 750)::.\ARMCC
+ 5060960::V5.06 update 7 (build 960)::.\ARMCC
0
@@ -1297,6 +1327,21 @@
+
+ Son
+
+
+ bruitverre.asm
+ 2
+ .\Src\bruitverre.asm
+
+
+ GestionSon.s
+ 2
+ .\Src\GestionSon.s
+
+
+
::CMSIS
@@ -1322,12 +1367,7 @@
- <Project Info>
-
-
-
-
-
+ StepSon
0
1
diff --git a/soft/PjtKEIL_StepSon/spice/PWM.asc b/soft/PjtKEIL_StepSon/spice/PWM.asc
new file mode 100644
index 0000000..5cbcda5
--- /dev/null
+++ b/soft/PjtKEIL_StepSon/spice/PWM.asc
@@ -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