Jump to content
  • 0

Mitsubishi PLC Data Types and Label Types

Bryon Sol



A lot of questions come up about Mitsubishi PLC data types.  This is more common now with GX Works3 and the FX5 (iQ-F) and R series (iQ-R) PLCs.

First, it's important to understand the memory in Mitsubishi PLCs.  There are only 16-bit registers and single bits.  There are no other storage types for data.  There are no 8-bit storage areas, or 32-bit or 64-bit.  

So if we start with storage areas in the PLC that are addressable (we call these DEVICES) they are as follows:


There are some other devices not covered here such as R registers and F annunciator bits, but for the most part this covers the most commonly used devices and their addressing whether it's decimal, octal or hexadecimal.

As you can see there's nothing about data types here, this is purely memory devices (aka memory locations).  What we use them for and how we use them is a separate thing.  For instance I could store a 16-bit integer in data register D0, or I could store a 32-Bit floating point (real) value in D0.  However, if I point a 32-bit floating point value at D0 it will consume both D0 and D1 registers (two consecutive 16-bit registers) to contain that value. So as a Mitsubishi programmer it is up to us to ensure we don't reuse the same register for multiple things.

These DEVICES have been around for many generations of Mitsubishi PLCs.  And prior to GX Works2 everything was programmed at the Device level.  There was no concept of Labels.  We had comments to be able to know what we were using various DEVICES for, but you had to enter the DEVICE when programming.  However, with GX Works2 Mitsubishi released the ability to use Labels.  In GX Works2 this worked by setting aside a portion of the normal Device Memory to be used for label memory area when you didn't specifically link a label to a device.  Or you could specify which register you wanted to use.

In the example below we have two labels one with a Device assigned to it and one without.  When the program compiles it will choose a data register to use.


What register an unassigned label uses can move around.  But it will like in a range defined by the following table (which is user manageable):


When GX Works3 came along and the new iQ-F and iQ-R hardware, a new memory area specifically for Labels was added to the processors so that we weren't using standard device memory for unassigned labels.  So the above table does not exist in GX Works3.

But what about Data Types?


In GX Works2 and earlier software, because we were doing things mostly at the device level the classic Mitsubishi data-type specific functions were used by most programmers.  For instance, on the iQ (Q series) PLCs we would have the following math functions:

+ for 16-bit addition
D+ for 32-bit addition
E+ for 32-bit Floating Point addition

In the example below we still use devices for the input and output arguments.  


But when we switch to Labels we now need to make sure our Data Type of our labels matches the expected data type of the function:


For this to work the labels would have to have the following data types:


 But it was really in Function Block Diagram programming (aka Structured Ladder) where the data type checks started to come into play and wouldn't let you get away with the wrong data type.


This error occurs because we accidentally set the data type as Word instead of Float.



So what data types do we have, and what values can we use with them, and what functions match those types?

Below is a screenshot of the data types you can pick from as standard (simple) data types on an FX5 (iQ-F) PLC


These can contain data as follows:


But now in FBD programming we need to use the correct function types to work with these Data Types.  

For instance INC increments a Word, but INC_U increments and Unsigned Word.

But it gets a little confusing sometimes when converting data types as there are an incredible number of data type conversion instructions:


Some of these are easy to understand as when you start to enter them they are very specific:


For instance DINT2FLT converts 32-bit SIGNED (aka Double Word [Signed]) to float.

However you have to get your data types correct when using the IEEE 61131 compliant function blocks.  And this is where things can get tricky.

For instance the WORD_TO_DINT function requires a WORD (aka Word Unsigned) input and converts this to a DINT ( Dword Signed) output. So WORD and DWORD are for UN-signed values and INT and DINT are for SIGNED values.  But you can't mix and match registers in with these functions because D100 has no data type.


So how do you know if a function is a classic Mitsubishi instruction or a new IEEE version?  Well you can tell by looking at where it exists in the Element selection window:


Functions up top under BASIC Instructions are classic Mitubishi instructions that have been around prior to pure label based programming and work at either register level OR Label level.

Instructions further down under "Standard Function/Function Block" area in Element Selection are IEEE compliant versions and require the proper data type or they simply won't compile.


If you need any assistance with this, reach out to your local Mitsubishi Distributor and they will be glad to assist.



Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...