if the output is 7D means 7 storing in hexaDeciNum[0],D storing in hexaDeciNum[1],
After converting the decimal to hex,I have to send the converted hex value through UART communication.
For transfer need to combine into single char.
Go back a step - the decimal number you pass to the routine is an integer. That means it's range is potentially 0 to 65535 and the result will be 0x00 to 0xFFFF but you only show an 8-bit number in your example. You also show the result being left in 'char hexaDeciNum[3]' which implies you expect a zero terminated value, in other words text.
What exactly do you want to convert from and to? Please tell us the range of values you want to deal with and the format of the result.
Go back a step - the decimal number you pass to the routine is an integer. That means it's range is potentially 0 to 65535 and the result will be 0x00 to 0xFFFF but you only show an 8-bit number in your example. You also show the result being left in 'char hexaDeciNum[3]' which implies you expect a zero terminated value, in other words text.
What exactly do you want to convert from and to? Please tell us the range of values you want to deal with and the format of the result.
I have to convert from 0 to 255,and converted value have to send through UART.The converted values are stored as separate values like 7 and D.
But I need as 7D.7D is an single value,which can be send to UART.
- - - Updated - - -
There are two keypad to increase and decrease the values.
If the key 1 is pressed means hex value which transferred through the UART have to increase from 0X00 to 0XFF.
If the key 2 is pressed means hex value which transferred through the UART have to decrease from 0XFF to 0X00.
if you want to send 125(decimal) then just send this byte (defined as 8 bit unsigned integer, or char) it needs no conversion because
125(decimal) = 7D(hex)
It is also the same as 0111 1101 (binary) or 175(octal) or "}"(ASCII) ...
it´s just one byte = 8 bits.
The only conversion that needs to be done is in your mind.