Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 ;

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

need help to finish this code. to turn PortC`s pin5, 6 and 7 at digital output pins. connect each pin to a seperate LEDs. Write assembly code to turns on all these LEDs show the circuit code and write system to instructor.

this code is for negative circuit. the negative circuit using tactile switch to open LED turns on. when switch closed, LED turns off.

and also for positive circuit,

thank you. just need the code

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions