Convert a decimal value in char to hex and store in the char

You mean code from post #3? Can you make sense of it? I totally agree with @gcjr: there's a lot of duplicated code there. Other than being a mess to follow visually and to debug, it makes it hard to test individual parts. If you split it into small subroutines, you can test them individually and use them as building blocks for other, bigger building blocks for other... get the idea?