Question: Write an interrupt driven RISC - V MCU program that drives 8 LEDs. Each time there is an interrupt, the program reads a 4 -

Write an interrupt driven RISC-V MCU program that drives 8 LEDs. Each time there is an interrupt, the program reads a 4-bit value from the input port. After reading 16 values (16 interrupts), the program averages those values and outputs the LED pattern corresponding to the average to the LEDs. The LEDs thus represent a visual representation of the average of the value read from the input when each time there was an interrupt. Assume an external device connected to the RISC-V MCU generates an interrupt and provides an input value for reading. You must use the provided LUT for this problem. The dark circles in the diagram below represent the "on" LEDs. Note the difference in average value and the patter on the LEDs that need to be output.
LED port address =0x1100C000
Input port address =0x11004444
Dont use I/O instructions in the interrupt service routine
Minimize the number of instructions in your solution
.data # 16 total values
my_lut: .byte 0x00,0x01,0x02,0x03,0x04,0x06,0x07,0x08, #LED output patterns
.byte 0x0C,0x0E,0x0F,0x10,0x18,0x1C,0x1E,0x1F

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!