Little and Big Endian

In computing, Big Endian arranges important data from left to right, while Little Endian arranges it from right to left. Based on this, I have made some modifications to my C++ code.

I have developed my code to separate packets with x12 and x16 commands, creating separate binary files. These files will be used in a program for creating graphics. I have also embedded test codes within my code for verification. These test codes allow me to apply the rules of Endianness both in C++ and in the graphics program. For example

You’ve given a detailed explanation of how a 4-byte float data is handled in big endian format in your C++ code. This is particularly focused on the conversion and interpretation of binary data according to the IEEE 754 standard. Here’s a detailed breakdown of your description:

  1. Variable ‘float_data’: This variable contains a 4-byte float data in the payload.
  2. Big Endian Format: The 4-byte float data is received in big endian format.For example, consider the hexadecimal value 0x41200000:
    • 0x41 translates to binary as 0100 0001
    • 0x20 translates to binary as 0010 0000
    • 0x00 translates to binary as 0000 0000
    • 0x00 translates to binary as 0000 0000
  3. Combining the Bytes: When these 4 bytes are combined, they form the binary sequence: 0100 0001 0010 0000 0000 0000 0000 0000
  4. IEEE 754 Standard: According to the IEEE 754 standard, this binary sequence represents the floating-point value 10.0.

This process demonstrates how you are interpreting and converting binary data in your C++ code, adhering to the endianness and IEEE 754 floating-point standards.

Save our packets to bin file for read python or plotting tool.

Python read bin file for plotting.

IEEE 754 format

Also you can use this function.

Bir yanıt yazın