Question: Build a program using assembly instructions that turns on both the blue and red LEDs on your Tiva C board. Then, modify your program to
Build a program using assembly instructions that turns on both the blue and red LEDs on your Tiva C board.
Then, modify your program to use switch SW on your Tiva C board to control those LEDs by turning on the blue and green led to create aqua blue SW pressed makes the LEDs turn on SW released makes the LEDs turn off
Here is what I have so far it turns on the red led when the button is pressed. thumb
global main
; Your constants go here
main:
asmfunc
; Initial setup
aSystemControlBase: field xFE ; Base address for the System Control registers which includes RCGCGPIO
bit: equ x ; bit enables GPIO port F
oRCGCGPIO: equ x ; offset for RCGCGPIO from base System Control registers address
aGPIOFBase: field x ; Base address for GPIO Port F registers APB
pin: equ x ; bit high only, for setting pin direction, etc.
pin: equ x ; bit high only, for setting pin pullup etc.
oGPIODIR: equ x ; offset for GPIODIR pin direction from any GPIO port base address
oGPIODEN: equ xC ; offset for GPIODEN digital IO from any GPIO port base address
oGPIOPUR: equ x ; offset for GPIOPUR pullup resistor from any GPIO port base address
swread: equ x ; offset for GPIODATA from any GPIO port base address, further offset to mask pin to allow read
oWrite: equ x ; offset for GPIODATA from any GPIO port base address, further offset to mask pin to allow write
;red light when button is pushedd PF&
;light off when button is let go PF
config: LDR R aSystemControlBase
MOV R #bit
STR RR#oRCGCGPIO
LDR R aGPIOFBase
MOV R #pin
STR RR#oGPIODIR
LDR R aGPIOFBase
MOV R #x
STR RR#oGPIODEN
LDR R aGPIOFBase
MOV R #pin
STR RR#oGPIOPUR
impl:
LDR RR#swread
CMP R #pin
BEQ off
on: MOV R#x
STR RR#oWrite
B impl
off:
MOV R#
STR RR#oWrite
B impl
loop:
B loop
endasmfunc
end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
