David Richards

const unsigned char changing value!

Discussion created by David Richards on Jun 25, 2013
Latest reply on Jul 1, 2013 by David Richards

Micro MC9S08LL8.

Using CodeWarrior 5.9.0


I have a program where a variable doesn't now need to change. If I leave the declaration as


     unsigned char proportional_band = 100;


then everything is fine and the value never changes. If I change the declaration to


     const unsigned char proportional_band = 100;


it starts off as 54, changes later to 123 and finally to 122.

Changing from char to short fixes the problem. What is going on?