Modification de Inverse_LED, création de Timer1_IRQHandler

This commit is contained in:
Yohan Boujon 2023-03-30 12:17:48 +02:00
parent 6f7d973e2c
commit 6409898e43
4 changed files with 67 additions and 26 deletions

View file

@ -219,12 +219,44 @@
<ExecCommand></ExecCommand>
<Expression>\\Simu_Etape0\FonctionEtape3.asm\51</Expression>
</Bp>
<Bp>
<Number>5</Number>
<Type>0</Type>
<LineNumber>58</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>6</Number>
<Type>0</Type>
<LineNumber>68</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
</Breakpoint>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>0</SubType>
<ItemText>0xE000ED08</ItemText>
<ItemText>0x20000200</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>

View file

@ -92,12 +92,11 @@ Allume_LED PROC
; On inverse la LED (besoin de R0)
;*******************************************************************************
Inverse_LED PROC
PUSH {R12,R0} ;On stocke R12 dans R0
PUSH {R12,R5} ;R12 et R5 sont mis dans la pile
LDR R12,=GPIOBASEB ;On recupère l'adresse de base
LDR R1,=isLedOn ;On recupère l'adresse de isLedOn
MOV R5,#(0x01 << 10) ;1 décalé de 10 dans R5
CMP R0,#0 ;Si R3=0 (default) alors on allume, sinon on eteint
;BEQ Allume
;B Eteint
BNE Eteint
Allume
STRH R5,[R12,#OffsetSet] ;On stocke la variable R5 à l'adresse 0x0X40010C10 (set)
@ -110,7 +109,7 @@ Eteint
Fin
POP {R12,R0} ;On restitue R12 dans R0
POP {R12,R5} ;On restitue R12
BX LR ;Retour
ENDP

View file

@ -30,8 +30,8 @@
AREA MesDonnees, data, readwrite
;**************************************************************************
Timer_Up_Reg EQU 25
Timer_Cc_Reg EQU 27
Timer_Up_Reg EQU 25+0x40
Timer_Cc_Reg EQU 27+0x40
MAX_Interrupt EQU 256
TVI_Flash EQU 0x0
TVI_Pile EQU 0x20000200 ;9 bits de poids faible = 0
@ -44,10 +44,20 @@ TVI_Pile EQU 0x20000200 ;9 bits de poids faible = 0
AREA moncode, code, readonly
;**************************************************************************
scbvector_link PROC
LDR R1,=TVI_Pile ;On relit l'adresse de TVIPile
LDR R0,=SCB_VTOR ;ON lit l'adresse de SCB_VTOR
STR R1,[R0] ;On met l'adresse de TVI_Pile dans le SCB_VTOR
BX LR
ENDP
Timer1_IRQHandler PROC
;On copie toute la TVI dans la RAM (0x2....)
;On modifie les interruptions Up et CC pour pointer sur nos fonctions rien qu'à nous
;On fait pointer à SCB_VTOR l'adresse de la TVI que nous avons copié
Init_TVI PROC
;On copie toute la TVI dans la RAM (0x2....)
;On modifie les interruptions Up et CC pour pointer sur nos fonctions rien qu'à nous
;On fait pointer à SCB_VTOR l'adresse de la TVI que nous avons copié
LDR R0,=TVI_Flash ;On Lit le premier TVI
LDR R1,=TVI_Pile ;Nouvelle TVI
MOV R2,#0 ;i
@ -59,11 +69,9 @@ for_tvi ;for(int i=0;i<MAX_Interrupt;i++)
ADD R2,R2,#1 ;i++
CMP R2,#MAX_Interrupt ;is i == MAX_Interrupt?
BNE for_tvi
scbvector_link
LDR R1,=TVI_Pile ;On relit l'adresse de TVIPile
LDR R0,=SCB_VTOR ;ON lit l'adresse de SCB_VTOR
STR R1,[R0] ;On met l'adresse de TVI_Pile dans le SCB_VTOR
BL scbvector_link ;Mets à jour SCB_VTOR avec TVI_Pile
ENDP
;**************************************************************************
END
END

View file

@ -6,6 +6,8 @@
AREA MesDonnees, data, readwrite
;**************************************************************************
isLedOn DCB 0x00
Barette1 DCB 0xff,0x00,0x0
DCB 0xff,0x00,0x0
DCB 0xff,0x00,0x0