I am using the 16 bit 9S12C128 MCU. I wrote this simple code to return a hex value from an integer input.
word dec_to_hex(signed short number)
hex_value = number;
What I would like to know is, does this return a 16 bit hex value (i.e. input = 32767, returns 0x7FFF; input = -32768, returns 0x8000)? I can't really check the output because when I use "%d", I get an integer value; and when I use a "%x", I get the hex value.
The reason for this is so that I can output the hex value to a DAC. Also, the data type "word" in a 16 bit MCU means that one word is 16 bits and the data type "dword" means 32 bits?
I have googled this but I could never get a clear answer. Any help is appreciated. Thanks in advance.