Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLP Progressive Learning Platform 5.2 only In this project, you will be adding an interrupt service routine (ISR) to an existing program. The program is

PLP Progressive Learning Platform 5.2 only

In this project, you will be adding an interrupt service routine (ISR) to an existing program. The program is already fully functional hexadecimal counter that shows the current counter value on the seven-segment display. You will use the timer to generate an interrupt every x cycles (where x can be between 100 and 200 cycles). Your ISR needs to do the following things: 1. Toggle all eight LEDs (i.e. if they are all off, they should all be turned on and if they are already on, turn them off) 2. Perform any tasks necessary to allow another timer interrupt within 100 to 200 cycles No changes should be made to the existing main loop or sseg_display.asm. Code should only be added following the TODO comments.

main.asm

.org 0x10000000

li $sp, 0x10fffffc # Stack pointer initialization

li $s0, sseg_lut # Lookup table address used by sseg_display

lui $s1, 0xf070 # Interrupt controller register

lui $s2, 0xf0a0 # Seven segment display

# ****************************

# TODO: enable interrupts here

# ****************************

main:

jal sseg_display

nop

addiu $a0, $a0, 1

j main

nop

# ****************************************

# TODO: add interrupt service routine here

# ****************************************

sseg_display.asm

asm_file_trap:

# If your program ends up in this loop then your ISR is not being exited correctly

lui $s0, 0xf0a0

li $t0, 0x86afafff # "Err" on seven segment

sw $t0, 0($s0)

j asm_file_trap

nop

sseg_display:

move $t1, $a0

move $t3, $0

# Position 0

andi $t2, $t1, 0xf

sll $t2, $t2, 2

addu $t2, $t2, $s0 # Calculate LUT address

lw $t2, 0($t2)

or $t3, $t3, $t2

# Position 1

andi $t2, $t1, 0xf0

srl $t2, $t2, 2

addu $t2, $t2, $s0 # Calculate LUT address

lw $t2, 0($t2)

sll $t2, $t2, 8

or $t3, $t3, $t2

# Position 2

andi $t2, $t1, 0xf00

srl $t2, $t2, 6

addu $t2, $t2, $s0 # Calculate LUT address

lw $t2, 0($t2)

sll $t2, $t2, 16

or $t3, $t3, $t2

# Position 3

andi $t2, $t1, 0xf000

srl $t2, $t2, 10

addu $t2, $t2, $s0 # Calculate LUT address

lw $t2, 0($t2)

sll $t2, $t2, 24

or $t3, $t3, $t2

# Write to seven segment and increment

jr $ra

sw $t3, 0($s2)

# Seven segment display lookup table

sseg_lut:

.word 0xc0 # 0

.word 0xf9 # 1

.word 0xa4 # 2

.word 0xb0 # 3

.word 0x99 # 4

.word 0x92 # 5

.word 0x82 # 6

.word 0xf8 # 7

.word 0x80 # 8

.word 0x90 # 9

.word 0x88 # a

.word 0x83 # b

.word 0xc6 # c

.word 0xa1 # d

.word 0x86 # e

.word 0x8e # f

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

Have roles been defined and assigned?

Answered: 1 week ago