XC8 novice question

Sep 11, 2016 1 Replies

Novice question using MPLABx + XC8


If i define my_variable using;



#define my_variable 0b10000000


And then I use it in a function that expects a 'char';



void my_function(char i);


I get a compiler warning;



warning: (752) conversion to shorter data type


By changing the function prototype to expect an 'int' the warning goes away so I think the defined my_variable is being assigned as an 'int'


So my question is how or can I structure my define so the defined my_variable is assigned as a 'char'..


I cannot see anything useful in the mplabx documentation.



Thanks.



(also posted to comp.arch.embedded)


Thanks, I got a heap of help from the kind folk over at comp.arch.embedded

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required