Dear all,
I have just a simple question for you.
If I try to store data into an array by using the following line, the resulting byte order is inverted.
(uint16_t)(&delta[0]) = 333; // from decimal 333 to hex 01 4D
delta[0] is 4D
delta[1] is 01
Why is it appen? How can I fix it?
Thank you in advance.
Best Regards,
Roberto
system
2
The AVR processor is little-endian.
What do you mean by "fix"?
I supposed it was a my mistake.
Is it possible to change the byte order by modifing the above line?
Thank you
system
4
You could use masks and shifts to achieve a big-endian result.
It isn't clear to me why this is important.
I need to send data throught a LoRaWAN connection and thus to transform back the hex data in int or float numbers.
Looks like some things are little-endian, some things are big-endian, and some things change endianness. Fun times.