Hi,
do we have to convert the data from integer to binary
"integer" and "binary" are two different things.
--> INTEGER is a data format. Let´s say "one byte unsigned integer" = uint8
other examples: float, char, int32 ...
The information of this uint8 is stored in 1 byte = 8 bits.
--> BINARY is just a form of representation. ... how a value is "visualized" (for human eyes).
****
Let´s say you have a uint8 variable containing the value of 65 (decimal)
It is stored in the 8 bits like this: 0-1-0-0-0-0-0-1
You may represent this value
* as 0b01000001 (binary)
* as 0x41 (HEX)
* as "A" (ASCII)
* or many other formats (without the need for converting it on the microcontroller, since it´s always the same 8 bits)
it does not matter how you "visualize" it, it will always be the same 8 bits (0-1-0-0-0-0-0-1) in the memory. All is the same for the computer.
--> No need to convert (process) it at all.
****
But you need to convert (process) the data when you need to transfer them into a different dataformat.
like:
uint8, 0x93 --> uint16, 0x0093 (decimal: 147)
int8, 0x93 --> int16, 0xFF93 (decimal: -109)
uint8, 0x93 --> float32, 0x43130000
int8, 0x93 --> float32, 0xC2DA0000
(btw: all have the same bitwise input value. All different data formats are represented in the same HEX format. Unless .. the obvious)
Klaus