diff --git a/soft/PjtKEIL_StepDeb_2/Src/Cligno.s b/soft/PjtKEIL_StepDeb_2/Src/Cligno.s index 8a75b7a..6429495 100644 --- a/soft/PjtKEIL_StepDeb_2/Src/Cligno.s +++ b/soft/PjtKEIL_StepDeb_2/Src/Cligno.s @@ -6,25 +6,43 @@ ;Section RAM (read only) : area mesdata,data,readonly + IMPORT GPIOC_Set + IMPORT GPIOC_Clear ;Section RAM (read write): area maram,data,readwrite - +FlagCligno DCW 0 ; =============================================================================================== - + EXPORT timer_callback ;Section ROM code (read only) : area moncode,code,readonly ; écrire le code ici - - - - +timer_callback proc + push {lr} + mov r0, #12 + ldr r2, =FlagCligno + ldr r1, [r2] + cmp r1, #1 + bne Reset + mov r1, #0 + str r1, [r2] + bl GPIOC_Set + pop {lr} + bx lr +Reset + mov r1, #1 + str r1, [r2] + bl GPIOC_Clear + pop {lr} + bx lr + + ENDP - - END \ No newline at end of file + 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 7307daf..1869ee6 100644 --- a/soft/PjtKEIL_StepDeb_2/Src/principal.c +++ b/soft/PjtKEIL_StepDeb_2/Src/principal.c @@ -42,21 +42,3 @@ while (1) { } } - -char FlagCligno; - -void timer_callback(void) -{ - if (FlagCligno==1) - { - FlagCligno=0; - GPIOC_Set(12); - } - else - { - FlagCligno=1; - GPIOC_Clear(12); - } - -} - diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index 8494b7d..4a968a9 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -6,6 +6,7 @@ ;Section RAM (read only) : area mesdata,data,readonly + IMPORT PWM_Set_Value_TIM3_Ch3 IMPORT LongueurSon IMPORT Son @@ -26,6 +27,7 @@ SortieSon DCW 0 ; écrire le code ici CallbackSon proc + push {lr} ldr r0, =IndexSon ; r0 = &IndexSon ldrh r1, [r0] ; r1 = IndexSon @@ -46,6 +48,9 @@ NoReset str r1, [r0] ; IndexSon++; ldr r0, =SortieSon ; r0 = &SortieSon strh r2, [r0] ; SortieSon = ce qu'on veut + mov r0, r2 + bl PWM_Set_Value_TIM3_Ch3 + pop {lr} bx lr ENDP diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index 2dd039c..965367a 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -12,9 +12,10 @@ int main(void) // Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers CLOCK_Configure(); GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); -PWM_Init_ff(TIM3, 3, 720); -Timer_1234_Init_ff(TIM4, 6552); // (91*10^-6)*(72*10^6) = 6552 +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) diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index d8c97ae..4a88dcf 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -215,7 +215,12 @@ 0 `SortieSon - 008000000000000000000000000000905D78864100000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004100000001000000000000000000F03F0D0000000000000000000000000000000000000094080008 + 008000000000000000000000000000905D78864100000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004100000001000000000000000000E03F170000000000000000000000000000000000000094080008 + + + 1 + ((portb & 0x00000001) & 0x11111111) >> 0 + 00800000000000000000000000000000E0FFEF400100000000000000000000000000000028706F72746220262030783030303030303031290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F1700000000000000000000000000000000000000540A0008