/*
** This function converts a 8 bit number to its ASCII equivalent value.
** The 8 bit number is passed as a parameter to this function.
*/
static unsigned int intToASCII(unsigned char byte)
{
unsigned int retVal = 0;
unsigned char lsn = 0, msn = 0;
lsn = (byte & 0x0F);
msn = (byte & 0xF0) >> 0x04;
retVal = (lsn + 0x30);
retVal |= ((msn + 0x30) << 0x08);
return retVal;
}
/*
** This function converts the ASCII value of a hexadecimal number to its
** equivalent hexadecimal value.
*/
static unsigned char ASCIIToInt(unsigned char byte)
{
unsigned char retVal = 0;
/* For numbers from 0x0 to 0x9.*/
if((byte >= 0x30) && (byte <= 0x39))
{
retVal = byte - 0x30;
}
/* For alphabets from A to Z.*/
else if((byte >= 0x41) && (byte <= 0x46))
{
retVal = byte - 0x37;
}
return retVal;
}