Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is an assembly program for a Tiva microcontroller. I need to fill in the bl

ID: 3664852 • Letter: T

Question

This is an assembly program for a Tiva microcontroller.

I need to fill in the blanks in this code with the listed memory locations, and hexadecimal values below.

The purpose of the code is to turn on an LED on the Tiva microcontroller only when both switches are pressed (boolean varibles 'PE3' and 'PE4').

The *anstrisked memory locations do not need to be worried about

Hardware connections
; PE3 is switch input (1 means switch is not pressed, 0 means switch is pressed)
; PE4 is switch input (1 means switch is not pressed, 0 means switch is pressed)
; PE2 is LED output (0 means door is locked, 1 means door is unlocked)
; **The specific operation of this system is to
; unlock if both switches are pressed
;this section takes the registers and maps them to the locations in memory
*GPIO_PORTE_DATA_R EQU 0x400243FC
GPIO_PORTE_DIR_R EQU 0x40024400
GPIO_PORTE_AFSEL_R EQU 0x40024420
GPIO_PORTE_DEN_R EQU 0x4002451C
*GPIO_PORTE_AMSEL_R EQU 0x40024528
GPIO_PORTE_PCTL_R EQU 0x4002452C
SYSCTL_RCGC2_R EQU 0x400FE108

AREA |.text|, CODE, READONLY, ALIGN=2
THUMB
EXPORT Start
      
Start
;initialize, put the code provided in the lab manual here

LDR R2, =SYSCTL_RCGC2_R
LDR R3, [R2]
ORR R3, R3,#0x10
STR R3, [R2]
NOP
NOP
NOP
NOP
; set pins as inputs and outputs
LDR R2, = ???
LDR R3, [R2] ;gets the value in the DDR
ORR R3, #0x04
AND R3, #0x04
STR R3, [R2]
LDR R2, = ??? ;this configures it as a general purpose IO ...I've only read about digital and analog IO's
MOV R0, #0x0000000
STR R0, [R2]
LDR R2, =GPIO_PORTE_DIR_R
MOV R0, #0
STR R0, [R2]
LDR R2, =GPIO_PORTE_DEN_R
MOV R0, #0xFF
STR R0, [R2]

; Something is needed here so that the program runs forever
LDR R1, =GPIO_PORTE_DATA_R
LDR R0, [R1]

; use XOR to take the value and complement (flip) the pins of interest
EOR R0, R0, #0x18 ; This will flip the bits
AND R0, R0, #0x18 ; pins 3 and 4 are the inputs we want

; R0 now had the bits s.t. bits 3 and 4 will be one if the switch is pressed
; PE2 now needs to be 1 when 3 and 4 are 1
; if they are both 1 we can subtract 0x14 and get zero
CMP R0, #0x18

; Answer question 6 on the submission sheet

BEQ LEDON ; branch to LEDON if ...
; Answer Question 7 on the submission sheet

; If the condition for the branch is not met,
; it will continue into this section of the program
; Need to turn off the LED. To do this,
; AND with 0x______ so PE2 always zero to turn off the LED
AND R0, R0, #0x______
; Fill in the correct value above and then delete this comment.

STR R0, [R1]

; Something is needed here so that this code is only executed
; when the LED should turn on.

ORR R0, #0x_______
; sets the value of bit 2 high to be stored, OR with 0x____ is always 1
STR R0, [R1] ;takes R0 and puts in in the location of [R1]

; More is needed here to make sure the program runs forever


ALIGN ; make sure the end of this section is aligned
END ; end of file

Explanation / Answer

1. 0x400243FC  

2. 0x40024420

3. 0x40024528

4. 0x4002452C

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote