Hi there.
I have a sensor which its data format is a frame with this format: begin(2 bytes), command(1 byte), data(2 bytes), parity(1 byte).
The 3 first bytes are fixed. the output should be a decimal floating point number:
I want to convert those two data byte to output, but I can't understand the way to this conversation. Can you help me?
Disagree let's see. For example how can I convert DA in hexadecimal to 47.4 in decimal? one byte is less. especially it can sense up to 120 or 130 therefore the only integer part of number needs one byte. Considering the floating part, we need at least two byte.
fatemeh_tabrizi:
Disagree let's see. For example how can I convert DA in hexadecimal to 47.4 in decimal? one byte is less. especially it can sense up to 120 or 130 therefore the only integer part of number needs one byte. Considering the floating part, we need at least two byte.
if (byteToConvert == 0xda)
{
convertedVal = 47.4;
}
Either I'm underthinking this problem, or you're overthinking it. (Or there is something you're not telling us)
fatemeh_tabrizi:
I need to achieve those output. I want to make them, not to memorize them! I need the way to convert DA to 47.4 not to equalization DA to 47.4. OK?
maybe they us that that mysterious sensor is! with any luck someone may have used is before.... in any case it would help us help YOU!