An example on how to convert from 4 bytes to real using Schneider Electric EcoStruxure Control Expert.

In this example, I am using Schneider Electric Modicon M580 PLC along with the Schneider Electric EcoStruxure Control Expert programming tool.

This conversion logic is very useful for thing like Modbus communication and any third party setup.

I will be demonstrating using a third party to validate the IEEE 754 Floating point conversion using the tool from Dr. Christopher Vickery webpage, who is from the Computer Science Department at Queens College of CUNY. I do not know him personally but just would like to give a shout out to him. Link to his webpage is as shown below.

Here are some common questions around the double and single precision floating point conversion.

**COMMON QUESTIONS**

*What is a bit?*

A bit is the most basic unit and can be either 1 or 0.

*What is a byte?*

A byte is a group of 8 bits, and different combinations (or permutations) of the bits ranging from 00000000 to 11111111 will give you a decimal value range from 0 to 255. Thus 1 byte. Thus, one byte can represent a decimal number between 0 and 255.

*What the hex?*

The hexadecimal is a numbering system where the each of the numeric value 16 possible values, ranging from 0 to 9 and followed by A to F.

*What is the meaning of floating point?*

A floating point is another name for real number; that is a numeric value with decimal.

*What is a IEEE-754 Floating Point representation?*

It is a way to represent floating point as a series of 32 bits number. IEEE-754 Floating Point conversion is a special arithmetic that has to be performed to convert the 32 bits to a real number; and vice versa. This conversion arithmetic was established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE).

*Why do you have to perform IEEE-754 Floating Point conversion?*

When transmission data from one device to another, it is transmitted as a series of 1s and 0s (binary), so it is prudent that the floating points to be converted into a digestible series of 32 bits (or 4 bytes).

Integer (or whole numbers) which is generally 16 bit numbers are easier to convert to binary and will not require a special arithmetic.

*What are the step to IEEE 754 Floating Point conversion arithmetic?*

There is a real good article titled “Example: Converting to IEEE 754 Form”.

The link to this material is also in the Reference section.

http://class.ece.iastate.edu/arun/Cpre305/ieee754/ie4.html

My demonstration YouTube Video of the programming example is as shown below.

**Reference**

- IEEE-754 Floating-Point Conversion – From Decimal Floating-Point To 32-bit and 64-bit Hexadecimal Representations
- IEEE-754 Floating-Point Conversion – From 32-bit Hexadecimal Representation To Decimal Floating-Point
- How to Convert a Number from Decimal to IEEE 754 Floating Point Representation
- IEEE-754 Floating Point Converter
- Single-precision floating-point format
- Float (IEEE754 Single precision 32-bit)
- IEEE 754
- IEEE Standard 754 Floating Point Numbers
- Example: Converting to IEEE 754 Form