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>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<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>
</SetRegEntry>
</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>
<THDelay>0</THDelay>
</Tracepoint>
@ -260,7 +308,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
@ -339,6 +387,13 @@
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>VarTime</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
@ -609,7 +664,7 @@
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Src\principal.c</PathWithFileName>

View file

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

View file

@ -1,6 +1,6 @@
PRESERVE8
THUMB
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
@ -12,7 +12,7 @@
VarTime dcd 0
; ===============================================================================================
;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 VarTime
;Section ROM code (read only) :
area moncode,code,readonly
@ -44,17 +43,18 @@ Delay_100ms proc
ldr r0,=VarTime
ldr r1,=TimeValue
str r1,[r0]
str r1,[r0]; TimeValue rangee a l adresse de r0
BoucleTempo
ldr r1,[r0]
ldr r1,[r0] ;r1 = valeur contenue à l'adresse de r0, = TimeValue - une constante
subs r1,#1
str r1,[r0]
bne BoucleTempo
;r1 = r1 - 1
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
endp
bx lr ; branch permettant le retour de la fonction
endp ; fin de la procedure delay_100ms
END

View file

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

View file

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

View file

@ -1,7 +1,8 @@
PRESERVE8
THUMB
include ../Driver/DriverJeuLaser.inc
export timer_callback
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
area mesdata,data,readonly
@ -10,8 +11,9 @@
;Section RAM (read write):
area maram,data,readwrite
FlagCligno dcd 0
; ===============================================================================================
@ -20,11 +22,55 @@
;Section ROM code (read only) :
area moncode,code,readonly
; é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

View file

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

View file

@ -1,6 +1,6 @@
PRESERVE8
THUMB
export CallbackSon
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
@ -11,7 +11,8 @@
area maram,data,readwrite
SortieSon dcd 0x0000
Index dcd 0
; ===============================================================================================
@ -21,10 +22,18 @@
area moncode,code,readonly
; é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

View file

@ -14,8 +14,11 @@ int main(void)
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
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>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
@ -666,6 +666,38 @@
</File>
</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>
<GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp>

View file

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