Question: MAIN PROGRAM * * * * * * * * * * * * * * * * * * * * * * *

MAIN PROGRAM ******************************
Port F has 5 pins.
PFO (Bit0)--> SW2
PFl (Bitl)--> Red LED
PF2(Bit2)--> Blue LED
PF3(Bit3)--> Green LED
PF4(Bit4)--> SW1
Start
BL portFconfig
loop
B loop THUMB
; Base address for Port F Data Register =04002.5000
GPIO_PORTF_DATA_R EQU 0x400253FC ; GPIO Data Register (GPIODATA)
; Test 1
redPattern
bluePattern
greenPattern
EQU
2_01010101010101010101010101010101
EQU
2_01010101010101010101010101010101
EQU
2_01010101010101010101010101010101
; Test 2
; redPattern
;bluePattern
EQU
2_00000101000000000101000000000101
; greenPattern
EQU
EQU
2_00000101000001010000000001010000
2_00000101010100000000010100000000
; Test 3
; redPattern
;bluePattern
EQU
; greenPattern
EQU
2_00010001000100010001000100010001
EQU 2_00100010001000100010001000100010
2_01000100010001000100010001000100
AREA
|.text|, CODE, READONLY, ALIGN=2
; Flash ROM
EXPORT Start
IMPORT portFconfigGPIO on the TM4C123: Sequence-based
Output Colors: setData
; input parameters: RO contains the bit values to output on Port F I/O pins
; return parameters: none
; destroys value in Rl register
PUSH {RO, RI}
LDR Rl,=GPIO_PORTF_DATA_R
STR RO,[R1]
POP {R0, R1}
BX LR
; input parameters: none
; return parameters: none
wait500ms
MOV32 R0, #1 ; change this number so that the delay is ~.5s
wait_loop
SUBS RO, #1
BNE wait_loop
BX LRThe general purpose is to familiarize you further with the software development steps
using the uVision simulator. You will learn how to perform digital input/output on parallel ports of the
TM4C123. Software skills you will learn include shifting and rotation of registers.
You are NOT allowed to use conditional branches in your solution.
The ONLY instructions that you are allowed to use in your solution are:
Rotates
Shifts
Moves
Unconditional Branches (including BL).
You are also allowed to call the two subroutines provided (setData & wait500ms). No other
instructions or subroutines are allowed.
In addition, your program (not including comments, directives, and subroutines) must be 25 lines
of code or less.
Instructions
Use the starter project provided to you. Submit the project folder to in ONE zip file and the lab report as
a separate PDF file.
Overview
The objective of this system is to make the LEDs on the LaunchPad blink in a very specific order. You will
be given some test patters to try out. Each test pattern has 3 parts: the red pattern, blue pattern, and the
green pattern. The pattern begins in bit 0 and ends in bit 31. However, your program will repeat each
32-bit sequence indefinitely.
For instance, if the patterns were given as follows:
redPattern EQU 2_01010101010101010101010101010101
bluePattern EQU 2_01010101010101010101010101010101
greenPattern EQU 2_01010101010101010101010101010101
then the first action is that the LaunchPad would turn all LEDs (RBG) on for 500ms because bit 0 of each
pattern is 1. The second action is to turn the LEDs off for 500ms because bit 1 of each pattern is low.
ECE 3436
Microprocessor Systems
If the pattern were instead as follows:
redPattern EQU 2_01010101010101010101010101010101
bluePattern EQU 2_00000000000000000000000000000000
greenPattern EQU 2_00000000000000000000000000000000
then only the red LED would flash because the blue and green patterns are always 0.
The last bits to be output are bits 31 of each pattern. Then the whole sequence begins again. Note that
the patterns can be any combination of 1s and 0s for each color.
You will be using one of the I/O ports on the TM4c123(Port F, PF). Port F has 3 bits that are hardwired
on LaunchPad to the LEDs. The outputs are in positive logic:
outputting a 1 will turn on the LED,
outputting a 0 will turn off the LED.
Below is the mapping of the I/O pins on Port F that are hardwired to the LEDs.
Bit1 is an output (connected to the Red LED)
Bit2 is an output (connected to the Blue LED)
Bit3 is an output (connected to the Green LED)
You are given two subroutines in the starter project to use as needed:
1. setData This subroutine outputs the 3 data bits to the microcontroller I/O pins. You must
ensure that the value that you want to send to the red LED is in bit 1, the value that you want to
send to the blue LED is in bit 2, and the value that you want to send to the green LED is in bit 3.
All other bit values will be ignored. The data to output to the LEDs must be in R0 when you call
the subroutine.
There is no return data. This subroutine overwrites the value in R1.
The subroutine is called as follows:
BL setData
2. wait500ms This subroutine should just provide 500ms of time delay. You must edit the first
instruction in the subroutine so that the delay time is approximately 500ms each time the
subroutine is called.
There is no return data. This subroutine overwrites the value in R0.
The subroutine is called as follows:
BL waitXms
Hello! I am confuse and dont understand. Can you show me the step and code? What do i write in main?
MAIN PROGRAM * * * * * * * * * * * * * * * * * *

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!