Answered step by step
Verified Expert Solution
Question
1 Approved Answer
int main(void) { /* Declare volatile pointers to I/O registers (volatile means that IO load and store instructions (e.g., ldwio, stwio) will be used to
int main(void) { /* Declare volatile pointers to I/O registers (volatile means that IO load and store instructions (e.g., ldwio, stwio) will be used to access these pointer locations) */ volatile int * green_LED_ptr = (int *) 0x10000010; // green LED address volatile int * HEX3_HEX0_ptr = (int *) 0x10000020; // HEX3_HEX0 address volatile int * SW_switch_ptr = (int *) 0x10000040; // SW slider switch address volatile int * KEY_ptr = (int *) 0x10000050; // pushbutton KEY address int HEX_bits = 0x0000000F; // pattern for HEX displays int SW_value, KEY_value, delay_count; while(1) { SW_value = *(SW_switch_ptr); // read the SW slider switch values *(green_LED_ptr) = SW_value; // light up the LEDs KEY_value = *(KEY_ptr); // read the pushbutton KEY values if (KEY_value != 0) // check if any KEY was pressed { HEX_bits = SW_value; // set pattern using SW values while (*KEY_ptr); // wait for pushbutton KEY release } *(HEX3_HEX0_ptr) = HEX_bits; // display pattern on HEX3 ... HEX0 if (HEX_bits & 0x80000000) /* rotate the pattern shown on the HEX displays */ HEX_bits = (HEX_bits << 1) | 1; else HEX_bits = HEX_bits << 1; for (delay_count = 100000; delay_count != 0; --delay_count); // delay loop } // end while }
using C
1)Write a program that reads the 10 slider switches, and: a. Displays their value on the 10 Green LEDs b. Convert the values read from the 10 slider switches to hexadecimal and display the result on the appropriate number of 7-segment displays. The decimal point should remain off. 2) Use the Example program as a template (no rotation required in this exercise). 3) Loop the program continually so new choices can be entered. 1)Write a program that reads the 10 slider switches, and: a. Displays their value on the 10 Green LEDs b. Convert the values read from the 10 slider switches to hexadecimal and display the result on the appropriate number of 7-segment displays. The decimal point should remain off. 2) Use the Example program as a template (no rotation required in this exercise). 3) Loop the program continually so new choices can be enteredStep 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