Fx1s Fx1n Fx2n (C) Fx3u Beginner's Manual
Fx1s Fx1n Fx2n (C) Fx3u Beginner's Manual
Fx1s Fx1n Fx2n (C) Fx3u Beginner's Manual
C
O
M
X
3
X
2
X
1
X
0
Y
4
C
O
M
1
Y
3
Y
2
Y
1
Y
0
RUN/STOP switch
Extension bus
(on side)
Battery
compartment
LEDs for indicating
the output status
Protective cover
for expansion bus
Protective cover
Operating status LEDs
2nd interface
for CNV adapter
Memory battery
LEDs for indicating
the input status
Connector for
terminal strips
Battery cover
Installation place for the
FX3U-7DMdisplay
Connection for
programming unit
LEDs for indicating
the output status
Blind cover for
expansion board
LEDs for indicating
the operating status
RUN/STOP switch
Protective cover for
expansion bus
LEDs for indicating
the input status
Top cover
(used if FX3U-7DM
is not installed)
Memory battery
Protective cover
Output terminals
Terminal cover
Protective cover
Terminals for
digital inputs
Terminal cover
2.5.7 PLC components glossary
The following table describes the meaning and functionality of the single components und
parts of a Mitsubishi PLC.
FX Beginners Manual 2 9
Programmable Logic Controllers Controller Design
Component Description
Connection for
expansion
adapter boards
Optional expansion adapter boards can be connected to this interface. A variety of diffe-
rent adapters are available for all FX lines (except the FX2NC). These adapters extend the
capabilities of the controllers with additional functions or communications interfaces. The
adapter boards are plugged directly into the slot.
Connection for pro-
gramming units
This connection can be used for connecting the FX-20P-E hand-held programming unit or
an external PC or notebook with a programming software package (e.g. GX Devel-
oper/FX).
EEPROM
Read/write memory in which the PLC program can be stored and read with the program-
ming software. This solid-state memory retains its contents without power, even in the
event of a power failure, and does not need a battery.
Memory cassette slot
Slot for optional memory cassettes. Inserting a memory cassette disables the controllers
internal memory the controller will then only execute the program stored in the cassette.
Extension bus
Both additional I/O expansion modules and special function modules that add additional
capabilities to the PLC system can be connected here. See Chapter 6 for an overview of
the available modules.
Analog
potentiometers
The analog potentiometers are used for setting analog setpoint values. The setting can be
polled by the PLC program and used for timers, pulse outputs and other functions (see
Section 4.6.1).
Service power supply
The service power supply (not for FX2NC) provides a regulated 24V DC power supply
source for the input signals and the sensors. The capacity of this power supply depends
on the controller model (e.g. FX1S and FX1N: 400mA; FX2N-16M- through
FX2N-32M-: 250 mA, FX2N-48M- through FX2N-64M-: 460 mA)
Digital inputs
The digital inputs are used for inputting control signals from the connected switches, but-
tons or sensors. These inputs can read the values ON (power signal on) and OFF (no
power signal).
Digital outputs
You can connect a variety of different actuators and other devices to these outputs,
depending on the nature of your application and the output type.
LEDs for indicating
the input status
These LEDs show which inputs are currently connected to a power signal, i.e. a defined
voltage. When a signal is applied to an input the corresponding LED lights up, indicating
that the state of the input is ON.
LEDs for indicating
the output status
These LEDs show the current ON/OFF states of the digital outputs. These outputs can
switch a variety of different voltages and currents depending on the model and output
type.
LEDs for indicating
the operating status
The LEDs RUN, POWER and ERROR show the current status of the controller. POWER
shows that the power is switched on, RUN lights up when the PLC program is being exe-
cuted and ERROR lights up when an error or malfunction is registered.
Memory battery
The battery protects the contents of the MELSELC PLCs volatile RAM memory in the
event of a power failure (FX2N, FX2NC and FX3U only). It protects the latched ranges for
timers, counters and relays. In addition to this it also provides power for the integrated
real-time clock when the PLCs power supply is switched off.
RUN/STOP switch
MELSEC PLCs have two operating modes, RUN and STOP. The RUN/STOP switch
allows you to switch between these two modes manually. In RUN mode the PLC executes
the program stored in its memory. In STOP mode program execution is stopped and it is
possible to program the controller.
2 10 MITSUBISHI ELECTRIC
Controller Design Programmable Logic Controllers
3 An Introduction to Programming
A program consists of a sequence of program instructions. These instructions determine the
functionality of the PLC and they are processed sequentially, in the order in which they were
entered by the programmer. To create a PLCprogramyou thus need to analyse the process to
be controlled and break it up into steps that can be represented by instructions. A program
instruction, represented by a line or rung in ladder diagram format, is the smallest unit of a
PLC application program.
3.1 Structure of a Program Instruction
A programinstruction consists of the instruction itself (sometimes referred to as a command)
and one or more (in the case of applied instructions) operands, which in a PLC are references
to devices. Some instructions are entered on their own without specifying any operands
these are the instructions that control program execution in the PLC.
Every instruction you enter is automatically assigned a step number that uniquely identifies its
position in the program. This is important because it is quite possible to enter the same instruc-
tion referring to the same device in several places in the program.
The illustrations belowshowhowprograminstructions are represented in the Ladder Diagram
(LD, left) and Instruction List (IL, right) programming language formats:
The instruction describes what is to be done, i.e. the function you want the controller to per-
form. The operand or device is what you want to performthe function on. Its designation con-
sists of two parts, the device name and the device address:
Examples of devices:
See Chapter 4 for a detailed description of the available devices.
The specific device is identified by its address. For example, since every controller has multiple
inputs you need to specify both the device name and the address in order to read a specific
input.
FX Beginners Manual 3 1
An Introduction to Programming Structure of a Program Instruction
X0
Device
Instruction
AND X0
Device
Instruction
X 0
Device address Device name
Device name Type Function
X Input Input terminal on the PLC (e.g. connected to a switch)
Y Output Output terminal on the PLC (e.g. for a contactor or lamp)
M Relay A buffer memory in the PLC that can have two states, ON or OFF
T Timer A time relay that can be used to program timed functions
C Counter A counter
D Data register
Data storage in the PLC in which you can store things like measured
values and the results of calculations.
3.2 Bits, Bytes and Words
As in all digital technology, the smallest unit of information in a PLCis a bit. Abit can only have
two states: 0 (OFF or FALSE) and 1 (ON or TRUE). PLCs have a number of so-called bit
devices that can only have two states, including inputs, outputs and relays.
The next larger information units are the byte, which consists of 8 bits, and the word, which
consists of two bytes. In the PLCs of the MELSEC FX families the data registers are word
devices, which means that they can store 16-bit values.
Since a data register is 16 bits wide it can store signed values between -32,768 and +32,767
(see Chapter 3.3). When larger values need to be stored two words are combined to form a
32-bit long word, which can store signed values between -2,147,483,648 and +2,147,483,647.
Counters make use of this capability, for example.
3.3 Number Systems
The PLCs of the MELSEC FX family use several different number systems for inputting and
displaying values and for specifying device addresses.
Decimal numbers
The decimal number systemis the systemwe use most commonly in everyday life. It is a posi-
tional base 10 system, in which each digit (position) in a numeral is ten times the value of the
digit to its right. After the count reaches 9 in each position the count in the current position is
returned to 0 and the next position is incremented by 1 to indicate the next decade (9 10, 99
100, 199 1,000 etc).
Base: 10
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
In the MELSEC FX family of PLCs decimal numbers are used for entering constants and the
setpoint values for timers and counters. Device addresses are also entered in decimal format,
with the exception of the addresses of inputs and outputs.
Binary numbers
Like all computers a PLCcan only really distinguish between two states, ON/OFFor 0/1. These
binary states are stored in individual bits. When numbers need to be entered or displayed in
other formats the programming software automatically converts the binary numbers into the
other number systems.
Base: 2
Digits: 0 and 1
3 2 MITSUBISHI ELECTRIC
Bits, Bytes and Words An Introduction to Programming
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 Byte 1 Byte
1 Word
Bit 15 Bit 0
When binary numbers are stored in a word (see above) the value of each digit (position) in the
word is one power of 2 higher than that of the digit to its right. The principle is exactly the same
as in decimal representation, but with increments of 2 instead of 10 (see graphic):
* In binary values bit 15 is used to represent the sign (bit 15=0: positive value, bit 15=1: negative value)
To convert a binary value to a decimal value you just have to multiply each digit with a value of 1
by its corresponding power of 2 and calculate the sum of the results.
Example 00000010 00011001 (binary)
00000010 00011001 (binary) = 1 x 2
9
+ 1 x 2
4
+ 1 x 2
3
+ 1 x 2
0
00000010 00011001 (binary) = 512 + 16 + 8 + 1
00000010 00011001 (binary) = 537 (decimal)
Hexadecimal numbers
Hexadecimal numbers are easier to handle than binary and it is very easy to convert binary
numbers to hexadecimal. This is why hexadecimal numbers are used so often in digital tech-
nology and programmable logic controllers. In the controllers of the MELSEC FX family hexa-
decimal numbers are used for the representation of constants. In the programming manual
and other manuals hexadecimal numbers are always identified with an H after the number to
avoid confusion with decimal numbers (e.g. 12345H).
Base: 16
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F (the letters A, B, C, D, E and F represent the
decimal values 10, 11, 12, 13, 14 and 15)
The hexadecimal system works in the same way as the decimal system you just count to FH
(15) instead of to 9 before resetting to 0 and incrementing the next digit (FH 10H, 1FH 20H,
2FH 30H, FFH 100H etc). The value of digit is a power of 16, rather than a power of 10:
FX Beginners Manual 3 3
An Introduction to Programming Number Systems
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2
0
2
1
2
2
2
3
2
4
2
5
2
6
2
7
2
8
2
9
2
10
2
11
2
12
2
13
2
14
2
15
Base 2 Notation Decimal Value Base 2 Notation Decimal Valuet
2
0
1 2
8
256
2
1
2 2
9
512
2
2
4 2
10
1024
2
3
8 2
11
2048
2
4
16 2
12
4096
2
5
32 2
13
8192
2
6
64 2
14
16384
2
7
128 2
15
32768*
1A7FH
16
0
= 1 (in this example: 15 x 1 = 15)
16
1
= 16 (in this example: 7 x 16 = 112)
16
2
= 256 (in this example: 10 x 256 = 2560)
16
3
= 4096 (in this example: 1 x 4096 = 4096)
6783 (decimal)
The following example illustrates why it is so easy to convert binary values hexadecimal
values:
* Converting the 4-bit blocks to decimal values does not directly produce a value that corresponds to the complete
16-bit binary value! In contrast, the binary value can be converted directly to hexadecimal notation with exactly the
same value as the binary value.
Octal numbers
Inputs X8 and X9 and outputs Y8 and Y9 do not exist on the base units of the MELSECFXfam-
ily. This is because the inputs and outputs of MELSEC PLCs are numbered using the octal
number system, in which the digits 8 and 9 dont exist. Here, the current digit is reset to 0 and
the digit in the next position is incremented after the count reaches 7 (0 7, 10 17, 70 77,
100 107 etc).
Base: 8
Digits: 0, 1, 2, 3, 4, 5, 6, 7
Summary
The following table provides an overview of the four different number systems:
3 4 MITSUBISHI ELECTRIC
Number Systems An Introduction to Programming
Decimal notation Octal notation Hexadecimal notation Binary notation
0 0 0 0000 0000 0000 0000
1 1 1 0000 0000 0000 0001
2 2 2 0000 0000 0000 0010
3 3 3 0000 0000 0000 0011
4 4 4 0000 0000 0000 0100
5 5 5 0000 0000 0000 0101
6 6 6 0000 0000 0000 0110
7 7 7 0000 0000 0000 0111
8 10 8 0000 0000 0000 1000
9 11 9 0000 0000 0000 1001
10 12 A 0000 0000 0000 1010
11 13 B 0000 0000 0000 1011
12 14 C 0000 0000 0000 1100
13 15 D 0000 0000 0000 1101
14 16 E 0000 0000 0000 1110
15 17 F 0000 0000 0000 1111
16 20 10 0000 0000 0001 0000
: : : :
99 143 63 0000 0000 0110 0011
: : : :
1 1 1 1 0 1 1 0 1 0 1 1 0 0 1 1
15 5 11 9
F 5 B 9
Binary
Decimal*
Hexadecimal
3.4 The Basic Instruction Set
The instructions of the PLCs of the MELSEC FX family can be divided into two basic catego-
ries, basic instructions and applied instructions, which are sometimes referred to as applica-
tion instructions.
The functions performed by the basic instructions are comparable to the functions achieved by
the physical wiring of a hard-wired controller. All controllers of the MELSEC FX family support
the instructions in the basic instruction set, but the applied instructions supported vary from
model to model (see Chapter 5).
Basic instruction set quick reference
FX Beginners Manual 3 5
An Introduction to Programming The Basic Instruction Set
Instruction Function Description Reference
LD Load Initial logic operation, polls for signal state 1 (normally open)
Chapter 3.4.1
LDI Load invers Initial logic operation, polls for signal state 0 (normally closed)
OUT Output instruction Assigns the result of a logic operation to a device Chapter 3.4.2
AND Logical AND Logical AND operation, polls for signal state 1
Chapter 3.4.4
ANI AND NOT Logical AND NOT operation, polls for signal state 0
OR Logical OR Logical OR operation, polls for signal state 1
Chapter 3.4.5
ORI OR NOT Logical OR NOT operation, polls for signal state 0"
ANB AND Block
Connects a parallel branch circuit block to the preceding parallel block, in
series.
Chapter 3.4.6
ORB OR Block Connects a serial block of circuits to the preceding serial block, in parallel.
LDP
Pulse signal
instructions
Load Pulse, load on detection of rising edge of device signal pulse
Chapter 3.4.7
LDF Load Falling Pulse, load on falling device signal pulse
ANDP AND Pulse, logical AND on rising device signal pulse
ANDF AND Falling Pulse, logical AND on falling device signal pulse
ORP OR Pulse, logical OR on rising device signal pulse
ORF OR Falling Pulse, logical OR on falling device signal pulse
SET Set device
Assigns a signal state that is retained even if after input condition is no
longer true
Chapter 3.4.8
RST Reset device
MPS
Store, read and delete
intermediate operation
results
Memory Point Store, store an operation result in the stack
Chapter 3.4.9 MRD Memory Read, read a stored operation result from the stack
MPP Memory POP, read a stored operation result and delete it from the stack
PLS
Pulse instructions
Pulse, sets a device for one operation cycle on the rising pulse of the input
condition (input turns ON)
Chapter
3.4.10
PLF
Pulse Falling, sets a device* for one operation cycle on the falling pulse of
the input condition (input turns OFF)
MC Master Control
Instructions for activating or deactivating the execution of defined parts of
the program
Chapter
3.4.11
MCR Master Control Reset
INV Invert Inverts the result of an operation
Chapter
3.4.12
3.4.1 Starting logic operations
A circuit in a programalways begins with an LD- or LDI instruction. These instructions can be
performed on inputs, relays, timers and counters.
For examples of using these instructions see the description of the OUT instruction in the next
section.
3.4.2 Outputting the result of a logic operation
The OUT instruction can be used to terminate a circuit. You can also programcircuits that use
multiple OUT instructions as their result. This is not necessarily the end of the program, how-
ever. The device set with the result of the operation using OUT can then be used as an input
signal state in subsequent steps of the program.
Example (LD and OUT instructions)
These two instructions result in the following signal sequence:
3 6 MITSUBISHI ELECTRIC
The Basic Instruction Set An Introduction to Programming
Instruction Function Symbol GX Developer FX
OUT
Output instruction, assigns the result of
an operation to a device
X000
0 Y000
Ladder Diagram Instruction List
0 LD X000
1 OUT Y000
Y0
X0
OFF
ON
OFF
ON
t
(0)
(1)
(0)
(1)
The condition of the LD instruction (poll for signal state 1) is true so the result of the
operation is also true (1) and the output is set.
F5
F6
F7
Instruction Function Symbol GX Developer FX
LD
Load instruction, starts a logic operation
and polls the specified device for signal
state 1
LDI
Load instruction, starts a logic operation
and polls the specified device for signal
state 0
Example (LDI and OUT instructions)
Double assignment of relays or outputs
Never assign the result of an operation to the same device in more than one place in the
program!
FX Beginners Manual 3 7
An Introduction to Programming The Basic Instruction Set
X005
X003
M10
X004
X001
You can solve this problem
with modification shown on
the right. This takes all the
required input conditions
into account and sets the
result correctly.
X000
0 Y000
Ladder Diagram Instruction List
0 LDI X000
1 OUT Y000
Y0
X0
t
(0)
(1)
(0)
(1)
OFF
ON
OFF
ON
The condition of the LDI instruction (poll for signal state 0) is no
longer true so the output is reset.
X005
X003
M10
M10
X004
X001
The program is executed
sequentially from top to bot-
tom, so in this example the
second assignment of M10
would simply overwrite the
result of the first assign-
ment.
3.4.3 Using switches and sensors
Before we continue with the description of the rest of the instructions we should first describe
how signals from switches, sensors and so on can be used in your programs.
PLC programs need to be able respond to signals fromswitches, buttons and sensors to per-
formthe correct functions. It is important to understand that programinstructions can only poll
the binary signal state of the specified input irrespective of the type of input and how it is
controlled.
Usually, switches with make contacts are used. Sometimes, however, break contacts are used
for safety reasons for example for switching off drives (see section 3.5).
The illustration below shows two program sequences in which the result is exactly the same,
even though different switch types are used: When the switch is operated the output is set
(switched on).
3 8 MITSUBISHI ELECTRIC
The Basic Instruction Set An Introduction to Programming
Y000
X000
0
24 V
X0
Y0
X0
OFF
ON
OFF
ON
t
Y000
X000
0
24 V
X0
Y0
X0
OFF
ON
OFF
ON
t
LD X000
OUT Y000
OUT Y000
LDI X000
Schalter bettigt
Schalter bettigt
Make
contact
When a make contact is ope-
rated the input is set (ON, sig-
nal state 1)
Break
contact
When a break contact is ope-
rated the input is reset (OFF,
signal state 0)
As you can imagine, this means that when
you are writing your program you need to be
aware whether the element connected to the
input of your PLCis a make or a break device.
An input connected to a make device must be
treated differently to an input connected to a
break device. The following example illustra-
tes this.
3.4.4 AND operations
Note that the programming software uses the same icons and function keys for the AND and
ANI instructions as for the LD and LDI instructions. When you programin Ladder Diagramfor-
mat the software automatically assigns the correct instructions on the basis of the insertion
position.
When you program in Instruction List format remember that you cant use the AND and ANI
instructions at the beginning of circuit (a programline in ladder diagramformat)! Circuits must
begin with an LD or LDI instruction (see Chapter 3.4.1).
Example of an AND instruction
In the example output Y0 is only switched on when inputs X0 and X1 are both on:
FX Beginners Manual 3 9
An Introduction to Programming The Basic Instruction Set
Instruction Function Symbol GX Developer FX
AND
Logical AND (AND operation with poll for
signal state 1 or ON)
ANI
Logical AND NOT (AND operation with
poll for signal state 0 or OFF)
An AND operation is logically the same as a
serial connection of two or more switches in
an electrical circuit. Current will only flow if all
the switches are closed. If one or more of the
switches are open no current flows the AND
condition is false.
X000
0
X001
Y000
Ladder Diagram Instruction List
0 LD X000
1 AND X001
2 OUT Y000
AND instruction
Y0
X0
OFF
ON
t
(0)
(1)
(0)
(1)
X1
(0)
(1)
OFF
ON
OFF
ON
F5
F6
Example of an ANI instruction
In the example output Y0 is only switched on when input X0 is on and input X1 is off:
3 10 MITSUBISHI ELECTRIC
The Basic Instruction Set An Introduction to Programming
Y0
X0
t
(0)
(1)
(0)
(1)
X1
(0)
(1)
OFF
ON
OFF
ON
OFF
ON
X000
0
X001
Y000
0 LD X000
1 ANI X001
2 OUT Y000
Instruction List Ladder Diagram
ANI instruction
3.4.5 OR operations
Example of an OR instruction
In the example output Y0 is switched on when either input X0 or input X1 is on:
FX Beginners Manual 3 11
An Introduction to Programming The Basic Instruction Set
Instruction Function Symbol GX Developer FX
OR
Logical OR (OR operation with poll for
signal state 1 or ON)
ORI
Logical OR NOT (OR operation with poll
for signal state 0 or OFF)
An OR operation is logically the same as the
parallel connection of multiple switches in an
electrical circuit. As soon as any of the
switches is closed current will flow. Current will
only stop flowing when all the switches are
open.
X000
0
X001
Y000
0 LD X000
1 OR X001
2 OUT Y000
Instruction List Ladder Diagram
OR instruction
Y0
X0
t
(0)
(1)
(0)
(1)
X1
(0)
(1)
OFF
ON
OFF
ON
OFF
ON
F5
F6
Example of an ORI instruction
In the example output Y0 is switched on when either input X0 is on or input X1 is off:
3.4.6 Instructions for connecting operation blocks
Although ANB- and ORBare PLCinstructions they are only displayed and entered as connect-
ing lines in the Ladder Diagramdisplay. They are only shown as instructions in Instruction List
format, where you must enter them with their acronyms ANB and ORB.
Both instructions are entered without devices and can be used as often as you like in a pro-
gram. However, the maximumnumber of LDand LDI instructions is restricted to 8, which effec-
tively also limits the number of ORB or ANB instructions you can use before an output instruc-
tion to 8 as well.
3 12 MITSUBISHI ELECTRIC
The Basic Instruction Set An Introduction to Programming
Y0
X0
t
(0)
(1)
(0)
(1)
X1
(0)
(1)
OFF
ON
OFF
ON
OFF
ON
Instruction Function Symbol GX Developer FX
ANB
AND Block (serial connection of blocks of
parallel operations/circuits)
ORB
OR Block (parallel connection of blocks
of serial operations/circuits)
F9
X000
0
X001
Y000
0 LD X000
1 ORI X001
2 OUT Y000
Instruction List Ladder Diagram
ORI instruction
Example of an ANB instruction
In this example output Y07 is switched on if input X00 is 1, or if relay M2 is 0 and input X01 is
0, or if relay M10 is 1.
Example of an ORB instruction
In this example output Y07 is switched on if input X00 is 1 and input X01 is 0, or if relay M2 is
0 and relay M10 is 1.
FX Beginners Manual 3 13
An Introduction to Programming The Basic Instruction Set
Y007
X000
0
M2
X001
M10
0 LD X000
1 ORI M2
2 LDI X001
3 OR M10
4 ANB
5 OUT Y007
Instruction List
Ladder Diagram
ANB instruction
1
st
parallel connection (OR operation)
2
nd
parallel connection (OR operation)
ANB instruction connecting both OR operations
Y007
X000
0
M2
X001
M10
0 LD X000
1 ANI X001
2 LDI M2
3 AND M10
4 ORB
5 OUT Y007
Instruction List
Ladder Diagram
ORB instruction
1
st
serial connection (AND operation)
2
nd
serial connection (AND operation)
ORB instruction connecting both AND operations
3.4.7 Pulse-triggered execution of operations
In PLC programs you will often need to detect and respond to the rising or falling edge of a bit
devices switching signal. A rising edge indicates a switch of the device value from0 to 1, a
falling edge indicates a switch from 1 to 0.
During program execution operations that respond to rising and falling pulses only deliver a
value of 1 when the signal state of the referenced device changes.
When do you need to use this? For example, suppose you have a conveyor belt with a sensor
switch that activates to increment a counter every time a package passes it on the belt. If you
dont use a pulse-triggered function you will get incorrect results because the counter will
increment by 1 in every programcycle in which the switch registers as set. If you only register
the rising pulse of the switch signal the counter will be incremented correctly, increasing by 1
for each package.
Note Most applied instructions can also be executed by pulse signals. For details see chapter . 5).
Evaluating a rising signal pulse
3 14 MITSUBISHI ELECTRIC
The Basic Instruction Set An Introduction to Programming
Instruction Function Symbol GX Developer FX
LDP
Load Pulse, loads on the rising edge of
the devices signal
LDF
Load Falling Pulse, loads on the falling
edge of the devices signal
ANDP
AND Pulse, logical AND operation on the
rising edge of the devices signal
ANDF
AND Falling Pulse, logical AND operation
on the falling edge of the devices signal
ORP
OR Pulse, logical OR operation on the
rising edge of the devices signal
ORF
OR Falling Pulse, logical OR operation
on the falling edge of the devices signal
M0
X001
0
Ladder Diagram Instruction List
0 LDP X001
1 OUT M0
M0
X1
OFF
ON
t
(0)
(1)
0
1
Relay M0 is only switched on for the duration of a single
program cycle
Evaluating a falling signal pulse
With the exception of the pulse trigger characteristic the functions of the LDP, LDF, ANDP,
ANDF, ORP and ORF instructions are identical to those of the LD, AND and OR instructions.
This means that you can use pulse-trigger operations in your programs in exactly the same
way as the conventional versions.
3.4.8 Setting and resetting devices
The SET instruction can be used to set outputs (Y), relays (M) and state relays (S).
The RST instruction can be used to reset outputs (Y), relays (M), state relays (S), timers (T), counters (C) and re-
gisters (D, V, Z).
The signal state of an OUT instruction will normally only remain 1 as long as the result of the
operation connected to the OUT instruction evaluates to 1. For example, if you connect a
pushbutton to an input and a lamp to the corresponding output and connect them with an LD
and an OUT instruction the lamp will only remain on while the button remains pressed.
The SET instruction can be used to use a brief switching pulse to switch an output or relay on
(set) and leave themon. The device will then remain on until you switch it off (reset) with a RST
instruction. This enables you to implement latched functions or switch drives on and off with
pushbuttons. (Outputs are generally also switched off when the PLC is stopped or the power
supply is turned off. However, some relays also retain their last signal state under these condi-
tions for example a set relay would then remain set.)
To enter a SET or RST instruction in Ladder Diagramformat just click on the icon shown in the
table above in GX Developer, or press the F8 key. Then enter the instruction and the name of
the device you want to set or reset, for example SET Y1.
FX Beginners Manual 3 15
An Introduction to Programming The Basic Instruction Set
M374
M235 X010
0
Ladder Diagram Instruction List
0 LD M235
1 ANDF X010
2 OUT M374
M374
M235
t
0
1
0
1
X10
OFF
ON
(0)
(1)
If X10 is off (0) and M235 is on (1) relay M374 is switched on for the
duration of a single program cycle.
Instruction Function Symbol GX Developer FX
SET
Set a device
,
(assign signal state 1)
SET
RST
Reset a device
,
(assign signal state 0)
RST
F8
F8
This example is a program for controlling a pump to fill a container. The pump is controlled
manually with two pushbuttons, ONand OFF. For safety reasons a break contact is used for the
OFF function. When the container is full a level sensor automatically switches the pump off.
3 16 MITSUBISHI ELECTRIC
The Basic Instruction Set An Introduction to Programming
X001
X003
X002
RST Y000
SET Y000 0
2
Ladder Diagram Instruction List
0 LD X001
1 SET Y000
2 LDI X002
3 OR X003
4 RST Y000
Pump
ON
Pump
OFF
Level
sensor
Pump
Pump
X2
X1
M0
t
If the set and reset instructions for the same
device both evaluate to 1 the last operation
performed has priority. In this example that
is the RST instruction, and so M0 remains
off.
X001
X002
SET M0
RST M0
0
2
Ladder Diagram Instruction List
0 LD X001
1 SET M0
2 LD X002
3 RST M0
3.4.9 Storing, reading and deleting operation results
The MPS, MRD and MPP instructions are used to store the results of operations and interme-
diate values in a memory called the stack, and to read and delete the stored results. These
instructions make it possible to programmulti-level operations, which makes programs easier
to read and manage.
When you enter programs in Ladder Diagramformat these instructions are inserted automati-
cally by the programming software. The MPS, MRD and MPP instructions are only actually
shown when you display your programin Instruction List format, and they must also be entered
manually when you program in this format.
To make the advantage of these instructions clearer the example below shows the same pro-
gram sequence programmed without MPS, MRD and MPP:
When you use this approach you must program the devices (X0 in this example) repeatedly.
This results in more programming work, which can make quite a difference in longer programs
and complex circuit constructions.
In the last output instruction you must use MPPinstead of MRDto delete the stack. You can use
multiple MPS instructions to create operations with up to 11 levels. For more examples of how
to use the MPS, MRDand MPPinstructions see the Programming Manual for the FXFamily.
FX Beginners Manual 3 17
An Introduction to Programming The Basic Instruction Set
Instruction Function Symbol GX Developer FX
MPS
Memory Point Store, stores the result of
an operation
MRD
Memory Read, reads a stored operation
result
MPP
Memory POP, reads a stored operation
result and deletes it
X000 X001
X003
X002
Y000
Y002
Y001
0
Ladder Diagram Instruction List
0 LD X000
1 MPS
2 AND X001
3 OUT Y000
4 MRD
5 AND X002
6 OUT Y001
7 MPP
8 AND X003
9 OUT Y002
MPS
MRD
MPP
X000 X001
X000 X003
X000 X002
Y000
Y001
Y002
0
3
6
Ladder Diagram
0 LD X000
1 AND X001
2 OUT Y000
3 LD X000
4 AND X002
5 OUT Y001
6 LD X000
7 AND X003
8 OUT Y002
Instruction List
3.4.10 Generating pulses
* PLC and PLF instructions can be used to set outputs (Y) and relays (M).
These instructions effectively convert a static signal into a brief pulse, the duration of which
depends on the length of the programcycle. If you use PLS instead of an OUT instruction the
signal state of the specified device will only be set to 1 for a single programcycle, specifically
during the cycle in which the signal state of the device before the PLS instruction in the circuit
switches from 0 to 1 (rising edge pulse).
The PLF instruction responds to a falling edge pulse and sets the specified device to 1 for a
single program cycle, during the cycle in which the signal state of the device before the PLF
instruction in the circuit switches from 1 to 0 (falling edge pulse).
To enter a PLS or PLF instruction in Ladder Diagramformat click in the GX Developer toolbar
on the tool icon shown above or press F8. Then enter the instruction and the corresponding
device to be set in the dialog, e.g. PLS Y2.
3 18 MITSUBISHI ELECTRIC
The Basic Instruction Set An Introduction to Programming
Instruction Function Symbol GX Developer FX
PLS
Pulse, sets an device* for the duration of
a single program cycle on the rising edge
of the switching pulse of the input condi-
tion / device
PLS
PLF
Pulse Falling, sets a device* for the dura-
tion of a single program cycle on the fal-
ling edge of the switching pulse of the
input condition / device
PLF
X000
X001
M0
M1
PLS M0
PLF M1
SET Y000
RST Y000
0
2
4
6
Ladder Diagram Instruction List
0 LD X000
1 PLS M0
2 LD M0
3 SET Y000
4 LD X001
5 PLF M1
6 LD M1
7 RST Y000
F8
F8
M1
X1
M0
Y0
X0
t
The rising edge of the device X0
signal triggers the function.
Relays M0 and M1 are only
switched on for the duration of a
single program cycle.
In the case of device X1 the falling
edge of the signal is the trigger.
3.4.11 Master control function (MC and MCR instructions)
The MC instruction can be used on outputs (Y) and relays (M). n: N0 through N7
n: N0 through N7
The Master Control Set (MC) and Reset (MCR) instructions can be used to set conditions on
the basis of which individual program blocks can be activated or deactivated. In Ladder Dia-
gram format a Master Control instruction functions like a switch in the left-hand bus bar that
must be closed for the following program block to be executed.
In the example above the program lines between the MC and MCR instructions are only exe-
cuted when input X001 is on.
The section of the program to be executed can be specified with the nesting address N0
through N7, which allows you to enter multiple MCinstructions before the closing MCRinstruc-
tion. (See the FXProgramming Manual for an example of nesting.) Addressing a Yor Mdevice
specifies a make contact. This contact activates the programsection when the input condition
for the MC instruction evaluates true.
FX Beginners Manual 3 19
An Introduction to Programming The Basic Instruction Set
Instruction Function Symbol GX Developer FX
MC
Master Control, sets a master control
condition, marking the beginning of a
program block
MC n
MCR
Master Control Reset, resets a master
control condition, marking the end of a
program block
MCR n
F8
X002
X001
X003
N0
MC N0 M10
MCR N0
Y003
Y004
0
4
6
8
M10
X002
M155
10
X004
Ladder Diagram
Instruction List
0 LD X001
1 MC N0 M10
4 LD X002
5 OUT Y003
6 LD X003
7 OUT Y004
8 MCR N0
10 LD X002
11 AND X004
12 OUT M155
The switch does not have to
be programmed manually and
it is only actually displayed
during program execution in
Monitor mode.
F8
If the input condition of the MCinstruction evaluates false the states of the devices between the
MC and MCR instructions change as follows:
Latched timers and counters and devices that are controlled with SET an RST instructions
retain their current state.
Unlatched timers and devices that are controlled with OUT instructions are reset.
(See chapter 4 for details on these timers and counters.)
3.4.12 Inverting the result of an operation
The INV instruction is used on its own without any operands. It inverts the result of the opera-
tion that comes directly before it:
If the operation result was 1 it is inverted to 0
If the operation result was 0 it is inverted to 1.
The above example produces the following signal sequence:
The INV instruction can be used when you need to invert the result of a complex operation. It
can be used in the same position as the AND and ANI instructions.
The INV instruction cannot be used at the beginning of an operation (circuit) like an LD, LDI,
LDP or LDF instruction.
3 20 MITSUBISHI ELECTRIC
The Basic Instruction Set An Introduction to Programming
Instruction Function Symbol GX Developer FX
INV Invert, reverses the result of an operation
Y000
X001 X002
0
Ladder Diagram Instruction List
0 LD X001
1 AND X002
2 INV
3 OUT Y000
INV instruction
Y000
X001
t
0
1
0
1
X002
0
1
0
1
Operation result before the
INV instruction
Operation result after the
INV instruction
3.5 Safety First!
PLCs have many advantages over hard-wired controllers. However, when it comes to safety it
is important to understand that you cannot trust a PLC blindly.
Emergency STOP devices
It is essential to ensure that errors in the control systemor programcannot cause hazards for
staff or machines. Emergency STOP devices must remain fully functional even when the PLC
is not working properly for example to switch off the power to the PLCoutputs if necessary.
Never implement an Emergency STOPswitch solely as an input that is processed by the PLC,
with the PLC program activating the shutdown. This would be much too risky.
Safety precautions for cable breaks
You must also take steps to ensure safety in the event that the transmission of signals fromthe
switches to the PLCare interrupted by cable breaks. When switching equipment on and off via
the PLC always use switches or pushbuttons with make contacts for switching on and with
break contacts for switching off.
This ensures that if there is a cable break the drive is switched off automatically and it is not
possible to activate the drive. In addition to this, switching off has priority because it is pro-
cessed by the program after the switch on instruction.
Interlock contacts
If you have two outputs that should never both be switched on at the same time for example
outputs for selecting forward or reverse operation for a motor the interlock for the outputs
must also be implemented with physical contacts in the contactors controlled by the PLC. This
is necessary because only an internal interlock is possible in the program and an error in the
PLC could cause both outputs to be activated at the same time.
FX Beginners Manual 3 21
An Introduction to Programming Safety First!
EMERG.
OFF
0 V
+24 V
ON OFF
X000 X001
COM Y000
X002
Y001
In this example the contactor for a drive sys-
tem can also be switched off manually with
an Emergency OFF switch.
Motor ON
Motor OFF
Motor ON
Motor ON
X001
X002
RST Y000
SET Y000 0
2
In the program for this installation the make
contact of the ON switch is polled with an LD
instruction, the break contact of the OFF
switch with an LDI instruction. The output,
and thus also the drive, is switched off when
the input X002 has a signal state of 0. This
is the case when the OFF switch is operated
or when the connection between the switch
and input X002 is interrupted.
Automatic shutdown
When a PLC is used to control motion sequences in which hazards can arise when compo-
nents move past certain points additional limit switches must be installed to interrupt the move-
ment automatically. These switches must function directly and independently of the PLC. See
Chapter 3.6.2 for an example of such an automatic shutdown facility.
Output signal feedback
Generally, the outputs of PLCs are not monitored. When an output is activated the program
assumes that the correct response has taken place outside the PLC. In most cases no addi-
tional facilities are required. However, in critical applications you should also monitor the out-
put signals with the PLC for example when errors in the output circuit (wire breaks, seized
contacts) could have serious consequences for safety or system functioning.
3 22 MITSUBISHI ELECTRIC
Safety First! An Introduction to Programming
X000 X001
COM Y000
X002
Y001
In the example on the right a make contact in
contactor K1 switches input X002 on when out-
put Y000 is switched on. This allows the pro-
gram to monitor whether the output and the
connected contactor are functioning properly.
Note that this simple solution does not check
whether the switched equipment is functioning
properly (for example if a motor is really turn-
ing). Additional functions would be necessary
to check this, for example a speed sensor or a
voltage load monitor.
+24 V
K1
K2
K1 K2
K1
X000 X001
COM Y000
X002
Y001
The example on the right shows such an inter-
lock with contactor contacts. Here it is physi-
cally impossible for contactors K1 and K2 to be
switched on at the same time.
3.6 Programming PLC Applications
Programmable logic controllers provide an almost unlimited number of ways to link inputs with
outputs. Your task is to choose the right instructions from the many supported by the control-
lers of the MELSEC FX family to program a suitable solution for your application.
This chapter provides two simple examples that demonstrate the development of a PLCappli-
cation from the definition of the task to the finished program,.
3.6.1 An alarm system
The first step is to have a clear concept of what you want to do. This means that you need to
take a bottom-up approach and write a clear description of what it is you want the PLCto do.
Task description
The objective is to create an alarmsystemwith several alarmcircuits and a delay function for
arming and disarming the system.
The system will be armed with a key switch, with a 20-second delay between turning the
switch and activation. This provides enough time for the user to leave the house without
tripping the alarm. During this delay period a display will show whether the alarm circuits
are closed.
An alarm will be triggered when one of the circuits is interrupted (closed-circuit system,
also triggers an alarm when a circuit is sabotaged). In addition to this we want to show
which circuit triggered the alarm.
When an alarmis triggered a siren and a blinking alarmlamp are activated after a delay of
10 seconds. (The acoustic and visual alarms are activated after a delay to make it possible
to disarm the system after entering the house. This is also why we want to use a special
lamp to show that the system is armed.)
The siren will only be sounded for 30 seconds, but the alarm lamp will remain activated
until the system is disarmed.
A key-operated switch will also be used to deactivate the alarm system.
Assignment of the input and output signals
The next step is to define the input and output signals we need to process. On the basis of the
specifications we know that we are going to need 1 key-operated switch and 4 alarmlamps. In
addition to this we need at least 3 inputs for the alarmcircuits and 2 outputs for the siren and the
blinking alarmlamp. This makes a total of 4 inputs and 6 outputs. Then we assign these signals
to the inputs and outputs of the PLC:
FX Beginners Manual 3 23
An Introduction to Programming Programming PLC Applications
Function Name Adress Remarks
Input
Arm system S1 X1 Make contact (key-operated switch)
Alarm circuit 1 S11, S12 X2
Break contacts (an alarm is triggered
when the input has the signal state 0)
Alarm circuit 2 S21, S22 X3
Alarm circuit 3 S31, S32 X4
Output
Display system armed H0 Y0
The outputs functions are activated when
the corresponding outputs are switched
on (set). For example, if Y1 is set the
acoustic alarm will sound.
Acoustic alarm (siren) E1 Y1
Optical alarm (rotating beacon) H1 Y2
Alarm circuit 1 display H2 Y3
Alarm circuit 2 display H3 Y4
Alarm circuit 3 display H4 Y5
Programming
Now we can start writing the program. Whether relay devices are going to be needed and if so
howmany usually only becomes clear once you actually start programming. What is certain in
this project is that we are going to need three timers for important functions. If we were using a
hard-wired controller we would use timer relays for this. In a PLCyou have programmable elec-
tronic timers (see section 4.3). These timers can also be defined before we start programming:
Next we can program the individual control tasks:
b Delayed arming of the alarm system
When the key-operated switch is turned to ON the delay implemented with timer T0 starts to
run. After 20 seconds (K200 = 200 x 0.1s = 20s) the indicator lamp connected to output Y000
lights up, indicating that the system is armed.
b Monitor alarm circuits and trigger alarm signal
Output Y000 is polled in this routine to check whether the alarm system is armed. You could
also use a relay here that would then be set and reset together with Y000. An interruption of an
alarmcircuit will only set relay M1 (indicating that an alarmhas been triggered) if the alarmsys-
temis actually armed. In addition to this outputs Y003 through Y005 are used to indicate which
alarm circuit triggered the alarm. Relay M1 and the corresponding alarm circuit output will
remain set even when the alarm circuit is closed again.
3 24 MITSUBISHI ELECTRIC
Programming PLC Applications An Introduction to Programming
Function Adress Remarks
Timer
Arming delay T0 Time: 20 seconds
Alarm triggering delay T1 Time: 10 seconds
Siren activation duration T2 Time: 30 seconds
0
4
T0
Y000
K200
X001
T0
Ladder Diagram Instruction List
0 LD X001
1 OUT T0 K200
4 LD T0
5 OUT Y000
X002
X003
X004
Y000
Y000
Y000
6
10
14
M1
M1
Y003
Y004
M1
SET
SET
SET
SET
SET
SET Y005
Ladder Diagram Instruction List
6 LDI X002
7 AND Y000
8 SET M1
9 SET Y003
10 LDI X003
11 AND Y000
12 SET M1
13 SET Y004
14 LDI X004
15 AND Y000
16 SET M1
17 SET Y005
b Alarm activation delay
When an alarmis triggered (M1 switches to 1) the 10s delay timer starts. After the 10 seconds
T1 then starts timer T2, which is set to 30 seconds, and the siren activation time begins.
b Alarm display (switch on siren and rotating beacon)
The siren is activated after the 10s activation delay (T1) and remains on while timer T2 is run-
ning. After the end of the 30s activation period (T2) the siren deactivates. The rotating beacon
is also switched on after the 10s delay. The following illustration shows the signal sequence
generated by this section of the program:
FX Beginners Manual 3 25
An Introduction to Programming Programming PLC Applications
T2 T1
T1
26
29
Y001
Y002
Ladder Diagram Instruction List
26 LD T1
27 ANI T2
28 OUT Y001
29 LD T1
30 OUT Y002
T2
T1
Y1
M1
10 s
t
OFF
ON
0
1
0
1
30 s
0
1
Y2
OFF
ON
M1
T1
18
22
T1
T2
K100
K300
Ladder Diagram Instruction List
18 LD M1
19 OUT T1 K100
22 LD T1
23 OUT T2 K300
b Resetting all outputs and the relay
When the alarmsystemis switched off with the key-operated switch all the outputs used by the
program and the relay M1 are all reset. If an alarm was triggered the interrupted alarm circuit
which was released until the system was switched off is displayed.
3 26 MITSUBISHI ELECTRIC
Programming PLC Applications An Introduction to Programming
X001
31 Y000
Y001
Y002
Y003
Y004
Y005
M1
RST
RST
RST
RST
RST
RST
RST
Ladder Diagram Instruction List
31 LDI X001
32 RST Y000
33 RST Y001
34 RST Y002
35 RST Y003
36 RST Y004
37 RST Y005
38 RST M1
Connection of the PLC
The sketch below shows how easy it is to implement this alarm system with a PLC of the FX
family. The example shows a FX1N-14MR.
FX Beginners Manual 3 27
An Introduction to Programming Programming PLC Applications
S1
S/S 0 V
N
PE
H1 H2 H3 H4 H0 E1
L1
S21 S11 S31
S32 S22 S12
MITSUBISHI
POWER
RUN
ERROR
FX -14MR 1S
0 1 2 3
4 5 6 7
0 1 2 3
4 5
IN
100-240
VAC
14MR
-ES/UL
L N
S/S
X0
X1
X2
X3
X4
X5
X6
X7
OUT
24V COM0
Y0 0V
COM1
Y1
COM2
Y2
Y3
Y4
Y5
3.6.2 A rolling shutter gate
Task description
We want to implement a control system for a warehouses rolling shutter gate that will enable
easy operation from both outside and inside. Safety facilities must also be integrated in the
system.
b Operation
It must be possible to open the gate fromoutside with the key-operated switch S1 and to
close it with pushbutton S5. Inside the hall it should be possible to open the gate with
pushbutton S2 and to close it with S4.
An additional time switch must close the gate automatically if it is open for longer than
20 s.
The states gate in motion and gate in undefined position must be indicated by a blin-
king warning lamp.
b Safety facilities
A stop button (S0) must be installed that can halt the motion of the gate immediately at any
time, stopping the gate in its current position. This Stop switch is not an Emergency OFF
function, however! The switch signal is only processed by the PLCand does not switch any
external power connections.
Aphotoelectric barrier (S7) must be installed to identify obstacles in the gateway. If it regis-
ters an obstacle while the gate is closing the gate must open automatically.
Two limit switches must be installed to stop the gate motor when the gate reaches the fully
open (S3) and fully closed (S6) positions.
3 28 MITSUBISHI ELECTRIC
Programming PLC Applications An Introduction to Programming
STOP
S1
Warning lamp H1
S5
S3
S6
S7
S0 S2 S4
Assignment of the input and output signals
The task description clearly defines the number of inputs and outputs needed. The gate drive
motor is controlled with two outputs. The signals required are assigned to the PLC inputs and
outputs as follows:
The program components
b Operation of the rolling shutter gate with the pushbuttons
The programmust convert the input signals for the operation of the gate into two commands for
the drive motor: Open Gate and Close Gate. Since these are signals frompushbuttons that
are only available briefly at the inputs they need to be stored. To do this we use two relays to
represent the inputs in the program and set and reset them as required:
M1: open gate
M2: close gate
The signals for opening the gate are processed first: When key-operated switch S1 or button
S2 are operated a signal is generated and M001 is set to a signal state of 1 for just one pro-
FX Beginners Manual 3 29
An Introduction to Programming Programming PLC Applications
Function Name Adress Remarks
Inputs
STOP button S0 X0
Break contact (when the switch is opera-
ted X0 = 0 and the gate stops)
OPEN key-operated switch
(outside)
S1 X1
Make contacts
OPEN button (inside) S2 X2
Upper limit switch (gate open) S3 X3
Break contact (X2 =0 when the gate is
up and S3 is activated)
CLOSE button (inside) S4 X4
Make contacts
CLOSE button (outside) S5 X5
Lower limit switch (gate closed) S6 X6
Break contact (X6 = 0 when the gate is
down and S6 is activated)
Photoelectric barrier S7 X7
X7 is set to 1 when an obstacle is regis-
tered
Outputs
Warning lamp H1 Y0
Motor contactor (motor reverse) K1 Y1 Reverse = OPEN gate
Motor contactor (motor forward) K2 Y2 Forward = CLOSE gate
Timer Delay for automatic close T0 Time: 20 seconds
PLS
SET
SET
PLS
M100
M1
M2
M200
X001
0
4
7
11
M100
M200
X004
M2
M1
X002
X005
Ladder Diagram Instruction List
0 LD X001
1 OR X002
2 PLS M100
4 LD M100
5 ANI M2
6 SET M1
7 LD X004
8 OR X005
9 PLS M200
11 LD M200
12 ANI M1
13 SET M2
gramcycle. This ensures that the gate cannot be blocked if the button sticks or of the operator
does not release it.
It must be ensured that the drive can only be switched on when it is not already turning in the
opposite direction. This is implemented by programming the PLC so that M1 can only be set
when M2 is not set.
NOTE The motor direction interlock must also be complemented by an additional interlock with
physical contactors outside the PLC (see wiring diagram).
A similar approach is used to process the signals frombuttons S4 and S5 for closing the gate.
Here, M1 is polled for a signal state of 0 to ensure that M1 and M2 cannot both be set at the
same time.
b Close gate automatically after 20 seconds
When the gate is open limit switch S3 activates and input X3 is switched off. (For safety reasons
S3 is a break contact.) When this happens timer T0 starts the 20s delay (K200 = 200 x 0.1s =
20s). When the timer reaches 20s relay M2 is set and the gate is closed.
b Stop gate with STOP switch
Pressing the STOP button (S0) resets relays M1 and M2, stopping the gate motor.
b Identifying obstacles with the photoelectric barrier
If an obstacle is registered by the photoelectric barrier while the gate is closing relay M2 is
reset and the close operation is halted. After this relay M1 is set, opening the gate again.
3 30 MITSUBISHI ELECTRIC
Programming PLC Applications An Introduction to Programming
SET M2
T0
K200
18
14
T0
X003
Ladder Diagram Instruction List
14 LDI X003
15 OUT T0 K200
18 LD T0
19 SET M2
RST
RST
M1
M2
20
X000
Ladder Diagram Instruction List
20 LDI X000
21 RST M1
22 RST M2
RST
SET
M2
M1
23
X007 M2
Ladder Diagram Instruction List
23 LD X007
24 AND M2
25 RST M2
26 SET M1
b Switching the motor of with the limit switches
When the gate is open limit switch S3 is activated and input X3 is switched off. This resets relay
M1, turning off the motor. When the gate is fully closed S6 is activated, X6 is switched off and
M2 is reset, turning off the motor. For safety reasons the limit switches are break contacts. This
ensures that the motor is also switched off automatically (or cannot be switched on) if the con-
nection between the switch and the input is interrupted.
NOTE The limit switches must be wired so that they also switch off the motor automatically without
support from the PLC (see wiring diagram).
b Controlling the motor
At the end of the programthe signal states of relays M1 and M2 are transferred to outputs Y001
and Y002.
b Warning lamp: Gate in Motion and Gate in Undefined Position
If neither of the limit switches is activated this means that the gate is being opened or closed or
has been stopped in an intermediate position. In all these situations the warning lamp blinks.
The blink speed is controlled with special relay M8013, which is automatically set and reset at
1s intervals (see Chapter 4.2).
FX Beginners Manual 3 31
An Introduction to Programming Programming PLC Applications
RST
RST
M1
M2
27
29
X003
X006
Ladder Diagram Instruction List
27 LDI X003
28 RST M1
29 LDI X006
30 RST M2
Y001
Y002
31
33
M1
M2
Ladder Diagram Instruction List
31 LD M1
32 OUT Y001
33 LD M2
34 OUT Y002
Y000 35
X003 X006 M8013
Ladder Diagram Instruction List
35 LD X003
36 AND X006
37 AND M8013
38 OUT Y000
Connection of the PLC
The rolling shutter gate control system can be implemented with a controller like the
FX1N-14MR.
3 32 MITSUBISHI ELECTRIC
Programming PLC Applications An Introduction to Programming
MITSUBISHI
POWER
RUN
ERROR
FX -14MR 1S
0 1 2 3
4 5 6 7
0 1 2 3
4 5
IN
100-240
VAC
14MR
-ES/UL
L N
S/S
X0
X1
X2
X3
X4
X5
X6
X7
OUT
24V COM0
Y0 0V
COM1
Y1
COM2
Y2
Y3
Y4
Y5
S/S 0 V
24 V
N
PE
L1
S3 S4 S2 S5 S6 S7 S0
K2 K1
S3 S6
K1 K2 H1
S1
Interlock by contactor
Deactivation by limit switches
W
a
r
n
i
n
g
l
a
m
p
O
p
e
n
g
a
t
e
C
l
o
s
e
g
a
t
e
S
T
O
P
O
p
e
n
g
a
t
e
(
o
u
t
s
i
d
e
)
O
p
e
n
g
a
t
e
(
i
n
s
i
d
e
)
U
p
p
e
r
l
i
m
i
t
s
w
i
t
c
h
C
l
o
s
e
g
a
t
e
(
i
n
s
i
d
e
)
C
l
o
s
e
g
a
t
e
(
o
u
t
s
i
d
e
)
L
o
w
e
r
l
i
m
i
t
s
w
i
t
c
h
P
h
o
t
o
e
l
e
c
t
r
i
c
b
a
r
r
i
e
r
4 Devices in Detail
The devices in PLCs are used directly in control programinstructions. Their signal states can
be both read and changed by the PLC program. A device reference has two parts:
the device name and
the device address.
4.1 Inputs and Outputs
The PLCs inputs and outputs connect it to the process that it is controlling. When an input is
polled by the PLC program the voltage on the input terminal of the controller is measured.
Since these inputs are digital they can only have two signal states, ON or OFF. When the volt-
age at the input terminal reaches 24V the input is on (state 1). If the voltage is lower than 24V
the input evaluates as off (signal state 0).
In MELSECPLCs the identifier X is used for inputs. The same input can be polled as often as
necessary in the same program.
NOTE The PLCcannot change the state of inputs. For example, it is not possible to execute an OUT
instruction on an input device.
If an output instruction is executed on an output the result of the current operation (the signal
state) is applied to the output terminal of the PLC. If it is a relay output the relay closes (all relays
have make contacts). If it is a transistor output the transistor makes the connection and acti-
vates the connected circuit.
The identifier for output devices is Y. Outputs can be used in logic operation instructions as
well as with output instructions. However, it is important to remember that you can never use an
output instruction on the same output more than once (see also section 3.4.2).
FX Beginners Manual 4 1
Devices in Detail Inputs and Outputs
X000 X001
Y000 Y001
X002
Y002
The illustration on the left shows an example
of how you can connect switches to the
inputs and lamps and contactors to the out-
puts of a MELSEC PLC.
X 0
Device address Device name
Example of a device reference (e.g. input 0):
The following table provides a general overview of the inputs and outputs of the controllers of
the MELSEC FX family.
* The total number of inputs can be increased to max. 248 (X367) with expansion modules. However, the sum of all
inputs and outputs cannot exceed 256.
4 2 MITSUBISHI ELECTRIC
Inputs and Outputs Devices in Detail
Device Inputs Outputs
Device identifier X Y
Device type Bit device
Possible values 0 or 1
Device address format Octal
Number of devi-
ces and addres-
ses (depends on
controller base
unit type)
FX1S
6 (X00X05)
8 (X00X07)
12 (X00X07, X10, X11, X12, X13)
16 (X00X07, X10X17)
4 (Y00Y03)
6 (Y00Y05)
8 (Y00Y07)
14 (Y00Y07, Y10Y15)
FX1N
8 (X00X07)
14 (X00X07, X10X15)
24 (X00X07, X10X17, X20X27)
36 (X00X07, X10X17, X20X27,
X30X37, X40, X41, X42, X43)
The total number of inputs can be increa-
sed to max. 84 (X123) with expansion
modules. However, the sum of all inputs
and outputs cannot exceed 128.
6 (Y00Y05)
10 (Y00Y07, Y10, Y11)
16 (Y00Y07, Y10Y17)
24 (Y00Y07, Y10Y17, Y20Y27)
The total number of outputs can be
increased to max. 64 (Y77) with expan-
sion modules. However, the sum of all
inputs and outputs cannot exceed 128.
FX2N
8 (X00X07)
16 (X00X07, X10X17)
24 (X00X07, X10X17, X20X27)
32 (X00X07, X10X17, X20X27,
X30X37)
40 (X00X07, X10X17, X20X27,
X30X37, X40X47)
64 (X00X07, X10X17, X20X27,
X30X37, X40X47, X50X57,
X60X67, X70X77)
8 (Y00Y07)
16 (Y00Y07, Y10Y17)
24 (Y00Y07, Y10Y17, Y20Y27)
32 (Y00Y07, Y10Y17, Y20Y27,
Y30Y37)
40 (Y00Y07, Y10Y17, Y20Y27,
Y30Y37, Y40Y47)
64 (Y00Y07, Y10Y17, Y20Y27,
Y30Y37, Y40Y47, Y50Y57,
Y60Y67, Y70Y77)
FX2NC
8 (X00X07)
16 (X00X07, X10X17)
32 (X00X07, X10X17, X20X27,
X30X37)
48 (X00X07, X10X17, X20X27,
X30X37, X40X47, X50X57)
8 (Y00Y07)
16 (Y00Y07, Y10Y17)
32 (Y00Y07, Y10Y17, Y20Y27,
Y30Y37)
48 (Y00Y07, Y10Y17, Y20Y27,
Y30Y37, Y40Y47, X50X57)
FX3U
8 (X00X07)
16 (X00X07, X10X17)
24 (X00X07, X10X17, X20X27)
32 (X00X07, X10X17, X20X27,
X30X37)
40 (X00X07, X10X17, X20X27,
X30X37, X40X47)
64 (X00X07, X10X17, X20X27,
X30X37, X40X47, X50X57,
X60X67, X70X77)
8 (Y00Y07)
16 (Y00Y07, Y10Y17)
24 (Y00Y07, Y10Y17, Y20Y27)
32 (Y00Y07, Y10Y17, Y20Y27,
Y30Y37)
40 (Y00Y07, Y10Y17, Y20Y27,
Y30Y37, Y40Y47)
64 (Y00Y07, Y10Y17, Y20Y27,
Y30Y37, Y40Y47, Y50Y57,
Y60Y67, Y70Y77)
4.2 Relays
In your PLCprograms you will often need to store intermediate binary results (a signal state of
0 or 1) temporarily for future reference. The PLChas special memory cells available for this
purpose known as auxiliary relays, or relays for short (device identifier: "M").
You can store the binary result of an operation in a relay, for example with an OUT instruction,
and then use the result in future operations. Relays help to make programs easier to read and
also reduce the number of programsteps: You can store the results of operations that need to
be used more than once in a relay and then poll it is often as you like in the rest of the program.
In addition to normal relays the FX controllers also have retentive or latched relays. The nor-
mal unlatched relays are all reset to a signal state of 0 when the PLCpower supply is switched
off, and this is also their standard state when the controller is switched on. In contrast to this,
latched relays retain their current states when the power is switched off and on again.
You can also configure these relays as latched relays with the PLC parameters.
You can also configure these relays as unlatched relays with the PLC parameters.
4.2.1 Special relays
In addition to the relays that you can switch on and off with the PLC program there is also
another class of relays known as special or diagnostic relays. These relays use the address
range starting with M8000. Some contain information on systemstatus and others can be used
to influence programexecution. The following table shows a fewexamples of the many special
relays available.
FX Beginners Manual 4 3
Devices in Detail Relays
Device
Relay types
Unlatched relays Latched relays
Device identifier M
Device type Bit device
Possible values fr a device 0 or 1
Device address format Decimal
Number of devices and
addresses
FX1S 384 (M0M383) 128 (M384M511)
FX1N 384 (M0M383) 1152 (M384M1535)
FX2N
FX2NC
500 (M0M499)
524 (M500M1023)
2048 (M1024M3071)
FX3U 500 (M0M499)
524 (M500M1023)
6656 (M1024M7679)
M1
M1
M1
Poll for signal state 1 (relay set)
Poll for signal state 0 (has the relay been reset?)
4.3 Timers
When you are controlling processes you will often want to program a specific delay before
starting and stopping certain operations. In hard-wired controllers this is achieved with timer
relays. In PLCs this is achieved with programmable internal timers.
Timers are really just counters that count the PLCs internal clock signals (e.g. 0.1s pulses).
When the counter value reaches the setpoint value the timers output is switched on.
All timers function as make delay switches and are activated with a 1 signal. To start and reset
timers you program them in the same way as outputs. You can poll the outputs of timers as
often as you like in your program.
In the above example timer T200 is started when input X0 is switched on. The setpoint value is
123 x 10ms = 1.23 s, so T200 switches on output Y0 after a delay of 1.23 s. The signal
sequence generated by the following program example is as follows:
You can also specify the timer setpoint value indirectly with a decimal value stored in a data
register. See section 4.6.1 for details.
4 4 MITSUBISHI ELECTRIC
Timers Devices in Detail
X0
T200
T200
Y0
K123
0
4
Ladder Diagram Instruction List
0 LD X0
1 OUT T200 K123
4 LD T200
5 OUT Y0
X0
T200
Y0
1,23 s
The timer continues to count the internal
10ms pulses as long as X0 remains on.
When the setpoint value is reached the
output of T200 is switched on.
If input X0 or the power supply of the PLC
are switched off the timer is reset and its
output is also switched off.
Special
relay
Function
Program processing
options
M8000 When the PLC is in RUN mode this relay is always set to 1.
Poll signal state
M8001 When the PLC is in Run mode this relay is always set to 0.
M8002
Initialisation pulse (following activation of RUN mode this relay is set
to 1 for the duration of one program cycle.
M8004 PLC error
M8005 Low battery voltage
M8013 Clock signal pulse: 1 second
M8031
Clear all devices (except data registers D) that are not registered as
battery-latched.
Poll signal state
Set signal state.
M8034
Disable outputs the PLC outputs remain off but program execution
continues.
Retentive timers
In addition to the normal timers described above the controllers of the FX1N, FX2N, FX2NC and
FX3U series also have retentive timers that retain their current time counter value even if the
device controlling them is switched off.
The current timer counter value is stored in a memory that is retained even in the event of a
power failure.
Example of a program using a retentive timer:
Timer T250 is started when input X0 is switched on. The setpoint value is 345 x 0.1 s = 34.5s.
When the setpoint value is reached T250 switches output Y1 on. Input X2 resets the timer and
switches its output off..
FX Beginners Manual 4 5
Devices in Detail Timers
X1
T250
T250
Y1
K345
X2
T250 RST
0
4
6
Ladder Diagram Instruction List
0 LD X0
1 OUT T250 K345
4 LD T250
5 OUT Y1
6 LD X2
7 RST T250
When X1 is on the timer counts the internal
100ms pulses. When X1 is switched off the
current time counter value is retained. The
timers output is switched on when the cur-
rent value reaches the setpoint value of the
timer.
A separate instruction must be programmed
to reset the timer since it is not reset by swit-
ching off input X1 or the PLCs power. Input
X2 resets timer T250 and switches off its
output..
T250
t1 t2
X1
Y1
X2
t1 + t2 = 34,5 s
Timers in the base units of the MELSEC FX family
* These timers are only available when special relay M8028 is set. The total number of 100ms timers is then reduced
to 32 (T0 T31).
4 6 MITSUBISHI ELECTRIC
Timers Devices in Detail
Device
Timer types
Normal Timers Retentive Timers
Device identifier T
Device type (for setting and polling) Bit device
Possible values (timer output) 0 or 1
Device address format Decimal
Timer setpoint value entry
As a decimal integer constant. The setpoint can
be set either directly in the instruction or indi-
rectly in a data register.
Number of devices
and addresses
FX1S
100 ms
(Range 0.1 to 3276.7 s)
63 (T0T62)
10 ms
(Range 0.01 to 327.67 s)
31 (T32T62)*
1 ms
(Bereich 0.001 to 32.767 s)
1 (T63)
FX1N
100 ms
(Range 0.1 to 3276.7 s)
200 (T0T199) 6 (T250T255)
10 ms
(Range 0.01 to 327.67 s)
46 (T200T245)
1 ms
(Range 0.001 to 32.767 s)
4 (T246T249)
FX2N
FX2NC
100 ms
(Range 0.1 to 3276.7 s)
200 (T0T199) 6 (T250T255)
10 ms
(Range 0.01 to 327.67 s)
46 (T200T245)
1 ms
(Range 0.001 to 32.767 s)
4 (T246T249)
FX3U
100 ms
(Range 0.1 to 3276.7 s)
200 (T0T199) 6 (T250T255)
10 ms
(Range 0.01 to 327.67 s)
46 (T200T245)
1 ms
(Range 0.001 to 32.767 s)
256 (T256T511) 4 (T246T249)
4.4 Counters
The programmers of the FX family also have internal counters that you can use for program-
ming counting operations.
Counters count signal pulses that are applied to their inputs by the program. The counter out-
put is switched on when the current counter value reaches the setpoint value defined by the
program. Like timers, counter outputs can also be polled as often as you like in the program.
Example of a program using a counter:
Whenever input X1 is switched on the value of counter C0 is incremented by 1. Output Y0 is set
when X1 has been switched on and off ten times (the counter setpoint is K10).
The signal sequence generated by this program is as follows:
There are two kinds of counters, 16-bit counters and 32-bit counters. As their names indicate,
they can count up to either 16-bit or 32-bit values and they use 16 bits and 32 bits, respectively,
to store their setpoint values. The following table shows the key features of these counters.
FX Beginners Manual 4 7
Devices in Detail Counters
X1
C0
K10
X0
C0 RST
C0
Y0
0
3
7
Ladder Diagram
Once the counter value has reached the set-
point value any additional pulses on input X1
no longer have any effect on the counter.
First the counter is reset with input X0 and a
RST instruction. This resets the counter value
to 0 and switches off the counter output.
0
1
2
3
4
5
6
7
8
9
10
X0
X1
Y0
Instruction List
0 LD X0
1 RST C0
3 LD X1
4 OUT C0 K10
7 LD C0
8 OUT Y0
In addition to normal counters the controllers of the MELSEC FX family also have high-speed
counters. These are 32-bit counters that can process high-speed external counter signals
read on inputs X0 to X7. In combination with some special instructions it is very easy to use
these counters to automate positioning tasks and other functions.
High-speed counters use an interrupt principle: The PLCprogramis interrupted and responds
immediately to the counter signal. For a detailed description of high-speed counters please
refer to the Programming Manual for the MELSEC FX family.
Counter overview
The current counter values of retentive counters are retained when the power supply is switched off.
You can set the PLC parameters to configure whether the current values of these counters should be retained
when the power supply is switched off.
4 8 MITSUBISHI ELECTRIC
Counters Devices in Detail
Device
Counter types
Normal counters Retentive counters
Device identifier C
Device type (for setting and polling) Bit device
Possible device values (counter output) 0 or 1
Device address format Decimal
Counter setpoint value entry
As a decimal integer constant. The setpoint can
be set either directly in the instruction or indi-
rectly in a data register (two data registers for
32-bit counters).
Number of devices
and addresses
FX1S
16 bit counter 16 (C0C15) 16 (C16C31)
32 bit counter
32 bit high-speed counter 21 (C235C255)
FX1N
16 bit counter 16 (C0C15) 184 (C16C199)
32 bit counter 20 (C200C219) 15 (C220C234)
32 bit high-speed counter 21 (C235C255)
FX2N
FX2NC
16 bit counter 100 (C0C99)
100 (C100C199)
15 (C220C234)
FX3U
16 bit counter 100 (C0C99)
100 (C100C199)
15 (C220C234)
You can also configure these registers as latched registers with the PLC parameters.
You can also configure these registers as unlatched registers with the PLC parameters.
4.5.2 Special registers
Just like the special relays (Chapter 4.2.1) starting at address M8000 the FX controllers also
have special or diagnostic registers, whose addresses start at D8000. Often there is also a
direct connection between the special relays and special registers. For example, special relay
M8005 shows that the voltage of the PLCs battery is too low, and the corresponding voltage
value is stored in special register D8005. The following table shows a small selection of the
available special registers as examples.
Registers with externally modifiable contents
The controllers of the FX1S and FX1N series have two integrated potentiometers with which
you can adjust the contents of special registers D8030 and D8031 in the range from 0 to 255
(see section 4.6.1). These potentiometers can be used for a variety of purposes for example
to adjust setpoint values for timers and counters without having to connect a programming unit
to the controller.
4 10 MITSUBISHI ELECTRIC
Registers Devices in Detail
Device
Data register types
Normal registers Latched registers
Device identifier D
Device type (for setting and polling)
Word device (two registers can be combined to store double-word
values)
Possible device values
16 bit registers: 0000H to FFFFH (-32768 to 32767)
32 bit register: 00000000H to FFFFFFFFH (-2 147 483 648 to
2 147 483 647)
Device address format Decimal
Number of devices and
addresses
FX1S 128 (D0D127) 128 (D128D255)
FX1N 128 (D0D127) 7872 (D128D7999)
FX2N
FX2NC
200 (D0D199)
312 (D200D511)
7488 (D512D7999)
FX3U 200 (D0D199)
524 (M500M1023)
6656 (M1024M7679)
Special
register
Function
Program processing
optionsm
D8004 Error relay address (shows which error relays are set)
Read register contents D8005 Battery voltage (e.g. the value 36 means 3.6V)
D8010 Current program cycle time
D8013D8019 Time and date of the integrated real-time clock
Read register contents
Change register contents
D8030 Value read from potentiometer VR1 (0 255)
Read register contents (FX1S
and FX1N only)
D8031 Value read from potentiometer VR2 (0 255)
4.5.3 File registers
The contents of file registers are also not lost when the power supply is switched off. File regis-
ters can thus be used for storing values that you need to transfer to data registers when the
PLC is switched on, so that they can be used by the programfor calculations, comparisons or
as setpoints for timers.
File registers have the same structure as data registers. In fact, they are data registers they
consist of blocks of 500 addresses each in the range from D1000 to D7999.
For a detailed description of the file registers see the Programming Manual for the MELSEC
FX family.
4.6 Programming Tips for Timers and Counters
4.6.1 Specifying timer and counter setpoints indirectly
The usual way to specify timer and counter setpoint values is directly, in an output instruction:
In the example above T31 is a 100ms timer. The constant K500 sets the delay to 500 x 0.1s =
50s. The setpoint for counter C0 is also set directly, to a value of 34 with the constant K34.
The advantage of specifying setpoints like this is that you dont have to concern yourself with
the setpoint value once you have set it. The values you use in the program are always valid,
even after power failures and directly after switching the controller on. However, there is also a
disadvantage: If you want to change the setpoint you need to edit the program. This applies
particularly for timer setpoint values, which are often adjusted during controller configuration
and program tests.
You can also store setpoint values for timers and counters in data registers and have the pro-
gramread themfromthe registers. It is then possible to change the values quickly with a pro-
FX Beginners Manual 4 11
Devices in Detail Programming Tips for Timers and Counters
Device File registers
Device identifier D
Device type (for setting and polling)
Word device (two registers can be combined to store double-word
values)
Possible device values
16 bit register: 0000H to FFFFH (-32768 to 32767)
32 bit register: 00000000H to FFFFFFFFH (-2 147 483 648 to
2 147 483 647)
Device address format Decimal
Number of devices and
addresses
FX1S
1500 (D1000D2499)
A maximum of 3 blocks of 500 file registers each can be defined in
the PLC parameters.
FX1N
7000 (D1000D7999)
A maximum of 14 blocks of 500 file registers each can be defined in
the PLC parameters.
FX2N
FX2NC
FX3U
X17
T31
K500
M50
C0
K34
0
4
Instruction List
0 LD X17
1 OUT T31 K500
4 LD M50
5 OUT C0 K34
Ladder Diagram
gramming unit if necessary, or to specify setpoint values with switches on a control console or
a HMI control panel.
The following listing shows an example of how to specify setpoint values indirectly:
When relay M15 is one the contents of data register D100 are copied to D131. This register
contains the setpoint value for T131. You could use a programming or control unit to adjust
the contents of D100.
The special relay M8002 is only set for a single programcycle directly after the PLCis swit-
ched on. This is used to copy the constant value of 34 to data register D5, which is then
used as the setpoint value for counter C0.
You dont have to write program instructions to copy the setpoint values to the data registers.
You could also use a programming unit to set thembefore the programis started, for example.
E
WARNING:
If you use normal registers the setpoint values will be lost when the power supply is
switched off and when the RUN/STOPswitch is set to the STOPposition. If this happens
hazardous conditions may be created next time the power is switched on and/or when
the PLC is started again, because all the setpoints will have a value of 0.
If you dont configure your programto copy the values automatically you should always
use latched data registers for storing the setpoint values for timers and counters. Also,
remember that even the contents of these registers will also be lost when the PLC is
switched off if the backup battery is empty.
4 12 MITSUBISHI ELECTRIC
Programming Tips for Timers and Counters Devices in Detail
X17
T31
D131
M8002
MOV D100 D131
M15
M50
C0
D5
MOV K34 D5
0
6
10
16
Instruction List
0 LD M15
1 MOV D100 D131
6 LD X17
7 OUT T31 D131
10 LD M8002
11 MOV K34 D5
16 LD M50
17 OUT C0 D5
Ladder Diagram
Setting setpoints with the integrated potentiometers
The controllers of the FX1S and FX1N series have two integrated analog potentiometers with
which you can adjust setpoint values for timers and other functions quickly and easily.
In the programexample above Y0 is switched on after the delay specified for timer T1, for the
time specified for timer T2 (delayed pulse generation).
FX Beginners Manual 4 13
Devices in Detail Programming Tips for Timers and Counters
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
0 1 2 3
4 5 6 7
10 11
IN
OUT
POWER
FX -24MR 1N
RUN
ERROR
100-240
VAC
X7 X11 X13 X15
X5 X3 X1 S/S X6 X10 X12 X14
X4 X2 X0 N L
24MR
-ES/UL
Y10 Y6 Y5 Y3
COM3 Y4 COM4 Y7 Y11
COM2 COM1 COM0 24+
Y2 Y1 Y0 0V
MITSUBISHI
The value of the upper potentiometer (VR1) can
be read from special data register D8031, the
value of the lower potentiometer (VR2) fromregis-
ter D8031. To use one of the potentiometers as the
setpoint value source for a timer you just specify
the corresponding register in your program ins-
tead of a constant.
The value in the register can be adjusted between
0 and 255 by turning the potentiometer.
Potentiometer
T1
T2
Y000
T2
T1
X001
T1
D8030
D8031
0
4
8
Ladder Diagram Instruction List
0 LD X001
1 OUT T1 D8030
4 LD T1
5 OUT T2 D8031
8 LD T1
8 ANI T2
10 OUT Y000
T2
T1
Y0
X1
[D8030]
t
OFF
ON
OFF
ON
0
1
0
1
[D8031]
Signal sequence
4.6.2 Switch-off delay
By default, all the timers in MELSECPLCs are delayed make timers, i.e. the output is switched
ON after the defined delay period. However, you will often also want to program a delayed
break operation (switch OFF after a delay). A typical example of this is a ventilation fan in a
bathroomthat needs to continue running for several minutes after the lights are switched off.
Program version 1 (latching)
As long as input X1 (e.g. a light switch) is on output Y0 (fan) is also on. However, the latching
function ensures that Y0 also remains on after X1 has been switched off, because timer T0 is
still running. T0 is started when X1 is switched off. At the end of the delay period (300 x 0.1s =
30s in the example) T0 interrupts the Y0 latch and switches the output off.
Program version 2 (set/reset)
When X1 is switched on output Y0 is set (switched on). When X1 is switched off timer T0 is
started. After the delay period T0 then resets output Y0. The resulting signal sequence is iden-
tical with that produced by program version 1.
4 14 MITSUBISHI ELECTRIC
Programming Tips for Timers and Counters Devices in Detail
Y000
X001
X001
Y000
T0
T0
K300
0
5
Ladder Diagram Instruction List
0 LD X001
1 LD Y000
2 ANI T0
3 ORB
4 OUT Y000
5 LDI X001
6 OUT T0 K300
Y0
X1
T0
30 s
t
Signal sequence
X001
T0
RST Y000
X001
SET Y000
T0
K300
0
6
2
Ladder Diagram Instruction List
0 LD X001
1 SET Y000
2 LDI X001
3 OUT T0 K300
6 LD T0
7 RST Y000
4.6.3 Delayed make and break
Sometimes you will want to switch an output on after a delay and then switch it off again after
another delay. This is very easy to implement with the controllers basic logical instructions.
Output Y000 is latched with the help of T1, keeping the output switched on until the end of the
break delay period.
FX Beginners Manual 4 15
Devices in Detail Programming Tips for Timers and Counters
T1
X000
Y000
X000
T2
T1
T2
Y000
K25
K50
0
8
4
Ladder Diagram Instruction List
0 LD X000
1 OUT T1 K25
4 LDI X000
5 OUT T2 K50
8 LD T1
9 OR Y000
10 ANI T2
11 OUT Y000
T2
T1
Y0
X0
t1
t
OFF
ON
OFF
ON
0
1
0
1
t2
Signal sequence
4.6.4 Clock signal generators
The controllers have special relays that make it very easy to programtasks requiring a regular
clock signal (for example for controlling a blinking error indicator light). Relay M8013 switches
on and off at 1-second intervals, for example. For full details on all special relays see the Pro-
gramming Manual for the FX family.
If you need a different clock frequency or different on and off times you can programyour own
clock signal generator with two timers, like this:
Input X1 starts the clock generator. If you want, you can omit this input then the clock genera-
tor is always on. In the program you could use the output of T1 to control a blinking warning
light. The on period is determined by T2, the off period by T1.
The output of timer T2 is only switched on for a single programcycle. This time is shown much
longer than it really is in the signal sequence illustration below. T2 switches T1 off and immedi-
ately after this T2 itself is also switched off. In effect this means that the duration of the on
period is increased by the time that it takes to execute a program cycle. However, since the
cycle is only a few milliseconds long it can usually be ignored.
4 16 MITSUBISHI ELECTRIC
Programming Tips for Timers and Counters Devices in Detail
T1
T2
Y000
T2
X001
T1
K10
K20
0
5
Ladder Diagram Instruction List
0 LD X001
1 ANI T2
2 OUT T1 K10
5 LD T1
6 OUT T2 K20
9 OUT Y000
T2
T1
Y1
X0
t1
t
OFF
ON
OFF
ON
0
1
0
1
t2
Signal sequence
5 More Advanced Programming
The basic logic instructions listed in Chapter 3 can be used to emulate the functions of a
hard-wired contactor controller with a programmable logic controller. However, this only
scratches the surface of the capabilities of modern PLCs. Since every PLC is built around a
microprocessor they can also easily performoperations like mathematical calculations, com-
paring numbers, converting fromone number systemto another or processing analog values.
Functions like these that go beyond the capabilities of logic operations are performed with spe-
cial instructions, which are referred to as applied or application instructions.
5.1 Applied Instructions Reference
Applied instructions have short names that are based on the English names of their functions.
For example, the instruction for comparing two 16-bit or 32-bit numbers is called CMP, which is
short for compare.
When you program an applied instruction you enter the instruction name followed by the
device name. The following table shows all the applied instructions currently supported by the
MELSECFXfamily of controllers. This list may look a little overwhelming at first, but dont worry
you dont have to memorise themall! When you are programming you can use the powerful
Help functions of GX Developer and GX IEC Developer to find the instructions you need.
In this chapter we will only cover the more frequently-used instructions, which are shown with a
grey shaded background in the reference table. For full documentation of all the instructions
with examples please refer to the Programming Manual for the FX family.
FX Beginners Manual 5 1
More Advanced Programming Applied Instructions Reference
Category
Instruc-
tion
Function
Controller
FX1S FX1N FX2N FX2NC FX3U
Program flow
functions
CJ Conditional Jump to a program position
CALL Calls (executes) a subroutine
SRET
Subroutine Return, marks the end of a sub-
routine
IRET
Interrupt Return, marks the end of an inter-
rupt routine
EI
Enable Interrupt, enables processing of inter-
rupt routines
DI
Disable Interrupt, disables processing of
interrupt routines
FEND First End, marks end of main program block
WDT WatchDog Timer refresh
FOR Marks beginning of a program loop
NEXT Marks end of a program loop
Move and com-
pare functions
CMP Compare numerical values
ZCP Zone Compare, compares numerical ranges
MOV Move data from one storage area to another
SMOV Shift Move
CML Compliment, copies and inverts
BMOV Block Move
FMOV Fill Move, copy to a range of devices
XCH Exchange data in specified devices
BCD BCD conversion
BIN Binary conversion
5 2 MITSUBISHI ELECTRIC
Applied Instructions Reference More Advanced Programming
Category
Instruc-
tion
Function
Controller
FX1S FX1N FX2N FX2NC FX3U
Math and logic
instructions
ADD Add numerical values
SUB Subtract numerical values
MUL Multiply numerical values
DIV Divide numerical values
INC Increment
DEC Decrement
AND Logical AND
OR Logical OR
XOR Logical exclusive OR
NEG Negation, logical inversion of device contents
Rotate and shift
functions
ROR Rotate right
ROL Rotate left
RCR Rotate carry right, rotate right with carry
RCL Rotate carry left, rotate left with carry
SFTR Shift right, bitwise shift to the right
SFTL Shift left, bitwise shift to the left
WSFR Word shift right, shift word values to the right
WSFL Word shift left, shift word values to the left
SFWR Shift register write, writes to a FIFO stack
SFRD Shift register read, reads from a FIFO stack
Data operation
functions
ZRST Zone Reset, resets ranges of like devices
DECO Decode data
ENCO Encode data
SUM Sum (number) of active bits
BON Bit on, checks status of a bit
MEAN Calculates mean values
ANS Timed annunciator set, starts a timer interval
ANR Annunciator reset
SQR Square root
FLT Floating point, converts data
High-speed
instructions
REF Refresh inputs and outputs
REFF Refresh inputs and filter adjust
MTR Input matrix, read a matrix (MTR)
DHSCS High-speed counter set
DHSCR High-speed counter reset
DHSZ High speed zone compare
SPD Speed detection
PLSY Pulse Y output (frequency)
PWM Pulse output with pulse width modulation
PLSR Pulse ramp (accelleration/deceleration setup)
Application
instructions
IST Initial state, set up multi-mode STL system
SER Search data stack
ABSD Absolute counter comparison
INCD Incremental counter comparison
TTMR Teaching timer
STMR Special timer
ALT Alternate state, flip-flop function
RAMP Ramp function
ROTC Rotary table control
SORT Sort table data on selected fields
FX Beginners Manual 5 3
More Advanced Programming Applied Instructions Reference
Category
Instruc-
tion
Function
Controller
FX1S FX1N FX2N FX2NC FX3U
Instructions for
external
I/O devices
TKY Ten key input
HKY Hexadecimal key input
DSW Digital switch
SEGD 7-segment display decoder
SEGL 7-segment display with latch
ARWS Arrow switch
ASC ASCII conversion
PR Print, data output via the outputs
FROM Read data from a special function module
TO Write data to a special function module
Instructions for
external serial
devices
RS RS serial communications
PRUN Parallel run (octal mode)
ASCI Convert to an ASCII character
HEX Convert to a hexadecimal character
CCD Check Code, sum and parity check
VRRD
Read setpoint values from FX1N-8AV-BD and
FX2N-8AV-BD
VRSC
Read switch settings fromFX1N-8AV-BD and
FX2N-8AV-BD
RS2 RS serial communications (2)
PID Program a PID control loop
Store/restore
index registers
ZPUSH Zone push, store contents of index registers
0 LD ...
1 OR>= C20 K200
5.4 Math Instructions
All the controllers of the MELSEC FX family can performall four basic arithmetical operations
and can add, subtract, multiply and divide integer numbers (i.e. non-floating-point numbers).
These instructions are described in this section.
The controller base units of the FX2N, FX2NC and FX3U series can also process floating-point
numbers. This is done with special instructions that are documented in detail in the Program-
ming Manual of the MELSEC FX series.
After every addition or subtraction you should always programinstructions to check the states
of the special relays listed below to see whether the result is 0 or has exceeded the permitted
value range.
b M8020
This special relay is set to "1" if the result of an addition or subtraction is 0.
b M8021
Special relay M8021 is set to "1" if the result of an addition or subtraction is smaller than
-32,767 (16-bit operations) or -2,147,483,648 (32-bit operations).
b M8022
Special relay M8022 is set to "1" if the result of an addition or subtraction is greater than
+32,767 (16-bit operations) or +2,147,483,647 (32-bit operations).
These special relays can be used as enable flags for continuing with additional math opera-
tions. In the following example the result of the subtraction operation in D2 is used as a divisor.
Since dividing by 0 is impossible and causes an error the division is only executed if the divisor
is not 0.
5 20 MITSUBISHI ELECTRIC
Math Instructions More Advanced Programming
SUB D0 D1 D2
M8000
DIV D3 D2 D5
M8020
8
0
Ladder Diagram Instruction List
0 LD M8000
1 SUB D0 D1 D2
8 LDI M8020
9 DIV D3 D2 D5
5.4.1 Addition
The ADD instruction calculates the sum of two 16-bit or 32-bit values and writes the result to
another device.
First source device or constant
Second source device or constant
Device in which the result of the addition is stored
The example above adds the contents of D0 and D1 and writes the result to D2.
Examples
Add 1,000 to the contents of data register D100:
The signs of the values are taken into account by the ADD instruction:
You can also add 32-bit values by prefixing a "D" to the ADD instruction (DADD):
If you want you can also write the result to one of the source devices. However, if you do this
remember that the result will then change in every programcycle if the ADD instruction is exe-
cuted cyclically!
The ADD instruction can also be executed in pulse-triggered mode. Then it is only executed
when the signal state of the input condition changes from"0" to "1". To use this mode just add a
"P" suffix to the ADD instructions (ADDP, DADDP).
In the following example the constant value 27 is only added to the contents of D47 once, in the
program cycle in which the signal state of relay M47 changes from "0" to "1":
FX Beginners Manual 5 21
More Advanced Programming Math Instructions
ADDP D47 K27 D51
M47
0
Ladder Diagram Instruction List
0 LD M47
1 ADDP D47 K27 D51
1000 ADD K1000 D100 D102 53 +
D 100 D 102
1053
5 ADD D10 D11 D12 -8
D 10
+
D 11 D 12
-3
65238 DADD D0 D2 D4
D 0
+
D 1
27643
D 2 D 3
92881
D 4 D 5
18 ADD D0 K25 D0 25
D 0
+
D 0
43
ADD D0 D1 D2 0
Ladder Diagram Instruction List
0 ADD D0 D1 D2
5.4.2 Subtraction
The SUB instruction calculates the difference between two numerical values (contents of
16-bit or 32-bit devices or constants). The result of the subtraction is written to a third device.
Minuend (the subtrahend is subtracted from this value)
Subtrahend (this value is subtracted from the minuend)
Difference (result of the subtraction)
In the example above the contents of D1 is subtracted from the contents of D0 and the differ-
ence is written to D2.
Examples
Subtract 100 from the contents of data register D11 and write the result to D101:
The signs of the values are taken into account by the SUB instruction:
You can also subtract 32-bit values by prefixing a D to the SUB instruction (DSUB):
If you want you can also write the result to one of the source devices. However, if you do this
remember that the result will then change in every programcycle if the SUB instruction is exe-
cuted cyclically!
The SUB instruction can also be executed in pulse-triggered mode. Then it is only executed
when the signal state of the input condition changes from"0" to "1". To use this mode just add a
"P" suffix to the SUB instructions (SUBP, DSUBP).
In the following example the contents of D394 is only subtracted fromcontents of D50 once, in
the program cycle in which the signal state of relay M50 changes from "0" to "1":
5 22 MITSUBISHI ELECTRIC
Math Instructions More Advanced Programming
247 SUB D100 K100 D101 100
D 100
D 101
147
5 SUB D10 D11 D12 -8
D 10
D 11 D 12
13
65238 DSUB D0 D2 D4
D 0
D 1
27643
D 2 D 3 D 4 D 5
37595
197 SUB D0 K25 D0 25
D 0
D 0
172
SUBP D50 D394 D51
M50
0
Ladder Diagram Instruction List
0 LD M50
1 SUBP D50 D394 D51
SUB D0 D1 D2 0
Ladder Diagram Instruction List
0 SUB D0 D1 D2
5.4.3 Multiplication
The FX controllers MUL instruction multiplies two 16-bit or 32-bit values and writes the result
to a third device.
Multiplicand
Multiplier
Device in which the result of the addition is stored
The example above adds the contents of D0 and D1 and writes the result to D2.
NOTE When you multiply two 16-bit values the result can quite easily exceed the range that can be
displayed with 16 bits. Because of this the product of multiplications is always written to two
consecutive 16-bit devices (i.e. a 32-bit double word).
When you multiply two 32-bit values the product is written to four consecutive 16-bit devices
(64 bits, two double words).
Always take the size of these device ranges into account when you are programming and
take care not to create range overlaps by using the devices in the ranges to which the pro-
ducts are written!
Examples
Multiply the contents of D0 and D1 and store the product in D3 and D2:
The signs of the values are taken into account by the MUL instruction. In this example the value
in D10 is multiplied by the constant value -5:
You can also multiply 32-bit values by prefixing a "D" to the MUL instruction (DMUL):
The MUL instruction can also be executed in pulse-triggered mode by adding a "P" suffix to the
MUL instructions (MULP, DMULP). The following multiplication is only executed when input
X24 switches from "0" to "1":
FX Beginners Manual 5 23
More Advanced Programming Math Instructions
MUL D0 D1 D2 0
Ladder Diagram Instruction List
0 MUL D0 D1 D2
1805 MUL D0 D1 D2 481
D 0
x
D 3
868205
D 1 D 2
8 MUL D10 K-5 D20 -5
D 10
x
D 21
-40
D 20
65238 DMUL D0 D2 D4
D 0
x
D 1
27643
D 2 D 3
1803374034
D 6 D 7 D 5 D 4
MULP D25 D300 D26
X24
0
Ladder Diagram Instruction List
0 LD X24
1 MULP D25 D300 D26
5.4.4 Division
The MELSEC FX familys DIV instruction divides one number by another (contents of two
16-bit or 32-bit devices or constants). This is an integer operation and cannot process float-
ing-point values. The result is always an integer and the remainder is stored separately.
Dividend
Divisor
Quotient (result of the division, dividend divisor = quotient)
NOTES The divisor should never be 0. Division by 0 is not possible and will generate an error.
When two 16-bit values are divided the quotient is written to one 16-bit device and the re-
mainder is written to the next device. This means that the result of a division always requires
two consecutive 16-bit devices (= 32 bits).
When you divide two 32-bit values the quotient is written to two 16-bit devices and the re-
mainder is written to the next two 16-bit devices. This means that four consecutive 16-bit de-
vices are always required for the result of a 32-bit division.
Always take the size of these device ranges into account when you are programming and
take care not to create range overlaps by using the devices in the ranges to which the results
of the calculations are written!
Examples
Divide the contents of D0 by the contents of D1 and write the result to D2 and D3:
The signs of the values are taken into account by the DIV instruction. In this example the coun-
ter value of C0 is divided by the value in D10:
5 24 MITSUBISHI ELECTRIC
Math Instructions More Advanced Programming
DIV D0 D1 D2 0
Ladder Diagram Instruction List
0 DIV D0 D1 D2
40 DIV D0 D1 D2 6
D 0
D 1 D 2
6
D 3
4
Quotient (6 x 6 = 36)
Remainder (40 - 36 = 4)
36 DIV C0 D10 D200 -5
C 0
D 10 D 200
-7
D 201
1
Quotient
Remainder
Division with 32-bit values:
Adding a P suffix to the DIV instructions executes the instructions in pulse-triggered mode
(DIV -> DIVP, DDIVPL -> DMULP). In the following example the counter value of C12 is only
divided by 4 in the program cycle in which input X30 is switched on:
5.4.5 Combining math instructions
In real life one calculation is seldom all you want to perform. The FX controllers allow you to
combine math instructions to solve more complex calculations. Depending on the nature of the
calculation you may have to use additional devices to store intermediate results.
The following example shows how you could calculate the sumof the values in data registers
D101, D102 and D103 and then multiply the result by the factor 4:
First the contents of D101 and D102 are added and the result is stored in D200.
If (and only if) the sum of D101 and D102 does not exceed the permitted range it is then
added to the value in D103.
If the sumof D101 through D103 does not exceed the permitted range it is multiplied by the
factor 4 and the result is written to D104 and D105.
FX Beginners Manual 5 25
More Advanced Programming Math Instructions
65238 DDIV D0 D2 D4 27643
D1
2
9952
D0 D3 D2 D5 D4
D7 D6
Quotient
Remainder
DIVP C12 K4 D12
X30
0
Ladder Diagram Instruction List
0 LD X30
1 DIVP C12 K4 D12
ADD D101 D102 D200
M101
ADD D200 D103 D200
M8022
MUL D200 K4 D104
M8021 M8022
0
Ladder Diagram Instruction List
0 LD M101
1 ADD D101 D102 D200
8 MPS
9 ANI M8022
10 ADD D200 D103 D200
17 MPP
18 ANI M8021
19 ANI M8022
20 MUL D200 K4 D104
5 26 MITSUBISHI ELECTRIC
Math Instructions More Advanced Programming
6 Expansion Options
6.1 Introduction
You can expand the base units of the MELSECFX series with expansion modules and special
function modules.
These modules are divided into three categories:
b Modules that that occupy digital inputs and outputs (installed on the right of the controller).
These include the compact and modular digital expansion and special function modules.
b Modules that do not occupy any digital inputs and outputs (installed on the left side of the
controller).
b Interface and communications adapters that do not occupy any digital inputs and outputs
(installed directly in the controller unit).
6.2 Available Modules
6.2.1 Modules for adding more digital inputs and outputs
A variety of different modular and compact expansion modules are available for adding I/Os to
the MELSEC FX1N/FX2N/FX2NC and FX3U base units. In addition to this, digital I/Os can also
be added to the controllers of the FX1S, FX1N and FX3U series with special expansion adapters
that are installed directly in the controller itself. These adapters are a particularly good choice
when you only need a fewadditional I/Os and/or do not have enough space to install expansion
modules on the side of the controller.
The "modular" expansion units only contain the digital inputs and outputs, they do not have
their own power supplies. The "compact" expansion units have a larger number of I/Os and an
integrated power supply unit for the system bus and the digital inputs.
The available base units and expansion units can be mixed and matched in a huge variety of
different combinations, making it possible to configure your controller systemvery precisely to
the needs of your application.
6.2.2 Analog I/O modules
Analog I/Omodules convert analog input signals to digital values or digital input signals to ana-
log signals.
A number of modules are available for current/voltage signals and for temperature monitoring
with direct connections for Pt100 resistance thermometers or thermo elements. See Chapter 7
for an introduction to analog signal processing.
FX Beginners Manual 6 1
Expansion Options Introduction
6.2.3 Communications modules
Mitsubishi Electric produces a range of interface modules and adapters with serial ports
(RS-232, RS-422 and RS-485) for connecting peripherals or other controllers.
Anumber of special communications modules are available for integrating the MELSECFX1N,
FX2N, FX2NC and FX3U in a variety of different networks.
ENetwork interface modules are currently available for Profibus/DP, AS-interface, DeviceNet,
CANopen, CC-Link and Mitsubishis own proprietary networks.
6.2.4 Positioning modules
You can complement the internal high-speed counters of the MELSEC FX controllers with
additional external hardware high-speed counter modules, which you can use for connecting
devices like incremental rotary transducers and positioning modules for servo and stepping
drive systems.
You can programprecise positioning applications with the MELSEC FX family with the help of
positioning modules for pulse train generation. These modules can be used to control both
stepping and servo drives.
6.2.5 HMI control and display panels
Mitsubishi Electrics control and display panels provide an effective and user-friendly
human-machine interface (HMI) for working with the MELSEC FX series. HMI control units
make the functions of the controlled application transparent and comprehensible.
All the available units can monitor and edit all relevant PLC parameters, such as actual and
setpoint values for times, counters, data registers and sequential instructions.
HMI units are available with both text and graphics based displays. Fully-programmable func-
tion keys and touch-sensitive screens make them even easier to use. The units are pro-
grammed and configured with a Windows
B
Y
0
+
B
Y
0
-
B
Y
1
+
B
Y
1
-
The digital values generated fromthe signals coming from
the analog input adapters two input channels are written
directly to special registers D8112 and D8113, which
makes it particularly easy to process them.
The output value for the analog output adapter is written
by the programto special register D8114 and then conver-
ted by the adapter and sent to the output.
Special adapters do not use any input or output points in
the base unit. They communicate directly with the base
unit via special relays and registers. Because of this, no
instructions for communication with special function
modules are needed in the program (see below).
FX -4AD-TC
2N
A / D
In addition to analog modules the available special
function modules include communication modules, posi-
tioning modules and other types. Each special function
module occupies eight input points and eight output
points in the base unit. Communication between the spe-
cial function module and the PLC base unit is carried out
via the memory buffer of the special function module with
the help of FROMand TOinstructions (see section 5.2.5).
7.2 List of Analog Modules
* The special function module FX2N-8AD can acquire temperatures as well as currents and voltages.
FX Beginners Manual 7 5
Processing Analog Values List of Analog Modules
A
n
a
l
o
g
I
n
p
u
t
M
o
d
u
l
e
s
Modul Type Designation
No. of
channels
Range Resolution FX1S FX1N
FX2N
FX2NC
FX3U
Adapter
Board
FX1N-2AD-BD 2
Voltage:
0 V to 10 V DC
2.5 mV (12 bits)
b b
Current:
4 mA to 20 mA DC
8 A (11 bits)
Special
Adapter
FX3U-4AD-ADP 4
Voltage:
0 V to 10 V DC
2.5 mV (12 bits)
b
Current:
4 mA to 20 mA DC
10 A (11 bits)
Special
Function
Block
FX2N-2AD 2
Voltage:
0 V to 5 V DC
0 V to 10 V DC
2.5 mV (12 bits)
b b b
Current:
4 mA to 20 mA DC
4 A (12 bits)
FX2N-4AD 4
Voltage:
-10 V to 10 V DC
5 mV
(with sign, 12 bits)
b b b
Current:
4 mA to 20 mA DC
-20 mA to 20 mA DC
10 A
(with sign, 11 bits)
FX2N-8AD* 8
Voltage:
-10 V to 10 V DC
0.63 mV
(with sign, 15 bits)
b b b
Current:
4 mA to 20 mA DC
-20 mA to 20 mA DC
2.50 A
(with sign, 14 bits)
FX3U-4AD 4
Voltage:
-10 V to 10 V DC
0.32 mV
(with sign, 16 bits)
b
Current:
4 mA to 20 mA DC
-20 mA to 20 mA DC
1.25 A
(with sign, 15 bits)
Adapter
Board
FX1N-1DA-BD 1
Voltage:
0 V to 10 V DC
2,5 mV (12 bits)
b b
Current:
4 mA to 20 mA DC
8 A (11 bits)
Special
Adapter
FX3U-4DA-ADP 4
Voltage:
0 V to 10 V DC
2.5 mV (12 bits)
b
Current:
4 mA to 20 mA DC
4 A (12 bits)
Special
Function
Block
FX2N-2DA 2
Voltage:
0 V to 5 V DC
0 V to 10 V DC
2.5 mV (12 bits)
b b b
Current:
4 mA to 20 mA DC
4 A, (12 bits)
FX2N-4DA 4
Voltage:
-10 V to 10 V DC
5 mV (with sign, 12 bits)
b b b
Current:
0 mA to 20 mA DC
4 mA to 20 mA DC
20 A (10 bits)
FX3U-4DA 4
Voltage:
-10 V to 10 V DC
0.32 mV
(with sign, 16 bits)
b
Current:
0 mA to 20 mA DC
4 mA to 20 mA DC
0.63 A (15 bits)
A
n
a
l
o
g
O
u
t
p
u
t
M
o
d
u
l
e
s
* The special function block FX2N-8AD is able to measure voltage, current and temperature.
b The adapter board, special adapter or special function block can be used with a base unit or expansi-
on unit of this series.
The adapter board, special adapter or special function block cannot be used with this series.
7 6 MITSUBISHI ELECTRIC
List of Analog Modules Processing Analog Values
C
o
m
b
i
n
e
d
A
n
a
l
o
g
I
n
p
u
t
&
O
u
t
p
u
t
M
o
d
u
l
e
s
T
e
m
p
e
r
a
t
u
r
e
A
c
q
u
i
s
i
t
i
o
n
M
o
d
u
l
e
s
Modul Type Designation
No. of
channels
Range Resolution FX1S FX1N
FX2N
FX2NC
FX3U
Special
Function
Block
FX0N-3A
2 inputs
Voltage:
0 V to 5 V DC
0 V to 10 V DC
40 mV (8 bits)
b b b
Current:
4 mA to 20 mA DC
64 A (8 bits)
1 output
Voltage:
0 V to 5 V DC
0 V to 10 V DC
40 mV (8 bits)
Current:
4 mA to 20 mA DC
64 A (8 bits)
FX2N-5A
4 inputs
Voltage:
-100 mV to 100 mV DC
-10 V to 10 V DC
50 V
(with sign, 12 bits)
0.312 mV
(with sign, 16 bits)
b b b
Current:
4 mA to 20 mA DC
-20 mA to 20 mA DC
10 A/1,25 A
(with sign, 15 bits)
1 output
Voltage:
-10 V to 10 V DC
5 mV
(with sign, 12 bits)
Current:
0 mA to 20 mA DC
20 A (10 bits)
Special
Adapter
FX3U-4AD-PT-ADP 4
Pt100 resistance
thermometer:
-50 gC to 250 gC
0.1 gC b
FX3U-4AD-TC-ADP 4
Thermocouple type K:
-100 gC to 1000 gC
0.4 gC
b
Thermocouple type J:
-100 gC to 600 gC
0.3 gC
Special
Function
Block
FX2N-8AD* 8
Thermocouple type K:
-100 gC to 1200 gC
0.1 gC
b b b
Thermocouple type J:
-100 gC to 600 gC
0.1 gC
Thermocouple type T:
-100 gC to 350 gC
0.1 gC
FX2N-4AD-PT 4
Pt100 resistance
thermometer:
-100 gC to 600 gC
0.2 to 0,. gC b b b
FX2N-4AD-TC 4
Thermocouple type K:
-100 gC to 1200 gC
0.4 gC
b b b
Thermocouple type J:
-100 gC to 600 gC
0.3 gC
Temperature
Control Module
(Special
Function Block)
FX2N-2LC 2
For example with a ther-
mocouple type K:
-100 gC to 1300 gC
0.1 gC or 1 gC
(depends on temperature
probe used)
b b b
Pt100 resistance
thermometer:
-200 gC to 600 gC
FX Beginners Manual I
Index
Index
A
Adapter boards (analog input/output) 7-4
ADD instruction 5-21
Analog input modules
Function 7-1
Overview 7-5
Analog output modules
Function 7-2
Overview 7-5
ANB instruction 3-12
AND instruction 3-9
ANDP/ANDF instruction 3-14
ANI instruction 3-9
Automatic shutdown 3-22
B
Binary numbers 3-2
BMOV instruction 5-10
Buffer memory 5-12
C
CMP instruction 5-15
Counter
Functions 4-7
Specifying setpoints indirectly 4-11
D
Data registers 4-9
Device
Address 3-1
Counter overview 4-8
Data register overview 4-10
File register overview 4-11
Inputs/outputs overview 4-2
Name 3-1
Relay overview 4-3
Timer overview 4-6
DIV instruction 5-24
E
EEPROM 2-9
Emergency STOP devices 3-21
Example of programming
A rolling shutter gate 3-28
An alarm system 3-23
Clock signal generator 4-16
Delay switch 4-4
Specifying timer and counter setpoints 4-11
Switch-off delay 4-14
F
Falling edge 3-14
FMOV instruction 5-11
FROM instruction 5-14
H
Hexadecimal numbers 3-3
I
Instruction
ADD 5-21
ANB 3-12
AND 3-9
ANDF 3-14
ANDP 3-14
ANI 3-9
BMOV 5-10
CMP 5-15
DIV 5-24
FMOV 5-11
FROM 5-14
Interlock of contacts 3-21
INV 3-20
LD 3-6
LDF 3-14
LDI 3-6
LDP 3-14
MC 3-19
MCR 3-19
MOV 5-7
MPP 3-17
MPS 3-17
MRD 3-17
MUL 5-23
II MITSUBISHI ELECTRIC
Index
OR 3-11
ORB 3-12
ORF 3-14
ORI 3-11
ORP 3-14
OUT 3-6
PLF 3-18
PLS 3-18
RST 3-15
SET 3-15
SUB 5-22
TO 5-15
INV instruction 3-20
L
LD instruction 3-6
LDI instruction 3-6
LDP/LDF instruction 3-14
M
MC instruction 3-19
MCR instruction 3-19
Memory battery 2-9
MOV instruction 5-7
MPP instruction 3-17
MPS instruction 3-17
MRD instruction 3-17
MUL instruction 5-23
O
Octal numbers 3-4
Optical couplers 2-6
OR instruction 3-11
ORB instruction 3-12
ORF instruction 3-14
ORI instruction 3-11
ORP/ORF instruction 3-14
OUT instruction 3-6
P
PLF instruction 3-18
PLS instruction 3-18
Process image processing 2-2
Program instruction 3-1
Pt100 resistance thermometers 7-2
R
Resistance thermometer 7-2
Resolution (Analog modules) 7-3
Retentive timers 4-5
Rising edge 3-14
RST instruction 3-15
RUN/STOP switch 2-9
S
Safety for cable breaks 3-21
Service power supply 2-9
SET instruction 3-15
Signal feedback 3-22
Special adapter 7-4
Special function modules
Analog modules 7-4
exchange of data with base unit 5-12
Special registers 4-10
Special relays 4-3
SUB instruction 5-22
Switch-off delay 4-14
T
Temperature acquisition modules
Function 7-2
Overview 7-6
Temperature control module 7-5, 7-6
Thermocouples 7-2
Timers 4-4
TO instruction 5-15
MITSUBISHI ELECTRIC
HEADQUARTERS
MITSUBISHI ELECTRIC EUROPE
EUROPE B.V.
German Branch
Gothaer Strae 8
D-40880 Ratingen
Phone: +49 (0) 2102 / 486-0
Fax: +49 (0) 2102 / 486-1120
e mail: megfamail@meg.mee.com
MITSUBISHI ELECTRIC FRANCE
EUROPE B.V.
French Branch
25, Boulevard des Bouvets
F-92741 Nanterre Cedex
Phone: +33 1 55 68 55 68
Fax: +33 1 55 68 56 85
e mail: factory.automation@fra.mee.com
MITSUBISHI ELECTRIC IRELAND
EUROPE B.V.
Irish Branch
Westgate Business Park, Ballymount
IRL-Dublin24
Phone: +353 (0) 1 / 419 88 00
Fax: +353 (0) 1 / 419 88 90
e mail: sales.info@meir.mee.com
MITSUBISHI ELECTRIC ITALY
EUROPE B.V.
Italian Branch
Via Paracelso 12
I-20041 Agrate Brianza (MI)
Phone: +39 039 6053 1
Fax: +39 039 6053 312
e mail: factory.automation@it.mee.com
MITSUBISHI ELECTRIC SPAIN
EUROPE B.V.
Spanish Branch
Carretera de Rub 76-80
E-08190 Sant Cugat del Valls
Phone: +34 9 3 / 565 3160
Fax: +34 9 3 / 589 1579
e mail: industrial@sp.mee.com
MITSUBISHI ELECTRIC UK
EUROPE B.V.
UK Branch
Travellers Lane
GB-HatfieldHerts. AL10 8 XB
Phone: +44 (0) 1707 / 27 61 00
Fax: +44 (0) 1707 / 27 86 95
e mail: automation@meuk.mee.com
MITSUBISHI ELECTRIC JAPAN
CORPORATION
Office Tower Z 14 F
8-12,1 chome, Harumi Chuo-Ku
Tokyo104-6212
Phone: +81 3 6221 6060
Fax: +81 3 6221 6075
MITSUBISHI ELECTRIC USA
AUTOMATION
500 Corporate Woods Parkway
VernonHills, IL 60061
Phone: +1 847 / 478 21 00
Fax: +1 847 / 478 22 83
MIDDLE EAST
REPRESENTATIVES
Ilan & Gavish Ltd. ISRAEL
Automation Service
24 Shenkar St., Kiryat Arie
IL-49001 Petah-Tiqva
Phone: +972 (0) 3 / 922 18 24
Fax: +972 (0) 3 / 924 07 61
e mail: iandg@internet-zahav.net
TEXEL Electronics Ltd. ISRAEL
Box 6272
IL-42160 Netanya
Phone: +972 (0) 9 / 863 08 91
Fax: +972 (0) 9 / 885 24 30
e mail: texel_me@netvision.net.il
EUROPEANREPRESENTATIVES
GEVA AUSTRIA
Wiener Strae 89
AT-2500 Baden
Phone: +43 (0) 2252 / 85 55 20
Fax: +43 (0) 2252 / 488 60
e mail: office@geva.at
TEHNIKON BELARUS
Oktjabrskaya 16/5, Ap 704
BY-220030 Minsk
Phone: +375 (0)17 / 210 4626
Fax: +375 (0)17 / 210 4626
e mail: tehnikon@belsonet.net
Koning & Hartman B.V. BELGIUM
Researchpark Zellik, Pontbeeklaan 43
BE-1731 Brussels
Phone: +32 (0)2 / 467 17 51
Fax: +32 (0)2 / 467 17 45
e mail: info@koningenhartman.com
AKNATHON BULGARIA
Andrej Ljapchev Lbvd. Pb 21 4
BG-1756 Sofia
Phone: +359 (0) 2 / 97 44 05 8
Fax: +359 (0) 2 / 97 44 06 1
e mail:
AutoCont CZECHREPUBLIC
Control Systems s.r.o.
Nemocnicni 12
CZ-702 00 Ostrava 2
Phone: +420 59 / 6152 111
Fax: +420 59 / 6152 562
e mail: consys@autocont.cz
louis poulsen DENMARK
industri & automation
Geminivej 32
DK-2670 Greve
Phone: +45 (0) 70 / 10 15 35
Fax: +45 (0) 43 / 95 95 91
e mail: lpia@lpmail.com
UTUElektrotehnika AS ESTONIA
Prnu mnt.160i
EE-11317 Tallinn
Phone: +372 (0) 6 / 51 72 80
Fax: +372 (0) 6 / 51 72 88
e mail: utu@utu.ee
Beijer Electronics OY FINLAND
Ansatie 6a
FIN-01740 Vantaa
Phone: +358 (0) 9 / 886 77 500
Fax: +358 (0) 9 / 886 77 555
e mail: info@beijer.fi
UTECOA.B.E.E. GREECE
5, Mavrogenous Str.
GR-18542 Piraeus
Phone: +302 (0) 10 / 42 10 050
Fax: +302 (0) 10 / 42 12 033
e mail: sales@uteco.gr
Meltrade Ltd. HUNGARY
Fert Utca 14.
HU-1107 Budapest
Phone: +36 (0)1 / 431-9726
Fax: +36 (0)1 / 431-9727
e mail: office@meltrade.hu
SIAPOWEL LATVIA
Lienes iela 28
LV-1009 Riga
Phone: +371 784 / 22 80
Fax: +371 784 / 22 81
e mail: utu@utu.lv
UAB UTUPOWEL LITHUANIA
Savanoriu pr. 187
LT-2053 Vilnius
Phone: +370 (0) 52323-101
Fax: +370 (0) 52322-980
e mail: powel@utu.lt
EUROPEANREPRESENTATIVES
INTEHSIS SRL MOLDOVA
Bld. Traian 23/1
MD-2060 Kishinev
Phone: +373 (0)22/ 66 4242
Fax: +373 (0)22/ 66 4280
e mail: intehsis@mdl.net
Koning & Hartman B.V. NETHERLANDS
Donauweg 2 B
NL-1000 AKAmsterdam
Phone: +31 (0)20 / 587 76 00
Fax: +31 (0)20 / 587 76 05
e mail: info@koningenhartman.com
Beijer Electronics A/S NORWAY
Teglverksveien 1
N-3002 Drammen
Phone: +47 (0) 32 / 24 30 00
Fax: +47 (0) 32 / 84 85 77
e mail: info@beijer.no
MPL Technology Sp. z o.o. POLAND
ul. Sliczna 36
PL-31-444 Krakw
Phone: +48 (0) 12 / 632 28 85
Fax: +48 (0) 12 / 632 47 82
e mail: krakow@mpl.pl
Sirius Trading&Services srl ROMANIA
Str. Biharia No. 67-77
RO-013981 Bucuresti 1
Phone: +40 (0) 21 / 201 1146
Fax: +40 (0) 21 / 201 1148
e mail: sirius@siriustrading.ro
CRAFT
Consulting & Engineering d.o.o.
Branka Krsmanovica Str. 43-V
SCG-18000 Nis
Phone: +381 (0)18 / 531 226
Fax: +381 (0)18 / 532 334
e mail: craft@bankerinter.net
INEA SR d.o.o. SERBIAANDMONTENEGRO
Karadjordjeva 12/260
SCG-113000 Smederevo
Phone: +381 (0)26 / 617 163
Fax: +381 (0)26 / 617 163
e mail: vladstoj@yubc.net
AutoCont Control s.r.o. SLOVAKIA
Radlinskho 47
SK-02601 Doln Kubn
Phone: +421 435868 210
Fax: +421 435868 210
e mail: info@autocontcontrol.sk
INEA d.o.o. SLOVENIA
Stegne 11
SI-1000 Ljubljana
Phone: +386 (0) 1-513 8100
Fax: +386 (0) 1-513 8170
e mail: inea@inea.si
Beijer Electronics AB SWEDEN
Box 426
S-20124 Malm
Phone: +46 (0) 40 / 35 86 00
Fax: +46 (0) 40 / 35 86 02
e mail: info@beijer.se
ECONOTEC AG SWITZERLAND
Postfach 282
CH-8309 Nrensdorf
Phone: +41 (0) 1 / 838 48 11
Fax: +41 (0) 1 / 838 48 12
e mail: info@econotec.ch
GTS TURKEY
Darlaceze Cad. No. 43 Kat. 2
TR-80270 Okmeydani-Istanbul
Phone: +90 (0) 212 / 320 1640
Fax: +90 (0) 212 / 320 1649
e mail: gts@turk.net
CSC Automation Ltd. UKRAINE
15, M. Raskova St., Fl. 10, Office 1010
UA-02002 Kiev
Phone: +380 (0) 44 / 494 3355
Fax: +380 (0) 44 / 494 3366
e mail: csc-a@csc-a.kiev.ua
EURASIANREPRESENTATIVES
Kazpromautomatics Ltd. KAZAKHSTAN
2, Scladskaya Str.
KAZ-470046 Karaganda
Phone: +7 3212 50 11 50
Fax: +7 3212 50 11 50
e mail: info@kpakz.com
Avtomatika Sever Ltd. RUSSIA
Lva Tolstogo Str. 7, Off. 311
RU-197376 St Petersburg
Phone: +7 812 1183 238
Fax: +7 812 1183 239
e mail: as@avtsev.spb.ru
Consys
Promyshlennaya St. 42 RUSSIA
RU-198099 St Petersburg
Phone: +7 812 325 3653
Fax: +7 812 147 2055
e mail: consys@consys.spb.ru
Electrotechnical RUSSIA
Systems Siberia
Shetinkina St. 33, Office 116
RU-630088 Novosibirsk
Phone: +7 3832 / 119598
Fax: +7 3832 / 119598
e mail: info@eltechsystems.ru
Elektrostyle RUSSIA
Poslannikov Per., 9, Str.1
RU-107005 Moscow
Phone: +7 095 542 4323
Fax: +7 095 956 7526
e mail: info@estl.ru
Elektrostyle RUSSIA
Krasnij Prospekt 220-1, Office No. 312
RU-630049 Novosibirsk
Phone: +7 3832 / 106618
Fax: +7 3832 / 106626
e mail: info@estl.ru
ICOS RUSSIA
Industrial Computer Systems Zao
Ryazanskij Prospekt, 8A, Off. 100
RU-109428 Moscow
Phone: +7 095 232 0207
Fax: +7 095 232 0327
e mail: mail@icos.ru
NPP Uralelektra RUSSIA
Sverdlova 11A
RU-620027 Ekaterinburg
Phone: +7 34 32 / 532745
Fax: +7 34 32 / 532745
e mail: elektra@etel.ru
STC Drive Technique RUSSIA
Poslannikov Per., 9, Str.1
RU-107005 Moscow
Phone: +7 095 790 7210
Fax: +7 095 790 7212
e mail: info@privod.ru
AFRICANREPRESENTATIVE
CBI Ltd. SOUTHAFRICA
Private Bag 2016
ZA-1600 Isando
Phone: +27 (0) 11/ 928 2000
Fax: +27 (0) 11/ 392 2354
e mail: cbi@cbi.co.za
Gothaer Strae 8 Telefon: 02102 486-0 Fax: 02102 486-7170 www.mitsubishi-automation.de
D-40880 Ratingen Hotline: 01805 000-7650 megfa-mail@meg.mee.com www.mitsubishi-automation.com
MITSUBISHI ELECTRIC
INDUSTRIAL AUTOMATION