forked from acco/chti23
Sortie Son finie, programme PWM compile mais pas testé sortie
This commit is contained in:
parent
32ceb6a175
commit
9d4ac64b8f
4 changed files with 79 additions and 19 deletions
|
@ -1,6 +1,11 @@
|
|||
PRESERVE8
|
||||
THUMB
|
||||
extern Son
|
||||
extern LongueurSon
|
||||
export CallbackSon
|
||||
export SortieSon
|
||||
export Index
|
||||
include ../Driver/DriverJeuLaser.inc
|
||||
|
||||
; ====================== zone de réservation de données, ======================================
|
||||
;Section RAM (read only) :
|
||||
|
@ -9,31 +14,65 @@
|
|||
|
||||
;Section RAM (read write):
|
||||
area maram,data,readwrite
|
||||
|
||||
|
||||
SortieSon dcd 0x0000
|
||||
Index dcd 0
|
||||
Index dcd 0x0000
|
||||
; ===============================================================================================
|
||||
|
||||
|
||||
;Si Indice<LongueurSon
|
||||
;{
|
||||
;R0<-Son[Index]
|
||||
;R0=R0+32768
|
||||
;R0=R0/92
|
||||
;Sortir la valeur PWM en fonction de R0
|
||||
;Indice++
|
||||
;}
|
||||
|
||||
|
||||
|
||||
;On place l'adresse de Son dans un registre
|
||||
;On place la valeur à cette adresse dans un deuxième registre
|
||||
;On lui ajoute 32768 pour se placer dans l'intervalle [0,65535]
|
||||
;On divise par 92 pour se placer dans l'intervalle [0,712]
|
||||
;On place le résultat dans SortieSon
|
||||
;On incrémente l'indice du tableau Son de 16 bits
|
||||
|
||||
;Section ROM code (read only) :
|
||||
area moncode,code,readonly
|
||||
; écrire le code ici
|
||||
|
||||
CallbackSon proc
|
||||
;
|
||||
ldrh r2, Son
|
||||
ldrh r3, Index
|
||||
ldrh r1, [r2,r3]
|
||||
;
|
||||
;Si Indice<LongueurSon
|
||||
;{
|
||||
push {lr}
|
||||
ldr r0, =LongueurSon
|
||||
ldr r1, [r0]
|
||||
ldr r3,=Index
|
||||
ldr r4,[r3]
|
||||
cmp r4,r1
|
||||
bge Depassement
|
||||
;R1<-Son[Index]
|
||||
ldr r2,=Son ;on place l'adresse de Son dans un registre
|
||||
ldrsh r1, [r2,r4,lsl #1]
|
||||
;R1=R1+32768
|
||||
add r1, #32768
|
||||
;R0=R0/92
|
||||
mov r0, #92
|
||||
udiv r1, r0
|
||||
strh r1, SortieSon
|
||||
add r3, #16
|
||||
strh r3, Index
|
||||
bx lr
|
||||
;Sortir la valeur PWM en fonction de R0
|
||||
;ldr r5, =SortieSon
|
||||
str r1, [r0]
|
||||
bl PWM_Set_Value_TIM3_Ch3
|
||||
;Indice++
|
||||
add r4, #1
|
||||
str r4,[r3]
|
||||
pop {pc}
|
||||
;}
|
||||
|
||||
Depassement
|
||||
pop {pc}
|
||||
endp
|
||||
|
||||
END
|
|
@ -3,6 +3,8 @@
|
|||
#include "DriverJeuLaser.h"
|
||||
|
||||
|
||||
extern void CallbackSon(void);
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
@ -15,10 +17,9 @@ int main(void)
|
|||
CLOCK_Configure();
|
||||
|
||||
Timer_1234_Init_ff(TIM4,6552);
|
||||
Timer_1234_Init_ff(TIM3,6552);
|
||||
Active_IT_Debordement_Timer(TIM4,2,CallbackSon);
|
||||
unsigned short int PWM_Init_ff(TIM3,4,720);
|
||||
char GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
|
||||
PWM_Init_ff(TIM3,3,720);
|
||||
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
|
@ -154,6 +154,26 @@
|
|||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>Index</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>1</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>SortieSon</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<MemoryWindow1>
|
||||
<Mm>
|
||||
<WinNumber>1</WinNumber>
|
||||
<SubType>10</SubType>
|
||||
<ItemText>0x200000A0</ItemText>
|
||||
<AccSizeX>0</AccSizeX>
|
||||
</Mm>
|
||||
</MemoryWindow1>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
|
@ -174,7 +194,7 @@
|
|||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aLa>1</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
|
@ -199,8 +219,8 @@
|
|||
<LogicAnalyzers>
|
||||
<Wi>
|
||||
<IntNumber>0</IntNumber>
|
||||
<FirstString>((portb & 0x00000002) >> 1 & 0x2) >> 1</FirstString>
|
||||
<SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F160000000000000000000000000000000000000096020008</SecondString>
|
||||
<FirstString>`portb</FirstString>
|
||||
<SecondString>00800000000000000000000000000000E0FFEF4000000000000000000000000000000000706F7274620000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F1A00000000000000000000000000000000000000B40A0008</SecondString>
|
||||
</Wi>
|
||||
</LogicAnalyzers>
|
||||
<DebugDescription>
|
||||
|
@ -460,7 +480,7 @@
|
|||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<TargetName>Simu</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::.\ARMCC</pCCUsed>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
|
|
Loading…
Reference in a new issue