Hi Guys,
I'm working on KL05Z. I accomplished 12 bit ADC of temperature of MCU and now I wish to send the result to PC.
I used the 16 bit variant to content the result , when I try to cast (byte), for sending data ,the result become " #".
Do you know how to solve this problem ?
your reply will be highly appreciate ,
Thanks,
Minh.
Hi
Usually one would send the value as ASCII coded hex (for example)
0x1234 from ADC could be sent as "1234" (4 bytes on the UART).
If you simply cast to a byte you will lose 8 bits of the value. You could also send as 2 binary values rather than 1 (0x1234 -> 0x12 + 0x34)
Regards
Mark
Hi Mark,
Thank you for your reply,
I'll try it out.
Minh.
Hello Nguyen,
I can't understand your problem what do you mean by "the result becomes #"
Regards
Waqas Ehsan Butt
Hi Waqas Butt,
uinit16_t Temp;
Temp=(25-(ADCR_temp-ADC_temp25)*100/ADC_m);
The result is in 16bit data. when I cast (byte) Temp. The result will be error , and I get " #" character.
MInh.