diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index 4a968a9..84e1d0d 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -13,7 +13,7 @@ ;Section RAM (read write): area maram,data,readwrite -IndexSon DCW 0 +IndexSon DCW 5512 SortieSon DCW 0 EXPORT SortieSon @@ -21,11 +21,21 @@ SortieSon DCW 0 ; =============================================================================================== EXPORT CallbackSon + EXPORT StartSon ;Section ROM code (read only) : area moncode,code,readonly ; écrire le code ici +StartSon proc + push {lr} + ldr r0, =IndexSon + mov r1, #0 + str r1, [r0] + pop {lr} + bx lr + ENDP + CallbackSon proc push {lr} ldr r0, =IndexSon ; r0 = &IndexSon @@ -35,9 +45,7 @@ CallbackSon proc ldr r3, [r2] ; r3 = LongueurSon cmp r1, r3 - blt NoReset - mov r1, #0 ; si IndexSon >= LongueurSon alors IndexSon = 0 -NoReset + bge DoNothing ldr r3, =Son ; r3 = &Son ldrsh r2, [r3, r1, LSL#1] ; r2 = Son[IndexSon] add r2, #0x8000 ; translater de [-32768;32767] à [0;65535] @@ -50,6 +58,7 @@ NoReset strh r2, [r0] ; SortieSon = ce qu'on veut mov r0, r2 bl PWM_Set_Value_TIM3_Ch3 +DoNothing pop {lr} bx lr diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index 965367a..78d61c0 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -1,6 +1,7 @@ #include "DriverJeuLaser.h" extern void CallbackSon(void); +extern void StartSon(void); int main(void) { @@ -16,10 +17,10 @@ PWM_Init_ff(TIM3, 3, 720); // f_PWM = 72MHz/720 = 100kHz Timer_1234_Init_ff(TIM4, 6552); // periode_son/f_CPU = (91*10^-6)*(72*10^6) = 6552 Active_IT_Debordement_Timer(TIM4, 2, CallbackSon); -//============================================================================ - +//============================================================================ while (1) { + StartSon(); } } diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index 4a88dcf..9c08782 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -215,7 +215,7 @@ 0 `SortieSon - 008000000000000000000000000000905D78864100000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004100000001000000000000000000E03F170000000000000000000000000000000000000094080008 + 0080000000000010572172410000005058E17A4100000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004100000001000000000000000000E03F170000000000000000000000000000000000000094080008 1