Answered step by step
Verified Expert Solution
Question
1 Approved Answer
7. (16 points) The below code is supposed to display the binary addition of the on-board buttons and switches to the on-board LEDs. BTN4 BTN3
7. (16 points) The below code is supposed to display the binary addition of the on-board buttons and switches to the on-board LEDs. BTN4 BTN3 BTN2 BTN1 SW4 SW3 SW2 SW1 LD4 LD3 LD2 LD1 While testing the code, two problems were discovered. 1. The LEDs never turn on. 2. After fixing the LED problem, the switches were not changing the LEDs, only the buttons a. (8 points) Find and fix the two problems. b. (8 points) You now want to also display the binary addition solution to one digit of the seven- segment display. Finish writing the code for the sub-routine "set_SVNSEG". Also, add the appropriate code to your main to display the binary addition to both the LEDs and one digit of the seven-segment display. .global main set LED_BASEADDR, Ox4BB00000 .set SB_BASEADDR, 0x4BB02000 .set SVN_SEG_BASEADDR, 0x4BB03000 text main: always_loop: BL get_switches BL get_buttons ADD r3, r2, r1 BL set_LEDs @ get the value of switches @ get the value of buttons @sum = buttons + switches @set LEDs to sum b always_loop @ Branch back to always_loop: get_switches: LDR ro, =SB_BASEADDR LDR 11,[ro] MOV PC, Ir get_buttons: LDR rO, ESB_BASEADDR LDR r1, [ro, #Ox04] MOV pc, Ir setup_LEDs: LDR rO, ELED_BASEADDR MOV 11, #OxOF STR r1, [ro] MOV pc, Ir set_LEDs LDR r0, ELED_BASEADDR STR 13,[r0, #0x04] MOV pc, Ir setup_SVNSEG: LDR rO, ESVN_SEG_BASEADDR MOV 11, #Ox01 STR 11,[ro] MOV pc, Ir set_SVNSEG: @ Write the code to put a 4-bit value on one seven-segment display digit .end 7. (16 points) The below code is supposed to display the binary addition of the on-board buttons and switches to the on-board LEDs. BTN4 BTN3 BTN2 BTN1 SW4 SW3 SW2 SW1 LD4 LD3 LD2 LD1 While testing the code, two problems were discovered. 1. The LEDs never turn on. 2. After fixing the LED problem, the switches were not changing the LEDs, only the buttons a. (8 points) Find and fix the two problems. b. (8 points) You now want to also display the binary addition solution to one digit of the seven- segment display. Finish writing the code for the sub-routine "set_SVNSEG". Also, add the appropriate code to your main to display the binary addition to both the LEDs and one digit of the seven-segment display. .global main set LED_BASEADDR, Ox4BB00000 .set SB_BASEADDR, 0x4BB02000 .set SVN_SEG_BASEADDR, 0x4BB03000 text main: always_loop: BL get_switches BL get_buttons ADD r3, r2, r1 BL set_LEDs @ get the value of switches @ get the value of buttons @sum = buttons + switches @set LEDs to sum b always_loop @ Branch back to always_loop: get_switches: LDR ro, =SB_BASEADDR LDR 11,[ro] MOV PC, Ir get_buttons: LDR rO, ESB_BASEADDR LDR r1, [ro, #Ox04] MOV pc, Ir setup_LEDs: LDR rO, ELED_BASEADDR MOV 11, #OxOF STR r1, [ro] MOV pc, Ir set_LEDs LDR r0, ELED_BASEADDR STR 13,[r0, #0x04] MOV pc, Ir setup_SVNSEG: LDR rO, ESVN_SEG_BASEADDR MOV 11, #Ox01 STR 11,[ro] MOV pc, Ir set_SVNSEG: @ Write the code to put a 4-bit value on one seven-segment display digit .end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started