You are on page 1of 143

Revisions

* The manual number is noted at the lower left corner of the front cover.
Release Date Manual Number Revision
7/2007 FXTRN0573023-A Rev A - Created new manual (taken largely from the MEAU
FX Training Manual, Rev F)
7/2007 FXTRN0573023-AA4 Rev A with A4 Paper Size and layout changes
5/2008 FXTRN0573023-B Rev B
- Added information on FX3UC
- Added Windows Vista compatibility
- Minor text/layout revisions and corrections

Disclaimer: This manual does not imply guarantee or implementation right for industrial ownership or
implementation of other rights. Mitsubishi Electric Corporation is not responsible for industrial
ownership problems caused by use of the contents of this manual.

2007 Mitsubishi Electric Corporation


Introduction
This Training Manual was created to accompany the FX-TRN-KIT-R Training and
Demonstration Kit. Please go through this manual carefully to develop full familiarity
with the functions and performance of the FX3U PLC and Training Kit itself, so as to
ensure correct use of the FX3U and its related devices in the future.

Table of Contents

CHAPTER 1 Introduction and Overview 1

1.1 Course Objectives ..................................................................................... 1


1.2 Course Prerequisites ................................................................................. 1
1.3 Course Duration......................................................................................... 1
1.4 Course Description .................................................................................... 2
1.5 Product Line Overview............................................................................... 3

CHAPTER 2 FX Series Hardware Review 5

2.1 What is a dedicated PLC? ......................................................................... 5


2.2 The FX Line of PLCs.................................................................................. 6
2.3 Hardware Components .............................................................................. 8
2.4 Inputs ....................................................................................................... 10
2.5 Outputs .................................................................................................... 12
2.6 Analog Modules and Special Adapters .................................................... 14
2.7 High-Speed I/O & Positioning Modules and Special Adapters................. 15
2.8 Communication Modules, Boards, and Special Adapters ........................ 17
2.9 Network Modules, Boards, and Special Adapters.................................... 19
2.10 Miscellaneous .......................................................................................... 22
2.11 Power Supplies........................................................................................ 22
2.12 Exercise Power Supply Calculation ...................................................... 29
2.13 Memory Types ......................................................................................... 31

CHAPTER 3 Programming Equipment 33

3.1 Hand-Held Programming Units ................................................................ 33


3.2 Programming Software ............................................................................ 33
3.3 GX Developer Overview.................................................................................... 34
3.4 File Format .......................................................................................................... 37
3.5 Hardware Connection........................................................................................ 37

CHAPTER 4 Numbering Systems 39

4.1 Binary Numbers ....................................................................................... 39


4.2 Hexadecimal Numbers............................................................................. 40
4.3 Octal Numbers......................................................................................... 41
4.4 Binary Coded Decimal ............................................................................. 42
4.5 Exercise Numbering Systems Conversion............................................ 43

i
CHAPTER 5 Numeric Data in PLCs 45

5.1 Integer Handling ...................................................................................... 45


5.2 Non-Integer Handling............................................................................... 47

CHAPTER 6 System Devices 49

6. System Devices ....................................................................................... 49

CHAPTER 7 Addressing 55

7.1 Right Side Bus Addressing ...................................................................... 55


7.2 FX3U Left Side Bus Addressing .............................................................. 55
7.3 Addressing Example ................................................................................ 57
7.4 Exercise PLC Addressing ..................................................................... 58

CHAPTER 8 Training Kit Layout 59

8.1 Addressing............................................................................................... 59
8.2 Indicator Lights ........................................................................................ 60
8.3 Operator Interface.................................................................................... 60

CHAPTER 9 PLC Instruction Types 61

9.1 Basic Instructions..................................................................................... 61


9.2 STL (Step Ladder) Instructions ................................................................ 61
9.3 Applied Instructions ................................................................................. 61

CHAPTER 10 Basic Instructions 63

10.1 Symbols ................................................................................................... 63


10.2 Ladder Basics .......................................................................................... 64
10.3 Common Instructions ............................................................................... 65
10.4 Exercise Ladder Basics ........................................................................ 67

CHAPTER 11 Developing and Editing Programs 69

11.1 Launching GX Developer......................................................................... 69


11.2 Creating a New Project ............................................................................ 70
11.3 Editing the Ladder.................................................................................... 71
11.4 Program Transfer..................................................................................... 72
11.5 Online Editing .......................................................................................... 74
11.6 Monitoring Program Operations............................................................... 75
11.7 Forcing Bits and Changing Registers ...................................................... 76
11.8 Exercise Contacts and Coils ................................................................. 77

ii
CHAPTER 12 Timers and Counters 79

12.1 Timers...................................................................................................... 79
12.2 Counters .................................................................................................. 80
12.3 Program Examples .................................................................................. 85
12.4 Additional Timer Instructions.................................................................... 87
12.5 Exercise Timers and Counters.............................................................. 88
12.6 Exercise Conveyor Control ................................................................... 88

CHAPTER 13 Applied Instructions 89

13.1 General Format........................................................................................ 89


13.2 Data Transfer Instructions........................................................................ 90
13.3 Comparison Instructions .......................................................................... 91
13.4 Exercise Parking Lot ............................................................................. 93
13.5 Exercise Conveyor Control Part 2......................................................... 94
13.6 Conversion Instructions ........................................................................... 94
13.7 Increment and Decrement Instructions .................................................... 95
13.8 Exercise INC and DEC ......................................................................... 95
13.9 Arithmetic Instructions.............................................................................. 95
13.10 Exercise Binary Math ............................................................................ 96
13.11 Exercise Parking Lot Part 2 .................................................................. 96
13.12 Exercise Conveyor Control Part 3......................................................... 97
13.13 High-Speed Processing ........................................................................... 97
13.14 Exercise High-Speed I/O ...................................................................... 99
13.15 FX3U Left Side Bus ............................................................................... 100
13.16 Temperature Sensor .............................................................................. 100
13.17 Exercise Parallel Link.......................................................................... 101
13.18 TO/FROM Instructions ........................................................................... 102
13.19 Exercise Analog Control ..................................................................... 103
13.20 Shift Instructions .................................................................................... 106
13.21 Exercise Analog Processing ............................................................... 107
13.22 Program Flow Control ............................................................................ 108

CHAPTER 14 Diagnostic Devices 111

14.1 Special M Relays ................................................................................... 111


14.2 Special D Registers ............................................................................... 112
14.3 Handy Troubleshooting Circuits............................................................. 113
14.4 Real Time Clock Usage ......................................................................... 113
14.5 Exercise Daylight Savings Time ......................................................... 114
14.6 GX Developer Diagnostics..................................................................... 115
14.7 Find/Replace Menu................................................................................ 116
14.8 Data Trace ............................................................................................. 122

iii
CHAPTER 15 Documentation and Printing 123

15.1 Comments ............................................................................................. 123


15.2 Statements............................................................................................. 126
15.3 Notes ..................................................................................................... 126
15.4 Device Labels ........................................................................................ 126
15.5 Viewing Documentation ......................................................................... 127
15.6 Printing................................................................................................... 127

Appendix 129

iv
CHAPTER 1 Introduction & Overview
Welcome to the FX series programmers training course. This course is intended for
designers and control engineers, responsible for developing application programs using
the FX series programmable logic controller (PLC). Apart from traditional product
training concentrating on tools, a portion of this training is devoted to design, with the
intention of laying a foundation for a successful and short design and debugging cycle.

CHAPTER Objectives: At the conclusion of this chapter, students will be able to

o Identify the objectives of this course.


o Identify the objectives of each chapter.
o List the prerequisites and target audience of the course.

Materials: FX-TRN-KIT-R Training Manual

Overview: This chapter is an introduction to the course and its organization.


This will give readers a quick listing of the chapters, their sequence and their
contents. If there are additional opinions or needs regarding topics and issues
that may not be covered in the course, please inform the course Trainer or the
nearest Mitsubishi Electric product provider.

1.1 Course Objectives


At the conclusion of this course, students will be able to

o Identify the FX series hardware variations available, and understand their


intended application.

o Use the GX Developer software, in conjunction with the FX-TRN-KIT-R


Training Kit, to develop, test, debug, and implement a symbolic ladder
program for a machine control application.

o Understand the structure and basic operation special function modules


(SFMs) and FX3U left side bus boards (BDs) and special adapters (ADPs)
used for operations such as analog to digital (AD) and digital to analog (DA)
conversion, networking, and high-speed processing.

1.2 Course Prerequisites

This class is meant for those with basic electronics knowledge, and some
exposure to industrial control concepts. Experience with PLC ladder code or any
computer programming language is also advantageous.

1.3 Course Duration


This is a 3 day training course.

1
1.4 Course Description

CHAPTER 1 - Introduction to the Course


This is a brief introduction to the course, and a breakdown of the chapter topics.

CHAPTER 2 - Hardware Review


This chapter discusses the hardware structure of the FX series programmable
logic controller, CPU types and capabilities, input and output module types and
characteristics, special function module types and capabilities, board types and
capabilities, special adapter types and capabilities, and other FX series related
hardware.

CHAPTER 3 - Programming Equipment


This chapter covers the hardware, software, and connection necessary to
connect a laptop or PC to an FX PLC. Alternatives to laptop and PC
programming are also covered.

CHAPTER 4 - Numbering Systems


This chapter discusses the four different numbering systems used by FX PLC
systems: Binary, Octal, Hexadecimal, and Binary Coded Decimal (BCD).

CHAPTER 5 - Numeric Data in PLCs


This chapter explains how integers and non-integers are handled by the PLC.

CHAPTER 6 - System Devices


This chapter covers the FX PLC devices, such as X input devices, Y output
devices, and M auxiliary relays, that are used within the program instructions.

CHAPTER 7 Addressing
This chapter covers the rules of addressing on both the right side and left side
bus of the FX3U, including limitations on the maximum number of I/O.

CHAPTER 8 - Training Kit Layout


This chapter examines and explains the hardware kit that will run the programs
written in this class.

CHAPTER 9 - PLC Instruction Types


This chapter explains the 3 main types of FX programming instructions and their
intended purposes.

CHAPTER 10 - Basic Instructions


This chapter explains contacts, coils and other basic ladder code instructions.

CHAPTER 11 - Developing and Editing Program


This chapter reviews the process of starting a project, writing a simple ladder
program, transferring data to the PLC, and monitoring the PLC operations.

CHAPTER 12 - Timers and Counters


This chapter reviews these two important devices in detail and contains an
example application using timers.

2
CHAPTER 13 - Applied Instructions
This chapter covers many advanced instructions: data manipulation instructions,
arithmetic instructions, comparison instructions, conversion instructions, logical
operations, FX3U left side bus utilization methods, and TO/FROM instructions.
This chapter contains many example applications using the applied instructions.

CHAPTER 14 - Diagnostic Devices


This chapter covers the special auxiliary relays and data registers that can assist
in troubleshooting and writing programs. This chapter also contains a brief
explanation of the diagnostic capabilities of GX Developer and some sample
diagnostic ladder code.

CHAPTER 15 - Documentation and Printing


This chapter reviews the types of documentation that can be included in a GX
Developer ladder program, as well as the different options available for printing
the GX Developer project.

1.5 Product Line Overview


Mitsubishi offers Modular and Micro style controllers. Two of the current models
are shown below.

Q SERIES

FX SERIES
The FX series PLC will be covered in this class. There are many programming
similarities between the FX and Q series controllers. The FX series simply
incorporates inputs, outputs, power supply and processor into one package!

3
4
CHAPTER 2 FX Series Hardware Review
This chapter discusses the hardware structure of the FX series programmable logic
controller (PLC), including a review of the different CPU types, input/output modules
and other related hardware and devices.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Explain the general sections of a PLC.


o Describe the different models in the FX family.
o Describe the characteristics of the I/O modules available.
o List some of the factors to be considered in specifying hardware.

Materials: FX-TRN-KIT-R Training Manual


FX Series Catalog

2.1 What is a dedicated PLC?


A dedicated PLC is a microprocessor controlled computer that is designed
specifically to perform real-time industrial machine control.

There are three general sections to all PLCs: INPUT, CPU, and OUTPUT.

INPUT
The input section consists of integrated input terminals, or
extension input terminals, that the input devices of the application
will be wired to, like limit switches, or transistor sensors, etc. When
the input voltage reaches its specified level the input becomes
active. Once active, the input can be read by the PLC.

CPU
The CPU is the backbone of the PLC which runs and manages all
of the system processes. Each FX series model has a different
CPU type. Therefore, the FX model (and CPU) needs to be
selected depending on the requirements of the application.

OUTPUTS
The output section consists of integrated output terminals and
extension output terminals that are controlled by the CPU. Based
on the condition of the inputs, the CPU will judge which outputs
should turn ON, activating machine devices like lights, buzzers,
relays, solenoids, or motors.

The three sections are controlled by user-written sequencing software called the
ladder program, which takes the place of hard-wired circuits. The relationship
between inputs and outputs is controlled by the logic in the ladder program.
Because hard-wired circuits are now replaced by software logic, machine
modifications and improvements are much easier to implement.

5
2.2 The FX Line of PLCs
All of the PLCs in the FX line have certain characteristics in common:

1) An integrated power supply. Most of the PLCs in this line have a built in
power supply that requires 100-240 VAC power. Several of the PLCs have a
DC power version available as well.

2) Integrated I/O. Each main unit has a specific number of inputs and outputs,
depending on the model chosen. The inputs are typically DC, although
certain models have AC inputs as well. All models have relay and transistor
output versions available (except the FX0S), and several offer triac outputs.

3) Common Instructions. Although the higher-end PLCs have more advanced


instructions available, all PLCs support at least a common instruction set of
20 basic and 35 applied instructions.

4) Additional built-in special functionalities. For example, all FX PLCs have a


built-in high-speed counter (or several high-speed counters).

The FX Series Legacy

The F series of PLCs was originally introduced in 1981 with the F PLC. The F
was then improved and revised several times, resulting in the F1, F1J and F2
models. After the F2 came the FX series PLCs. These models included the FX,
FX0, FX1, FX2, FX0S, FX0N, and FX2C, as well as the current offerings, the
FX1S, FX1N, FX2N, FX2NC, and FX3U. By 2006, sales of Mitsubishi F series
PLCs exceeded 7 million units worldwide!

The currently available models of FX series PLCs are detailed below.

FX1S

The FX1S PLC has the small footprint like the FX0S, but with many more
capabilities. The FX1S has more I/O (up to 30), more internal devices, and has
motion control capability with up to 100kHz pulse train output and built-in
positioning instructions. A small HMI (the FX1N-5DM) can be connected to the
front and used to monitor and change timers, counters and data registers. The
FX1S can use one board, but has no expansion bus.

FX1N

The FX1N provides the mid-range number of I/O points similar to the FX0N, but
with more capabilities and expandability. The FX1N has more internal devices
than the FX0N (1536 M relays and 235 counters), and has motion control
capability equivalent to the FX1S. The FX1N also has a number of boards that
can be added to provide additional I/O or allow the connection of FX0N
communication modules. The right side expansion bus can be connected with
special function modules enabling further I/O, analog, positioning, or
communication capacity. The FX1N-5DM can also be connected to the FX1N.

6
FX2N

The FX2N is currently one of Mitsubishis most powerful processors. It is fully


expandable and can control up to 256 I/O. It has 3072 internal relays, 256
timers, 234 counters, 8000 data registers, and up to 21 high-speed counters.
Numerous special function modules are available for this line, including modules
for Profibus, CC-link, AS-Interface and I/O, as well as an electronic cam switch
module. Besides special function modules on the right side expansion bus, this
versatile PLC can be extended by boards which connect to the front of the PLC.
These can give the PLC a second programming port, an RS-485 port, an RS-232
port, or even an Ethernet gateway. FX0N and FX series modules can be used
with this PLC.

FX2NC

Similar to the FX2N in all respects except for no built-in real-time clock and a 24V
DC power supply only, the FX2NC uses connector-type distributed I/O instead of
I/O terminals. The result is a powerful, expandable, super-compact PLC main
unit less than 1/3 the size of the smallest FX2N. Boards are replaced with
special adapter units, and right side expansion bus special function modules can
still be connected.

FX3U

The FX3U is Mitsubishis latest and most powerful processor. It is highly


expandable and can control up to a maximum of 384 I/O with a standard 64,000
steps of program memory. It has four times more internal devices than the
FX2N, a faster CPU, and a new left side expansion bus. All the right side
expansion bus special function modules available for the FX2N are compatible
with this line. New communication boards and special adapters, including a new
USB communication board, can be used to reach a maximum of 3 serial
connections on this PLC. New networking options include a full-feature Ethernet
module, Profibus Master and Slave modules, and a Modbus special adapter.
The FX3U controls up to three axes of pulse train outputs from the main unit,
expandable to four when using new high-speed special adapters. Finally, the
FX3U can be expanded with two axis integrated positioning control using
Mitsubishis own SSCNET III fiber optic positioning network.

FX3UC

The FX3UC is the ultra-compact version of the FX3U processor with connector-
type distributed I/O, like the FX2NC. It retains almost all features of the FX3U but
does not the support use of the expansion boards and high-speed I/O adapters
on the left side expansion bus, as well as the FX3U-7DM display module, due to
form factor restrictions. The FX3UC right side expansion bus can be converted to
the standard right side expansion bus using either the FX2NC-CNV-IF, or the
FX3UC-1PS-5V.

This training course will make use of the FX3U series PLC. However, most of
what is covered will apply to the entire FX series PLC line.

7
2.3 Hardware Components

Main Units

FX3U Main Unit FX3UC Main Unit

The main unit contains:

1) The CPU. This is the main processing power behind the PLC; reading inputs,
calculating logic and mathematics, and writing to outputs.

2) Integrated power supply. This provides power to the CPU, inputs, and a
limited number of connected extension blocks, special function blocks and
special adapters.

3) Integrated inputs. These can be either DC or AC, depending on the model


selected. The largest FX series main units have 64 inputs.

4) Integrated outputs. These can be relays, transistors or triacs, depending on


the model selected. The largest FX series main unit has 64 outputs. For the
FX1S series and FX1N series the ratio of inputs to outputs is 3:2 or 4:3. In
the FX2N series, FX2NC series, FX3U series, and FX3UC series the ratio is
always 1:1.

5) Programming port. This port uses RS-422 as its communication protocol.


The PLC can be programmed through this port, or a Human-Machine
Interface (HMI) can be connected instead.

6) Accessory connection ports. These can be used to connect memory modules


or boards to the main unit.

8
Powered Extension Units

As mentioned previously, the FX series I/O is expandable. One way to increase


I/O is through the use of powered extension units. These units have:

1) Integrated power supply. This can be used as an alternative to the power


supply of the main unit for other extension blocks and special function
modules. AC and DC power types are both available.

2) Integrated inputs. <30VDC and <264VAC input units are available. The
number of inputs is either 16 or 24, depending on the model selected.

3) Integrated outputs. The number of outputs is the same as the number of


inputs (16 or 24). Relay, transistor, and triac type outputs are all available.

Connecting I/O to a main unit

9
Non-powered Extension Blocks

Another way to expand the I/O of an FX series system


is through the use of non-powered extension blocks.
These do not have a power supply, so they draw
power from either the main unit or a powered
extension unit. As such, there is a limit (in addition to
the I/O allocation limit) to the number of extension
blocks that can be added. How to calculate this
number will be covered later.

Non-powered extension blocks provide 8 or 16 I/O


points. Each terminal is either an input or output, but not both. Inputs are
24VDC, and all three output types are available. If the available models do not
meet the needs of the system, units from the FX0N PLC line can be used, as well
as from the FX2NC PLC line (through the use of the FX2N-CNV-IF converter).

For FX2NC and FX3UC PLCs, an FX2NC-CNV-IF (or FX3UC-1PS-5V for the
FX3UC only) must be used to connect FX2N extension units or blocks. Additional
FX2NC series extension blocks are also available.

Note: Be aware of the terminology used; an extension unit is powered, while


an extension block is non-powered.

2.4 Inputs
Input devices are the interface between PLCs and machines. The FX PLC main
unit has a number of integrated inputs available. If more are needed, input
extension units and extension blocks are available to be connected.

There are 2 different input types

DC Inputs
o Fast response
o 90% of new designs use this type of input
o 24VDC input voltage
o Sink or Source logic

AC Inputs
o Slow response
o Easy to interface AC devices
o 120VAC input voltage

Integrated Inputs

10
SINK or SOURCE logic refers to the voltage level that will cause the input to
become active.

SINK Logic: the input becomes active when connected to GROUND.


The S/S terminal must be manually wired to +24VDC.

Use SINK for NPN type sensors

SOURCE Logic: the input becomes active when connected to +24VDC.


The S/S terminal must be manually wired to GROUND.

Use SOURCE for PNP type sensors

11
The input trigger levels vary, depending on the module type. Generally, the input
becomes active at the 2/3 level and then back to inactive at the 1/3 level.

For example, a +24VDC input will become active when the input voltage reaches
16VDC, and then become inactive when the voltage reaches 8VDC.

24V

16V

VOLTAGE LEVEL
8V

0V

OFF
DIGITAL INPUT is ON
ON

10ms 10ms

The standard input device has a 10ms input filter. This is done deliberately for
switch de-bounce. As switch contacts close, the mechanical contacts actually
bounce slightly, causing the input voltage to fluctuate rapidly for a short period of
time. This 10ms delay allows the switch contacts time to stop bouncing.

It is possible to adjust the input filter constant. This is explained in Section 14.2
of this Training Manual.

Typically if more than 20 pulses per second are required, a high-speed counter
module or the built-in high-speed inputs should be used. For more details on
internal high-speed counters, refer to Section 12.2 of this Training Manual.

The PLC main unit will contain 8, 16, 24, 32, 40, or 64 built-in physical inputs.
Extension units offer either 16 or 24 additional input points. Extension blocks
offer 8 or 16 additional input points. All input points can be switched between
sink or source logic.

2.5 Outputs
Output devices allow the PLC to control and interface with other machines and
equipment. The FX PLC main unit has a number of integrated outputs available.
If more are needed, output extension units and extension blocks are available to
be connected.

12
Integrated Outputs

There are 3 different output types

Relay Outputs
Triac Outputs
Transistor Outputs

RELAY OUTPUTS
Relays are dry contacts; whatever is input on the common terminal is switched
out when the output becomes activate. This is the most common type of output
terminal used. Loads up to 2 Amps, 100VAC~240VAC or 30VDCcan be
switched, with a maximum of 8 Amps per common. Most base units and
extension modules have four outputs per common.

TRIAC OUTPUTS
Triacs are solid state AC switches. When the output becomes active the terminal
connects the load to the AC source. Load switching is up to 0.3Amps at 240VAC
per point, with a maximum of 0.8 Amps per common. Each base unit or
extension module has up to four outputs per common.

TRANSISTOR OUTPUTS
Fast response is the main characteristic. Transistors are solid state DC
switches. When the output becomes active, the terminal connects the load to the
DC source. Load switching is up to 0.5Amps per point, with a maximum of 0.8
Amps per common. 5 to 30VDC can be switched. Most base units and
extension modules have four outputs per common. Transistor outputs are
required for high-speed pulse train outputs from the PLC main unit.

Transistor Output Wiring:


Sink Outputs Source Outputs

13
2.6 Analog Modules and Special Adapters
All of the hardware that has been discussed thus far has used discrete I/O; the
inputs or outputs are either ON or OFF. This is acceptable if all the inputs in the
PLC system are switches or simple sensors, and the outputs simply need to be
turned ON and OFF. However, if it is necessary for the FX PLC to monitor or
control a temperature or other variable voltage input/output, an analog special
function module (SFM) or special adapter (ADP) is required. Analog boards (BD)
for the FX1S, FX1N, and FX2N are not described in this document.

Right Side Bus Analog Modules

There are 3 types of Analog SFMs: Analog Input modules, Analog Output
modules, and Combination Analog Input/Output modules. All are used with I/O
points that have more states than just ON or OFF. Examples of analog inputs
would be a velocity reading or pressure reading. An example of an analog output
would be the variable speed of a motor.

The input modules come with 2, 4, or 8 analog input channels. These are the
FX2N-2AD, FX2N-4AD, and FX2N-8AD, respectively. The output modules come
with 2 or 4 channels. These are the FX2N-2DA and FX2N-4DA, respectively.
There are 2 combination modules: the FX0N-3A has 2 input channels and 1
output channel, the FX2N-5A has 4 input channels and 1 output channel. For
the FX3U and FX3UC series only, there are two other analog modules, the
FX3U-4AD and FX3U-4DA, which are like the FX2N-4AD and FX2N-4DA, but
support higher resolution and faster processing.

All the modules measure or output varied current or voltage, usually 20mA to
+20mA, 4 to 20mA, or 10V to +10V, as set by the programmer. Depending on
the type of module, data is received from either the PLC or from the analog input
channels and the raw number data is interpreted as either the current or voltage
level to be output (if from the PLC, digital to analog, or DA), or the analog value
read from the input channel (if from an analog input, analog to digital, or AD).

Programming Example

The PLC programmer wants to detect small changes in


pressure to control a chemical mixing process. He has
a sensor that has a range of 0 to 300 PSI and generates
a voltage of 10 to +10V. The FX2N-4AD module sees
10V as the number -2000, and +10 V as +2000.

Given this information, the programmer knows that at 0


PSI the sensor sends a voltage of 10V, which results in
a value of -2000 being read to the PLC. At 150 PSI, 0V
is generated, resulting in a value of 0 being read to the
PLC. At 300 PSI, the voltage is 10V and the PLC value
would be 2000. It is the responsibility of the programmer to know what analog
pressure value equates to what PLC digital value, and to write the program to
scale and/or use that value accordingly.

14
Temperature Input Modules
These modules are similar to the other 4 input channel analog modules except
for the type of input devices which can be connected. With the FX2N-4AD-TC,
thermocouple temperature sensors are used for temperature detection which
produce changes in voltage. Type J and Type K thermocouples are supported.
With the FX2N-4AD-PT, platinum temperature sensors (PT-100 RTD) are used.
These sensors can detect very small temperature changes (i.e. 0.2C to 0.3C,
0.36F to 0.54F). The FX2N-8AD modules inputs can also be configured for
type K, J, or T thermocouples.

FX3U & FX3UC Left Side Bus Analog Adapters

One of the new features of the FX3U is a high-speed expansion


bus on the left side of the PLC. A maximum of 4 analog special
adapters (ADPs) can be used on this left side expansion bus,
regardless of which of the 4 available analog ADPs they are.
The ADPs available are a 4-channel input ADP, a 4-channel
output ADP, a 4-channel thermocouple sensor input ADP, and a
4-channel PT-100 RTD sensor input ADP. These left side
expansion bus ADPs do not require TO/FROM instructions
(discussed later). Data from the analog inputs are written
directly into special data registers within the PLC.

2.7 High-Speed I/O & Positioning Modules and Special Adapters


Ordinary counters in the PLC are dependent on the ladder program scan time in
two ways: updating the input conditions being used as the counter input, and
updating the accumulated value of the counter device being used. This may be
too slow for high-speed counting applications. Thus, the FX series PLC main
units have built-in high-speed counters with varying maximum counting
frequencies depending on the PLC model. High-speed pulse train outputs from
the main unit, SFMs, or ADPs can be used for positioning applications where it is
necessary to precisely control equipment like inverters and servo motors.
Further interpolated positioning applications can also be realized using SFMs.
The FX PLC has many expandable high-speed input/output and positioning
control options.

High-Speed Counter Module

The FX2N-1HC module provides the connected FX


series PLC with one additional high-speed counter at up
to 50kHz with selectable inputs of 5, 12 or 24VDC. It
allows for two single phase inputs, one for counting up
and one for counting down, or one 2-phase input. It
also has two integrated transistor outputs which can be
controlled independently from one another through
internal compare instructions.

15
Single-Axis Positioning Modules
The FX2N-1PG (PG meaning Pulse Generator) module
creates a pulse train output that can be used for motion
control applications. This module accepts 24VDC inputs
and produces pulse trains at speeds up to 100kHz. The
FX2N-1PG attaches to the right side expansion bus.

The FX2N-10PG module allows for either 5VDC or


24VDC inputs and can produce pulse trains at speeds
up to 1MHz. This module also connects to the right side
expansion bus.

For both of the PG positioning modules, the


characteristics of the pulse train outputs, such as
frequency, and OFF/ON status can be controlled by the PLC program or by
parameters set prior to operation.

The FX2N-10GM is a single-axis positioning module which can be used either on


the right side expansion bus or independently from the FX PLC at up to 200kHz.
For both of the GM positioning modules, dedicated software
FX-PCS-VPS/WIN-E allows users to program the modules
separately from the PLC in a visual step-based environment.

Two-Axis Positioning Modules


The FX2N-20GM is a two-axis positioning module which can
be used either on the right side expansion bus or
independently from the FX PLC at up to 200kHz. The
FX2N-20GM also provides linear and circular interpolation
capabilities. For both of the GM positioning modules,
dedicated software FX-PCS-VPS/WIN-E allows users to program the modules
separately from the PLC in a visual step-based environment.

The FX3U-20SSC-H module provides high-end


positioning control capabilities to the FX3U and
FX3UC series PLCs. It is designed to use the
Mitsubishi MR-J3-B servo line with its 10Mbps fiber
optic SSCNETIII communication network. The MR-J3-
B Servo Amplifiers can be placed up to 50 meters
away from the PLC via the dedicated fiber optic plug-
and-play cables. This module controls up to 2 axes at
up to 50MHz and can be setup and operated with its
own dedicated software FX Configurator-FP. The
module is capable of extensive table operations and
both linear and circular interpolation capabilities. This
module connects to the right side expansion bus.

16
FX3U Left Side Bus High-Speed Input Adapter
The FX3U-4HSX-ADP special adapter connects to the left
side expansion bus of the FX3U and enhances the existing
100kHz high-speed counting ability of the FX3U main unit to
200kHz. The FX3U-4HSX-ADP does not require TO/FROM
instructions (discussed later) and instead directly routs the
high-speed inputs into X0-X3 or X4-X7 (depending on the
adapters address). A maximum of two high-speed input
adapters can be used on an FX3U CPU, providing up to eight
high-speed inputs. These special adapters must be located
directly next to the left side of the PLC or connected to the left
side of the FX3U-2HSY-ADP high-speed output adapter.

FX3U Left Side Bus High-Speed Output Adapter

The FX3U-2HSY-ADP module connects to the left side


expansion bus of the FX3U and extends the existing 3-axis
100kHz high-speed pulse output ability of the FX3U transistor
type main units to 200kHz on up to 4 axes. The FX3U-2HSY-
ADP does not require TO/FROM instructions (discussed
later) and instead directly routs the high-speed outputs into
Y0, Y1, Y4, and Y5 or Y2, Y3, Y6, and Y7 (depending on the
adapters address). A maximum of two high-speed output
adapters can be used on an FX3U CPU, providing up to four
high-speed outputs. These special adapters must be located
directly next to the left side of the PLC or connected to the left
side of the FX3U-4HSX-ADP high-speed input adapter.

2.8 Communication Modules, Boards, and Special Adapters


Many times, more is required of a PLC system than just monitoring inputs and
controlling output devices. Data may need to be acquired from or sent to another
peripheral device, PLC or PC. The single programming port may not be enough.

The FX family has several options that can be used to add communication
abilities and expand the flexibility of the FX system. Network connection
modules will be discussed in the next section of the training manual. In this
section, only modules, boards, and special adapters used to augment the serial
communication ability of the PLC will be discussed.

The FX3U and FX3UC PLCs support the addition of two serial ports via the left
side bus. For the FX3U, if using a communication BD board, only one additional
communication ADP module can be used. When using the FX3UC, or the FX3U
with an FX3U-CNV-BD board, two additional communication ADP modules can
be used. Communication BDs and ADPs for the FX1S, FX1N, FX2N, and
FX2NC are not pictured in this document.

17
RS-232 Communication Interface Adapter and Module
To add an RS-232 communication port to the FX3U PLC, the FX3U-232ADP,
FX3U-232ADP-MB, FX2N-232IF or FX3U-232-BD must be attached. For the
FX3UC, only the FX3U-232ADP, FX3U-232ADP-MB, and FX2N-232IF can be
attached.

For the FX1S, FX1N, FX2N, and FX2NC, the FX2NC-232ADP will work.
However, the FX*N-CNV-BD is required for PLCs other than the FX2NC in order
to use the FX2NC-232ADP. An FX1N and FX2N 232-BD are also available.

The FX3U-232ADP can be connected to the left side of the


PLC through the left side expansion bus. This module may
require special ladder code and or parameter setup in the PLC
to configure the communication port. Data can be transmitted
and received through the use of the RS or RS2 Instruction.

The FX3U-232ADP-MB allows the same functionality as the


FX3U-232ADP, but with added Modbus communication support
when paired with an FX3U or FX3UC PLC of firmware version
2.40 or higher. The FX series RS-232 Modbus capabilities
allow the FX3U PLC to be a master of one slave station
(numbered 0x01-0x10), or a slave station itself on any existing
Modbus network.

The FX2N-232IF connects to the right side bus of the


PLC, in the same way as any other SFMs. PLC
programming using the TO/FROM instructions
(discussed later) is necessary to initialize the module
and setup its parameters. The module can be
configured to automatically convert data between ASCII
that is received or transmitted and binary or BCD data
that is used in the PLC. The RS and RS2 instructions
can not be used with this module. This module does not
count as one of the two additional serial ports mentioned
above.

RS-232 Communication Board FX3U-232-BD

This board connects to the port located on the left side of the
FX3U PLC. Unlike with the FX2N-232IF and FX3U-232ADP,
this connection location takes up no extra space in the PLC
system.

Like the 232ADP, this board may require special ladder code
and or parameter setup in the PLC to configure the
communication port. If using an open protocol, the RS or
RS2 instruction is required to transmit and receive data.

18
RS-422 Communication Board FX3U-422-BD
The Mitsubishi HMI line commonly connects to FX series PLCs
through the programming ports. If the programmer needs to
interface with the PLC program without disconnecting the HMI,
either transparent mode (through the HMI) or a communication
board are the simplest ways to accomplish this goal. The
board simply adds a second programming port to the PLC, with
no need for any ladder code or parameter setup. Note that an
HMI can interface with the PLC through this port as well as the
built-in programming port. An FX1N and FX2N 422-BD are
also available.

USB Communication Board FX3U-USB-BD


This board will add a standard USB Mini-B female port to the
front face of the FX3U PLC, allowing a PC to connect to the
PLC via any standard USB Type-A female port. The required
drivers for the PC and a high-speed 3m USB 2.0 cable are
included with the board.

2.9 Network Modules, Boards, and Special Adapters

The FX series PLC has several networking capabilities that can be added on to
the main unit. These allow the PLC to operate on a far larger system than could
be possible with a FX main unit PLC. Restrictions to the number and
combination of modules that can be attached may apply. Refer to the users
manuals for more details.

RS-485 Communication Board & Interface Adapter

The FX3U-485-BD communication board connects


to the port located on the left side of the FX3U
PLC and provides several serial networking
options. One example of these is N:N Networking.
This is a multi-drop Master/Slave network that
allows the connection of up to 8 stations on one
network. Other available communication networks
include Parallel Link, Computer Link, Inverter Communication, and
Non-Protocol Communication using ladder code instructions to
communicate between the FX3U PLC and an assortment of
peripherals. This board occupies one serial port of the FX3U.

The FX3U-485ADP allows the same functionality as the FX3U-485-BD, but with
a stronger signal rated for longer distances. This adapter also occupies one
serial port of the FX3U or FX3UC.

The FX3U-485ADP-MB allows the same functionality as the FX3U-485ADP, but


with added Modbus communication support when paired with an FX3U or
FX3UC PLC of firmware version 2.40 or higher. The FX series RS-485 Modbus
19
capabilities allow the FX3U PLC to be a master to up to 16 slave stations
(numbered 0x01-0x10), or a slave station itself on any existing Modbus network.
This adapter also occupies one serial port of the FX3U or FX3UC.

For the FX1S, FX1N, FX2N, and FX2NC, the available adapter for an RS-485
connection is the FX2NC-485ADP, which requires the use of an FX*N-CNV-BD
converter board to connect to the PLC (except for the FX2NC). An FX1N and
FX2N 485-BD are also available. All of these occupy one serial port.

AS-I Master Module FX2N-32ASI-M


AS-I is a low-cost electromechanical connection system
designed to operate over a two-wire cable carrying data
and power over a distance of up to 100m, or more if
repeaters are used. It is especially suitable for lower
levels of plant automation where simple - often binary -
field devices such as switches need to interoperate in a
stand-alone local area automation network controlled by a
PLC or PC. AS-Interface is best seen as a digital
replacement for traditional cable tree architectures.

This module allows the FX2N, FX2NC, FX3U, or FX3UC to use the AS-I network
to control and monitor up to 31 field devices.

For more information on AS-I, see www.as-interface.com

I/O Link FX2N-16LNK-M


I/O Link is a distributed I/O system for Mitsubishi FX
series PLCs. I/O modules can be placed at up to 200m
from the main system and are addressed like standard
I/O, subject to limitations of the CPU. Each I/O link
master module can control up to 128 I/O points on up to
16 stations.

CC-Link Master Module FX2N-16CCL-M

CC-Link is primarily a high powered remote I/O network,


although it can be used to connect local stations as well.
CC-Link uses twisted-pair cabling and has a range of
1200m with a maximum data transmission rate of
10Mbps at 100m. CC-Link also boasts fast update
times (3.9ms for 64 stations) and high I/O capability
(2048 points).

This module allows an FX1N, FX2N, FX2NC, FX3U, or FX3UC PLC to be the
master on a CC-Link network with up to 15 slave stations.

20
CC-Link Interface Module FX2N-32CCL
The FX2N-32CCL allows the FX1N, FX2N, FX2NC,
FX3U, or FX3UC PLC to connect to the CC-Link network
as a remote device station. The CC-link master controls
the FX PLC by writing data to the buffer memory of the
FX2N-32CCL, which then in turn transfers data to and
from the PLC.

CC-Link/LT Interface Module FX2N-64CL-M


CC-Link/LT is a high-speed remote I/O network using
dedicated cabling up to 500m long while updating up to
1024 I/O in 2ms.

This module allows an FX1N, FX2N, FX2NC, FX3U, or


FX3UC PLC to be the master on a CC-Link/LT network
controlling up to 256 I/O.

Profibus Master Module FX3U-64DP-M


This module works only with the FX3U and FX3UC series
PLCs and is a full-featured master module for Profibus
DP-V1 networks. With this module, the FX3U or FX3UC
can be the master on a 64 slave station Profibus network
supporting a maximum speed of 12Mbps at distances up
to 100m.

Profibus is an open network protocol with many 3rd party


devices. For more information on Profibus, see www.profibus.org.

Profibus Interface Modules FX3U-32DP & FX0N-32NT-DP

Both of these modules allow the connected FX PLC be a slave on a Profibus


network, however the FX3U-32DP allows the FX3U or FX3UC PLC to
communicate using Profibus DP-V1, and the FX0N-32NT-DP allows the FX1N,
FX2N, FX2NC, FX3U, or FX3UC PLC to communicate
using Profibus DP-V0. The FX3U-32DP allows data
transfer of up to 144bytes using cyclic communication, or
140bytes using acyclic communication. The FX0N-32NT-
DP allows data transfer of up to 40bytes using cyclic
communication only.

Profibus Interface Module FX2N-32DP-IF


The FX2N-32DP-IF is used to replace the CPU in an FX
setup, allowing FX series extension blocks (I/O) and
special function modules to be configured as remote I/O on a Profibus network
using Profibus DP-V0.
21
Ethernet Interface Modules FX2NC-ENET-ADP & FX3U-ENET

The FX2NC-ENET-ADP can be connected to the FX1S, FX1N,


FX2N, and FX2NC PLCs. All but the FX2NC will require the FX*N-
CNV-BD. The FX2NC-ENET-ADP is a simple serial to Ethernet
gateway for the FX series PLCs. GX Developer v8.25 and later
support Ethernet connection to the FX series PLCs via this module.
Earlier versions of the software required additional drivers.

The FX3U-ENET works only with the FX3U


and FX3UC series PLCs and is a full-featured Ethernet
module. The FX3U-ENET supports up to 8
simultaneous connections to the FX3U or FX3UC PLC
for either PLC-to-PLC or PLC-to-PC communication,
including parameter and ladder program monitoring and
Upload/Download. Additionally, when connected to a
mail server, the FX3U-ENET has extensive e-mail
capabilities for both data and text.

2.10 Miscellaneous Hardware

Display Module FX3U-7DM & FX3U-7DM-HLD

The FX3U-7DM Display Module can be mounted directly to the


front of the FX3U PLC giving the operator a 4 line by 16
character text display screen. It allows the operator to view the
PLC clock, view or modify data addresses
inside the PLC, perform error checks, show
the PLC status, as well as display user-
defined text messages. The module can
also be protected with a password. A panel-mounting
adapter is sold separately which allows the unit to be
mounted through a cut-out in a cabinet or enclosure door.

2.11 Power Supplies

All PLCs in the FX family have an integrated power supply. The power supply
accepts either 85-264VAC or 24VDC (12VDC on select FX1N models).

The AC-powered FX PLCs generate 2 types of bus power: 5VDC and 24VDC.
The amount of current on each supply varies depending on model and size of the
PLC. Check the hardware manual of the product in question for more details.
The DC-powered FX PLCs only contain the internal 5VDC bus.

The 5VDC bus provides power to the CPU and extension blocks. Because there
is a finite amount of power generated, this limits the number of extension blocks
that can be connected.

22
The AC-powered FX PLCs have 0V and 24V terminals built-in. The power
provided can be used for discrete I/O extensions, and is also available for the
powering of accessories such as sensors and HMIs. Be careful not to exceed
the rated capacity of the power supply.

How to compute the power consumption of the power supply

As has been stated before, the built-in power supply can only support a
certain number of extension block and special function blocks.

In the case of the FX3U, an additional power supply, the FX3U-1PSU-5V,


can be added to offer additional bus voltage. For the FX3UC, the FX3UC-
1PS-5V can be added. These additional power supplies create 1A of
5VDC and 300mA of 24VDC. It is recommended to use this module after
discrete I/O extension blocks as they require high amounts of 24VDC off
of the built-in power supply. Up to 2 additional power supplies can be
used on a single FX3U system. The FX3UC-1PS-5V can be used to
convert the FX3UC right side bus to the standard right side bus, like the
FX2NC-CNV-IF.

For the FX3UC 5V bus calculations, refer to Section 1.9 of the FX3UC
Users Manual - Hardware Edition.

Determine legal system configurations by following the steps below.

1) Total up the number of non-powered inputs and outputs to be


added to the main unit. Note that when a powered extension unit
is used, all I/O points following it are calculated as a separate
system. Every 16 additional input points require 100mA from the
24VDC bus, and every 16 additional output points require 150mA
from the 24VDC bus. Look at Table 1 or 2 for the PLC type or
Table 3 or 4 for the powered extension unit type. Cross-reference
the input column with the output column. The number found is the
remaining current on the 24VDC bus.

2) Look at Table 5 to determine the amount of 5VDC current available.


Tables A1 and A2 describe FX3U main units, while table D1
describes powered extension units. The FX3U 5VDC bus current
can be augmented by connecting an FX3U-1PSU-5V if necessary.

3) Take note of all discrete I/O extension blocks, special function


modules, option boards, and special adapters in the system. Look
up the 5VDC and 24VDC current consumption ratings for each in
Table 6. In the table, if an external 24VDC value is listed, the unit
has terminals for connecting to an external power supply. In this
case the unit does not need to be added to the internal 24VDC
current consumption unless the external wiring is connected to the
24VDC output terminals on the PLC.

4) Add up the total current consumption and subtract it from the total
current capacity available.
23
NOTE: These tables are in Chapter 6 of the FX3U Users Manual -
Hardware Edition.

TABLE 1: FX3U (16 or 32 I/O units)

TABLE 2: FX3U (48 I/O or larger)

TABLE 3: FX2N-32E*

TABLE 4: FX2N-48E*

24
TABLE 5: 24VDC and 5VDC Supply Capacities

FX3U CPU Units (AC Powered)

FX3U CPU Units (DC Powered)

25
FX2N Powered Extension Units

TABLE 6: Expansion Devices

FX3U Option Boards

FX3U Left Side Bus Adapters

26
FX2N Non-powered Extension Blocks

Special Function Modules

27
Special Function Modules (Continued)

FX3U Display Module

28
Worksheet for Exercise 2.12

29
2.12 EXERCISE Power Supply Calculation

Using the worksheet on the previous page, combined with the preceding tables,
use the steps as discussed previously to determine the power consumption of
the system above.

1. Is this a valid configuration?

2. If not, why not?

3. If not, how can it be corrected?

30
2.13 Memory Types
The built-in internal memory of the FX series PLCs can not be expanded.
However, memory cassettes are available for each model which can be used in
place of the internal program memory, sometimes even if the memory cassette is
of a larger capacity than the internal memory of the PLC. Memory cassettes can
also add portability to a program. The program is saved in the cassette, and
when the cassette is connected to another PLC, the ladder program in the
cassette is processed by the CPU instead of the one in the PLC program
memory, which is retained. Special memory cards with the program loader
option allow the memory card to read or overwrite the program in the PLC.

Note that since the PLC uses the cassette instead of the PLC program memory,
the cassette memory is not cumulative with the program memory of the PLC.

Depending on the PLC type, there are four types of memory cassette: RAM,
EPROM, EEPROM and FLROM. Each type has its advantages and
disadvantages. The PLC type, application, and level of security required will
dictate which type of memory should be used.

RAM (Random Access Memory)


RAM memory is volatile, which means it relies on a battery to keep the program
in memory. It is easy to make changes to a program that is kept in RAM
memory. On-line program changes are allowed with RAM.

EPROM (Erasable Programmable Read Only Memory)


EPROM memory is non-volatile; it retains the program memory without a battery.
It is difficult to make changes to programs stored in EPROM, because an
ultraviolet light is required to erase it. An EPROM burner is required. Online
changes are NOT allowed.

EEPROM (Electrically Erasable Programmable ROM)


EEPROM is also non-volatile memory; the program is retained with no battery
connected. However, it is easy to make changes to EEPROM, because it is
electrically erasable. On-line changes are allowed with the FX1N and higher.

FLROM (Flash ROM)


FLROM is also non-volatile memory; the program is retained with no battery
required. FLROM operates similarly to EEPROM, as it is electrically erasable
and can be overwritten many times. Only the FX3U and FX3UC series PLCs use
Flash ROM.

The chart below details the internal capacity, types of memory cassette, and
deviations of memory cassette capacity available for each FX series PLC model.

31
PLC Type Internal RAM EPROM EEPROM FLROM
FX1S 2K - - 2K w/loader -
FX1N 8K - - 8K w/loader -
FX2N 8K 16K 16K 4K, 8K, 16K -
FX2NC 8K - - 4k, 16k, RTC* -
16k, 64k,
FX3U 64K - - -
64k w/loader*

Notes:
The FX2NC does not have an internal real time clock. A memory module with a real time
clock must be attached if real time clock functionality is required.
The FX-RAM-8 and FX-ROM-8 actually hold 16K steps of memory.
The FX3U-FLROM-64L must be used for program loader functionality on the FX3U.

When choosing a memory type, the questions to ask are

1) Which PLC type is being used and what options are available?
2) Should the program be retained even if battery power is lost?
3) Should the program be able to be changed easily?

32
CHAPTER 3 Programming Equipment
This chapter discusses the hardware and software requirements to program a PLC.
The student will also be shown how to connect the system together. Alternatives to
laptop and PC programming are also covered.
Chapter Objectives: At the conclusion of this chapter, students will be able to

o List the hardware required to program a PLC with a laptop or PC.


o Describe alternatives to using a laptop or PC for programming.
o Describe how to connect a PLC system to a laptop or PC.
o List the types of software used to program a PLC.

Materials: FX-TRN-KIT-R Training Manual

3.1 Hand-Held Programming Units

Most programmers will use a laptop or PC to change or access their PLC


program. However, due to issues of expense, security, or convenience, this may
not always be the case.

The FX-10P-E and FX-20P-E can be useful for situations when all that is
necessary is changing a timer, adding a contact or making and address change.
They are handheld LCD display units that connect directly to and are powered by
the PLC. These units allow for programming changes and monitoring.

FX-10P-E This unit permits online program changes only. The display is 2
lines by 16 characters in size. It can monitor the program, and change the states
of devices (forcing bits).

FX-20P-E This unit is a more powerful version of the FX-10P-E with a 4 lines
by 16 characters backlit display. It supports both online and offline programming
through the use of a dedicated memory cassette, the FX-20P-MXF*, meaning
that it can both read and write PLC programs. Up to 16K steps of memory can
be programmed in offline mode.

Note that both the FX-10P-E and FX-20P-E support only up to FX2N PLC
functionality. Thus, memory size and instruction limitations may apply.

3.2 Programming Software


There are several software packages used for programming and troubleshooting
all Mitsubishi PLCs. The three most used packages are GX Developer, GX IEC
Developer and GX Simulator. Some users may be familiar with previous
software packages, including MEDOC (DOS application), FX-WIN, and GPP-Win
(previous version of GX Developer). This training will deal with GX Developer
only. Please contact your Mitsubishi product provider for software updates to the
latest version.

33
GX DEVELOPER This is a Windows based software (95, 98, NT, 2000, XP,
Vista) used to program all of the Mitsubishi PLC lines, including the FX series, Q
series, A series and Motion A series PLCs. This software, which replaces the
previous Windows package, GPP-WIN, has a large number of troubleshooting
and diagnostic features, as well as easy connection setup for networks. It also
has import capabilities to bring in programs written using older software
packages.

GX IEC DEVELOPER This is a Windows based software (95, 98, NT, 2000,
XP, Vista) similar in all features to GX Developer, but using IEC 1131.3
programming standards. This software implements project tree organization and
programming using built-in and/or user-made Function Blocks. The advantage of
Function Blocks lies in the ability to easily re-use multiple instances of the same
Function Block over all programs, cutting development time and improving
productivity.

GX DEVELOPER-FX This is a Windows based software (95, 98, NT, 2000, XP,
Vista) based on the GX Developer software package. This software has all the
features of GX Developer, but only supports the FX series line of PLCs and their
functionalities. This package is offered at a discounted price versus the entire
GX Developer package, making it a cost saving option for anyone who does not
need to program the entire range of Mitsubishi PLCs.

GX IEC DEVELOPER-FX This is a Windows based software (95, 98, NT,


2000, XP, Vista) based on the GX IEC Developer software package. This
software has all the features of GX IEC Developer, but only supports the FX
series line of PLCs and their functionalities. Like GX Developer-FX, this package
is offered at a discounted price, also making it a cost saving option for anyone
who does not need to program the entire range of Mitsubishi PLCs.

GX SIMULATOR This is a Windows based software (95, 98, NT, 2000, XP,
Vista) not used to program PLCs, but instead to assist in program
troubleshooting. This software acts as a PC-based PLC, allowing a GX
Developer or GX IEC Developer program to be tested without having to
download to an actual PLC. GX Simulator has the ability to simulate discrete and
analog I/O, serial and network communications, and special function modules.
Programs can be partially executed, or partially skipped, or executed step by
step.

3.3 GX Developer Overview


This section will provide an overview of things to remember when installing and
using GX Developer. This is not intended to be a full tour of GX Developers
features. That will be accomplished during the coursework.

INSTALLATION

IMPORTANT: Before installing GX Developer, make sure to remove any


previous version of GX Developer or GPP-WIN using the Add/Remove
Program utility in the Windows Control Panel. Do NOT delete the

34
directories and attempt to reinstall. The uninstall process will not erase
any of the PLC programs that have been previously created.

When Windows does the Program Remove, it will display a message


stating that some elements could not be removed, please remove
manually. These are the previously created PLC programs, so their
removal must be done manually at the users discretion.

The GX Developer installation CD should have an automatic startup menu


when inserted into the PC. If it does not, run the program by double
clicking on the autorun.exe file located in the root directory of the
installation CD. Or, open the Windows Start Menu, select Run, and type
or browse to D:\autorun.exe, where D:\ is the CD drive of the PC.

It is very important that the prompts are read and responded to, because
this is the only opportunity to install the Import from MELSEC MEDOC
features. When this prompt appears users must click on each check box
to install, otherwise the programmer will be unable to import MEDOC
programs in the future without first reinstalling GX Developer.

GX Developer Version

The software version installed can be found within GX Developer by going


to the Help menu and selecting Product Information. If the part number
(following the version number in the Product information window) begins
with SW2-SW5, then the software was originally GPP-Win. Starting with
SW6, the software was renamed to GX Developer.

FEATURES

Multiple windows
It is possible to have multiple windows open within GX Developer.
Thus, different windows showing different sections of code and
various monitors can be open at once.

Import from other formats


Programs written in MEDOC, GPPA, and FX-WIN can be imported
into GX Developer.

Workspace setup is saved


Save and Save As preserves the last state of the program,
including all open windows and their positions. Thus the desired
work environment is kept instead of constantly having to recreate it
every time the program is reopened.

Entry Ladder Monitor


A new feature to GX Developer, the Entry Data Ladder allows the
programmer to copy rungs from different sections of the program
into one screen for easy monitoring.

Local Device Monitor


35
A new feature to GX Developer, this monitor allows the
programmer to monitor the states of local devices (used with the
QCPU only)

CAUTIONS

Importing from MEDOC


GX Developer writes a temporary file during the import process. If
the import destination is write-protected or does not have enough
space, the import will fail. Copying the original files to the hard
drive before importing is recommended.

Importing Documentation
Documentation will not import if it has foreign characters (like the
tilde ~).

Copy and Paste


Copy and paste is not available between GX Developer and other
Windows applications, with the exception of comments. Comments
can be copied between the Comment list and any spreadsheet
software. Ladder code can be copied and pasted between
sessions of GX Developer.

Multiple Projects
Only one project can be open per session of GX Developer. If
copying and pasting between multiple GX Developer projects is
required, multiple sessions of GX Developer must be opened. This
can be done from the File menu, Start New GX Developer
session, or by launching GX Developer a second time from the
Start Menu.

Read Only Files


GX Developer cannot open read-only files. If a project has been
archived to a CD, the CD is read-only, and all files on the CD will be
read-only. If these files are copied to a hard drive, they will still be
marked as read-only. Users will need to change these files to be
read/write in the attributes tab in Windows before GX Developer will
see the folders as a project. This applies to the project folder, all
subfolders and all files.

Zipping the program for distribution


A GX Developer project has a special format of folders and
placement of files. While it is possible to manually recreate this
format, when emailing a program it is advisable to do a Save As
and zip the whole folder. This will preserve the project format.

Disk Defragmentation Utilities


Use of a 3rd party disk defragmentation utility could corrupt the GX
Developer license. The GPPW directory should be excluded from
the disk defragmentation process. The defragmentation utility
which comes with Windows can be run without restriction.
36
3.4 File Format

3.5 Hardware Connection

The circular 8 pin port on the PLC CPU module uses RS-422 communication.
Most personal computers only have a RS-232 communication port if any port at
all. For this reason, the F2-232CAB-1, FX-232AWC-H, and the FX-422CAB0 are
recommended for PC-to-PLC connection. The FX-232AWC-H is a RS-422-to-
RS-232 conversion unit, the F2-232CAB-1 connects the conversion unit to the
standard RS-232 port of a PC up to 3m away, and the FX-422CAB0 connects the
conversion unit to the FX PLC up to 1.5m away.

RS-232 PORT

F2-232CAB-1

FX-422CAB0 RS-422 PORT


FX-232AWC-H

37
If the PC does not have an RS232 serial port, there are a couple of options
available.

On the FX3U series PLC, an FX3U-USB-BD can be attached so that a PC


with a standard USB Type-A port can directly connect to the PLC using
the included or a user-provided USB cable (Type-A Male to Mini-B Male).
For the FX1S, FX1N, FX2N, FX2NC, FX3U, and FX3UC PLCs, a USB to
serial converter like the FX-USB-AW can be used. The converter plugs
directly into the FX PLCs RS-422 port and also comes with a USB cable.
When using a Mitsubishi HMI, like the GOT1000 series, Transparent
Mode is available, where a USB Type-A Male to Mini-B Male cable can be
plugged into the HMI already connected to the PLC, allowing access to
the HMI project as well as the PLC all through one cable. GOT1000
Transparent Mode requires GX Developer Version 8.22Y or higher, and
will be the default method of connection for this training.

USB PORT FX-TRN-KIT-R

GT1155-QSBD
USB Cable Front USB PORT

38
CHAPTER 4 Numbering Systems
The PLC uses several numbering systems besides the decimal (Base 10) system. An
understanding of these other systems is crucial to successful programming.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Name the different numbering systems.


o Describe how the different systems represent numbers.
o Convert between number systems.

Materials: FX-TRN-KIT-R Training Manual


FX-TRN-KIT-R Training Kit (Optional)

4.1 Binary Numbers


In the Binary numbering system, or BIN, each digit is called a binary unit, or bit
for short. Binary is a Base 2 numbering system, meaning there are only 2
possible values for each digit. Each digit can only have a value of either 0 or 1.

A group of 4 bits is called a NIBBLE


A group of 8 bits is called a BYTE
A group of 16-bits is called a WORD

The position of a bit, in a byte or word, determines its value. Starting from the
right side, bit number 0 represents a value of 1. As the bit moves left, the bit
value doubles with each position. Bit 1 has a value of 2, bit 2 has a value of 4, bit
3 has a value of 8, etc.

The following example shows the associated values of a BYTE:


Bit Value
128 64 32 16 8 4 2 1

0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
Bit Number

39
To convert from binary to decimal, just add the bit values of the bits that are set
to 1, as shown below.

Bit Value
128 64 32 16 8 4 2 1

0 0 0 0 0 0 0 1
7 6 5 4 3 2 1 0
Bit Number

Binary Word Decimal Value

0000 0001 1
0000 0010 2
0000 0100 4
0000 1000 8
0000 0011 3
0000 0101 5
0000 0110 6

4 bits can represent values 0 to 15

0000 0000 0
0000 1111 15 (8+4+2+1=15)

4.2 Hexadecimal Numbers


Hexadecimal, or HEX, is a Base 16 numbering system, meaning each digit has
16 possible values. Each digit represents a number from 0 to 15. This is
accomplished by using letters for values greater than 9.

Digits 0 to 9 are the same as with decimal, after which letters A to F are used.
DECIMAL 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
HEXADECIMAL 0 1 2 3 4 5 6 7 8 9 A B C D E F

Hexadecimal is also considered a shorthand method of writing Binary.


Each Hexadecimal digit represents 4 bits (or a Nibble) of data.

BINARY 0000 0010 0011 0100 1000 1001 1010 1011 1111
HEXADECIMAL 0 2 3 4 8 9 A B F

40
4.3 Octal Numbers
Octal, or OCT, is a Base 8 numbering system, meaning there are 8 possible
values. The numbers for the octal system are 0 to 7.

In decimal, when the count passes 9, 19, etc. the count restarts at 0 and the next
digit increments by one (i.e. after 9 comes 10, after 19 comes 20).

In the same way, when the count passes 7 in octal, the count restarts at 0 and
the next digit is incremented. Thus after 7 comes 10 and after 17 comes 20.

DECIMAL 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
OCTAL 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 21 22

Octal is also a shorthand method of writing BINARY.


Each Octal digit represents 3 binary bits of data.

BINARY 000 010 011 100 001 101 110 111


OCTAL 0 2 3 4 1 5 6 7

Putting the charts for hexadecimal and octal together, it becomes easy to convert
between hex and octal.

Convert Hexadecimal 349AFh into Octal

HEXADECIMAL 3 4 9 A F

BINARY 0011 0100 1001 1010 1111


(Regroup into 3s) 00 110 100 100 110 101 111

OCTAL 0 6 4 4 6 5 7

Thus 0x349AF in Hexadecimal is 0644657 in Octal

41
4.4 Binary Coded Decimal
Binary Coded Decimal, or BCD, uses the same digits as Decimal, 0 to 9, but
with the same format as binary. When converting BCD to Binary, each decimal
digit is broken down into 4 binary bits (or a Nibble).

Convert decimal 26 into Binary Coded Decimal


Bit Value
8 4 2 1 8 4 2 1

0 0 1 0 0 1 1 0
7 6 5 4 3 2 1 0
Bit Number

2 6
BCD was developed with the use of decimal input/output devices in mind, like
thumbwheels and seven segment displays. Decimal input/output devices only
count from 0 to 9, and require the use of 4 binary bits to do so.

DECIMAL 2 9 12 30
BCD 0000 0010 0000 1001 0001 0010 0011 0000

The difference between Binary and BCD is apparent when converting from
decimal.

Converting decimal 12 to binary, bits 3 (value of 8) and 2 (value of 4) are 1.


Converting BCD 12 to binary, bits 4 (value of 8) and 1 (value of 4) are 1.

FX series PLCs have dedicated instructions to convert between BCD and BIN.

The BCD instruction converts from BIN to BCD.


The BIN instruction converts from BCD to BIN.

42
4.5 EXERCISE Numbering Systems Conversion
In this exercise, convert the following numbers to the given numbering system.

n Convert decimal 2 to HEX= BIN= OCT=

o Convert decimal 10 to HEX= BIN= OCT=

p Convert decimal 16 to HEX= BIN= OCT=

q Convert decimal 28 to HEX= BIN= OCT=

r Convert decimal 6 to BCD=

s Convert decimal 16 to BCD=

t Convert decimal 35 to BCD=

Answers can be verified using the GOT interface of the FX-TRN-KIT-R Training Kit. For
more information about the FX-TRN-KIT-R Training Kit, refer to Chapter 8 of this
Training Manual.

43
44
CHAPTER 5 Numeric Data in PLCs
Most PLC applications will require the handling of data, whether manipulating counter
and timer values, reading data from a Special Function Module and processing the
information, or solving high-level mathematical computations. It is important that the
programmer understands how the PLC recognizes and handles the different types of
data that can be encountered.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Describe how a PLC handles integer and non-integer numbers.

Materials: FX-TRN-KIT-R Training Manual

5.1 Integer Handling


A very important fact to note is that the PLC handles only integer data by default
meaning that numbers are only recognized as whole numbers; 1, 10, -2, etc.
The PLC does not recognize non-whole numbers like 3.14159. Attempting to
enter a number like this will cause an error. If a mathematical operation like 5
divided by 3 (answer: 1.667) is performed, the PLC will drop the fractional part
and output an answer of 1. The remainder, 2 in this example, is stored in the
data register following the destination register of the math instruction.

16-Bit Numbers

Integers in PLCs are 16-bit numbers, unless otherwise declared by


programming. Remembering back to the binary number chapter, this
means that the numeric range for integers is: 0000 0000 0000 0000 to
1111 1111 1111 1111. When converted to decimal, this means the
integer range for the PLC is 0 to 65,535.

The integer range is actually -32,768 to + 32,767 due to the fact that the
bit farthest to the left (bit 15) is used by the PLC as the sign bit. This bit is
also known as the Most Significant Bit, or MSB. If it is 1, the number is
negative, if 0 then positive. Thus the actual largest positive number is
0111 1111 1111 1111 which is 32,767. If the program is incrementing an
integer value and goes above 32,767, the PLC will recognize the value as
rolling over to 32,768. And inversely, if the program is decrementing an
integer value and goes below 32,768, the PLC will recognize the value
as rolling over to 32,767. Thus 1000 0000 0000 0000 is -32,768. Why?

45
The PLC uses a numbering format known as Twos Complement to
display negative numbers. Twos complement is easy to calculate:

n Change all 1s to 0s and all 0s to 1s. This new number is known as


the complement.

o Add a 1 to the number


0111 1111 1111 1111 this is 32,767
1000 0000 0000 0000 this is the complement (the sign bit is not included in the
complement but needs to be a 1 for this number to be negative)
+ 1 add 1
1000 0000 0000 0001 this is 32,767.

1000 0000 0000 0000 is 1 less than 32,767, therefore it is 32,768.

The NEG instruction can be used to perform a twos complement on either


16-bit or 32-bit data to change a negative to a positive.

32-Bit Numbers

As stated before, integers are 16-bit by default. When certain instructions


are used, it is possible to use 32-bit numbers. When this is done, the PLC
recognizes two 16-bit registers as 1 large register. Bit 15 is no longer
considered as the MSB. The PLC now considers bit 31 to be the MSB.
This allows the PLC to display integer values -2,147,483,648 to
2,147,483,647.

When 32-bit instructions are used, it is important to note that the number
occupies both the source/destination register and the following register.
Take this into account when writing ladder programs because overwriting
the second register can have unpredictable consequences on the data.

46
5.2 Non-integer Handling
As mentioned above, the default method for handling fractional values is to drop
them. This restriction can be avoided through use of the floating point numbers
described in Section 5.1 of the FX3U & FX3UC Programming Manual - Basic &
Applied Instructions Edition.

There are 2 formats for displaying non-integer numbers: Scientific Notation and
Floating Point.

Scientific Notation

Scientific Notation uses two registers to store the mantissa and the
exponent. The mantissa is the first four significant digits of a number, and
the exponent shows the position of the decimal point. This format cannot
be used in calculations, but is useful for displaying data.

Example: 1,238,900 would be displayed as 1238 x 103. 1238 is the


mantissa and 103, which indicates the decimal point is 3 places to the
right, is the exponent. Note that the 9 is dropped and not rounded up.

A number between 0 and 1000 or 0 and 1000 is represented by a


negative exponent. The exponent shows how many places to the left of
the mantissas least significant digit to position the decimal point.

Example: 0.00123 would be displayed as 123 x 10-5.

This format allows numbers outside of the normal 32-bit range to be


displayed. The number range is 9999 x 1035 to 9999 x 1035. The trade
off is a loss of precision with only 4 significant digits.

The method for storing a scientific notation number: the mantissa is stored
in a 16-bit register, and the exponent is stored in the next 16-bit register.
For the examples above, if 1,238,900 was to be stored in D0 and .00123
was to be stored in D2, the data registers would appear as follows:

D0 1238
D1 3
D2 123
D3 -5

47
Floating Point

Similar to the Scientific Notation format, this format uses two consecutive
16-bit registers. The mantissa occupies all 16-bits of the first 16-bit
register and the first 7 bits of the second 16-bit register. The exponent
occupies the last 9 bits of second 16-bit register, with bit 31 acting as the
sign bit.

The mantissa and exponent representation of floating point numbers


follows a special format recommended by the I.E.E.E. (Institute of
Electrical and Electronic Engineers). For more information refer to Section
5.1.3 in the FX3U & FX3UC Programming Manual - Basic & Applied
Instructions Edition.

The main advantage in using this format is the accuracy over Scientific
Notation. For example, the number (3.1415926) appears as 3.141592
(7 significant digits) in floating point format, and as 3142 x 10-3 in scientific
notation.

48
CHAPTER 6 System Devices
To write a program for a PLC, it is necessary to be familiar with the devices that are
used in the instructions. An overview is provided here with more detailed information to
follow in later chapters.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Name and describe the devices used in an FX PLC ladder program.

Materials: FX-TRN-KIT-R Training Manual

A common question when discussing system devices is the number of each that
is available to use. This varies depending on the FX PLC model. Refer to the
users manual of the corresponding FX PLC.

X Physical Inputs

X devices are bit devices used to designate physical inputs.

All bit devices within the PLC including X, Y, M, and S can be grouped
together in deviations of 4 (i.e. 4, 8, 12, 16 32) for use with ladder code
instructions. To group the bits together, specify the number of deviations
with a K value (decimal constant) as a prefix to a bit device, for example
K4X000 indicates bits X000-X017.

Y Physical Outputs

Y devices are bit devices used to designate physical outputs.

M Auxiliary Relays

M relays are internal bit devices that can be used for any function needed.
When an M device coil is driven or set, the corresponding M device
contact becomes active.

In GX Developer, it is possible to configure M relays to be battery-backed.


Battery-backed relays will maintain their contact state (OFF or ON) during
PLC STOP or power loss.

There is a group of M relays that have dedicated functions. They are


M8000-M8511. The meanings are described fully in Chapter 36 of the
FX3U & FX3UC Programming Manual - Basic & Applied Instructions
Edition.

49
S State Relays

S relays are internal bit devices used in STL programming to indicate


which state, or section of ladder logic code, is active. If STL programming
is not used, these bits can be utilized in the same manner as M bits.

In GX Developer, it is possible to configure S relays to be battery-backed.


Battery-backed relays will maintain their contact state (Off or On) during
PLC STOP or power loss.

Using STL programming in conjunction with the IST instruction (Initial


State) causes certain state relays to have special operations. For
example, S0 is the manual operation return state and S2 is the automatic
operation return state.

S relays can also be used as Annunciators. Through programming


techniques described in Chapter 4.4 of the FX3U & FX3UC Programming
Manual - Basic & Applied Instructions Edition, S900-S999 can be used as
user-defined fault indicators.

T Timers

T devices are internal timer devices. By default, T devices function at


either 100ms, 10ms, or 1ms time intervals, depending on the device
address. Most T devices, depending on their address, are non-retentive,
meaning they do not hold their timer value if the input conditions become
inactive. In the FX2N, FX2NC, and FX3U, T devices addressed T246 and
above are retentive. This means the T device will hold its timer value
until it is reset. While the T device coil is driven, its timer value increments
according to its associated time interval. When the timer value reaches its
associated set value, the corresponding T device contact becomes active.

All T devices are 16-bit, meaning the maximum timer value and set value
are +32767. Valid set values are K values (decimal constants) and D
registers values which are multiplied by the time interval of the T device.
For example, a 100ms timer has a maximum set value of 3276.7 seconds.

In GX Developer, it is possible to assign a range of T devices to be


battery-backed. Battery-backed T devices will hold their timer value
during PLC STOP or power loss provided that the input conditions
driving the T device coil stays active as well. Otherwise the timer value
and device contact will be reset.

Timers will be covered in detail in Chapter 12 of this Training Manual.

C Counters

C devices are counter devices. Each time the C device coil is driven, the
associated counter value increments or decrements (depending on the C
device address and up/down count setting). When the counter value
reaches its associated set value, the C device contact becomes active.
50
By default, all C devices are retentive, meaning that their counter values
are held until reset.

C devices can be either 16-bit or 32-bit, meaning the maximum counter


value and set value are -32,768 to +32,767 (16-bit) or -2,147,483,648 to
2,147,483,647 (32-bit). Valid set values are K values (decimal constants)
and D register values.

There are 3 types of C devices: 16-bit up counters, 32-bit up/down


counters, and 32-bit high-speed up/down counters. Within the high-speed
counter category there are 1-phase and 2-phase counters.

In GX Developer, it is possible to assign a range of C devices to be


battery-backed. Battery-backed C devices will hold their counter value
during PLC STOP or power loss. Otherwise the counter value and device
contact will be reset.

Counters will be covered in detail in Chapter 12 of this Training Manual.

D Data Registers and File Registers

D registers are data registers (word devices) that can be used for any
function needed. All D registers are 16-bit registers, meaning their value
range is from -32,768 to 32,767. In the ladder program, 32-bit operations
can also be performed. In those cases, two consecutive D registers are
used together and are recognized by the PLC as one long register, able to
hold numerical values from -2,147,483,648 to 2,147,483,647.

In GX Developer, it is possible to assign a range of D registers to be


battery-backed. This means the registers will retain their value during
PLC STOP or power loss.

File registers are D registers that are stored within the PLC program
memory. They must be declared in the Parameters section of GX
Developer in blocks of 500 and are only accessible by copying values
between them and their associated D registers. Each block of 500
declared File Registers reduces the program step capacity by 500.

Data registers D8000-D8511 are dedicated for PLC diagnostics and


special functions. All of their functions can be seen in Chapter 36 of the
FX3U & FX3UC Programming Manual - Basic & Applied Instructions
Edition.

51
In the FX3U and FX3UC, the PLC has the ability to directly access bits
within D registers. By placing a decimal point between the D register
address and bit address, the status of a single bit within the register can
be referenced in any bit device instruction. An example would be D100.0
which references bit 0 (the least significant bit) in D register D100.

R and ER Extension Registers and Extension File Registers (FX3U and


FX3UC Only)

R registers are extension registers which are an extended set of battery-


backed data registers only available for the FX3U and FX3UC. They can
be used for any function needed as well as a special data logging function
only available for R registers and ER registers. For more details on the
logging functions, see Chapter 33 of the FX3U & FX3UC Programming
Manual - Basic & Applied Instructions Edition.

ER registers are extension file registers which relate to R registers in the


same way that file registers relate to D registers. ER registers require a
memory cassette to be attached to the FX3U or FX3UC PLC and support
dedicated instructions in the PLC for data logging. ER registers must be
initialized within the ladder program in sectors of 2048 registers and are
only accessible by copying values between them and the R registers. For
more details, see Chapter 33 of the FX3U & FX3UC Programming Manual
- Basic & Applied Instructions Edition.

V and Z Index Registers

V registers and Z registers are index registers and can both be used for
16-bit instructions, while only Z can be used with 32-bit instructions
(occupying the V register of the same device address). Values stored in
an index register are used as offsets to the specified device. To offset a
device, reference the offset with an index register device address as a
suffix to a device. For example, if V0 has the value of 2 then D10V0
references D10 + 2, meaning D12. If Z2 has a value of 8, then Y001Z2
means Y011. Remember that X and Y addresses are in octal, so the
offset value is converted to octal and added to the base address.
Because 8 in decimal is 10 in octal, the address is increased by 10.

If V registers or Z registers are used without a device or constant value


prefix, they function the same as D registers.

52
Index registers are useful for writing short ladder code that can be used to
access many different device addresses without taking up scan time.

P - Pointers

P addresses signify pointers which are used with conditional jump (CJ),
and subroutine call (CALL) instructions to alter program flow. The CJ and
CALL instructions cause the program scan to execute different sections of
the ladder program, either by moving to another location within the same
program or by calling subroutines to be executed within the normal scan.

Pointers will be covered in Section 13.22 of this Training Manual.

I - Interrupts

I addresses signify interrupts which are used to execute processes within


the normal scan sequence. When triggered, the ladder code assigned to
the interrupt executes immediately, regardless of what other ladder code
is being processed. The interrupts can be triggered by physical inputs,
counters, or specified time intervals.

K, H, and E Numerical Constants

K, H and E are used to indicate numerical constants. The PLC does not
recognize numerical values by themselves and instead requires that
values have prefixes to declare what type of numerical value they are.
The K prefix declares that the constant value will be a decimal constant.
The H prefix declares a hexadecimal constant. An E prefix declares a
real number constant, such as 3.14159, which, in turn, means that floating
point functions will need to be used.

U\G Buffer Memory Access (FX3U and FX3UC Only)

The U\G addressing system allows ladder code instructions to directly


reference locations within the buffer memory in an attached special
function module (SFM). The number after U specifies the SFM address
(0-7), and the number after G specifies the buffer memory location
address within the SFM. This feature is available for the FX3U and
FX3UC only.

53
54
CHAPTER 7 - Addressing
Controlling and monitoring I/O and devices in a PLC program requires knowledge of the
device address to be controlled. The same applies to the internal memory of Special
Function Modules. This chapter explains how the addresses of the special function
modules, special adapters and I/O points in a system are determined.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Correctly address a discrete input or output point.


o Determine the address of a Special Function Module and Special Adapter.
o Describe the I/O limitations of an FX3U system.

Materials: FX-TRN-KIT-R Training Manual

7.1 Right Side Bus Addressing

1) Addressing of inputs and outputs is in Octal (X000-X007, X010-X017, etc.).

2) Addressing for both inputs and outputs start at 0 (X000 and Y000).

3) Addressing is consecutive.

4) SFMs are addressed 0 7. The first SFM to the right of the PLC is SFM 0;
the next one is SFM 1, etc.

5) A maximum of 8 SFMs can be connected to a main unit.

6) SFMs do not affect the addressing of I/O modules, and vice versa.

7) The FX3U PLC cannot have more than 128 inputs and 128 outputs directly
connected. It is possible to extend to 384 I/O via networked I/O (over CC-
Link and/or AS-I).

8) SFMs use 8 points of I/O each which is deducted from the directly connected
I/O limit. Thus an FX3U with one SFM has a maximum directly connected I/O
capacity of 248 I/O. The maximum number of inputs possible is still 128, and
the maximum number of outputs is still 128 individually, as long as 248
combined I/O is not exceeded.

7.2 FX3U Left Side Bus Addressing

The FX3U series has an additional expansion bus on the left side of the PLC.
This bus is used with boards (BDs) and special adapters (ADPs) which can be
used to add functionality to the PLC.

55
There are 4 different types of special adapters available.
Analog I/O Special Adapters (maximum 4 per PLC)
High-Speed Pulse Input Special Adapters (maximum 2 per PLC)
High-Speed Pulse Output Special Adapters (maximum 2 per PLC)
Serial Communication Special Adapters (maximum 2 per PLC or 1 when
simultaneously using a Serial Communication BD)

Analog ADPs

Analog input/output data and parameters are stored directly in the PLC
device memory. ADPs are addressed outward from the left of the PLC.

1st ADP uses M8260-M8269 and D8260-D8269


2nd ADP uses M8270-M8279 and D8270-D8279
3rd ADP uses M8280-M8289 and D8280-D8289
4th ADP uses M8290-M8299 and D8290-D8299

High-Speed Input ADPs

High-speed input ADPs are addressed outward from the left of the PLC.

1st ADP uses X000, X001, X002, X006 (C235-C237, C244)


2nd ADP uses X003, X004, X005, X007 (C238-C239, C245)

Note that these are the same device addresses used by the first eight
physical inputs on the PLC. Only the high-speed input ADP terminals OR
the built-in I/O terminals should be used. Do NOT wire both. For other
limitations, refer to the FX3U & FX3UC Programming Manual - Basic &
Applied Instructions Edition.

High-Speed Output ADPs

High-speed output ADPs are addressed outward from the left of the PLC.

1st ADP uses Y000, Y001, Y004, Y005


2nd ADP uses Y002, Y003, Y006, Y007

Note that these are the same device addresses used by the first eight
physical outputs on the PLC. Only the high-speed output ADP terminals
OR the built-in I/O terminals should be used. Do NOT wire both. For
other limitations, refer to the FX3U & FX3UC Programming Manual - Basic
& Applied Instructions Edition.

Serial Communications ADPs

The serial communication ports of the serial communication ADPs are


addressed as Channel 1 (Ch1) and Channel 2 (Ch2) outward from the left
of the PLC. When using a serial communication BD, the BD is addressed
as Ch1, thus leaving only Ch2 available for one serial communication

56
ADP. Programming information for serial communication is covered in the
FX Series Data Communications Manual.

7.3 Addressing Example

FX3U-48MR/ES X000-X007, X010-X017, X020-X027


Y000-Y007, Y010-Y017, Y020-Y027

Left Side Bus: Outward from the left of the PLC


FX3U-232-BD board not addressed
FX3U-4HSX-ADP X000, X001, X002, X006
FX3U-2HSY-ADP Y000, Y001, Y004, Y005
FX3U-2HSY-ADP Y002, Y003, Y006, Y007
FX3U-485-ADP not addressed
FX3U-4AD-ADP M8260-M8269, D8260-D8269
FX3U-4AD-ADP M8270-M8279, D8270-D8279

Right Side Bus: Outward from the right of the PLC


FX2N-16EX-ES/UL X030-0X37, X040-X047
FX2N-16EYT-ESS/UL Y030-Y037, Y040-Y047
FX2N-1HC SFM 0
FX2N-10PG SFM 1
FX2N-32ER-ES/UL X050-X570, X060-0X67
Y050-Y057, Y060-Y067
FX2N-2LC SFM 2
FX2N-64CL-M SFM 3
FX2N-16CCL-M SFM 4
FX2N-32CCL SFM 5

57
7.4 EXERCISE PLC Addressing
1) A PLC system consists of an FX3U-64MR (32/32 I/O), one FX3U-USB-BD,
one FX3U-4AD-ADP, one 8 point input module, two 16-point output modules, two
SFMs, one 16 point input module, and one more SFM. Draw the system and
determine the addressing.

2) ARE THE FOLLOWING SYSTEMS LEGAL? WHY OR WHY NOT?

A. A 64 I/O main unit (32/32 I/O), four 8 point input modules, six 8 point
output modules, and nine SFMs.

B. A 128 I/O main unit (64/64 I/O), two SFMs, two 48 I/O Extension Units
(24/24 I/O each), one 16 point input module.

C. A 128 I/O main unit (64/64 I/O), three SFMs, two 48 I/O Extension Units
(2424 I/O each), one 16 point input module.

D. An 80 I/O main unit (40/40 I/O), two 48 I/O Extension Units (24/24 I/O
each), four 16 point output modules, one 8 point input module.

E. An FX3U 64 I/O main unit (32/32 I/O), three FX3U-4AD-ADP, one FX3U-
4DA-ADP, one FX3U-4AD-PT-ADP, two FX3U-4HSX-ADPs, two FX3U-
485-ADPs, one FX3U-USB-BD.

58
CHAPTER 8 Training Kit Layout
Now that all the necessary background has been covered, it is time to take out and set
up the hardware if it has not been done already. This chapter explains the contents of
the training kit and provides a brief tour of its features.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Name the different parts of the training kit.


o Know how the parts work together.

Materials: FX-TRN-KIT-R Training Manual


FX-TRN-KIT-R Training Kit

8.1 Addressing
This demo kit has an FX3U-32MT/ESS, FX3U-485-BD, FX3U-4AD-PT-ADP,
FX2N-5A, and a GT1155-QSBD.

The FX3U has 16 inputs, addressed X000-X007 and X010-X017, and 16 outputs,
addressed Y000-Y007 and Y010-Y017.

The FX2N-5A is a 4 channel analog input and 1 channel analog output module.
It is the first special function module to the right of the main unit and is thus
addressed as SFM 0.

The FX3U-485-BD takes up the BD Board location on the main unit and uses
serial communication channel 1 (Ch1).

The FX3U-4AD-PT-ADP is the first analog module to the left of the PLC. As
such, it uses device addresses M8260-M8269 and D8260-D8269.
59
8.2 Indicator Lights
The PLC has indicator LEDs for its inputs and outputs as well as Status LEDs on
the front face of the main unit.

There are two sets of I/O indicator LEDs, one set for inputs, one set for outputs.
When X000 is being driven (ON), LED 0 in the input section is ON. When Y000
is being driven (ON), LED 0 in the output section is ON, etc.

There are 4 LEDs on the far right of the main unit which are status LEDs.
1st LED indicates that power is being supplied to the PLC.
2nd LED is ON when the PLC is in RUN mode, OFF when in STOP mode.
3rd LED turns ON when the battery voltage is low.
4th LED has two purposes:
o Blinking indicates that there is an error in the program.
o Steadily ON indicates a CPU problem, such as removing the memory
cassette while the unit was still powered and in RUN.
Input Indicator LEDs

Status LEDs

Output Indicator LEDs

8.3 Operator Interface


The exercises in this training will involve the use of the Graphic Operation
Terminal (GOT) as a visual aid and PLC interface. There are screens loaded in
the GOT to visualize PLC operations, monitor device values, and simulate
various programming exercises planned for this training. Only some chapters
and sections of this training course relate to the GOT interface, they will be noted
specifically in this Training Manual.

Try accessing the Chapter 8; Training Kit Layout screen by using the GOT
touch-screen and get used to the GOT interface and layout.

The FX-TRN-KIT-R Training Kit also has hard-wired Digital Input Switches,
Analog Input Dials, High-Speed Input Switches and Dials, and a PT
Temperature Sensor for users to interface with the PLC. The analog output
channel 1 from the FX2N-5A is displayed on the Analog Output Meter which will
be discussed later in Section 13.15 of this Training Manual. All hard-wired inputs
and outputs can be re-routed manually to other peripheral devices and
equipment by using the Auxiliary Inputs and Outputs. For this, please refer to
the circuit and wiring diagram included with the training kit.

60
CHAPTER 9 PLC Instruction Types
To write a ladder program for a PLC, it is necessary to be familiar with the instructions
available in the PLC instruction set. An overview is provided here, with more detailed
information to follow in later chapters.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Describe the 3 different types of instructions.

Materials: FX-TRN-KIT-R Training Manual

More information on all instructions can be found in great detail in the FX Programming
Manual corresponding to the associated PLC model.

Manual Number PLC Series Covered


JY992D48301 FX, FX0, FX0S, FX0N, FX2C
JY992D88101 FX1S, FX1N, FX2N, FX2NC
JY997D16601 FX3U

9.1 Basic Instructions


This category refers to instructions relating to the 4 basic bit devices (X, Y, M,
and S), the timer devices (T), and the counter devices (C) not including high-
speed counters. This includes the LD, LDI, OUT, SET, RST, and PLS functions.
This type of instruction will typically make up most of the program.

9.2 Step Ladder Instructions

Step ladder instructions are used in Step Ladder Programming (STL). This
programming style is similar to Sequential Function Chart (SFC) programming in
that it implements a flow chart of the system operations, but with STL the flow
chart is implied and actually created in ladder code. When programming in
ladder code, the STL contact is a common instruction used to check if a state is
active. S relays are used to indicate states.

STL Programming is not covered in this training. However, a full explanation and
examples can be found in Chapter 34.2 of the FX3U & FX3UC Programming
Manual - Basic & Applied Instructions Edition.

9.3 Applied Instructions


These instructions allow the PLC to perform complex data manipulations,
mathematical operations, and communications. Examples of applied instruction
applications are BIN-to-BCD conversion, floating point trigonometric functions,
data sorting, and inverter communication. Most applied instructions for the FX
PLC work on the 16-bit or 32-bit word level.

61
62
CHAPTER 10 Basic Instructions
Basic instructions are bit, timer, and counter control instructions and typically make up a
majority of the ladder program. They are used to confirm input statuses, manipulate
outputs, shift bits, and perform master control for nesting loops or other ladder code.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Name the most common basic instructions.


o Know the format of these instructions and what they do.

Materials: FX-TRN-KIT-R Training Manual


FX3U & FX3UC Programming Manual - Basic & Applied
Instructions Edition
FX-TRN-KIT-R Training Kit

10.1 Symbols
NORMALLY OPEN CONTACT. This contact is active while the
associated device coil is being driven. The mnemonic is LD,
which stands for LOAD. This symbol occupies 1 step of program
memory.

NORMALLY CLOSED CONTACT. This contact is active while


the associated device coil is not being driven. The mnemonic is
LDI, which stands for LOAD INVERSE. This symbol occupies 1
step of program memory.

COIL DRIVE. This symbol always appears at the right side of


the ladder program and represents an output coil. The specified
device is driven when all the input conditions before it are active.
When driven, the bit device contact with the same address becomes active. The
mnemonic is OUT, for OUTPUT. This symbol occupies 1 step of program
memory, except when being used with a timer or counter device, at which point it
can occupy up to 5 steps.

BRACKET CONTROL. This symbol is typically used for


applied instructions. However, there are a few basic
instructions that use the brackets as well which will usually
appear at the right side of the ladder program. Multiple instructions and
mnemonics are associated with the bracket symbol, each of which may occupy
multiple steps of program memory depending on the instruction used.

INVERT. This instruction inverts the state of all input conditions


before it. If the input conditions are active at the point of the invert,
the output of the invert instruction is false (inactive) and vice versa.

It is important that the above concepts are clear before moving on. The symbols
above show the instructions represented in their inactive state. When a contact
is active, intuitively it means electricity is allowed to flow through.
63
For example, a light switch is usually in the OFF position (inactive), no current is
flowing (the switch is open) until someone turns it ON (drives it, making it active).
At this point, electricity starts to flow (the switch is closed) and the lights turn ON.
A light switch can be thought of like a normally open contact.

The normally closed contact is the opposite in every respect. Current flows until
the switch is turned ON. A common example of this is an Emergency Stop
switch (E-Stop). The circuit allows current to flow until an operator hits the switch
in an emergency. The switch turns on and the current flow stops.

Example: Normally Open & Normally Closed Contacts

10.2 Ladder Basics


The alignment and order of contacts and coils determine how a rung (horizontal
circuit representation) of ladder code is processed.

If two or more instructions are positioned in series (one after another, shown
below), they are operated with an AND relationship. In order for current to flow
through the rung, all the contacts must be active. In this example, only if X000 is
active, X001 is inactive, and X002 is active simultaneously will Y000 be driven.

If two or more devices are in parallel (one below another, shown below), they are
operated with an OR relationship. OR conditions provide multiple paths for the
current to flow. In this example, if X000 is active, or if X001 is inactive, or if
X002 is active, Y000 will be driven.

64
AND/OR conditions can be combined to create complex rungs of logic.

Note: A rung must have an input instruction (like LD or LDI), and an output
instruction (like OUT) to be a complete circuit. If an output instruction is
meant to always be on, there is a special auxiliary relay which can be
used with the LD instruction in front of it, addressed M8000. This bit is on
while the PLC is in RUN. Connecting an output coil or bracket control
instruction directly to the left vertical ladder rail is not allowed.

For a visual simulation of how these basic instructions are handled, access the
Section 10.2; Basic Instructions screen on the GOT of the FX-TRN-KIT-R
Training Kit. Use the hard-wired digital input switches and GOT touch-screen to
drive contacts in the simulated ladder code.

10.3 Common Instructions

SET Bit Set


RST Bit Reset

The set instruction (SET) latches the specified bit device ON. The reset
instruction (RST) releases the latch. When RST is used with a word device, the
word device value is set to 0.

PLS Rising Edge Pulse


PLF Falling Edge Pulse

The rising edge pulse instruction (PLS) triggers on the positive edge of the input
condition, while the falling edge pulse instruction (PLF) triggers on the negative
edge of the input condition. Both result in the setting the specified device ON for
1 ladder scan only.

65
Another method for pulsing contacts is the rising edge and falling edge pulse
instructions. These contacts activate only for one scan, similar to PLS and PLF.

RISING EDGE PULSE. The rising edge pulse (LDP) contact


becomes active for one scan pulse when the specified device
turns ON. Instead of using X003 as an input and then a PLS
instruction on an M relay, this instruction issues a one scan pulse
to the instructions following it without taking up an extra bit device.

FALLING EDGE PULSE. The falling edge pulse (LDF) contact


becomes active for one scan pulse when the specified device
turns OFF. Instead of using X004 as an input and then a PLF
instruction on an M relay, this instruction issues a one scan pulse
to the instructions following it without taking up an extra bit device.

ALT Alternate State

The alternate state instruction (ALT) toggles the state of the specified bit device.
If the bit device is active, the ALT instruction makes it inactive and vice versa.

ZRST Zone Reset

The zone reset instruction (ZRST) is used to reset a range of devices, rather than
resetting single devices as RST does. The devices can be bits, words, timers, or
counters with the starting and ending device addresses specified. When ZRST is
used with word devices, the word device values are set to 0. The second
argument (ending device address) of the instruction must be higher than the first
argument (starting device address).

66
For a visual simulation of these common instructions, access the Section 10.3;
Common Instructions screen on the GOT of the FX-TRN-KIT-R Training Kit.
Use the GOT touch-screen to drive and pulse contacts in the simulated system.

10.4 EXERCISE Ladder Basics

1) X001 turns on and sets Y003. What happens to Y003 when X001
turns off?

2) What type of symbol is normally used to represent a standard E-Stop


in ladder logic? (Yes, E-stops are commonly hard-wired, but are often
referred to in other parts of a program for various reasons)

3) List the common basic symbols (like ) and describe what


they do.

4) List the common basic instructions and common instructions (like PLS)
and describe what they do.

5) What is required for a rung to be a complete circuit?

6) On a main conveyor, a sensor (input X002) checks for the presence of


a certain package. When one is detected, the sensor switches on and
turns on a pusher (output Y007). The pusher stays on until the package is
detected by the side conveyor sensor (X003). When Y007 turns off, the
pusher automatically retracts. Write the ladder code to accomplish this.

NOTE: As the package is pushed, it leaves the detection area of sensor


(X002) before being detected by the side conveyor sensor (X003).

For a visual simulation of the application described in this exercise, access


the Section 10.4; Exercise Ladder Basics screen on the GOT of the
FX-TRN-KIT-R Training Kit. This screen is meant to help students
visualize the application described in the exercise as to make writing the
ladder code easier. Note that PLC ladder code is not actually being used
to run the GOT simulation.

67
68
CHAPTER 11 Developing & Editing Programs
Now is the time to put to work some of the knowledge that has been covered so far. In
this chapter an overview will be given on launching GX Developer, writing a simple
program, downloading it to the PLC and testing its operation, while investigating some
of the tools in the GX Developer software along the way.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Launch GX Developer.
o Enter instructions to write a small ladder program.
o Transfer the ladder program between the PLC and the laptop or PC.
o Perform Online editing.
o Monitor the Program.
o Change PLC device values with the software.
o Monitor PLC device values in data registers.

Materials: FX-TRN-KIT-R Training Manual


FX-TRN-KIT-R Training Kit

11.1 Launching GX Developer


GX Developer is a WINDOWS based ladder programming/monitoring software.
The serial port or virtual serial port (USB, Ethernet, Transparent Mode, etc.) is
used to communicate between the PC and PLC.

GX Developer will run on Windows 95, 98, NT, 2000, XP, and Vista.
GX Developer can be started in one of 2 ways:
1) Double-clicking on the shortcut icon if one is present.
2) Selecting it from the Start Menu. The default path is Start All Programs
MELSOFT Application GX Developer.

Once started, a screen similar to the one on the next page will appear:

69
Toolbars

Workspace

Project Data List

The dark gray area is the workspace where all work windows will appear. Most
of the toolbars that are open are but rarely used. These can be closed down to
make the workspace larger:

1) Go to the View menu and select Toolbar.


2) Select Standard and LD symbol, and deselect the rest.
3) Go to the View menu and find Project Data List.
4) Deselect Project Data List until required.

11.2 Creating a New Project


1) There are three ways to create a new project:
Under the Project menu, select New
Press Ctrl+N
Click the toolbar hotkey for new document (the blank white sheet of paper)
2) Select the PLC series from the combo box. For this class select FXCPU.
3) Select PLC type from the combo box. For this class select FX3U(C).
4) Defining a pathname and project name first as well as a short title is optional.
These do not need to be set at this point. This information can be assigned
when the project is saved later.
5) Press OK.

70
11.3 Editing the Ladder
Follow the steps below to create a simple ladder program.

1) Click on the Normally Open (NO) Contact hotkey (like the symbol)
2) Type X0 into the dialog box that pops up and click OK
3) Double-click inside the placement box (cursor, or blue square by default)
4) The dialog box has a combo box on the left. Select the Normally Closed
(NC) symbol. Type X1 in the textbox on the right and press OK.
5) Press the F7 key. Type Y0 in the textbox and press OK.

NOTE: The F7 key may not work depending on the selected keyboard layout. Under Tools
menu, in Customize Keys, the keyboard shortcuts can be set to one of 3 standard sets. 7 is
the key in MEDOC format for a coil. In GPPQ and GPPA the key is F7. The default
keyboard on a new installation of GX Developer is GPPQ format. This can be changed to
whichever keyboard layout a user is most familiar and most comfortable with.

6) Without clicking anything or moving the placement box, type OR X2


and press the Enter key.
7) Go to the Edit menu and select Ladder Symbol then Application
Instruction. Type SET Y1 in the textbox and press OK.

Steps 1-7 show how to create an entire rung of ladder code using each of the 5
ways to enter symbols. Next, follow the steps below to edit the ladder code.

8) Click on the LD X2 symbol (second line).


9) Go to the Edit menu and select Delete Line. The rung disappears.
10) Return to the Edit menu and Select Undo. The rung Reappears.
11) Right click on X000. Select Delete Row and press Yes. X000 and
X002 disappear.
12) Right click on X001. Select Delete Row and press Yes. X001
disappears.
13) Right click on the rung and select Undo. X1 reappears.
14) Try to Undo again.

Notice that Undo is grayed out. There is only one level for Undo.

Insert Rung and Insert Row add space for a new rung or new contact. Use
Insert Row to put X0 and X2 back into their respective locations.

But the two lines are no longer connected.

Connect lines and rungs together by using the Free-draw Line hotkey (F10) or
Draw Vertical Line hotkey (Shift+F9). Now the two lines should be back
together in a single rung.
71
Notice that the rung is highlighted in gray. This means that the rung is only
tentative ladder code and has not been set in the program yet. Go to the Convert
menu and select Convert, or convert the ladder by right-clicking in the
workspace or by pressing the F4 key. The gray highlight disappears. If the
tentative ladder code has errors or does not form a complete circuit, the
conversion will fail with an error message. The software will not allow saving or
downloading of programs containing unconverted code.

Click on the View menu and select Instruction List. The ladder logic diagram
disappears and is replaced by abbreviations and the addresses:

This is the ladder program written out in instruction list format, which is the
program format that the PLC actually understands. Ladder can be displayed
again by going back to the View menu. Instead of Instruction List, Ladder is
now displayed.

Save the program by clicking on the Save hotkey in the toolbar, or by pressing
Ctrl+S. Enter the Project Name as FXPROG1. Click Yes on the dialog box to
save the project.

11.4 Program Transfer


With GX Developer, the PC communicates with the PLC over hardware interface
ports (COM ports) which are automatically assigned by the PC and Windows OS.
Each computer will have different COM port numbers for each communication
device in the PC (RS-232, Parallel Port, USB, etc.). To check these COM port
numbers, users must access the Device Manager of the System item in the
Windows Control Panel. However, for the purpose of this training, GOT
Transparent Mode will be used instead as to avoid numbered COM ports all
together. This is done through a process called Transfer Setup.

1) In GX Developer, go to the Online menu and select Transfer Setup.


2) A large dialog box should open with many different buttons and options.
The first button in the upper left labeled Serial should be highlighted.
Double-click on it.
3) The default settings for this dialog box are
RS-232C, COM 1, and 115.2Kbps for
the FX3U. Instead, select USB (GOT
transparent mode).
4) The COM port and Transmission
speed options disappear. Press OK to
register the new communication settings.

72
5) Connect the PC to the front USB port of the GOT if it is not already
connected and press Connection test (to the right side of the large dialog
box) to test the connection.
6) If communication is successful, make sure to select OK in the large
dialog box to save the new communication settings.

It is now possible to transfer data between the PC and PLC.

To transfer a program to the PLC, the PLC must be in STOP mode. This can be
done by setting the key switch on the PLC to the STOP position, or remotely by
using the software. If the PLC is in RUN, a Remote Stop can be performed
manually, but if an attempt is made to download to a PLC which is in RUN, the
software automatically prompts to Remote Stop the PLC and then downloads
the program. When program download is complete, it will then prompt to
Remote Start the PLC.

1) Go to the Online menu and


select Write to PLC.
2) Press Param+Prog or
manually select the
Program-Main and
Parameter-PLC parameter
from the dialog box.
3) Press Execute and then
select Yes to continue.

A progress bar appears to show the


program download process, after
which another dialog box pops up to
indicate the download is finished. Press OK. Return the PLC to RUN mode
either by the switch or remotely.

Two other options in the Online menu are Read from and Verify with the PLC.

Read from PLC uploads the program from the PLC to the PC and displays it in
GX Developer. This would be used to make changes to an unprotected program
in the PLC without having the original GX Developer project.

4) Select Read from PLC from the Online menu.


5) Press Param+Prog or manually select Program-Main and
Parameter-PLC parameter from the dialog box.
6) Press Execute and then select Yes to continue.
7) When done, press OK and then close the dialog box.

Verify with PLC compares the program that is open in GX Developer with the
program in the PLC. This is especially useful in an environment where several
employees have the ability to make changes to a program. This prevents the
programmer from inadvertently writing over unsaved changes made by a co-
worker or themselves.

8) Select Verify with PLC from the Online menu.


73
9) Press Param+Prog or manually select Program-Main and
Parameter-PLC parameter from the dialog box.
10) Press Execute and then select Yes to continue.

GX Developer will do a comparison and list any unmatched items.

11) Close the verification screens by either pressing the X in the upper right
corner of the window, or by selecting Close from the left-most menu.

Step Range Specification

Thought the FX3U and FX3UC should have no problems, for non-FX3U PLCs it
may appear that very small programs take a long time to download. This is
because no matter how many ladder logic steps are in the program, GX
Developer always downloads at least 8000 steps for the FX1N and FX2N at a
lower communication speed than with the FX3U and FX3UC. It is possible to
speed the process up considerably but be careful when using this shortcut to
ensure that all code including the END instruction is downloaded.

1) Take note of the final step number next to the rung with the END
instruction.
2) Go to the Online menu and select Write to PLC.
3) Select Programs-Main and Parameter-PLC parameter as usual.
4) Click on the Program tab.
5) Change the Range type to Step Range.
6) Adjust the range accordingly in the Start and End columns.
7) Press Execute and then select Yes to continue.

11.5 Online Editing


So far we have written a small program and then downloaded it to the PLC.
Since the program change was done in the computer only, this is called Offline
Editing. If the computer is connected to the PLC it is possible to change the
program directly in the PLC, avoiding the need to download or stop the PLC.
This is called Online Editing. Note that some PLC memory types do not support
this feature, as discussed in Section 2.13.

Monitor (Write Mode)

1) Go to Monitor in the Online menu.


2) Select Monitor (Write Mode).
3) Change the rung so that it looks like the one below.

4) Convert the rung to write the changes to the PLC.

74
At this point the new program exists in the PLC, but not on the PC. Therefore,
before leaving Monitor (Write Mode), remember to save the project.

Note that there is a Convert (Online Change) option which is effectively


converting and writing the ladder program to the PLC while the PLC is in RUN at
the same time. This can be found in the Convert menu, or by pressing Shift+F4
while in Write Mode. The difference between this and Monitor (Write Mode) is
that device values will not be displayed with the ladder program in Write Mode.

The current rung is called a LATCH and HOLD circuit and is very common.
X010 is a momentary contact, such as a pushbutton, that starts a machine.
Without the branch (second line, OR Y000), the machine would only run as long
as the pushbutton was held down. But with this circuit, when Y000 turns on it
keeps the branch active, even if X010 becomes inactive. To turn the machine
off, it is necessary to toggle the stop button, X011.

11.6 Monitoring Program Operations

With GX Developer it is possible to view what is being executed in the ladder


program while it is running and check bit and word device values. This process
is called Monitoring the program.

1) Go to Monitor in the Online menu.


2) Select Monitor Mode or press F3.

A small box will pop up, indicating the mode (RUN or STOP) of the PLC and the
maximum scan time recorded thus far for the ladder program.

Notice that X010 and Y000 are not highlighted, and X011 is highlighted. This
indicates whether an input device is active or not, or if an output coil is being
driven. A highlighted contact is active (conducting), and a highlighted coil is
being driven. For now, the LD X010 and LD Y000 instructions should be
inactive, because they are NO contacts. The LDI X011 instruction, on the other
hand, which is a NC contact, should be active.

Turn on X010 by toggling the corresponding hard-wired digital input switch.


When the switch is toggled ON, the bit in the program becomes highlighted.
Toggle X011 OFF. Notice that the bit is not highlighted anymore. Toggle X011
and X010 so that both are highlighted. When all the contacts (input conditions)
on a rung are highlighted, the rung is true. When a rung is true, the output of the
rung is driven. Note that Y000 is highlighted on the screen and that the Output 0
LED is lit on the FX3U.

Entry Ladder Monitor

This feature allows the user to monitor multiple rungs in a non-sequential order.

1) Go to Write Mode in the Edit Menu or by pressing F2.


2) Highlight, copy, and paste the rung three times into the same ladder
program (total of 4 rungs taking up 8 lines).

75
3) Change the device addresses of the contacts and coils (i.e. X000, X001,
Y001, and X002, X003, Y002, etc.) to create four different rungs.
4) Perform a Convert (Online Change).
5) Switch the ladder diagram to Monitor Mode.
6) Go to Monitor in the Online menu, and select Entry Data Monitor.
7) Select Tile Horizontally from the Window menu.
8) In the bottom window (the ladder code window) highlight the 4th rung.
9) Click and hold on the highlighted rung and drag it to the upper window
10) Repeat steps 8 and 9 for the 1st rung and 3rd rung.
11) Click on the upper window (Entry Data Monitor) to make it the active window
and maximize it.
12) Switch the window into Monitor Mode (Note that each window must be
switched to Monitor Mode individually).
13) Toggle the associated switches and watch the results.

11.7 Forcing Bits and Changing Registers


It can often be helpful to run sections of PLC code while writing a program. This
allows the programmer to test parts of the code while the program is small
enough to make changes easily. This can be done without the use of switches or
other devices by using the PLC and GX Developer. This is called Forcing.

1) Switch the PLC to RUN.


2) Using the ladder program from the last section, switch to Monitor (Write
Mode) in GX Developer.
3) Make sure the hard-wired toggle switches for X010 and X011 are OFF.
Then, holding the Shift key and double-click on X010.
4) After observing the change, keep X010 OFF and, while holding the Shift
key, double-click on Y000. What happens?

Notice that X010, a hard-wired input, can only be forced temporarily. In FX


series PLCs, hard-wired inputs can only be forced ON or OFF for a single scan
cycle before the hard-wired input status overrides the software. Hard-wired
outputs that are used in the ladder program can only be forced for one scan as
well. When physical outputs (Y) are not used in the ladder program, they can be
forced freely. However, when physical inputs (X) are not wired, they can still only
be forced for a single scan. Physical input and output addresses without physical
76
terminals connected to the PLC, like X020 and Y020 for this training, can be
forced without restriction. Internal bits, like M relays, can also be forced freely,
as long as they are not being controlled by the ladder program in the PLC.

This is the easiest way to turn contacts and relays OFF and ON without wiring
external switches. Forcing is not recommended when the PLC is connected to a
running system, however. There is no dialog box that warns of the change that is
about to happen, and dangerous results could occur.

Another way to force device values is


through the Device Test window.

1) Go to Monitor in the Online menu and


select Entry Data Monitor.
2) If the Entry Data Monitor from the last
section is still available, double-click on
X010. Otherwise, double-click in the
Device column, type X10 into the
dialog box and click Register. Then
close the dialog box and double-click
on X010.
3) When the Device Test window appears,
click Force ON.

From this window it is also possible to


change numerical values of data registers.

4) In the Device Test window, type D0 into the Device textbox in the Word
device/buffer memory section.
5) Enter 10 into the Setting Value textbox.
6) Click Set to write the value 10 into D0.

Check to see that a 10 has been written into data register D0.

7) Go to Monitor in the Online menu and select Device batch.


8) Enter D0 into the Device textbox.
9) Click on the Start Monitor button.

11.8 EXERCISE Contacts and Coils


Please find Project 1 in the appendix. This project is intended to give the student
practice in entering and controlling ladder logic.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 11.8; Exercise Contacts and Coils
screen on the GOT. If the ladder code is entered correctly, the application
simulation should run smoothly. This screen is meant to help students visualize
applications that could be controlled with even the simplest of ladder code.

77
78
CHAPTER 12 Timers and Counters
Timers and counters are standard parts of a PLC program. This chapter will cover the
various types of timers and counters available with the FX series PLCs as well as how
to code them. Exercises will help users in their understanding of the concepts.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Describe the different types of timers


o Know the availability of timers and counter
o Describe the format for timer and counter instructions
o Describe timer and counter limitations
o List the types of set values available to timers and counters
o Write a program using timers

Materials: FX-TRN-KIT-R Training Manual


FX3U & FX3UC Programming Manual - Basic & Applied
Instructions Edition
FX-TRN-KIT-R Training Kit

12.1 Timers

Availability

FX3U and FX3UC PLCs have 512 timers.


FX1N, FX2N, and FX2NC PLCs have 256 timers.
FX1S PLCs have 64 timers.

Types

The time interval depends on the timer device address used.

100ms (0.1 seconds)


10ms (0.01 seconds)
1ms (0.001 seconds)

PLC Timer Device Addresses


Time Interval
FX1S FX1N/FX2N/FX2NC FX3U/FX3UC
100ms 0-62 0-199 0-199
10ms 32-62* 200-245 200-245
1ms (Retentive) - 246-249 246-249
100ms (Retentive) - 250-255 250-255
1ms 63 - 256-511
*Special auxiliary relay M8028 can be set to switch 31 of the 100ms timers to 10ms timers.

Set Value

The Set Value is the length of time a timer device runs before the timer value
stops incrementing and the device contact becomes active. The set value is

79
registered in multiples of the timer devices time interval. Thus T0, with a set
value of 50, runs for 5 seconds (50 x .1 seconds = 5 seconds).

The set value must be an integer between 1 and 32,767, because all timer
devices are 16-bit registers and can only count up. Set values can either be K
values (decimal constants), or word devices, such as a D register. When word
devices are used as the set value, the timer duration can be adjusted from an
HMI or within the ladder program by changing the word device value.

Reset (Retentive)

The accumulated timer value of a timer device returns to 0 and the device
contact becomes inactive when the input conditions of the rung become inactive
unless the timer is a retentive. To return a retentive timers timer value to 0 and
switch the device contact to inactive it is necessary to use the RST instruction.

Non-retentive timers will lose their timer values and device contact status at PLC
STOP or power loss. Retentive timers will keep both their timer values and
device contact status at PLC STOP or power loss.

Programming

Timer devices are programmed using the OUT instruction and two arguments,
first the timer device address, and second, the set value. The resulting ladder
code is shown below.

In this example, while X000 is active, T0 times up to 1 second (10 x 100ms)


before its contact device becomes active.

12.2 Counters

Availability

FX2N, FX2NC, FX3U, and FX3UC PLCs have 256 counters.


FX1N PLC has 256 counters.
FX1S PLCs have 45 counters.

PLC Counter Device Addresses


Counter Type
FX1S FX1N FX2N/FX2NC/FX3U/FX3UC
16-Bit 0-15 0-15 0-99
16-Bit Latched 16-31 16-199 100-199
32-Bit Bi-directional - 200-219 200-219
32-Bit Bi-directional Latched - 220-234 220-234
High-Speed Counters* 235-254** 235-255 235-255
* Although counters C235 to C255 (21 points) are all high-speed counters, the associated
physical inputs (X0-X7) are shared between them. A single physical input can not be
used for more than one high-speed counter at a time. For more details, see the end of
this Section in the Training Manual and Section 4.7 of the FX3U & FX3UC Programming
Manual - Basic & Applied Instructions Edition.
** The FX1S does not have C239, C240, C243, C245, C248, C250, or C253.
80
16-Bit Counters

Set Value

The Set Value is the number of times the counter devices input
conditions switch from inactive to active before the counter value stops
incrementing and the device contact becomes active. Thus, if C0 had
input condition X000 and set value 5, X000 would have to switch from
OFF to ON 5 times before the C0 device contact would become active.

For 16-bit counters, the set value must be an integer between 1 and
32,767, meaning that they can only count up. Set values can either be K
values (decimal constants), or word devices, such as a D register. When
word devices are used as the set value, the counter limit can be adjusted
from an HMI or within the ladder program by changing the word device
value.

The accumulated counter value of a 16-bit counter never goes above the
set value. Once the counter device contact has become active, it will
remain active until it is reset. Even if the counter value is manually
adjusted, the counter device contact will not become inactive.

Counting direction

16-bit counters can only count up.

Reset

While the PLC is in RUN, the accumulated counter value of a 16-bit


counter device returns to 0 and the device contact becomes inactive only
when the RST instruction is used.

16-bit counter devices C100-C199 are latched counters and therefore


retain their counter values and device contact status even during PLC
STOP or power loss. 16-bit counter devices C0-C99 will lose their counter
values and device contact status at PLC STOP or power loss unless they
have been declared as latched (battery-backed) within the PLC
Parameters, after which both counter value and device contact status are
retained.

Limitations

Negative set values are not permitted with 16-bit counters.

The only way to make a 16-bit counter count down is to decrement the
counter value with ladder code prior to the counter value reaching its set
value. Once the counter device contact becomes active, the only way for
it to become inactive is to use the RST instruction. The counter value will
appear to count down, but the counter device contact will remain active.

81
Manually adjusting the counter value up is possible, but the device contact
will not become active. The final count up to the set value must be from a
transition from inactive to active of the counter rungs input conditions.

Programming

16-bit counter devices are programmed using the OUT instruction and two
arguments, first the counter device address, and second, the set value.
The resulting ladder code is shown below.

In this example, each time X000 switches from inactive to active, the
counter value of C0 is incremented. When the counter value is 10, its
contact device becomes active.

32-bit counters

Set Value

The Set Value is the counter limit value which the accumulated counter
value must exceed (count from below the set value to above it) before the
device contact becomes active. Thus, if using C235 with a set value of
5000, the C235 counter value (triggered by X000) would have to go from
4999 to 5000 before the C235 device contact would become active.

For 32-bit counters, the set value must be an integer between


-2,147,483,648 and 2,147,483,647, meaning that they can count up or
down. Set values can either be K values (decimal constants), or a 32-bit
word devices, such as two consecutive D registers. When word devices
are used as the set value, the counter limit can be adjusted from an HMI
or within the ladder program by changing the word device value.

The accumulated counter value of a 32-bit counter can exceed the set
value. Once the counter device contact has become active, it will remain
active until it is reset or the counter value counts back down through the
set value. If the counter value is manually adjusted through the set value,
the counter device contact will not become inactive.

Counting direction

32-bit counters can count up or down. The counting direction for 32-bit
counters is based upon the status of special auxiliary relays M8200-
M8255, with the device address corresponding to the device address of
the 32-bit counter. If the relay is inactive, the corresponding counter
counts up. If the relay is active, the corresponding counter counts down.

For example, the direction of 32-bit counter C201 is determined by M8201.

82
Reset

While the PLC is in RUN, the accumulated counter value of a 32-bit


counter device can be returned to 0 and the device contact can be
switched to inactive when the RST instruction is used.

32-bit counter devices C220-C234 are latched counters and therefore


retain their counter values and device contact status even during PLC
STOP or power loss. 32-bit counter devices C200-C219 will lose their
counter values and device contact status at PLC STOP or power loss
unless they have been declared as latched (battery-backed) within the
PLC Parameters, after which both counter value and device contact status
are retained.

Limitations

While 32-bit counters can have negative presets, the counter device
contact will still become active only by counting up to the set value from a
smaller number.

For example, if counter C200 has a set value of -10, when the counter
counts down from -9 to -10, the device contact will not become active. If
the counter counts down to -11 and then counts up to -10, then the
counter device contact will become active.

Manually adjusting the counter value is possible, but the device contact
will not become active. The final count up to the set value must be from a
transition from inactive to active of the counter rungs input conditions.

Programming

32-bit counter devices are programmed using the OUT instruction and two
arguments, first the counter device address, and second, the set value.
The resulting ladder code is shown below.

In this example, each time X000 switches from inactive to active, the
counter value of C200 is incremented or decremented. When the counter
value goes from 99,999 to 100,000, its contact device becomes active.

High-Speed Counters

Overview

The PLC requires high-speed counter devices to count pulse train input
signals (around 20 per second or higher) and process them in the ladder
program. These input signals can come from peripherals like ultrasound
sensors or pulse train positioning equipment.

83
Specifications

The high-speed counter devices in FX series PLCs share all the same
properties as a normal 32-bit bi-directional retentive counter, but using
pre-defined physical inputs and combinations of physical inputs as the
input conditions. Furthermore, these high-speed counters can be divided
into attribute categories, including Hardware Counters or Software
Counters, and 1-Phase or 2-Phase. The number of high-speed inputs
available and the permitted frequency range of the inputs depend on the
FX series PLC model used. Please refer to the associated users manual
for more details on the high-speed input specifications.

Limitations

Hardware counter limitations depend only on the specification of the


hardware in the PLC, which remains constant throughout a PLC model.
For example, the FX3U PLC has six high-speed built-in physical inputs
capable of up to 100kHz 1-phase input frequency corresponding to C235-
C240 and two up to 10kHz corresponding to C244-C245. As mentioned in
Section 2.7 of this Training Manual, the maximum input frequency can be
enhanced to 200kHz by using the FX3U-4HSX-ADP.

Software counters, on the other hand, use program interrupts to process


input pulse signals, therefore limitations depend on several attributes of
the PLC system (i.e. special adapters connected), and ladder program
(i.e. how many high-speed commands are being used). In the FX3U and
FX3UC, C241-C243 each use one high-speed built-in physical input for 1-
phase counting, and another for high-speed counter value reset. The
maximum frequency for these counters requires calculations
corresponding to the table in Section 4.7.10 of the FX3U & FX3UC
Programming Manual - Basic & Applied Instructions Edition.

Programming

High-speed counter devices are programmed using the OUT instruction


and two arguments, first the counter device address, and second, the set
value. The difference between these counter devices and other counter
devices is that the input conditions in the ladder code are used to enable
the high-speed counter, not to increment/decrement the counter value.
The resulting ladder code is shown below.

In this example, while X010 is active, each time X000 switches from
inactive to active, the counter value of C235 is incremented or
decremented. When the counter value goes from 99,999 to 100,000, its
contact device becomes active.

For this training, the FX3U will be used with hardware counters C235 and
C236, corresponding to high-speed physical inputs X000 and X001,

84
respectively. These high-speed inputs can be simulated with the high-
speed input switches and dials located on the FX-TRN-KIT-R Training Kit.

12.3 Program Examples


Create a new program, enter the following timer rung, and write it to the PLC.

When developing logic, try to think with the words AND and OR, for example

When X012 AND X013 are ON, OR when X14 is ON, timer T0 operates.

Toggle the X014 switch to ON and monitor the timer value in Monitor Mode.
Toggle the X014 switch to OFF and notice the timer value returns to zero.
Timers T0-T199 are 100ms timers and T200-T245 are 10ms timers. The set
value, K40, is a multiplier meaning 40 x 100ms = 4 seconds. After the timer
reaches 4 seconds, the T0 contact will become active.

Add the following ladder code after the previous rung and write it to the PLC.

Toggle X012 AND X013 to ON. When T0 reaches 40, the T0 contact will
become active, turning on the output Y001.

Here is a pulse timer.

When the PLC starts running, the T2 normally closed (NC) contact is active. This
drives the T2 timer up to 20 seconds (200 x 100ms). When the timer reaches 20
seconds, the T2 contact conducts, driving the Y002 coil. Since this example
uses a NC contact as the input condition to T2, when the T2 contact conducts the
NC contact becomes inactive, automatically resetting the timer value and device
contact. When the timer resets, the T2 contact becomes inactive again, causing
the NC contact to conduct, which starts the timer operation again.
The result is the T2 normally open contact will be active for 1 ladder scan every
20 seconds, creating a timed output pulse.

Here is a Flip-flop circuit.

85
Initially the T3 NC contact conducts, driving the T4 timer up to 5 seconds. When
the T4 device contact becomes active, it drives the T3 timer up to 3 seconds.
After 3 seconds the T3 contact becomes active, opening the T3 NC contact,
which then resets T4 and T3.

The result is Y003 will be OFF for 5 seconds and then ON for 3 seconds.

Another useful timer circuit is an Off-Delay timer.

In this example, X000 initially drives Y010 when T5 is inactive. Once Y010 is
ON, it stays ON regardless of X000 due to the branch. After X000 turns OFF,
both the X000 NC contact and the Y010 NO contact are active, driving T5 for
seconds before the T5 NC contact resets the first rung along with Y010.

Sometimes, an output needs to be on for a specific amount of time, no matter


how long the input condition stays on. This is typically called a One-Shot timer.

In this example, X011 initially drives Y001. At the same time timer T1 starts to
operate. Once the T1 device contact becomes active, it turns Y001 OFF. Y001
will not turn ON again until after X011 has turned OFF and timer T1 is reset.

A quick calculation shows that the longest time duration that can be handled by a
timer is 32,767 x 0.1 sec / 60 = 54.36 minutes. What happens if it is necessary to
run a timer longer than this? One answer is to use a combination of timers and
counters together like the program below:

86
While X016 is ON, T0 is driven for 1 minute. After 1 minute, T0 causes C0 to
increment. After 60 increments (1 hour), C0 becomes active, incrementing C1.
After 24 hours C1 would become active and set a day counter.

Note: The program shown above is not complete. What needs to be added
to make it work properly?

12.4 Additional Timer Instructions

Two other handy timer instructions within the FX series instruction set are the
Teaching Timer (TTMR) and Hour Meter (HOUR) instructions.

The TTMR instruction measures the amount of time the input conditions are on in
100ms increments. It amplifies this value converted to seconds by a
magnification factor and stores this augmented value into a specified word device
(D). The current measurement value in 100ms increments is constantly written
to the next consecutive word device (D+1). Once the values are stored in the
PLC device memory, they can be used as set values to other timers, etc.

The instruction takes the number of accumulated seconds and multiples it by a


magnification factor of 10n, where n is 0, 1, or 2. To store the actual number of
seconds, the magnification factor would be K0 (101 = 1). To make a set value for
a 100ms timer, use magnification factor K1. This will take the number of seconds
and multiply it by 10 to get the number of 100ms increments. For a 10ms timer,
the number of seconds would need to be multiplied by 100, or 102 (n = K2).

The HOUR instruction is a built-in hour meter. The instruction times the number
of seconds its input conditions have been active (D1+1) and stores the number
of hours in a specified word device (D). After the set value of hours (S) is
reached, the specified output bit device (D2) will turn ON.

87
It is recommended that the devices used to store the current value in hours and
seconds should be in the retentive device range of the PLC so that they are not
lost during PLC STOP or power loss. This function can be coded as DHOUR to
use 32-bit registers and store longer time frames.

12.5 EXERCISE Timers and Counters


Please find Project 2 in the appendix. This project is intended to give the student
exposure to programming with timers and counters, as well as exposure to timer
and counter behavior.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 12.5; Exercise Timers and
Counters screen on the GOT. This screen is meant to help students visualize
the timer and counter operations for further understanding.

12.6 EXERCISE Conveyor Control

Write a program that uses:


X010 as the Start button (momentary contact Pulse command)
X011 as the Stop button (momentary contact Pulse command)
M0 as a latch contact
(remains on for the entire cycle, shuts off after the last conveyor shuts off)

When the start button is pushed, turn on outputs Y0 to Y7 in sequential order.


These outputs are 8 conveyors that must be turned on in order. Each conveyor
comes on 1 second after the previous conveyor comes on. When all conveyors
have been running for 5 seconds, turn the conveyors OFF in reverse order, one
at a time, one second apart. The Stop Button turns OFF all conveyors and M0.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 12.6; Exercise Conveyor Control
screen on the GOT. If the ladder code is entered correctly, the application
simulation should run smoothly. This screen is meant to help students visualize
the application described in this exercise for easier programming and debugging.

88
CHAPTER 13 Applied Instructions
Applied instructions are the advanced instructions of the FX line. These instructions
allow the PLC to perform complex data manipulations, mathematical operations, and
communications. Most applied instructions work on the 16-bit or 32-bit word level.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Name the most common applied instructions.


o Describe the format of the instructions and what they do.
o Write several programs using these instructions.

Materials: FX-TRN-KIT-R Training Manual


FX-TRN-KIT-R Training Kit

13.1 General Format

Applied instructions in GX Developer always use the bracket symbol. The


number of arguments varies depending on the instruction.

Example

This instruction adds the contents of Source 1 (D0) to the contents of Source 2
(K2) and places the result in the Destination register (D300).

It is also possible most of the time to use a Source as the Destination:

Example

In this case, the Source 2 and the Destination registers are the same register. If
D0 contains 9 and D300 contains 200 prior to the execution of the instruction,
then when the instruction is executed, 9 is added to 200, and the result (209) is
placed in D300.

Applied instructions are 16-bit instructions by default. If 32-bit data manipulation


is needed, the user must add a D as a prefix to the instruction.

Example: MOV transfers 16-bits of data


DMOV transfers 32-bits of data

Most of these instructions continue to execute once every scan while the input
conditions are active. Sometimes this is not what is wanted. While the user may
want to increment a data register by 1 (with INC) when an input turns ON, the
INC instruction will increment the data register once every scan as long as the
input is on. This could be hundreds of times every second.
89
To avoid this, the user must use pulse instructions, similar to those described in
Section 10.3 of this Training Manual. To change an applied instruction to a pulse
version, add a P as a suffix to the instruction.

Examples:

Divides D0 by D1 and places the result into D20 every scan.

Executes the division only once when the input conditions become active.

13.2 Data Transfer Instructions

Data transfer instructions must be placed at the end of the rung (right side).
When the input conditions are active, the data transfer instruction is performed.

Data Transfer Instruction 16-Bit Data 32-Bit Data Floating Point


1 to 1 MOV DMOV DEMOV
Many to Many BMOV - -
1 to Many FMOV DFMOV -

MOV Data Move


DMOV 32-Bit Move
DEMOV Floating Point Move

The move (MOV) instruction moves, or actually copies, data from the source
location to the destination location (after the instruction is executed, both
registers contain the same data). Two variants of this instruction are DMOV,
which uses 32-bit values, and DEMOV, which uses 32-bit floating point values.

In this example, while X011 is ON, the value in data register D1 is copied to D2.

BMOV Block Move

The block move (BMOV) instruction moves (copies) the specified number of
word devices starting from the source location to the same number of word
devices starting at the destination location. This instruction is not available for
32-bit data, since the number of words to move could simply be doubled.

In this example, while X011 is ON, three data registers starting at D1 are copied
to three data registers starting at D7.

90
FMOV Fill Move
DFMOV 32-Bit Fill Move

The fill move (FMOV) instruction moves (copies) the specified data value from
the source into the specified number of word devices starting at the destination
location. The DFMOV instruction uses 32-bit numbers, so the source refers to
two consecutive word devices, and the destination refers to 2x the number of
words specified starting at the destination location.

In this example, while X011 is ON, data registers D1 and D2 are copied to D10
and D11, D12 and D13, and D14 and D15.

For any of the data transfer instructions, a group of bit devices can be specified
instead by using a prefix of K and a number between 1 and 8.

In this example, while X012 is ON, 16-bits (4 nibbles of 4 bits each) starting at
X000 are copied into the 16-bit data register D100.

The value after K determines how many nibbles will be used in the operation.

K1 = 1 nibble (4 bits) K5 = 5 nibbles (20 bits)


K2 = 2 nibbles (8 bits) K6 = 6 nibbles (24 bits)
K3 = 3 nibbles (12 bits) K7 = 7 nibbles (28 bits)
K4 = 4 nibbles (16 bits) K8 = 8 nibbles (32 bits)

13.3 Comparison Instructions

The compare instructions must be placed at the end of the rung (right side).
When the input conditions are active, the comparison instruction is performed.

Compare Instruction 16-Bit Data 32-Bit Data Floating Point


1 to 1 CMP DCMP DECMP
1 to Range ZCP DZCP DEZCP

CMP Compare
DCMP 32-Bit Compare
DECMP Floating Point Compare

The compare (CMP) instruction compares one 16-bit value to a second 16-bit
value, and writes the results of the comparison to a group of 3 bit devices, which
can be Y outputs, M relays or S relays. The 3 result bits represent source data 1
being greater than, equal to, or less than source data 2, respectively.

91
In this example, while X011 is ON, bits M0, M1 and M2 show the comparison
results as follows:
M0 turns ON if the value in D0 is greater than 10.
M1 turns ON if the value in D0 equals 10.
M2 turns ON if the value in D0 is less than 10.

Two variants of this instruction are DCMP, which compares two 32-bit values,
and DECMP, which compares two 32-bit floating point values.

ZCP Zone Compare


DZCP 32-Bit Zone Compare
DEZCP Floating Point Zone Compare

The zone compare (ZCP) instruction compares one 16-bit value to a specified
value range and writes the results of the comparison to a group of 3 bit devices,
which can be Y outputs, M relays or S relays. The 3 result bits represent source
data 3 being less than, within, or greater than the range specified by source data
1 and 2.

In this example, while X011 is ON, bits M0, M1 and M2 show the zone
comparison results as follows:
M0 turns ON if the value in D0 is less than 10.
M1 turns ON if the value in D0 between 10 and 50, inclusive.
M2 turns ON if the value in D0 is greater than 50.

Note that the value of source data 1 needs to be less than that of source data 2.
If it is not, the PLC will still accept the instruction, but it will not function properly.

Two variants of this instruction are DZCP, which compares a 32-bit value to a
32-bit range, and DEZCP, which compares a 32-bit floating point value to a 32-bit
floating point range.

INLINE COMPARISONS

Unlike all of the comparison instructions discussed so far, the inline compare
instructions can be placed anywhere within the rung. They function in the same
way as any other input condition or contact. These instructions are only available
on the FX1S, FX1N, FX2N, FX2NC, FX3U, and FX3UC PLCs. These
instructions were not available on older FX PLCs.

In this example, while the value in D0 is less than 10, output coil Y001 is driven.

92
Inline Compare Instruction 16-Bit Data 32-Bit Data
Greater Than LD> LDD>
Greater Than or Equal To LD>= LDD>=
Equal To LD= LDD=
Less Than or Equal To LD<= LDD<=
Less Than LD< LDD<
Not Equal To LD<> LDD<>

With inline compare instructions it is possible to look at the accumulated value of


timers or counters to turn ON different outputs at different times or counter
values.

In this example, when the T10 timer value reaches 6, output Y001 is driven.

16-Bit and 32-Bit Comparisons

The compare, zone compare, and inline compare instructions shown above are
16-bit instructions by default. As described at the beginning of the chapter, if a
32-bit comparison is required, it is necessary to add a D to the instruction. For
example DCMP, DZCP, LDD=, LDD>, etc.

This is very important to remember in the case of comparing values like high-
speed counters. These counter values are 32-bit by default and will not function
properly with a standard 16-bit comparison instruction.

13.4 EXERCISE Parking Lot

Write a program for the following parking lot control application:

X010 indicates a car coming in.


X011 indicates a car going out.
Y000 is a sign which turns on to indicate the lot is full.
C200 (bi-directional 32-bit counter) keeps track of the number of cars in the lot.
D0 will store the maximum number of cars.

When a car comes in, count the car. When a car goes out, reduce the current
count by 1. When the lot is full, turn ON the Lot Full sign. Assume for this
exercise that a car can not come in and go out at the exact same time, but note
that in a real-life situation, this must be accounted for.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.4; Exercise Parking Lot screen
on the GOT. If the ladder code is entered correctly, the application simulation
should run smoothly. Use the GOT touch screen to adjust D0 to an initial value
of 10. Use different values in D0 later for further understanding. This screen is
meant to help students visualize the application described in this exercise for
easier programming and debugging.

93
13.5 EXERCISE Conveyor Control Part 2
Rewrite the Conveyor Control program from Section 12.6, using ONLY ONE
timer with compare statements to control the outputs.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.5; Exercise Conveyor Control 2
screen on the GOT. If the ladder code is entered correctly, the application
simulation should run smoothly. Use the GOT touch screen to select the Timer
device for monitoring. This screen is meant to help students visualize the
application described in this exercise for easier programming and debugging.

13.6 Conversion Instructions

The conversion instructions must be placed at the end of the rung (right side).
When the input conditions are active, the conversion instruction is performed.
Instructions are available to convert data to and from most of the numerical
formats and ASCII strings. The instructions which will be covered in this training
will convert integer numbers to floating point numbers and back.

FLT Integer to Floating Point


DFLT 32-Bit Integer to Floating Point

The float (FLT) instruction converts a 16-bit integer into a 32-bit floating point
value. DFLT converts a 32-bit integer to a 32-bit floating point number.

In this example, while X011 is ON, the integer value stored in D0 is converted to
a floating point value and stored in D10 and D11.

Note: Remember that floating point numbers can also be expressed as constants
using the E prefix, as described in Chapter 6 of this Training Manual.

INT Floating Point to 16-Bit Integer


DINT Floating Point to 32-Bit Integer

The integer (INT) instruction converts a 32-bit floating point number into a 16-bit
integer value. Only the integer portion is converted. Any fractional values are
lost. DINT converts a 32-bit floating point number to a 32-bit integer number.

In this example, while X010 is ON, the floating point value stored in D10 and D11
is converted to a 16-bit integer value and stored in D1. Note that if the floating
point value used in the INT instruction is larger than a 16-bit integer, the
instruction will not be executed. The value in the destination register will remain.

94
13.7 Increment and Decrement Instructions
The increment and decrement instructions must be placed at the end of the rung
(right side). When the input conditions are active, the instruction is performed.

INC Increment
DINC 32-Bit Increment
DEC Decrement
DDEC 32-Bit Decrement

The increment and decrement (INC and DEC) instructions simply add or subtract
1 from the value in a 16-bit data register. These instructions execute nearly twice
as fast as the ADD or SUB instructions, and are not subjected to the limitations of
a counter. These instructions can be coded to operate on 32-bit numbers as
DINC and DDEC. Note that all of these instructions will most likely be used as
pulse instructions (INCP, DECP, DINCP, and DDECP).

In this example, while X011 is ON, register D1 is incremented by 1 every scan.

In this example, while X011 is ON, register D1 is decremented by 1 every scan.

13.8 EXERCISE INC and DEC


Please find Project 3 in the appendix. This project is intended to demonstrate the
difference between INC/DEC and INCP/DECP.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.8; Exercise INC and DEC
screen on the GOT. If the ladder code is entered correctly, the differences
between INC and INCP, and DEC and DECP should be noticeable immediately.
This screen is meant to help students visualize the instructions used in the
project for further understanding.

13.9 Arithmetic Instructions

The arithmetic instructions must be placed at the end of the rung (right side).
When the input conditions are active, the instruction is performed.

Arithmetic Instruction 16-Bit Data 32-Bit Data Floating Point


Addition ADD DADD DEADD
Subtraction SUB DSUB DESUB
Multiplication MUL DMUL DEMUL
Division DIV DDIV DEDIV
Square Root SQR DSQR DESQR

95
Note how all 32-bit instructions as well as all floating point instructions are
prefixed with a D since they all operate on 32-bit numbers. The instructions
that are also prefixed with an E indicate floating point format. Also note that
due to the nature of multiplication and division, the 16-bit instructions produce a
32-bit result and the 32-bit instructions produce a 64-bit result. For more details,
refer to the FX3U & FX3UC Programming Manual - Basic & Applied Instructions
Edition.

Integer square root requires a little more explanation. The calculated square root
value will be an integer number with all fractional values ignored, unless floating
point is being used. If decimal places are ignored, special relay M8021 turns ON.

In this example, while X011 is ON, 30 is added to the value in register D0 and the
result is placed in D10 every scan.

13.10 EXERCISE Binary Math


Please find Project 4 in the appendix. This project is intended to give the student
practice in using the arithmetic instructions.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.10; Exercise Binary Math
screen on the GOT. If the ladder code is entered correctly, the arithmetic
operations should be performed accurately depending on inputs X010-X013.
This screen is meant to help students visualize the arithmetic instructions in both
their 16-bit (or 32-bit) decimal and binary form for further understanding.

13.11 EXERCISE Parking Lot Part 2


This is a modification of the Parking Lot program from Section 13.4. Add ladder
code to count the total number of cars that entered the parking lot during the day
and store that number in D10. Also add ladder code to count how much money
should be in the cash drawer at the end of the day, assuming each car pays
$4.50 on entrance, and store that total in D12-D13 (notice the fractional value).
There will also be a reset button for the manager to reset the car count and cash
total at the end of the day. The reset button should be M10. Again, assume for
this exercise that a car can not come in and go out at the exact same time, but
note that in a real-life situation, this must be accounted for.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.11; Exercise Parking Lot 2
screen on the GOT. If the ladder code is entered correctly, the application
simulation should run smoothly. Use the GOT touch screen to adjust D0 to an
initial value of 10 and reset the car count and cash total using the M10 push
button. Use different values in D0 later for further understanding. This screen is
meant to help students visualize the application described in this exercise for
easier programming and debugging.

96
13.12 EXERCISE Conveyor Control Part 3
This is a modification of the Conveyor Control 2 program from Section 13.5. Add
ladder code to set the number of cycles the conveyor system will run (D0)
continuously. The number of cycles must be a value between 5 and 15. If it is
not a value between 5 and 15, do not let the conveyor system start. For this
exercise, assume that D0 is not changed during operation, but note that in a real-
life situation, this must be accounted for.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.12; Exercise Conveyor Control
3 screen on the GOT. If the ladder code is entered correctly, the application
simulation should run smoothly. Use the GOT touch screen to adjust the value of
data register D0. This screen is meant to help students visualize the application
described in this exercise for easier programming and debugging.

13.13 High-Speed Processing

The FX3U has built-in high-speed counters as discussed in Section 12.2 and
built-in high-speed inputs and outputs as discussed briefly in Section 2.7.

High-Speed Counter Instructions

As previously mentioned, the high-speed counters are either hardware counters


that execute independent of the PLC scan, or software counters that execute as
interrupts when they count, also outside of the scan. Thus, the advantage of
high-speed counters is that they function outside of the scan.

It is important to remember that since high-speed counters are 32-bit counters,


32-bit D type instructions are required when using high-speed counter values.

While it is possible to use the normal SET, RST and comparison instructions with
high-speed counters, these instructions are scan dependent and therefore limit
the benefits of high-speed counters. To obtain full benefit of the high-speed
counters, use the following high-speed counter processing instructions.

HSCS High-Speed Counter Set

The high-speed counter set (HSCS) instruction functions like the standard
SET instruction. When the specified high-speed counter reaches the
specified value, the specified bit device is set. This instruction uses
interrupts and is independent from the scan.

In this example, the instruction sets Y010 (to ON) when the value of high-
speed counter C255 is 100.

97
HSCR High-Speed Counter Reset

The high-speed counter reset (HSCR) instruction functions like the


standard RST instruction. When the specified high-speed counter
reaches the specified value, the specified bit device is reset. This
instruction uses interrupts and is independent from the scan.

In this example, the instruction resets Y010 (to OFF) when the value of
high-speed counter C255 is 200.

HSZ High-Speed Zone Compare

The high-speed zone compare (HSZ) instruction functions like the


standard ZCP instruction. The value of the specified high-speed counter
is compared to a value range and the results of the comparison are stored
into 3 consecutive bit devices. Note that the HSZ instruction can only be
used once in the ladder program.

In this example, the results are as follows:


Y010 turns ON when C251 < 1000.
Y011 turns ON when 1000 <= C251 <= 1200.
Y012 turns ON when C251 > 1200.

Notice that DHSCS, DHSCR, and DHSZ are used as the operation
instead of HSCS, HSCR, and HSZ. Remember that high-speed counters
are 32-bit devices, so D must prefix the instruction.

High-Speed Input and Output Instructions

Also as previously mentioned, the FX series PLCs have built-in high-speed


physical inputs and some have built-in high-speed physical outputs. The FX3U
has a maximum high-speed input frequency of 100kHz for all models. The FX3U
transistor type models also have a maximum high-speed output frequency of
100kHz. Both input and output specifications for the FX3U can be expanded
using the high-speed input and output adapters.

For this training, only two of the most basic instructions will be covered. For
more details on high-speed processing and positioning instructions, refer to
Chapters 13, 20, 24, and 32 of the FX3U & FX3UC Programming Manual - Basic
& Applied Instructions Edition.

SPD Speed Detection

The speed detection (SPD) instruction measures the frequency of input


pulses received by a high-speed input terminal over a specified time
interval (in 1ms intervals) and places the result into a 16-bit word device.

98
There is also a DSPD instruction which will measure the frequency of a
high-speed input signal and place the result into a 32-bit word device.

In this example, while X010 is ON, the pulse density over 1 second (1000
x 1ms, or Hz) from high-speed input X000 is written to D0 every scan.

Note that the high-speed physical input device address (i.e. X000) for this
instruction can not be used simultaneously for any other high-speed
counter or high-speed processing instruction.

PLSY Pulse Y Output

The pulse Y output (PLSY) instruction outputs a pulse train of specified


length and frequency (Hz) through a high-speed output terminal. When 0
is specified as the pulse train length, a continuous train of pulses is output.
This can be used for pulse train positioning with servos and inverters.

There is also a DPLSY instruction which will output 32-bit value length
signals at 32-bit value frequencies.

In this example, while X010 is ON, a pulse train of 32-bit length stored in
D2-D3 and 32-bit frequency stored in D0-D1 is output on high-speed
output terminal Y000.

Note that the input conditions for the PLSY/DPLSY instruction need to be
active for the entire time that the pulse train is being output. If the input
conditions become inactive, the pulse train will stop, regardless of whether
the specified length of pulses has been output or not. Furthermore, upon
completion of the pulse train output, to execute the same rung again, the
input conditions must be turned OFF and then back ON to output the next
pulse train. To detect whether or not the PLSY/DPLSY instruction is
complete, use the special auxiliary relay M8029 which turns ON when all
pulses in the pulse train have been output. For more information on
M8029, refer to the FX3U & FX3UC Programming Manual - Basic &
Applied Instructions Edition.

13.14 EXERCISE High-Speed I/O

Write a ladder program that simulates a 3,000,000 pulse resolution encoder (0 to


3,000,000) using high-speed counter C235 which counts the pulse train input on
X000. Use comparisons to make sure C235 stays within its resolution range,
and use X010 to switch the direction of the encoder (up or down counting). At
the same time, compare the encoder value to the range 1,000,000 to 2,000,000,
with results written to Y010-Y012. A simulated sensor is connected to input
terminal X001, whose input pulse train frequency needs to be measured in Hz
and stored in D0. Y010 drives a continuous pulse train on output terminal Y000
with the frequency from D0. Y011 drives a continuous pulse train on output
99
terminal Y001 at 1000Hz. Y012 triggers a pulse train 100,000 pulses in length
on output terminal Y002 with the frequency from D0.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.14; Exercise High-Speed I/O
screen on the GOT. If the ladder code is entered correctly, the simulation should
run smoothly. Use the high-speed inputs for X000 and X001 and digital input
X010 on the training kit to simulate the encoder and sensor inputs. This screen
is meant to help students visualize the simulated encoder, sensor, and high-
speed output system described in this exercise for further understanding of the
high-speed processing instructions and for easier programming and debugging.

13.15 FX3U & FX3UC Left Side Bus

The FX3U and FX3UC PLCs have a left side bus linked directly to the CPU. This
bus is used with boards (BDs) (FX3U only) and special adapters (ADPs) for
various functions. It is important to understand that the main difference between
the left side bus BDs and ADPs and right side bus SFMs is that the left side bus
BDs and ADPs contain no internal memory. All processing using the left side
bus is done through the device memory and the CPU. Dedicated Special
Auxiliary Relays (M8000 and up) and Special Data Registers (D8000 and up) are
used for dedicated instructions and purposes. The following two sections will
contain example projects demonstrating the use of the left side bus. Use of the
right side bus will be covered later in Section 13.18 TO/FROM Instructions. For
a full list of the special device memory addresses, functions, and purposes, refer
to Chapter 36 of the FX3U & FX3UC Programming Manual - Basic & Applied
Instructions Edition.

13.16 EXERCISE Temperature Sensor

This exercise is intended as an example of using the special device memory


associated with the FX3U & FX3UC left side bus BDs and ADPs and
demonstrate some of the temperature sensor measurement capabilities.

In this exercise, the FX3U-4AD-PT-ADP is addressed as the 1st analog adapter


connected to the FX3U and Channel-1 is connected to a PT100 touchable
temperature sensor on the FX-TRN-KIT-R training kit. The specifications of the
ADP can be found in the FX3U Analog Edition manual. Special auxiliary relay
M8260 is used to switch the temperature measurement between Celsius and
Fahrenheit, and special data register D8264 stores the averaging time of the
temperature measurement. The temperature measurement from Channel-1 of
the 1st analog adapter is stored in D8260 in integer form but with one decimal
point value of accuracy. The Error Status for the 1st analog adapter is stored in
D8268 and the Model Code is stored in D8269.

Access the Section 13.16; Exercise Temperature Sensor screen on the GOT.
The temperature will be displayed on the GOT screen. Use the GOT touch
screen to switch between Celsius and Fahrenheit and adjust the temperature
measurement averaging time (D8264). Note that the operations with the ADP
are done automatically, and therefore there is no ladder code required. This
100
screen is meant to show students the simplicity of the temperature sensor
adapter as well as other analog adapters for further understanding.

13.17 EXERCISE Parallel Link


This exercise will require two FX-TRN-KIT-R training kits as well as user-supplied
twisted pair cables. If either of these items is not available, please skip this
section. For more information on Parallel Link and all the serial communication
capabilities of the FX series, refer to the FX Data Communication Edition manual.

Please find Project 5 in the appendix. This project is intended to give the student
practice in using the special device memory associated with the FX3U left side
bus BDs and ADPs and show an example of the FX built-in serial networking
capabilities. This ladder program also shows an example of index register use.

Use the following wiring diagram (duplicated from the FX3U Data Communication
Edition manual) with twisted pair cables to connect two FX-TRN-KIT-R training
kits within 50m of each other. Terminal resistors do not need to be added for the
FX3U range of RS-485 devices.

Parallel Link is a Master/Slave serial connection between two FX PLCs of the


same model (i.e. FX3U and FX3U), used to automatically update dedicated
system devices within both PLCs. This means that the master PLC on the
connection will constantly write a range of bit and word devices to the connected
PLC, and read a range of bit and word devices from the same PLC, causing the
dedicated range of bit and word devices to be the same in both PLCs. For this
example program, Regular Parallel Link Mode will be used, which updates M800-
M999 and D490-D509. A more detailed description of Parallel Link and its
specifications can be found in the FX3U Data Communication Edition manual.

In the Project 5 ladder program, Parallel Link does not require any special
communication parameters to be specified and therefore special data register
D8120 should be set to the default value of 0. Furthermore, Parallel Link is self-
refreshing, meaning that as soon as a master successfully detects a slave, the
Parallel Link becomes active. The only other ladder code necessary for
101
connection is that special auxiliary relay M8070 needs to be driven in the master
station and M8071 needs to be driven in the slave station. In this example
program, M0 will be used to switch between Master and Slave. Note that on the
FX-TRN-KIT-R training kit, the FX3U-485-BD is used, meaning that serial
communication channel 1 (Ch1) is being used. On other systems, if Ch2 is to be
used, M8178 must be driven in addition to the master or slave special auxiliary
relay. The Project 5 ladder program is designed to establish a Parallel Link
connection and control physical output terminals Y000-Y003 on both PLCs
determined by simple NO contact and NC contact logic. Also, data registers
D490-D491 and D500-D501 are updated between the PLCs while the Parallel
Link is active, shown on the GOT as X/Y-coordinate movement. Using Index
Registers Z0 and V0, one ladder program can be used for both master and slave
kits by offsetting the auxiliary relay and data register device addresses. For more
details on Index Registers, refer to the FX3U & FX3UC Programming Manual -
Basic & Applied Instructions Edition.

Once the ladder program has been entered into GX Developer and written to
BOTH PLCs in the training kits, access the Section 13.16; Exercise Parallel
Link screen on BOTH GOTs. Switch between Master (NO contact M0) and
Slave (NC contact M0) by pressing the Master and Slave buttons on the GOT
touch screen or the double-arrow. If the ladder code is entered correctly and the
wiring performed correctly, the Parallel Link should become active as soon as a
master is paired with a slave, shown on the GOT by the green lamp representing
M8072. Use X010-X017 on each kit to drive and increment the respective
auxiliary relays and data registers on each station and notice that the bit devices
and word devices are updated automatically between the two stations. Note that
there are only three rungs of ladder code in this example project relating to
Parallel Link. This screen is meant to help students visualize the simplicity of
Parallel Link and the serial networking options for further understanding.

13.18 TO/FROM Instructions


As discussed in previous sections, the main difference between the left side bus
BDs and ADPs and right side bus SFMs is that the left side bus BDs and ADPs
contain no internal memory. The internal memory within SFMs is called the
Buffer Memory (BFM), from which the SFM performs all its functions. The TO
and FROM instructions allow the PLC to access the BFM.

The BFM can be thought of as a large group of 16-bit word devices, with each
word or bit of the word corresponding to a different parameter or command. For
the PLC to access any of these parameters or give the SFM a command, it must
write to or read from the BFM. The 16-bit word devices that make up the BFM
have their own addresses that simply start from BFM #0 and go up.

Note: Before attempting to program an SFM, it is necessary to have the BFM list
for that SFM. Without the BFM list it is impossible to know what parameters
need to be set, which parameters are stored in which BFM location, and which
BFM locations trigger which commands.

The TO instruction is used to write 16-bit data to the BFM in the SFM. Typically,
this data is a parameter or command that will guide the functions of the module.
102
Instruction Format:

Example:

In this example, while X011 is ON, one word of data (K1), a constant value
(H1122), is written to BFM #0 (K0), in the 3rd SFM connected to the PLC (K2)
every scan.

The FROM instruction is used to read 16-bit data from the BFM of an SFM to the
PLCs device memory. This data could be converted analog input, or the module
status, etc. Data from the BFM is copied to the specified destination devices in
the PLC, where it can be further processed by the PLC.

Instruction Format:

Note that there are also 32-bit versions of the TO and FROM instructions DTO
and DFROM which write or read two BFM addresses at a time. When using
the 32-bit versions, it is important to note that the device count of the
instruction is in 32-bit increments and not 16-bit like the TO and FROM.

U\G Buffer Memory Access (FX3U & FX3UC Only)

Remember from Chapter 6 that U\G can also be used in place of a device
address to access single 16-bit word devices within the BFM using other applied
instructions in the FX3U or FX3UC. For example, the following two rungs are
equivalent.

In both of these example rungs, while X010 is ON, BFM #100 is read from the 1st
SFM (SFM 0) and stored in D100 in the PLC every scan. Be aware that there is
a difference in processing time between the two methods. For more details, refer
to the FX3U & FX3UC Programming Manual - Basic & Applied Instructions
Edition.

13.19 EXERCISE Analog Control

Please find Project 6 in the appendix. This project is intended to give the student
practice in using the TO and FROM instructions associated with the FX series
right side bus and demonstrate some of the analog control capabilities.

In this exercise, the FX2N-5A is addressed as the 1st SFM (SFM 0) connected to
the FX3U with input Channel-1 (CH1) and input Channel-2 (CH2) connected to
103
the two Analog Input dials on the FX-TRN-KIT-R training kit. The analog input
dials both have an approximate input range of 0 to +10VDC. Output Channel-1
(CH1) is connected to the Analog Output Meters on the FX-TRN-KIT-R training
kit. The analog output meter displays a voltage range of 0 to 10VDC (note that
no negative voltages can be displayed). The FX2N-5A has maximum analog
input and output voltage range of -10 to +10VDC with selectable digital value
ranges. A -32,000 to +32,000 digital value range, for example, means that the
digital value -32,000 corresponds to -10VDC, 0 represents 0VDC, and +32,000
represents +10VDC, etc. A more detailed explanation of the FX2N-5A
specifications can be found in the FX2N-5A Users Manual.

Below is an example of a typical BFM description, in this case BFM #0,


duplicated from the FX2N-5A Users Manual. A list of all buffer memory
functionality can be found in the FX2N-5A Users Manual.

104
In the Project 6 ladder program, BFM #0 will be initialized to H55, which indicates
a -10 to +10VDC analog input range corresponding to a -10,000 to +10,000
digital value range. BFM #1 will be initialized to its default value of 0, which
indicates a -10 to +10VDC analog output range corresponding to a -32,000 to
+32,000 digital value range. BFM #2 and BFM #3 store the averaging time
values of CH1 and CH2, respectively. BFM #6 and BFM #7 contain the
averaged analog input data from CH1 and CH2, respectively. BFM #14 and BFM
#15 handle the analog output value. BFM #14 stores the Digital to Analog (DA)
output value, but when the Direct Control Function is being used (BFM #23),
BFM #15 will store the adjusted DA output value. For this exercise, different
Direct Control Functions will be used to adjust the analog output value. Refer to
the description of BFM #23 below duplicated from the FX2N-5A Users Manual.

For this exercise, D0 will store the average Analog to Digital (AD) input value
from CH1, and D1 will store the average AD input value from CH2. The analog
input averaging times for CH1 and CH2 will be controlled by D2 and D3,
respectively. The DA output value will be stored in D10. The adjusted analog
output value (BFM #15) will be stored in D11. The Direct Control Function will be
controlled by M0-M7 (since there are only two analog input channels being
used). X000 and X001 are tied to the control of the CH1 Direct Control Function,
while X004 and X005 are tied to CH2. While X000 or X004 are ON individually,
the associated digital input values from CH1 and CH2 will be automatically added
to the DA output value within the SFM and written to BFM #15. While X001 or
X005 are ON in addition to X000 or X005, the digital input values from CH1 and
105
CH2 will be automatically subtracted from the DA output value within the SFM
and written to BFM #15. Thus, the analog output of the FX2N-5A is directly
adjusted by the analog inputs on the FX2N-5A and the digital inputs on the
FX3U. After initialization, X010 will drive all of the FROM instructions, and X011
will drive all of the TO instructions. This is intended to show the difference
between data within the PLC and data within the BFM of the SFM.

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.19; Exercise Analog Control
screen on the GOT. If the ladder code is entered correctly, the simulation should
run smoothly. Use the GOT touch screen to adjust the analog input averaging
times (D2-D3) and the DA output value (D10). Use X000-X001 and X004-X005
to switch between the Direct Control Functions. Remember that the analog
output meter on the FX-TRN-KIT-R can only display 0 to +10VDC. If the ladder
code is entered correctly, it should be easy to notice how the data on the GOT
screen differs from the analog inputs and outputs on the training kit when the TO
and/or FROM instructions are not being driven. The analog input dials and
analog output meter use data directly from the SFM, while the GOT and digital
input switches affect the PLC. This screen is meant to help students visualize
the relevance of the TO and FROM instructions for further understanding as well
as display some of the analog control options available.

13.20 Shift Instructions


The FX series PLCs contain numerous instructions for shifting bits within word
devices or words within arrays of word devices. These instructions are useful for
non-arithmetic data processing and data organization.

SFTL Bit Shift Left


SFTR Bit Shift Right

The Bit Shift Left (SFTL) and Bit Shift Right (SFTR) instructions move bits within
a word (or multiple words) to the left or right, replacing the shifted bits with
those from the source. The instructions take 4 parameters: the location of the
data to be shifted into the register(s), the first address of the shift data, the length
of the shift data, and the number of bits to shift the data left or right.

106
WSFL Word Shift Left
WSFR Word Shift Right

The Word Shift Left (WSFL) and Word Shift Right (WSFR) instructions move
words of data in the same way as the bit shift instructions. The instructions take
the same 4 parameters as the bit shift instructions: the location of the data to be
shifted into the register(s), the first address of the shift data, the length of the shift
data, and the number of words to shift the data left or right.

13.21 EXERCISE Analog Processing


This exercise is based off of the ladder program from Project 6: Analog Control.

First, edit the Project 6 ladder code so that the FROM and TO instructions are
being executed every scan (while the PLC is in RUN). Then, using Bit Shift and
Word Shift instructions, assemble a serial communication frame in D20-D27
107
consisting of the adjusted analog output value (D11) that could be sent to
another controller or PC.

The frame, or data register array, needs to be eight data words (eight data
registers) long, and each analog output value should be inserted to the array
starting at D20. Trigger each data insertion with X010. At the same time, each
data register (D20-D27) in the array has an associated bit device (Y000-Y007) to
indicate that valid data has been loaded into the data register. This should also
be triggered by X010, with insertion starting at Y000. To delete a data register
value and its associated bit, simply insert data from a blank data register (D5, for
example) starting at D27, and also adjust the bit array starting at Y007. Trigger
data deletion with X011. When the entire indicator bit array is full, the serial
communication frame is ready to be sent. However, for this example program,
simply reset the entire bit array and data register array when it is full.

An illustration of the system is provided below.

Indicator Bit Array

Delete Insert

Data Register Array

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 13.21; Exercise Analog Processing
screen on the GOT. If the ladder code is entered correctly, the simulation should
run smoothly. All of the Analog Control options remain from Project 6 in Section
13.15 except for the FROM and TO indicators. Use X010-X011 on the training
kit to insert and delete data from the indicator bit and data register arrays. This
screen is meant to help students understand shifting instructions by visualizing
the application described in this exercise for easier programming and debugging.

13.22 Program Flow Control

By default, the CPU of the PLC runs the ladder program top to bottom and left to
right. At the beginning of each program scan, all physical input values on the
system are read into the image memory. The program is then processed, with
modifications being made to the image memory. Once the END instruction is
reached, the outputs are updated based on the image memory. Then the
process begins again.

108
Sometimes this program flow needs to be altered, depending on the application.
There are several methods of controlling the flow of the program, including jumps
and subroutine calls.

These instructions use the pointer addresses, mentioned earlier. To set a pointer
location, double click in the left margin of the ladder (to the left of the vertical rail)
and enter a location address prefixed with P. When referencing this location in a
jump or subroutine call, refer to it by its P device address.

NOTE: Address P63 is reserved. It is a jump to the END instruction. Do not


write code for P63 in the ladder program, or an error will occur.

CJ Conditional Jump

The conditional jump (CJ) instruction allows a section of ladder code to be


skipped over (not processed) depending on its input conditions. When the input
conditions are active and the instruction is executed, all ladder code between the
CJ command and the specified pointer is not executed.

CALL Call Subroutine


SRET Subroutine Return
FEND Main Routine Program End

The call subroutine (CALL) instruction allows a specified section of ladder code
(subroutine) to be executed within normal processing when its input conditions

109
become active. Unlike the CJ command, execution of the main ladder program
resumes from the point where the subroutine was called after the subroutine has
been completed. By removing conditionally repeated ladder code from the main
ladder program (executed every scan) and using subroutines instead, the overall
scan time can be shortened, since the subroutine ladder code is only processed
when the CALL instruction is executed.

Subroutines are coded at the end of the PLCs main ladder program. The main
ladder program operations stop at the main program end (FEND) instruction and
the subroutine ladder code is written between the FEND instruction and the END
instruction. Subroutines are referenced by pointer device addresses at the
starting point, and a subroutine return (SRET) instruction at the end of the
subroutine. When the input conditions are active, the CALL instruction executes
the ladder code starting from the specified subroutine pointer until the SRET
instruction is reached. Once the SRET instruction is reached, program execution
returns to the main ladder program and continues from the step after the CALL
instruction was executed.

Access the Section 13.22; Program Flow screen on the GOT. This simulation
shows a side-by-side comparison of the jump (CJ) and call subroutine (CALL)
instructions. This screen is meant to help students visualize the difference in
program flow instructions for further understanding.

110
CHAPTER 14 Diagnostic Devices
The FX series PLC line has a number of dedicated special auxiliary relays and data
registers that store information, including PLC operation error codes.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Identify the most common special auxiliary relays and data registers that
assist in troubleshooting.
o Interpret the information shown by the most common special auxiliary relays
and data registers.
o Write small programs that can provide diagnostic functions.
o Use GX Developer diagnostics to troubleshoot errors.

Materials: FX-TRN-KIT-R Training Manual


FX-TRN-KIT-R Training Kit

14.1 Special M Relays


The special auxiliary relay M8000 and up are reserved for special system related
use. In the FX1S, FX1N, FX2N, and FX2NC PLCs, the range is M8000-M8255.
In the FX3U and FX3UC, the range is M8000-M8511. These special M relays
have various system functions. A complete list of special M relays can be found
in Chapter 36 of the FX3U & FX3UC Programming Manual - Basic & Applied
Instructions Edition or in the GX Developer help menu.

These special M relays can be useful for both programming and troubleshooting.
Some of the commonly used diagnostic special M relays are listed below.

M8004 Indicates that an error has occurred


M8006 Low battery
M8060-M8068 Error detection flags
M8064 Parameter error
M8065 Syntax error
M8066 Program error
M8067-M8068 Operation error (i.e. dividing by 0)

The special relays M8060-M8068 have associated special data registers D8060-
D8068 which hold the error number. These will be covered in the next section.

The following special M relays are not diagnostic relays, but are very useful when
programming (some have been used already in some of the training projects):

M8000 Always ON (PLC RUN)


M8001 Always OFF (PLC STOP)
M8002 Initial Pulse (NO Contact)
M8003 Initial Pulse (NC Contact)
M8011 10ms clock pulse
M8012 100ms clock pulse
M8013 1 second clock pulse
111
Access the Section 14.1; Special M Relays screen on the GOT. A few of the
special auxiliary relays from above are monitored on the GOT.

14.2 Special D Registers

The special data registers D8000 and up are reserved for special system related
use. In the FX1S, FX1N, FX2N, and FX2NC PLCs, the range is D8000-D8255.
In the FX3U and FX3UC, the range is D8000-D8511. These special D registers
have various system functions. A complete list of special D registers can be
found in Chapter 36 of the FX3U & FX3UC Programming Manual - Basic &
Applied Instructions Edition or in the GX Developer help menu.

Some of the commonly used diagnostic special D registers are listed below.

D8004 Address of the first error relay active (i.e. a value of


8064 indicates M8064 is active)
D8006 Low battery fault alarm level
D8010 Present scan time
D8061-D8068 Error codes
D8064 Parameter error code
D8065 Syntax error code
D8066 Program error code
D8067-D8068 Operation error code
D8069 Error step number

The following special D registers are not diagnostic registers, but are very useful
when programming or troubleshooting.

D8001 PLC type and firmware revision


D8005 Battery voltage
D8013-D8019 Real-time clock
D8013 Seconds
D8014 Minutes
D8015 Hours (24 hour format)
D8016 Day
D8017 Month
D8018 Year (2 digits 00-99)
D8019 Day of Week (0-6, Sunday-Saturday)
D8020 Input Filter (0-60 in ms, where 0 = minimum possible
hardware filter, varying by device address)

Access the Section 14.2; Special D Registers screen on the GOT. A few of the
special data registers from above are monitored on the GOT.

112
14.3 Handy Troubleshooting Circuits

The circuit below indicates that the PLC battery voltage is low. The alarm bit
turns on an output which could activate a light, or buzzer, etc.

The circuit blows stores the error code and error step when an error occurs. If
the destination word devices of the circuit have been declared as latched in the
PLC parameters, or if the word devices are in the range D512-D7999, then the
error information will be retained, even during PLC STOP or power loss.

14.4 Real Time Clock Usage

The FX PLCs all have real time clock capability. With the FX2NC, this capability
requires a real time clock enabled memory cassette. The data for the real time
clock is stored in special data registers D8013-D8019 as previously discussed.
There are a variety of instructions which can be used to access the data in the
real time clock, some of which are shown below. For more detail on these
instructions, refer to Chapter 21 of the FX3U & FX3UC Programming Manual -
Basic & Applied Instructions Edition.

If the registers D8013-D8019 are to be modified by commands other than the


ones below, the real time clock must be stopped. To stop the clock, turn ON
special auxiliary relay M8015. When M8015 turns back OFF, the data from
D8013 to D8019 is written to the PLCs internal real time clock. If the clock is not
stopped before adjustment the changes will not take effect.

If display of a 4 digit year is required, ladder code can be written to add 2000 to
the year register D8018, changing the display to 4 digits, but not actually
modifying the year value in the RTC. This needs to be done every time the PLC
switches from STOP to RUN, so it should be triggered by M8002.

TRD Read RTC Data

The time read (TRD) instruction is used to read the PLCs real time clock data
from the special data registers D8013-D8019 into other word devices in the PLC
device memory. The instruction copies all 7 registers to the 7 consecutive
registers following the destination word device.

113
TWR Set RTC Data

The time write (TWR) instruction is used to overwrite the PLCs real time clock
data in special data registers D8013-D8019 range with values from other word
devices in the PLC device memory. The instruction copies 7 consecutive
registers beginning at the source word device to the 7 special D registers which
make up the PLCs real time clock data (D8013-D8019).

TCMP RTC Data Compare

The time compare (TCMP) instruction will compare three arbitrary source word
devices for the hours, minutes, and seconds to 3 consecutive source word
devices for hours, minutes, and seconds data, respectively (note that this order is
opposite from the RTC registers D8013-D8015). The results are written to a
group of 3 bit devices, which can be Y outputs, M relays or S relays. The 3 result
bits represent the consecutive source word device data being less than, equal to,
or greater than the arbitrary source word device data, respectively.

TZCP RTC Data Zone Compare

The time zone compare (TZCP) instruction will compare one set of 3 consecutive
source word devices to two sets of 3 consecutive source word devices which
hold the upper and lower limits of clock data to compare to. The results are
written to a group of 3 bit devices, which can be Y outputs, M relays or S relays.
The 3 result bits represent the set of consecutive source word device data being
less than, equal to, or greater than the clock data range, respectively.

TADD RTC Data Addition


TSUB RTC Data Subtraction

The time addition and time subtraction (TADD and TSUB) instructions are used
to add or subtract two sets of 3 consecutive source word devices of time data
and write the result to a third set of 3 consecutive destination word devices.
These word devices hold hours, minutes, and seconds data, respectively, as with
all of the other time-related instructions.

XCH Exchange

The exchange (XCH) instruction is not directly related to the time-related


instructions, but it may be useful when using them. The XCH instruction
exchanges data between two 16-bit word devices, as in the values of each word
device are swapped and both word devices are overwritten. The 32-bit version
of this instruction DXCH performs the same function with 32-bit word devices.

14.5 EXERCISE Daylight Savings Time


The PLC does not have any built-in option to account for Daylight Savings Time
(DST). Ladder code must be written to control the PLC clock if DST is an issue.
The U.S. standard for Daylight Savings Time is shown below.

First Sunday in April at 2AM, set clock ahead one hour


114
Last Sunday in October at 2AM, set clock back one hour.

Write a PLC ladder program to set the RTC ahead in the spring and back in the
fall. Be careful in the fall that the clock is only set back once!

Once the ladder program has been entered into GX Developer and written to the
PLC in the training kit, access the Section 14.5; Exercise Daylight Savings
Time screen on the GOT. There are many ways of completing this exercise,
some of which may not be able to be easily simulated. The GOT screen
provided allows the student to manually stop the RTC by alternating special
auxiliary relay M8015, adjust the associated RTC data registers, and then start
the RTC again. Please note that D8019, representing the day of the week, can
not be adjusted, as the RTC calculates the day of the week depending on the
other RTC data provided. Also note that any invalid date and time input will
automatically be discarded when M8015 is turned back OFF. This screen is
meant to help students troubleshoot their ladder program for the application
described in this exercise, and show one of the ways that the GOT can be a
convenient and valuable troubleshooting tool.

14.6 GX Developer Diagnostics

Create a new program and enter the rung shown below:

Take a moment to examine the above rung. What happens when X010 is turned
ON? The fixed decimal constant 4 is divided by 0 and the result is stored into
D0-D1. This is an illegal operation, since the result is an infinite number.

Write the program to the PLC in the training kit and turn ON X010.

To troubleshoot, do the following steps:

1. Go to the Diagnostics menu.


2. Select PLC Diagnostics. A window similar to the one below appears:

115
Error Number 6705 is the error that appears in special data register D8067. Step
2 is the step where the error occurs and is stored in D8069. The Operation Error
message refers to Error Code 8067, which is stored in D8004.

3. Highlight the error by clicking on it


4. Press PLC Error in the Help section of the window.
5. The following screen should appear:

This screen explains possible causes of the error state and possible solutions.
While divide by 0 is not explicitly stated here, it can be inferred from the
references to an incompatible device specification (i.e. K0 as the divisor).

14.7 Find/Replace Menu

GX Developer provides several different


methods for locating devices or
instructions. The Find/Replace menu
has a variety of tools for searching or
modifying GX Developer projects. The
find functions will search a program for
all instances of a device, instruction, or
string. The replace functions allows for
the replacement of devices, instructions,
open/closed contacts, and other options.
The Cross reference and used
devices functions will show all instances
of a specified device in a program, or all
the devices used in the program.

Shown to the right is the list of options in


the Find/Replace menu.
116
Find Device is used to find a
specified device address regardless
of the instruction. It will search the
entire program for each instance, one
at a time. There are a couple of
options in this window. The Find
direction options in the bottom left of
the window allow users to specify the
direction and extent of the search.

On the bottom right, there is also a


section called Find option, described below.

None causes the find device function to look specifically for the device
address entered.

Digit allows the find device function to look for a bit device address within
a word of bits. For example, a Digit search for auxiliary relay M110 will
find that it has been used as part of the following TO instruction.

Multiple Words expands the search to include any word device that is
used by a multiple word device instruction. A Multiple word search for
data register D5 will find that it has been used as part of the following
FROM instruction.

Find Instruction is used to find all


instances of a particular instruction, one
at a time. The first combo-box selects
the ladder symbol and the second
comb-box selects the instruction to
search for. The Find direction section
functions as previously discussed.

Find Step Number is used to find a specific step number in the ladder program.
This can be useful with the PLC error diagnostics information previously
discussed to quickly locate errors in the program. Typing step numbers directly
into the number pad on a standard keyboard will
also automatically be input into the Find step
number function.

117
Find Character String is used to find a
text strings within the GX Developer
project. If the active window is the ladder
program window, the function will search
for text strings within the ladder program. If
the comment list is the active window, the
comments will be searched. Other
sections of options apply when used with
comments (Device, Find direction, and
Find target), which modify the search
criteria and methods.

Find Contact or Coil will find instances


the ladder program where the specified
device address is used as either a
contact or a coil. In the first combo-box, select contact or coil, then, in the
combo-box to the right, enter the bit device address. This is useful when a bit
device address has been programmed many times as a contact in the ladder
program but only in one location as a coil.

Replace Device is used to find and


replace a device address or range of
device addresses within the ladder
program. A single device address
can be specified for the Earlier
device and New device. The No.
of substitute points sets how many
consecutive device addresses to
replace. The check box for Move
comments and aliases allows
comments and aliases assigned to a
device address to be replaced with
the device address. The Find
direction section functions as
previously discussed.

118
Device Block Replacement is similar to the Replace Device function but allows
the multiple ranges of device addresses to be replaced all at once. Groups of
timers, counters, inputs, and data registers can all be replaced at once.

Replace Instruction is used to


change one instruction type to another.
The Earlier instruction is the
instruction type to be replaced, and the
New instruction is the instruction type
to replace the Earlier instruction with.
This can be useful when replacing all
instances of INC with INCP in a ladder
program.

Change Open/Close Contact is used


to change all instances of an open
contact to a closed contact for a single
bit device address and vice versa. It is
possible to invert the states of all
instances of the device address at once.
This is useful if the input type provided
to a machine changes or does not
match the ladder code, such as when a
program that uses normally closed stop
signals is used with a machine wired
with normally open switches.

119
Replace Character String is used to
replace text strings. This function is
similar to the Find character string
function previously discussed. The
function searches for instances of the
Earlier character string in the ladder
program, comment list, or device list,
and replaces them with the New
character string.

Change Module Start Address is used


to change the SFM address of a special
function module. The function searches
the program and changes all
occurrences of the SFM address in
instructions such as TO or FROM. By
specifying different values in the Start
and End range, the ladder code for a
range of SFMs can be changed at once.
Enter the Start and End SFM
addresses, and a new starting SFM
address. Instructions using the old SFM
address range will be adjusted to use an
equal sized SFM address range starting
at the New module start address,
either one at a time, or all at once.

Cross Reference Window is used to


launch a window-based version of the
cross reference list data. This
window-based display can be tiled,
cascaded, minimized, or moved
around as other windows in the
workspace. It does not need to be
closed to access other windows.

120
Cross Reference List is used to
launch a pop-up window version of the
cross reference list data. This pop-up
window display will stay on top of all
other windows and must be closed to
access other windows.

List of Used Devices is used to show a list of the devices used in the ladder
program. The list can be configured to show a list for either a single program
(the FX only supports one program per PLC) or all programs in the PLC (in the
case of a Q-Series PLC). A data address is entered in the find device box, and
after pressing the Execute button, a list starting at that specified device address
is displayed. There are two columns which will show an asterisk (*) if the
corresponding data address has been used as an input or output device. Inputs
include source data for applied instructions and outputs include destination
devices of applied instructions. ERR appears in the Unpaired column is if the
device address is used as either an input or output but not both. Depending on
the device address and its use in the program, this is not necessarily an error.

121
14.8 Data Trace

GX Developer provides a troubleshooting tool called a Trace. This tool allows


the programmer to graph the state of values in the PLC over time. This tool is
executed within the PLC, so it is not limited by the communication method
between the PC and PLC.

The FX series PLC supports a data trace of up to 512 samples. Samples can be
based on PLC scans or on an adjustable interval from 10ms to 2000ms, in 10ms
increments. Samples can be triggered from the software or by using a bit or
word device value in the PLC. The data trace function in the FX series PLC can
log up to 10 bit devices and 3 word devices simultaneously.

GX Developer has a built-in wizard to assist in the configuration of the data trace.
Settings can also be defined manually. Once the settings are made, the trace
settings are stored to a file on the PLC which can be read back from the PLC.
The trace results can be uploaded once the data trace has been completed and
also deleted from the PLC.

Once the completed data has been uploaded from the PLC, it can be viewed in
GX Developer or output to a .CSV file which can be viewed or graphed using
Microsoft Excel.

122
CHAPTER 15 Documentation & Printing
When programs are relatively simple, like the ones in this training, and written by the
programmers themselves it is fairly simple to troubleshoot the programs if there are any
problems. However, imagine if a program was 4000 steps and written by someone who
left the company 2 years ago. Without any program documentation, it would be nearly
impossible to troubleshoot the problem. This is why documentation of the program is a
very important step in program creation.

Chapter Objectives: At the conclusion of this chapter, students will be able to

o Describe the 4 types of documentation.


o Add documentation to a program.
o Describe the various options for printing a program

Materials: FX-TRN-KIT-R Training Manual

GX Developer offers 4 types of documentation: Comments, Statements, Notes, and


Aliases (sometimes called Device Labels).

Note: It has been described earlier that it is possible to add and modify devices and
instructions by double-clicking on a rung or device. This function will not work when a
documentation tool has been selected. However, the other methods of adding and
modifying ladder code will still be available.

15.1 Comments
Comments are attached to a device to provide a name or description. Typical
comments for an input device are: Start Push Button, Load Recipe, etc. Typical
comments for a coil or internal bit are: Fault Light, Engine 1 On, and Process
Enabled, etc. Comments can be 4 lines with 8 characters per line, 3 lines with 5
characters per line, or 2 lines with 8 characters per line. This is set in Comment
format item in the View menu.

By default, the only options listed are 4 * 8 characters and 3 * 5 characters.


To enable 2 * 8 characters, go to the Tools menu and select Options. Click on
the Whole data tab, and select 16 from the Common device comment
combo-box. When the Comment format item is accessed again, the options
are now 2 * 8 characters and 3 * 5 characters.

Comments are added by selecting Comment from the Documentation item in


the Edit menu, or by the clicking the Hot Key in the toolbar. After selecting
the comment documentation tool, double clicking on any device in the ladder
program and enter the comment for the device in the dialog box that opens.
Alternatively, in the Project Data List, expand the Device comment item and
double-click on the COMMENT item that appears.
This will open the comment list window, which can
be copied from and pasted to using any spreadsheet
software like Microsoft Excel.

123
Comment Input

Comments are the only form of documentation that can be downloaded to the
PLC. If a program from a PLC that contains comments is uploaded, those
comments will be visible to the new programmer as well. On the other hand,
statements and notes are stored in the GX Developer project file. If another
programmer needs access to these, a softcopy of the original GX Developer
project is required.

Important Note: The PLC will only hold the first 16 characters of each comment.
Any remaining characters in the comment will be truncated.

If the programmer wants to document the program with comments as the ladder
program is being written, it is possible to have the comment dialog box appear
after each instruction is written. Go to the Tools down menu, select Options,
and select the Continues during command write box in the Comment input
section of the Options window. As instructions are entered into the program, GX
Developer will prompt for a comment for each device in the instruction.

Setting comment capacity

To download comments into the PLC, a section of the


PLC program memory must be allotted for them. This
is called the Comments capacity and is set in the
PLC Parameters, in the Memory capacity tab.
Access the PLC Parameters in the Project Data List
by expanding the Parameter item and double-
clicking on the PLC Parameter item that appears.
Comment capacity is allocated as a number of
blocks, each block increasing the comment capacity
by 50 device comments, but decreasing the program
memory by 500 steps. Note that a comment for X000
counts as one device, even if X000 appears 15 times in the program.

124
Allotted number of
comment blocks

Number of comments

Program memory capacity


remaining

Uploading/Downloading comments

Uploading and downloading comments is easy and is done directly in the


Program Upload/Download window. Before uploading or downloading the
program, select the COMMENT box similar to the MAIN box for the ladder
program and the PLC parameter box for the PLC parameters. Then, select
Execute to upload or download the program, parameters, and comments.

125
15.2 Statements
Statements, also known as circuit or rung comments, are used to provide a
description of the purpose for the entire rung. A typical statement would be:
This rung waits until the counter reaches 20 and opens the gate.

Each statement can be up to 64 characters long. Multiple statements can be


attached to a single rung to provide an in-depth description of the rungs purpose.
Statements appear above the rung across the left vertical rail.

Statements are added by selecting Statement from the Documentation item in


the Edit menu, or by the clicking the Hot Key in the toolbar. After selecting
the statement documentation tool, double-click on any part of a rung and enter
the statement for that rung in the dialog box that opens. Or simply press the
semicolon at anytime while the rung is in
Write mode and enter the statement after
the semicolon. Double-click on the
statement again to modify it, or click on the
statement and press the Delete key to
delete it. When multiple statements are
added to the rung, the newer statements
will appear below the older ones.

15.3 Notes
Notes are also referred to as coil comments and appear above the output coil or
applied output instruction of a rung to the right.

Notes can be used for any additional descriptive purpose, but they are intended
to provide information about the output of the rung which it is above. Only one
note can be added to an output coil or instruction, but since multiple output coils
and instructions can be used in one rung, many notes can be added to one rung.
Notes can be up to 32 characters long.

Notes are added by selecting Note from the Documentation item in the Edit
menu, or by the clicking the Hot Key in the toolbar. After selecting the note
documentation tool, double-click on any
output coil or instruction of a rung and enter
the note for that output in the dialog box that
opens. Or simply type a semicolon after the
output coil or instruction and then type
the note in the dialog box that opens.

15.4 Aliases
Aliases are also referred to as device labels and can be displayed in place of the
device address (i.e. VACPUMP instead of Y000). An alias can be no more than
8 characters long with no spaces allowed. Aliases are entered in the Alias
column of the comment list window, previously described.

126
Alias Input

To replace the device addresses with their aliases, while the ladder program
window is active, go to the View menu, and select Alias. All the device
addresses with aliases will have been replaced. Note that it is possible to use
the alias as the device address when entering new instructions; just type an
apostrophe before entering the alias for
the device address required.

15.5 Viewing Documentation


To view GX Developer project documentation, go to the View menu and select
the documentation type to be viewed. It is possible to display comments,
statements, notes, and aliases all at the same time.

15.6 Printing
GX Developer has very flexible printing capabilities. These can be accessed by
clicking the Hot Key in the toolbar, or by selecting Print from the Project
menu. The programmer can choose to print as much or as little of the program
as required. Some of the available printing options are:

1. Title Prints a title page. Title can contain 9 lines of 64 characters.


This automatically includes the printing date.

2. Ladder Prints the Ladder Program. Individual parts of the ladder


program can also be selected for printing.

3. TC setting Prints just the timer and/or counter device information.

4. Device Comments Prints any commented devices and the


associated comments and/or aliases.
127
5. List of Used Devices Prints a list of the devices that are used in the
program. Ranges of devices can also be selected for printing.

6. Device Memory Prints the contents of the Device memory data,


which is typically a reading of all data registers in the PLC. This can
also be written to the PLC to initialize device values.

7. Parameters Prints the specified PLC parameters.

8. Cross reference list Prints all contacts and/or coils used in the
program. Ranges of devices can also be selected for printing.

While each tab can be configured and printed separately, there is an option to
print multiple tabs of data all at once. This is the Multiple printing button at the
bottom of the Print window. This function allows users to select which tabs of
information to print, as well as the order in which to they will be printed. Page
numbers will be continuous through the entire printout.

The Page setup button allows for configuration of the page layout. This
includes margins, headers, footers, page numbers, paper size, and orientation.

128
APPENDIX

129

You might also like