Professional Documents
Culture Documents
SWITCH
LED
SYSCTL_RCGCGPIO_R
EQU 0x400FE608
SYSCTL_RCGC2_GPIOE
SYSCTL_RCGC2_GPIOF
GPIO_PORTE_DATA_R
EQU 0x400243FC
GPIO_PORTE_DIR_R
EQU 0x40024400
GPIO_PORTE_AFSEL_R
EQU 0x40024420
GPIO_PORTE_PUR_R
EQU 0x40024510
GPIO_PORTE_DEN_R
EQU 0x4002451C
NVIC_ST_CURRENT_R
EQU 0xE000E018
GPIO_PORTF_DATA_R
EQU 0x400253FC
GPIO_PORTF_DIR_R
EQU 0x40025400
GPIO_PORTF_AFSEL_R
EQU 0x40025420
GPIO_PORTF_DEN_R
EQU 0x4002551C
DELAYVALUE
EQU 1290000
NVIC_ST_RELOAD_R
EQU 0xE000E014
NVIC_ST_CTRL_R
EQU 0xE000E010
SYSCTL_RCGC2_R
EQU 0x400FE108
EQU 50
;You MUST use these two buffers and two variables
;You MUST not change their names
DataPt
SPACE 4
TimePt
SPACE 4
;These names MUST be exported
EXPORT DataBuffer
EXPORT TimeBuffer
EXPORT DataPt
EXPORT TimePt
ALIGN
AREA |.text|, CODE, READONLY, ALIGN=2
THUMB
EXPORT Start
IMPORT TExaS_Init
CPSIE I
Start BL TExaS_Init
NOP
NOP
;-----------------------------------------------------------------------------PORTE Initialization
LDR R0, = GPIO_PORTE_DIR_R
ORR R1, R1, #0x02
BIC R1, R1, #0x01
STR R1, [R0]
; previous value
; previous value
;Turn on led
LDR R0,=GPIO_PORTE_DATA_R
LDR R1,[R0]
ORR R1,#0x02
STR R1,[R0]
;----------------------------------------------------------------------------
Debug_Capture
;----------------------------------------------------------------------------
BEQ not_pressed
pressed
B done
; toggle light
not_pressed
; store in R0
done
B loop
; Clear Enable
; reload at maximum
; clear counter
; enable SysTick with core clock
BX LR
;------------Debug_Capture------------
R6,R0;
BHS Done
; if the DataPt>= DataBuffer last spot then return
;read port e and the SysTick timer
LDR
R2,=GPIO_PORTE_DATA_R
LDR R3,[R2];
LDR R4,=NVIC_ST_CURRENT_R
LDR R5,[R4];
AND R3,#0x03
AND R12,R3,#0x01
LSL R12,#4
ORR R3,R12
;Increment dataPt
ADD R6,#4;
STR R6,[R1]
;Increment TimePt
ADD R1,#4
STR R1,[R0]
Done
POP
{R0-R6, R12}
BX
ALIGN
END
; restore registers
LR
Data.txt
:020000042000DA
:0350C00A4080000CC08000000000000
:0000000000000000000000000000000
:0000000000000000100000000000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:1000000100000001100000010000000
:10000001000000042FEFF00A241B100
:285620062C81300C20BC500224F7600
:2922700E2D5D80042198A00A25C3B00
:2A0EC0062E39D00C2264F00226A0000
:2ADB100E2F0620042341400A277C500
:2BB760062FE2700C241D90022858A00
:2C83B00E20BED00424F9E00A2924F00
:2D600006219B200C25C630022A01400
:2E3C500E2267700426A2800A2ADD900
:2F18A0062343C00C277ED0022BB9E00
:0101900082EC
:00000001FF