Debut StepSon reste a corriger SortieSon et faire PWM

This commit is contained in:
Baptiste Henriet 2023-04-07 08:22:51 +02:00
parent 15cdcee56f
commit e92068fbe2
11 changed files with 257 additions and 60 deletions

View file

@ -10,7 +10,7 @@
<aExt>*.s*; *.src; *.a*</aExt> <aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt> <oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt> <lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt> <tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt> <pExt>*.plm</pExt>
<CppX>*.cpp</CppX> <CppX>*.cpp</CppX>
<nMigrate>0</nMigrate> <nMigrate>0</nMigrate>
@ -75,7 +75,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>
@ -153,7 +153,55 @@
<Name>-U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name> <Name>-U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
</SetRegEntry> </SetRegEntry>
</TargetDriverDllRegistry> </TargetDriverDllRegistry>
<Breakpoint/> <Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>28</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218682</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\Src\principal.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\BacASable\Src/principal.c\28</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>30</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218692</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\Src\principal.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\BacASable\Src/principal.c\30</Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>VarTime</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>0</SubType>
<ItemText>0x080003E0</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<Tracepoint> <Tracepoint>
<THDelay>0</THDelay> <THDelay>0</THDelay>
</Tracepoint> </Tracepoint>
@ -260,7 +308,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>
@ -339,6 +387,13 @@
</SetRegEntry> </SetRegEntry>
</TargetDriverDllRegistry> </TargetDriverDllRegistry>
<Breakpoint/> <Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>VarTime</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1> <MemoryWindow1>
<Mm> <Mm>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
@ -609,7 +664,7 @@
<GroupNumber>1</GroupNumber> <GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber> <FileNumber>1</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>.\Src\principal.c</PathWithFileName> <PathWithFileName>.\Src\principal.c</PathWithFileName>

View file

@ -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>
@ -424,7 +424,7 @@
<TargetName>CibleSondeKEIL</TargetName> <TargetName>CibleSondeKEIL</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>
@ -1338,11 +1338,6 @@
<Layers> <Layers>
<Layer> <Layer>
<LayName>&lt;Project Info&gt;</LayName> <LayName>&lt;Project Info&gt;</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>0</LayTarg> <LayTarg>0</LayTarg>
<LayPrjMark>1</LayPrjMark> <LayPrjMark>1</LayPrjMark>
</Layer> </Layer>

View file

@ -1,6 +1,6 @@
PRESERVE8 PRESERVE8
THUMB THUMB
; ====================== zone de réservation de données, ====================================== ; ====================== zone de réservation de données, ======================================
;Section RAM (read only) : ;Section RAM (read only) :
@ -12,7 +12,7 @@
VarTime dcd 0 VarTime dcd 0
; =============================================================================================== ; ===============================================================================================
;constantes (équivalent du #define en C) ;constantes (équivalent du #define en C)
@ -20,8 +20,7 @@ TimeValue equ 900000
EXPORT Delay_100ms ; la fonction Delay_100ms est rendue publique donc utilisable par d'autres modules. EXPORT Delay_100ms ; la fonction Delay_100ms est rendue publique donc utilisable par d'autres modules.
EXPORT VarTime
;Section ROM code (read only) : ;Section ROM code (read only) :
area moncode,code,readonly area moncode,code,readonly
@ -44,17 +43,18 @@ Delay_100ms proc
ldr r0,=VarTime ldr r0,=VarTime
ldr r1,=TimeValue ldr r1,=TimeValue
str r1,[r0] str r1,[r0]; TimeValue rangee a l adresse de r0
BoucleTempo BoucleTempo
ldr r1,[r0] ldr r1,[r0] ;r1 = valeur contenue à l'adresse de r0, = TimeValue - une constante
subs r1,#1 subs r1,#1
str r1,[r0] ;r1 = r1 - 1
bne BoucleTempo str r1,[r0] ; rangee a l adresse de r0
bne BoucleTempo ;branch vers le début de BoucleTempo si la valeur à l'adresse de r0 != 0
bx lr bx lr ; branch permettant le retour de la fonction
endp endp ; fin de la procedure delay_100ms
END END

View file

@ -10,7 +10,7 @@
<aExt>*.s*; *.src; *.a*</aExt> <aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt> <oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt> <lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt> <tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt> <pExt>*.plm</pExt>
<CppX>*.cpp</CppX> <CppX>*.cpp</CppX>
<nMigrate>0</nMigrate> <nMigrate>0</nMigrate>
@ -154,6 +154,26 @@
</SetRegEntry> </SetRegEntry>
</TargetDriverDllRegistry> </TargetDriverDllRegistry>
<Breakpoint/> <Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>portb</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>FlagCligno</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>0</SubType>
<ItemText>0x2000047C</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>
@ -200,7 +220,7 @@
<Wi> <Wi>
<IntNumber>0</IntNumber> <IntNumber>0</IntNumber>
<FirstString>((portb &amp; 0x00000002) &gt;&gt; 1 &amp; 0x2) &gt;&gt; 1</FirstString> <FirstString>((portb &amp; 0x00000002) &gt;&gt; 1 &amp; 0x2) &gt;&gt; 1</FirstString>
<SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F160000000000000000000000000000000000000096020008</SecondString> <SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F170000000000000000000000000000000000000096020008</SecondString>
</Wi> </Wi>
</LogicAnalyzers> </LogicAnalyzers>
<DebugDescription> <DebugDescription>
@ -374,7 +394,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>

View file

@ -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>
@ -1338,11 +1338,6 @@
<Layers> <Layers>
<Layer> <Layer>
<LayName>&lt;Project Info&gt;</LayName> <LayName>&lt;Project Info&gt;</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>0</LayTarg> <LayTarg>0</LayTarg>
<LayPrjMark>1</LayPrjMark> <LayPrjMark>1</LayPrjMark>
</Layer> </Layer>

View file

@ -1,7 +1,8 @@
PRESERVE8 PRESERVE8
THUMB THUMB
include ../Driver/DriverJeuLaser.inc
export timer_callback
; ====================== zone de réservation de données, ====================================== ; ====================== zone de réservation de données, ======================================
;Section RAM (read only) : ;Section RAM (read only) :
area mesdata,data,readonly area mesdata,data,readonly
@ -10,8 +11,9 @@
;Section RAM (read write): ;Section RAM (read write):
area maram,data,readwrite area maram,data,readwrite
FlagCligno dcd 0
; =============================================================================================== ; ===============================================================================================
@ -20,11 +22,55 @@
;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
EXPORT FlagCligno
;void timer_callback(void)
;{
; if (FlagCligno==1)
; {
; FlagCligno=0;
; GPIOB_Set(1);
; }
; else
; {
; FlagCligno=1;
; GPIOB_Clear(1);
; }
;}
;void timer_callback(void)
timer_callback proc
;{
push {lr}
ldr r1,=FlagCligno
ldr r0, [r1]
cmp r0, #0
beq flag_nul
; if (FlagCligno==1)
; {
mov r0, #0
str r0, [r1]
mov r0, #1
bl GPIOB_Set
pop {pc}
; FlagCligno=0;
; GPIOB_Set(1);
; }
; else
flag_nul
; {
mov r0, #1
str r0, [r1]
bl GPIOB_Clear
; FlagCligno=1;
; GPIOB_Clear(1);
; }
;}
pop {pc}
endp
END END

View file

@ -2,7 +2,7 @@
#include "DriverJeuLaser.h" #include "DriverJeuLaser.h"
void timer_callback(void); extern void timer_callback(void);
int main(void) int main(void)
{ {
@ -18,6 +18,8 @@ CLOCK_Configure();
//** Placez votre code là ** // //** Placez votre code là ** //
Timer_1234_Init_ff(TIM4,7200000);
// Activation des interruptions issues du Timer 4 // Activation des interruptions issues du Timer 4
@ -25,7 +27,7 @@ CLOCK_Configure();
// cette fonction (si écrite en ASM) doit être conforme à l'AAPCS // cette fonction (si écrite en ASM) doit être conforme à l'AAPCS
//** Placez votre code là ** // //** Placez votre code là ** //
Active_IT_Debordement_Timer(TIM4,2,timer_callback);
// configuration de PortB.1 (PB1) en sortie push-pull // configuration de PortB.1 (PB1) en sortie push-pull
@ -39,9 +41,10 @@ GPIO_Configure(GPIOB, 1, OUTPUT, OUTPUT_PPULL);
while (1) while (1)
{ {
} }
} }
/*
char FlagCligno; char FlagCligno;
void timer_callback(void) void timer_callback(void)
@ -56,6 +59,5 @@ void timer_callback(void)
FlagCligno=1; FlagCligno=1;
GPIOB_Clear(1); GPIOB_Clear(1);
} }
} }
*/

View file

@ -1,6 +1,6 @@
PRESERVE8 PRESERVE8
THUMB THUMB
export CallbackSon
; ====================== zone de réservation de données, ====================================== ; ====================== zone de réservation de données, ======================================
;Section RAM (read only) : ;Section RAM (read only) :
@ -11,7 +11,8 @@
area maram,data,readwrite area maram,data,readwrite
SortieSon dcd 0x0000
Index dcd 0
; =============================================================================================== ; ===============================================================================================
@ -21,10 +22,18 @@
area moncode,code,readonly area moncode,code,readonly
; écrire le code ici ; écrire le code ici
CallbackSon proc
;
ldrh r2, Son
ldrh r3, Index
ldrh r1, [r2,r3]
add r1, #32768
mov r0, #92
udiv r1, r0
strh r1, SortieSon
add r3, #16
strh r3, Index
bx lr
endp
END END

View file

@ -14,8 +14,11 @@ int main(void)
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers // Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
CLOCK_Configure(); 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);
//============================================================================ //============================================================================

View file

@ -10,7 +10,7 @@
<aExt>*.s*; *.src; *.a*</aExt> <aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt> <oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt> <lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt> <tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt> <pExt>*.plm</pExt>
<CppX>*.cpp</CppX> <CppX>*.cpp</CppX>
<nMigrate>0</nMigrate> <nMigrate>0</nMigrate>
@ -666,6 +666,38 @@
</File> </File>
</Group> </Group>
<Group>
<GroupName>Son</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Src\bruitverre.asm</PathWithFileName>
<FilenameWithoutPath>bruitverre.asm</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>5</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Src\GestionSon.s</PathWithFileName>
<FilenameWithoutPath>GestionSon.s</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp> <tvExp>0</tvExp>

View file

@ -410,6 +410,21 @@
</File> </File>
</Files> </Files>
</Group> </Group>
<Group>
<GroupName>Son</GroupName>
<Files>
<File>
<FileName>bruitverre.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\bruitverre.asm</FilePath>
</File>
<File>
<FileName>GestionSon.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
</Group> </Group>
@ -819,6 +834,21 @@
</File> </File>
</Files> </Files>
</Group> </Group>
<Group>
<GroupName>Son</GroupName>
<Files>
<File>
<FileName>bruitverre.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\bruitverre.asm</FilePath>
</File>
<File>
<FileName>GestionSon.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
<GroupOption> <GroupOption>
@ -897,7 +927,7 @@
<TargetName>CibleSondeST</TargetName> <TargetName>CibleSondeST</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>
@ -1297,6 +1327,21 @@
</File> </File>
</Files> </Files>
</Group> </Group>
<Group>
<GroupName>Son</GroupName>
<Files>
<File>
<FileName>bruitverre.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\bruitverre.asm</FilePath>
</File>
<File>
<FileName>GestionSon.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
</Group> </Group>
@ -1322,12 +1367,7 @@
<LayerInfo> <LayerInfo>
<Layers> <Layers>
<Layer> <Layer>
<LayName>&lt;Project Info&gt;</LayName> <LayName>StepSon</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>0</LayTarg> <LayTarg>0</LayTarg>
<LayPrjMark>1</LayPrjMark> <LayPrjMark>1</LayPrjMark>
</Layer> </Layer>