I need help writing these functions for my assignment.
1) A function int ReadSwitches(void) that reads the slide switch bank and returns the current value, encoded as a binary number.
2) A function void DisplayHex(int value) that shows the hex equivalent of value on the lowestorder seven segment display. The easiest way to do this is with a look-up table (array) of values corresponding to the LEDs you want to light up to show a specific value. For example, if you want to display “1”, you want to turn on LED segments 1&2 in the picture. So your array would contain the following (among other things): lookUpTable[1]=0x06;
3) A main routine that blinks the lowest seven segment display ON and OFF. When ON, it should display the hex equivalent of the four-bit number encoded by the lowest four bits of the slide switch bank and this value should update as you change the switch positions. You can use the same delay loop from Part 1 to time the blinking.
The slide switches are memory mapped to address 0xFF200040 (called SW_BASE in address_map_arm.h).
The lower order four seven segment displays are mapped to address 0xFF200020 (called HEX3_HEX0_BASE in address_map_arm.h).
These are the requirements for the functions. Thank you for helping in advance.
1) A function int ReadSwitches(void) that reads the slide switch bank and returns the current value, encoded as a binary number.
2) A function void DisplayHex(int value) that shows the hex equivalent of value on the lowestorder seven segment display. The easiest way to do this is with a look-up table (array) of values corresponding to the LEDs you want to light up to show a specific value. For example, if you want to display “1”, you want to turn on LED segments 1&2 in the picture. So your array would contain the following (among other things): lookUpTable[1]=0x06;
3) A main routine that blinks the lowest seven segment display ON and OFF. When ON, it should display the hex equivalent of the four-bit number encoded by the lowest four bits of the slide switch bank and this value should update as you change the switch positions. You can use the same delay loop from Part 1 to time the blinking.
The slide switches are memory mapped to address 0xFF200040 (called SW_BASE in address_map_arm.h).
The lower order four seven segment displays are mapped to address 0xFF200020 (called HEX3_HEX0_BASE in address_map_arm.h).
These are the requirements for the functions. Thank you for helping in advance.