Hi,

I need to pass 2 shorts to a function and then extract each individal digit in the shorts to pass on to another function. E.g if i pass 90 as the value in the lower variable i first have to format it corretly (90 must be 0090 etc) and then pass each of digits to a new function to be displayed larger on screen etc. So

void displayNumber(short lower, short higher){
char lowerBuffer[50]={0};
char higherBuffer[50]={0};
char temp[10]={0};
short number;

/* using sprintf to format the number */
sprintf(lowerBuffer, "%04u", lower);
sprintf(higherBuffer, "%04u", higher);

/* get the digit i want and and the null term. */
temp[0] = lowerBuffer[0]; temp[1] = "\0";
number = atoi(temp)); /* convert it to number */
/* use function to display it on screen */
_OPTREX_number(number, 5, 10); /* ignore the two last par.*/

temp[0] = lowerBuffer[1]; temp[1] = "\0";
number = atoi(temp));
_OPTREX_number(number, 6, 10); /* ignore the two last par.*/

temp[0] = lowerBuffer[2]; temp[1] = "\0";
number = atoi(temp));
_OPTREX_number(number, 7, 10); /* ignore the two last par.*/

temp[0] = lowerBuffer[3]; temp[1] = "\0";
number = atoi(temp));
_OPTREX_number(number, 8, 10); /* ignore the two last par.*/

_OPTREX_number(10, 5, 10); /*10 is a colon */

temp[0] = higherBuffer[0]; temp[1] = "\0";
number = atoi(temp));
_OPTREX_number(number, 10, 10); /* ignore the two last par.*/

temp[0] = higherBuffer[1]; temp[1] = "\0";
number = atoi(temp));
_OPTREX_number(number, 11, 10); /* ignore the two last par.*/

temp[0] = higherBuffer[2]; temp[1] = "\0";
number = atoi(temp));
_OPTREX_number(number, 12, 10); /* ignore the two last par.*/

temp[0] = higherBuffer[3]; temp[1] = "\0";
number = atoi(temp));
_OPTREX_number(number, 13, 10); /* ignore the two last par.*/

}

So if i pass 900 and 300 on the display it would be: 0900:0300.

My question is:

Is there any quicker way in doing this. e.g. is the a way to convert use the lower and higher buffers more directly to convert it to a single digit. e.g _OPTREX_number(/*conversomehow)lowerBuffer[0], 5, 10)

G'n'R