Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assembly language for ARM Write a program that will illuminate the first LED if the value of the switches is equal to your age, and

Assembly language for ARM

Write a program that will illuminate the first LED if the value of the switches is equal to your age, and the second LED if all switches are 1.

I'm stuck on the second half of this question while trying to program my board which has (12 switches: sw0 -> sw11 and 12 LEDs: LED 0 -> LED 11)

This is what I have so far

==========================

.text .global main

.equ LED_CTL, 0x41210000 .set SW_DATA, 0x41220000

main: ldr r1,=SW_DATA ldr r2,=LED_CTL

loop_1: ldr r0,[r1] @load switch value, (*r1) ->r0 cmp r0,#21 @compare switch value with 21 beq led_light_1st @branch to 'led_light' if switch value is equal to 21

led_dim: mov r0,#0 str r0,[r2] b loop_1 @go back to start of loop

led_light_1st: mov r0,#1 @ This determines number of LEDs or location of LEDS 1.2.4.8.... str r0,[r2] b loop_1

.end

===============================

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

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions