I am preparing a code that sends various electrical parameters across a CANbus (power, voltage, current, etc.). Precision is necessary for this circumstance.
There are two options I see:
- Send the value as an integer, but scale it on sending and receiver side (Sending x100, Receiving /100, for example). If I do this, then I can send 2.12V as 212 (or 0xD4).
- Send it as a float value, which would require 32 bits but no scaling.
My questions are as follows:
- Can float values be sent across CANbus?
- If yes to Q1, is that a common practice? Or do most CANbus communication programmers use scaled integers?
Thank you in advance.