This article explains the data conversion process between Integer and Float in the Mitsubishi PLC GX-Works2 software. The Integer data type is used to store whole numbers without decimal points, while the Float (Floating Point) type is used to store numbers with fractional or decimal values. In GX-Works2, converting an Integer to a Float can be done using the FLT instruction, whereas converting a Float back to an Integer is done using the INT instruction.
Program Objective
Data Conversion Process Steps:
- Read Data from Analog Input
The analog input data is read and processed by the PLC and displayed in Integer format. - Convert Integer to Float
Use the FLT instruction to convert the analog data (Integer) into a Float (decimal number). - Convert Float to Integer
After the data is in Float format, use the INT instruction to convert it back into Integer format.
Video Simulation
In the video below, we simulated the PLC program and displayed the results.
Convert Integer to Float in Ladder Logic
IO Mapping Details
S.No. | Comment | Memory Bit | Memory Word |
---|---|---|---|
1 | TRIGGER_Float_INT | M0 | |
2 | REGISTER CONTACT AI | M8011 | |
3 | AI-INT | D0 | |
4 | AI-FLOAT | D10 | |
5 | AI-INT(2) | D20 |
Mitsubishi PLC Programming
RUNG 0
In this rung, when the NO contact from memory bit REGISTER CONTACT AI (M8011) is in the HIGH state, the RD3A instruction is activated. The RD3A instruction reads the data from Analog Input 1 and stores it into the memory word AI-INT (D0).
RUNG 8
When the NO contact from memory bit TRIGGER_Float_INT (M0) is in the HIGH state, the FLT instruction converts the data from memory word AI-INT (D0) into Float format and stores it in the memory word AI-FLOAT (D10).
Next, the INT instruction will convert the Float format data in the memory word AI-FLOAT(D10) into Integer Format data in the memory word AI-INT(2) (D20).
Read Next:
- Car Parking Application in Omron PLC Programming
- Scheduled Daily Plant Watering PLC Programming
- Introduction to Siemens PLC Organization Blocks (OB)
- Simple PLC Example on Heater and Cooler for Beginners
- Open Loop and Closed Loop System Questions and Answers