Jump to content
  • 0

Mitsubishi PLC Data Types and Label Types


Bryon Sol
 Share

Question

DEVICES AND LABELS

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:

image.png.383814d33a7e1980e29b1b48cf4f9820.png

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.

image.png.b7326c16b21030858c6461e393923b3b.png

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):

image.png.f9da63fcfcc19ef1df72712a6285913c.png

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?

DATA TYPES AND FUNCTIONS

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.  

image.png.7186e3bddc624653f610b0fc920da7c3.png

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:

image.png.44eca182908e4d5a2dd35eba6017312b.png

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

image.png.41ac7f74fae70ffbb5c7e6674e65cce6.png

 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.

image.png.c5e6a217030bb4e8fc698c2e78dbcea3.png

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

image.png.785882158acc3efb9453d5aed461fdad.png

 

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

image.png.3cdc84be6e8645303c633ad16405fa37.png

These can contain data as follows:

image.png.5313deb9a68954aafe4a565ebeaf061e.png

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:

image.png.b4a68a87446cc498498ac8e44bc6a194.png

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

image.png.e048d5d739d4b3f7e90cec825e976a8e.png

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.

image.png.0c18d36c3227f7a0c4e7e54813c93e6d.png

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:

image.png.bc41b27652807a5612472cf80ba677e7.png

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.

image.png.99a5506e107fc7e511040aad912dd94c.png

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.

Guest
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.

 Share

×
×
  • Create New...