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
|
PRESERVE8
|
||||||
THUMB
|
THUMB
|
||||||
|
extern Son
|
||||||
|
extern LongueurSon
|
||||||
export CallbackSon
|
export CallbackSon
|
||||||
|
export SortieSon
|
||||||
|
export Index
|
||||||
|
include ../Driver/DriverJeuLaser.inc
|
||||||
|
|
||||||
; ====================== zone de réservation de données, ======================================
|
; ====================== zone de réservation de données, ======================================
|
||||||
;Section RAM (read only) :
|
;Section RAM (read only) :
|
||||||
|
@ -9,31 +14,65 @@
|
||||||
|
|
||||||
;Section RAM (read write):
|
;Section RAM (read write):
|
||||||
area maram,data,readwrite
|
area maram,data,readwrite
|
||||||
|
|
||||||
|
|
||||||
SortieSon dcd 0x0000
|
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) :
|
;Section ROM code (read only) :
|
||||||
area moncode,code,readonly
|
area moncode,code,readonly
|
||||||
; écrire le code ici
|
; écrire le code ici
|
||||||
|
|
||||||
CallbackSon proc
|
CallbackSon proc
|
||||||
;
|
;
|
||||||
ldrh r2, Son
|
;Si Indice<LongueurSon
|
||||||
ldrh r3, Index
|
;{
|
||||||
ldrh r1, [r2,r3]
|
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
|
add r1, #32768
|
||||||
|
;R0=R0/92
|
||||||
mov r0, #92
|
mov r0, #92
|
||||||
udiv r1, r0
|
udiv r1, r0
|
||||||
strh r1, SortieSon
|
;Sortir la valeur PWM en fonction de R0
|
||||||
add r3, #16
|
;ldr r5, =SortieSon
|
||||||
strh r3, Index
|
str r1, [r0]
|
||||||
bx lr
|
bl PWM_Set_Value_TIM3_Ch3
|
||||||
|
;Indice++
|
||||||
|
add r4, #1
|
||||||
|
str r4,[r3]
|
||||||
|
pop {pc}
|
||||||
|
;}
|
||||||
|
|
||||||
|
Depassement
|
||||||
|
pop {pc}
|
||||||
endp
|
endp
|
||||||
|
|
||||||
END
|
END
|
|
@ -3,6 +3,8 @@
|
||||||
#include "DriverJeuLaser.h"
|
#include "DriverJeuLaser.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern void CallbackSon(void);
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
@ -15,10 +17,9 @@ int main(void)
|
||||||
CLOCK_Configure();
|
CLOCK_Configure();
|
||||||
|
|
||||||
Timer_1234_Init_ff(TIM4,6552);
|
Timer_1234_Init_ff(TIM4,6552);
|
||||||
Timer_1234_Init_ff(TIM3,6552);
|
|
||||||
Active_IT_Debordement_Timer(TIM4,2,CallbackSon);
|
Active_IT_Debordement_Timer(TIM4,2,CallbackSon);
|
||||||
unsigned short int PWM_Init_ff(TIM3,4,720);
|
PWM_Init_ff(TIM3,3,720);
|
||||||
char GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
|
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>0</IsCurrentTarget>
|
<IsCurrentTarget>1</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>18</CpuCode>
|
<CpuCode>18</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
|
@ -154,6 +154,26 @@
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<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>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
</Tracepoint>
|
</Tracepoint>
|
||||||
|
@ -174,7 +194,7 @@
|
||||||
<AscS3>0</AscS3>
|
<AscS3>0</AscS3>
|
||||||
<aSer3>0</aSer3>
|
<aSer3>0</aSer3>
|
||||||
<eProf>0</eProf>
|
<eProf>0</eProf>
|
||||||
<aLa>0</aLa>
|
<aLa>1</aLa>
|
||||||
<aPa1>0</aPa1>
|
<aPa1>0</aPa1>
|
||||||
<AscS4>0</AscS4>
|
<AscS4>0</AscS4>
|
||||||
<aSer4>0</aSer4>
|
<aSer4>0</aSer4>
|
||||||
|
@ -199,8 +219,8 @@
|
||||||
<LogicAnalyzers>
|
<LogicAnalyzers>
|
||||||
<Wi>
|
<Wi>
|
||||||
<IntNumber>0</IntNumber>
|
<IntNumber>0</IntNumber>
|
||||||
<FirstString>((portb & 0x00000002) >> 1 & 0x2) >> 1</FirstString>
|
<FirstString>`portb</FirstString>
|
||||||
<SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F160000000000000000000000000000000000000096020008</SecondString>
|
<SecondString>00800000000000000000000000000000E0FFEF4000000000000000000000000000000000706F7274620000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F1A00000000000000000000000000000000000000B40A0008</SecondString>
|
||||||
</Wi>
|
</Wi>
|
||||||
</LogicAnalyzers>
|
</LogicAnalyzers>
|
||||||
<DebugDescription>
|
<DebugDescription>
|
||||||
|
@ -460,7 +480,7 @@
|
||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>1</IsCurrentTarget>
|
<IsCurrentTarget>0</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>18</CpuCode>
|
<CpuCode>18</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<TargetName>Simu</TargetName>
|
<TargetName>Simu</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<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>
|
<uAC6>0</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
|
|
Loading…
Reference in a new issue