son à verifier

This commit is contained in:
Le-Tuong-Lan Nguyen 2023-04-12 10:58:28 +02:00
parent e0bb608df7
commit 16728f90fd
8 changed files with 307 additions and 59 deletions

View file

@ -170,22 +170,6 @@
<ExecCommand></ExecCommand> <ExecCommand></ExecCommand>
<Expression>\\BacASable\Src/principal.c\16</Expression> <Expression>\\BacASable\Src/principal.c\16</Expression>
</Bp> </Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>55</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134220362</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\Src\Cligno.s</Filename>
<ExecCommand></ExecCommand>
<Expression>\\BacASable\Src/Cligno.s\55</Expression>
</Bp>
</Breakpoint> </Breakpoint>
<Tracepoint> <Tracepoint>
<THDelay>0</THDelay> <THDelay>0</THDelay>

View file

@ -14,6 +14,7 @@ FlagCligno dcb 0
export FlagCligno export FlagCligno
export timer_callback export timer_callback
; =============================================================================================== ; ===============================================================================================
; char FlagCligno; ; char FlagCligno;
@ -76,8 +77,4 @@ flag_nul
;} ;}
endp endp
END END

View file

@ -9,22 +9,63 @@
;Section RAM (read write): ;Section RAM (read write):
area maram,data,readwrite area maram,data,readwrite
SortieSon dcw 0
export SortieSon
export CallbackSon
Index dcd 0
export Index
; =============================================================================================== ; ===============================================================================================
;static short int SortieSon;
;static int i
;if (i<LongueurSon){
;SortieSon=(Son[i]+32768)*719/65535;
;i+=1
;}
;Section ROM code (read only) : ;Section ROM code (read only) :
area moncode,code,readonly area moncode,code,readonly
import Son
import LongueurSon
import PWM_Set_Value_TIM3_Ch3
; écrire le code ici ; écrire le code ici
CallbackSon proc
push {r3}
ldr r1,=LongueurSon
ldr r1,[r1]
;static int i
ldr r0, =Index
ldrsh r2,[r0]
;if (i<LongueurSon)
cmp r2, r1
beq arret
;SortieSon=(Son[i]+32768)*719/65535;
ldr r1, =Son
ldrsh r3, [r1, r2, lsl #1]
mov r1, #0x8000
add r3, r1
mov r1, #0x2CF
mul r3, r1
mov r1, #0xFFFF
udiv r3, r1
ldr r4,=SortieSon
strh r3,[r4]
;i+=1
add r2, #1
str r2,[r0]
;bl PWM_Set_Value_TIM3_Ch3; mis @ de la sortie PWM
pop {r3}
arret
bx lr
endp
END END

View file

@ -1,26 +1,40 @@
#include "DriverJeuLaser.h" #include "DriverJeuLaser.h"
#define Periode_en_Tck PeriodeSonMicroSec*72 //4536 // T/T0 ici 63u
#define Periode_PWM_en_Tck 720 // 10u // plus ou moins 6.3u
extern short Son;
extern int LongueurSon;
extern int PeriodeSonMicroSec;
void CallbackSon(void);
int main(void) int main(void)
{ {
// =========================================================================== // Initialisation de taille et son pour le variable etat
// ============= INIT PERIPH (faites qu'une seule fois) ===================== int resolution;
// ===========================================================================
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers // Activation de la PLL qui multiplie la fréquence du quartz par 9
CLOCK_Configure(); CLOCK_Configure();
// Config port PB1 pour être utilisé en sortie
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
// Config TIM3-CH3 en mode PWM
resolution = PWM_Init_ff(TIM3, 3, Periode_PWM_en_Tck);
// Initialisation du timer 4
// Periode_en_Tck doit fournir la duréé interruptique;
// exprimée en période Tck de l'horloge principale du STM32 (72Mhz)
Timer_1234_Init_ff(TIM4, PeriodeSonMicroSec);
// enregistrement de la fonction de traitement de l'interruption timer
// avec la priorité 2, timer_callback est l'adresse de cette fonction, a crée en asm,
// cette fonction doit être conforme à l'AACPS
Active_IT_Debordement_Timer(TIM4, 2, CallbackSon);
//Lancement du timer
Run_Timer(TIM4);
//============================================================================ Run_Timer(TIM3);
while (1) while (1)
{ {
} }

View file

@ -0,0 +1,48 @@
#include "etat.h"
#include "DriverJeuLaser.h"
#define Periode_en_Tck PeriodeSonMicroSec*72 //4536 // T/T0 ici 63u
#define Periode_PWM_en_Tck 720 // 10u // plus ou moins 6.3u
extern short Son;
extern int LongueurSon;
extern int PeriodeSonMicroSec;
void timer_callback(void);
type_etat etat;
int main(void)
{
// Initialisation de taille et son pour le variable etat
etat.taille = LongueurSon;
etat.son = &Son;
etat.periode_ticks = PeriodeSonMicroSec;
// Activation de la PLL qui multiplie la fréquence du quartz par 9
CLOCK_Configure();
// Config port PB1 pour être utilisé en sortie
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
// Config TIM3-CH3 en mode PWM
etat.resolution = PWM_Init_ff(TIM3, 3, Periode_PWM_en_Tck);
// Initialisation du timer 4
// Periode_en_Tck doit fournir la duréé interruptique;
// exprimée en période Tck de l'horloge principale du STM32 (72Mhz)
Timer_1234_Init_ff(TIM4, Periode_en_Tck);
// enregistrement de la fonction de traitement de l'interruption timer
// avec la priorité 2, timer_callback est l'adresse de cette fonction, a crée en asm,
// cette fonction doit être conforme à l'AACPS
Active_IT_Debordement_Timer(TIM4, 2, timer_callback);
//Lancement du timer
Run_Timer(TIM4);
Run_Timer(TIM3);
while (1)
{
}
}

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>0</IsCurrentTarget> <IsCurrentTarget>1</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>18</CpuCode> <CpuCode>18</CpuCode>
<DebugOpt> <DebugOpt>
@ -154,13 +154,28 @@
</SetRegEntry> </SetRegEntry>
</TargetDriverDllRegistry> </TargetDriverDllRegistry>
<Breakpoint/> <Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>SortieSon</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>9</SubType>
<ItemText>0xE000E000</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<Tracepoint> <Tracepoint>
<THDelay>0</THDelay> <THDelay>0</THDelay>
</Tracepoint> </Tracepoint>
<DebugFlag> <DebugFlag>
<trace>0</trace> <trace>0</trace>
<periodic>1</periodic> <periodic>1</periodic>
<aLwin>1</aLwin> <aLwin>0</aLwin>
<aCover>0</aCover> <aCover>0</aCover>
<aSer1>0</aSer1> <aSer1>0</aSer1>
<aSer2>0</aSer2> <aSer2>0</aSer2>
@ -174,7 +189,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 +214,8 @@
<LogicAnalyzers> <LogicAnalyzers>
<Wi> <Wi>
<IntNumber>0</IntNumber> <IntNumber>0</IntNumber>
<FirstString>((portb &amp; 0x00000002) &gt;&gt; 1 &amp; 0x2) &gt;&gt; 1</FirstString> <FirstString>`SortieSon</FirstString>
<SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F160000000000000000000000000000000000000096020008</SecondString> <SecondString>000080000000000000000000000000000080864000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000F03F020000000000000000000000000000000000000030010008</SecondString>
</Wi> </Wi>
</LogicAnalyzers> </LogicAnalyzers>
<DebugDescription> <DebugDescription>
@ -374,7 +389,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>
@ -460,7 +475,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>
@ -666,6 +681,70 @@
</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>
<GroupName>Lib</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>6</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Src\etat.h</PathWithFileName>
<FilenameWithoutPath>etat.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>7</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Src\etat.inc</PathWithFileName>
<FilenameWithoutPath>etat.inc</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

@ -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>
@ -410,6 +410,36 @@
</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>
<GroupName>Lib</GroupName>
<Files>
<File>
<FileName>etat.h</FileName>
<FileType>5</FileType>
<FilePath>.\Src\etat.h</FilePath>
</File>
<File>
<FileName>etat.inc</FileName>
<FileType>5</FileType>
<FilePath>.\Src\etat.inc</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
</Group> </Group>
@ -419,7 +449,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>
@ -819,6 +849,36 @@
</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>
<GroupName>Lib</GroupName>
<Files>
<File>
<FileName>etat.h</FileName>
<FileType>5</FileType>
<FilePath>.\Src\etat.h</FilePath>
</File>
<File>
<FileName>etat.inc</FileName>
<FileType>5</FileType>
<FilePath>.\Src\etat.inc</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
<GroupOption> <GroupOption>
@ -897,7 +957,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 +1357,36 @@
</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>
<GroupName>Lib</GroupName>
<Files>
<File>
<FileName>etat.h</FileName>
<FileType>5</FileType>
<FilePath>.\Src\etat.h</FilePath>
</File>
<File>
<FileName>etat.inc</FileName>
<FileType>5</FileType>
<FilePath>.\Src\etat.inc</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
</Group> </Group>
@ -1322,12 +1412,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>