Hi I'm a new programmer; I'm having problems with unsigned char. I assign a decimal value of 128 to an unsigned char but when I printf this variable comes out as -128. If I assign 127 it comes out at +127, if I assign 129 it comes out as -129. Even if I assign a value of 127, then add 1 it still comes out as -128. It's definitely an unsigned character but it seems to be acting like a signed char.
unsigned char EncVal8; if(Pin8 == 1) { EncVal8 = 128; /*If Pin 8 is on then the Position Value for this Pin will equal 128 */ }
Cheers chaps, problem solved. So simple a solution, and sorted in seconds... Thanks Stewart