Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the code below is what needs to be adjusted for the program to function and it's the only thing I need thank you! ; GPIO.s

image text in transcribed

the code below is what needs to be adjusted for the program to function and it's the only thing I need thank you!

; GPIO.s

; Runs on LM4F120 and TM4C123

; Implements a NOT gate described in class

; PD3 is an output to LED, Positive logic

; PD0 is an input from switch, Positive logic

; Switch pressed causes LED to go OFF and

; release causes LED to go ON.

; **** To run this example in Simulator

; make sure and copy the C0DLL.dll file

;(in the folder where this [GPIO.s]file is)

; to your Keil ARM/Bin folder;

;; Note that running the simulator gives 4 warnings

;; Click OK and continue

GPIO_PORTD_DATA_R EQU 0x400073FC

GPIO_PORTD_DIR_R EQU 0x40007400

GPIO_PORTD_AFSEL_R EQU 0x40007420

GPIO_PORTD_DEN_R EQU 0x4000751C

SYSCTL_RCGCGPIO_R EQU 0x400FE608

AREA |.text|, CODE, READONLY, ALIGN=2

THUMB

EXPORT Start

GPIO_Init

; 1) activate clock for Port D

LDR R1, =SYSCTL_RCGCGPIO_R

LDR R0, [R1] ; R0 = [R1]

ORR R0, R0, #0x08 ; R0 = R0|0x08

STR R0, [R1] ; [R1] = R0

NOP

NOP

NOP

NOP ; allow time to finish activating

; 3) set direction register

LDR R1, =GPIO_PORTD_DIR_R ; R1 = &GPIO_PORTD_DIR_R

LDR R0, [R1] ; R0 = [R1]

ORR R0, R0, #0x08 ; R0 = R0|0x08 (make PD3 output)

;BIC R0, R0, #0x01 ; R0 = R0 & NOT(0x01) (make PD0 input)

STR R0, [R1] ; [R1] = R0

; 4) regular port function

LDR R1, =GPIO_PORTD_AFSEL_R ; R1 = &GPIO_PORTD_AFSEL_R

LDR R0, [R1] ; R0 = [R1]

BIC R0, R0, #0x09 ; R0 = R0&~0x09 (disable alt funct on PD3,PD0)

STR R0, [R1] ; [R1] = R0

; 5) enable digital port

LDR R1, =GPIO_PORTD_DEN_R ; R1 = &GPIO_PORTD_DEN_R

LDR R0, [R1] ; R0 = [R1]

ORR R0, R0, #0x09 ; R0 = R0|0x09 (enable digital I/O on PD3,PD0)

STR R0, [R1] ; [R1] = R0

BX LR

Start

BL GPIO_Init

LDR R0, =GPIO_PORTD_DATA_R

loop

LDR R1,[R0]

ORR R1, #0x08 ;

STR R1,[R0] ; Write to PortD DATA register to update LED on PD3

B loop ; unconditional branch to 'loop'

ALIGN ; make sure the end of this section is aligned

END ; end of file

made ln lab.) (5 pts) (a) Design a system that uses Port D pins 1, 2, 4, 5, 6. Pins 1 is input and Pins 2, 4, 5 and 6 are outputs. When the program starts, LEDs 2 and 5 turn on, LEDs 4 and 6 turn off toggle so LEDs 2 and 5 turn off, LEDs 4 and 6 turn on, in one cycle (loop). Then system repeats this process forever. Even though input pin is initialized, it's not used. (15pts) (b) After building the system, can you see if LEDs are toggling? Use no more than three sentences explain. 2. . Then all LEDs You must bring your circuit, code and working system to instructor to check. If all parts are correct, you pass Part

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

Briefly discuss the three ethical decision criteria.

Answered: 1 week ago

Question

4. Label problematic uses of language and their remedies

Answered: 1 week ago