Question
THIS NEEDS TO BE IN C!!! YOU ARE NOT ALLOWED TO USE THE FUNCTION ITOA! THE VALUES INSIDE OF THE TABLE ARE NOT CORRECT, BUT
THIS NEEDS TO BE IN C!!!
YOU ARE NOT ALLOWED TO USE THE FUNCTION "ITOA"!
THE VALUES INSIDE OF THE TABLE ARE NOT CORRECT, BUT IT SHOULD STILL WORK THE SAME. WE SIMPLY NEED TO MATCH UP WHATEVER VALUE IN THE TABLE THAT CORRESPONDS TO THE INPUT VALUES NUMBERS. SO IF WE GIVE THE FUNCTION 55, IT SHOULD RETURN WHATVER TABLE[5] IS TWICE. SO IN THIS CASE IT SHOULD RETURN "0x7F7F"
You need to develop an algorithm to convert the provided value to a
32-bit value that would display correctly on the seven segment display. You are required to only return
the necessary information without displaying leading zeros. For example, if value = 5, then the function would return the seven-segment conversion that would display 5 and not 05.
/* The function below takes two arguments: value which is the value in decimal
* to be displayed by the seven-segment displays and a character array that have the encoding
* to display the provided value in decimal on the seven-segment displays. The provided value
* can range from 0 - 999. The seven-segment displays must output the entire range correctly.
*/
unsigned char table[10] = { 0x3f, 0x06, 0x5b, 0x2F, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f}; -- these values map to a 7segment hex display. the values are 0,1,2,3,4,5,6,7,8,9. So when you give the function below a number, for example 11, you would just need to return "0x0606" which is two 1's in the above array.
TO DO:
*****************************************************************
int HEX3to0_display (int value, unsigned char * table)
{
/* YOU NEED TO COMPLETE THIS CONVERSION FUNCTION. */
}
**********************************************************
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