Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a 4-digit decimal counter that counts from 0000 to 9999, and displays the count value on the seven-segment display. Use a pushbutton to increment

Create a 4-digit decimal counter that counts from 0000 to 9999, and displays the count value on the seven-segment display. Use a pushbutton to increment the counter. Test your counter to make sure that each digit rolls over correctly (i.e., check that counting from 0009 to 0010 works correctly.

This is Arm assmebly code

.text

.global main

.set SEVENSEG_BASEADDR, 0x4BB03000

.set BUTTON_BASEADDR, 0x4BB00000

main:

LDR r0, =SEVENSEG_BASEADDR

LDR r1, =BUTTON_BASEADDR

Clr_D:

MOVw r7, #0

STR r7, [r0, #0x4]

MOVw r6, #0

STR r6, [r0, #0x8]

MOVw r5, #0

STR r5, [r0, #0xC]

MOVw r4, #0

STR r4, [r0, #0x10]

Count:

ADD r4, r4, #1

CMP r4, #10

BEQ D_3

STR r4, [r0, #0x10]

B Wait_for_tick

D_3:

MOVw r4, #0

STR r4, [r0, #0x10]

ADD r5, r5, #1

CMP r5, #10

BEQ D_2

STR r5, [r0, #0xC]

B Wait_for_tick

D_2:

MOVw r4, #0

MOVw r5, #0

STR r4, [r0, #0x10]

STR r5, [r0, #0xC]

ADD r6, r6, #1

CMP r6, #10

BEQ D_1

STR r6, [r0, #0x8]

B Wait_for_tick

D_1:

MOVw r4, #0

MOVw r5, #0

MOVw r6, #0

STR r4, [r0, #0x10]

STR r5, [r0, #0xC]

STR r6, [r0, #0x8]

ADD r7, r7, #1

CMP r7, #10

BEQ

STR r7, [r0, #0x4]

B Wait_for_tick

Wait_for_tick:

@ Your code goes here

.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 In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

Students also viewed these Databases questions

Question

Consistently develop management talent.

Answered: 1 week ago

Question

Create a refreshed and common vision and values across Europe.

Answered: 1 week ago