diff --git a/Brouillon.txt b/Brouillon.txt new file mode 100644 index 0000000..5d5c27f --- /dev/null +++ b/Brouillon.txt @@ -0,0 +1,17 @@ +int[] tableau = les valeurs; +int SortieSon; +int index = 0; + +int CallbackSon() +{ + echantillon = tableau[index]; + SortieSon = (int)(echantillon * 360 / 32768) + 360; + return SortieSon +} + +while (index<5512) +{ + CallbackSon(); + index++; +} + diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index 8a75b7a..3cc2259 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -11,9 +11,13 @@ area maram,data,readwrite - +SortieSon dcw 0 +Index dcd 0x00000000 ; =============================================================================================== - + EXPORT CallbackSon + EXPORT SortieSon + EXTERN Son + EXTERN LongueurSon @@ -21,10 +25,32 @@ area moncode,code,readonly ; écrire le code ici - - - - - - +CallbackSon proc + push {lr} + ldr r0, =SortieSon + ldr r1, =Son + ldr r2, =Index + ldr r3, =LongueurSon + push {r4} + push {r5} + push {r6} + push {r7} + push {r8} + ldr r4, [r2] ;on stocke la valeur de l'index dans r2. + ldr r5, [r1, r4] ;on stocke la valeur de Son[index] dans r5; + ldr r6, [r0] ; on stocke la valeur de SortieSon dans r6 + mov r7, #360 + mov r8, #32768 + mul r5, r7 + sdiv r5, r8 + adds r5, #360 + str r5, [r0] ; on stocke la valeur calculee dans r0 + adds r4, #1; on incremente r4 qui correspond à la valeur de l'index + ldr r2, [r4]; on stocke la nouvelle valeur de l'index à l'adresse de l'index + pop {r6} + pop {r5} + pop {r4} + pop {pc} + ENDFUNC + END \ No newline at end of file diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index d09be75..0e98767 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -1,7 +1,7 @@ #include "DriverJeuLaser.h" - +extern int CallbackSon(); int main(void) @@ -13,6 +13,12 @@ int main(void) // Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers CLOCK_Configure(); +// configuration du Timer 4 en débordement 100ms +u32 duree = 655200; //91*7200 +Timer_1234_Init_ff(TIM4, duree); + +//** Placez votre code là ** // +Active_IT_Debordement_Timer(TIM4, 2, CallbackSon); diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index a13d7da..300106f 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 @@ -75,7 +75,7 @@ 1 0 - 0 + 1 18 @@ -460,7 +460,7 @@ 1 0 - 1 + 0 18 @@ -666,6 +666,38 @@ + + Son + 1 + 0 + 0 + 0 + + 4 + 4 + 2 + 0 + 0 + 0 + .\Src\GestionSon.s + GestionSon.s + 0 + 0 + + + 4 + 5 + 2 + 0 + 0 + 0 + .\Src\bruitverre.asm + bruitverre.asm + 0 + 0 + + + ::CMSIS 0 diff --git a/soft/PjtKEIL_StepSon/StepSon.uvprojx b/soft/PjtKEIL_StepSon/StepSon.uvprojx index d0b5c10..aa24a2f 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 + + + GestionSon.s + 2 + .\Src\GestionSon.s + + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + ::CMSIS @@ -819,6 +834,21 @@ + + Son + + + GestionSon.s + 2 + .\Src\GestionSon.s + + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + ::CMSIS @@ -1297,6 +1327,21 @@ + + Son + + + GestionSon.s + 2 + .\Src\GestionSon.s + + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + ::CMSIS @@ -1322,12 +1367,7 @@ - <Project Info> - - - - - + StepSon 0 1