The text of a manual · part 3 of 11
MELSEC FX Family Programmable Logic Controllers Beginners Manual, pages 21 to 30
Pages 21 to 30 of 106
The original document is the PDF (969 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Mitsubishi FX2NC-32MT
Page 21
Programmable Logic Controllers
2.4
Selecting the Right Controller
Selecting the Right Controller The base units of the MELSEC FX1S, FX1N and FX2N(C) series are available in a number of different versions with different power supply options and output technologies. You can choose between units designed for power supplies of 100–240 V AC, 24 V DC or 12–24 V DC, and between relay and transistor outputs. The controllers of the FX3U series are currently only available for AC power supply and with relay outputs. Series
FX1S
FX1N
FX2N
FX2NC
FX3U
I/Os
Type
No. of inputs
No. of outputs
10
FX1S-10 M쏔-쏔쏔
6
8
14
FX1S-14 M쏔-쏔쏔
8
6
20
FX1S-20 M쏔-쏔쏔
12
8
30
FX1S-30 M쏔-쏔쏔
16
14
14
FX1N-14 M쏔-쏔쏔
8
6
24
FX1N-24 M쏔-쏔쏔
14
10
40
FX1N-40 M쏔-쏔쏔
24
16
60
FX1N-60 M쏔-쏔쏔
36
24
16
FX2N-16 M쏔-쏔쏔
8
8
32
FX2N-32 M쏔-쏔쏔
16
16
48
FX2N-48 M쏔-쏔쏔
24
24
64
FX2N-64 M쏔-쏔쏔
32
32
80
FX2N-80 M쏔-쏔쏔
40
40
128
FX2N-128 M쏔-쏔쏔
64
64
16
FX2NC-16 M쏔-쏔쏔
8
8
32
FX2NC-32 M쏔-쏔쏔
16
16
64
FX2NC-64 M쏔-쏔쏔
32
32
96
FX2NC-96 M쏔-쏔쏔
48
48
16
FX3U-16 MR/ES
8
8
32
FX3U-32 MR/ES
16
16
48
FX3U-48 MR/ES
24
24
64
FX3U-64 MR/ES
32
32
80
FX3U-80 MR/ES
40
40
Power supply
Output type
24 V DC or 100 – 240 V AC
Transistor or relay
12 – 24 V DC or 100 – 240 V AC
Transistor or relay
Wahlweise 24 V DC oder 100 – 240 V AC
Transistor or relay
24 V DC
Transistor or relay
100 – 240 V AC
Relay only
To choose the right controller for your application you need to answer the following questions: 쎲 How many signals (external switch contacts, buttons and sensors) do you need to input? 쎲 What types of functions do you need to switch, and how many of them are there? 쎲 What power supply options are available? 쎲 How high are the loads that the outputs need to switch? Choose relay outputs for switching high loads and transistor outputs for switching fast, trigger-free switching operations.
FX Beginners Manual
2–5
Page 22
Controller Design
2.5
Programmable Logic Controllers
Controller Design All the controllers in the series have the same basic design. The main functional elements and assemblies are described in the glossary in section 2.5.7.
2.5.1
Input and output circuits The input circuits use floating inputs. They are electrically isolated from the other circuits of the PLC with optical couplers. The output circuits use either relay or transistor output technology. The transistor outputs are also electrically isolated from the other PLC circuits with optical couplers. The switching voltage at all the digital inputs must have a certain value (e.g. 24 V DC). This voltage can be taken from the PLC’s integrated power supply unit. If the switching voltage at the inputs is less than the rated value (e.g. <24 V DC) then the input will not be processed. The maximum output currents are 2 A on 250 V three-phase AC and non-reactive loads with relay outputs and 0.5 A on 24 V DC and non-reactive loads.
2.5.2
Layout of the MELSEC FX1S base units
Protective cover
Terminal cover Mounting hole Power supply connection Interface for expansion adapter boards Cutout for adapters or control panel
Terminals for digital inputs 100-240 VAC
L
N
X7 X5 X3 X1 S/S X6 X4 X2 X0
0 1 2 3 4 5 6 7 IN
RUN/STOP switch
2 analog potentiometers
POWER RUN ERROR
Connection for programming units Connection for the service power supply
LEDs for indicating the input status
FX1S-14MR OUT
0 1 2 3 4 5 Y2 Y1 Y0 0V COM2 Y3 24V COM0 COM1
Y4 Y5
14MR -ES/UL
MITSUBISHI
LEDs for indicating the operating status LEDs for indicating the output status Protective cover
Terminals for digital outputs
2–6
MITSUBISHI ELECTRIC
Page 23
Programmable Logic Controllers
2.5.3
Controller Design
Layout of the MELSEC FX1N base units
Protective cover
Terminal cover
Terminals for digital inputs
Mounting hole
Connection of the power supply Extension bus
RUN/STOP switch Slot for memory cassettes, adapters and displays 2 analog potentiometers Connection for programming units Connection for the service power supply
100-240 VAC
L
X15 X7 X11 X13 X5 X3 X1 X14 S/S X6 X10 X12 X4 X2 X0 N 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 IN
POWER RUN ERROR
LEDs for indicating the operating status
FX1N-24MR OUT
0 1 2 3 4 5 6 7 10 11 Y6 Y10 Y5 Y3 Y2 Y1 Y11 Y0 0V COM4 Y7 COM2 COM3 Y4 24+ COM0 COM1
LEDs for indicating the input status
24MR -ES/UL
MITSUBISHI
Terminals for digital outputs
LEDs for indicating the output status Housing cover Lid
Terminal cover Protective cover
2.5.4
Layout of the MELSEC FX2N base units
Connection for the service power supply Terminal cover Mounting hole Connection for expansion adapter boards Memory battery
Slot for memory cassettes Terminals for digital inputs LEDs for indicating the input status LEDs for indicating the operating status Connection for extensions
Connection for programming units
Protective cover des Erweiterungsbusses
RUN/STOP switch
LEDs for indicating the output status
Removable terminal strip for digital outputs
Protective cover
Housing cover
FX Beginners Manual
2–7
Page 24
Controller Design
2.5.5
Programmable Logic Controllers
Layout of the MELSEC FX2NC base units
Protective cover Memory battery Battery compartment Extension bus (on side)
RUN/STOP switch MITSUBISHI POWER RUN BATT ERROR
RUN
X0
STOP
5 6
3
5 6 7
X4
•
•
COM
LEDs for indicating the output status
2
LEDs for indicating the input status Connector for terminal strips
COM
Memory cassette slot
X7
X6
X5
Memory cassette (optional)
X3
X2
X1
Cover
X0
7
1
Y4
Y0
X4
Protective cover for expansion bus
Y0
Y1
3
Y2
2
COM1 Y3
1
2nd interface for CNV adapter
MELSEC
FX2NC-16MR-T-DS
Y4
Operating status LEDs
Terminals for digital inputs Terminals for digital outputs
2.5.6
Layout of the MELSEC FX3U base units
Battery cover
Protective cover Terminal cover Terminals for digital inputs
Memory battery Installation place for the FX3U-7DM display Blind cover for expansion board RUN/STOP switch Connection for programming unit Top cover (used if FX3U-7DM is not installed)
2–8
LEDs for indicating the input status LEDs for indicating the operating status Protective cover for expansion bus LEDs for indicating the output status Output terminals Terminal cover
Protective cover
MITSUBISHI ELECTRIC
Page 25
Programmable Logic Controllers
2.5.7
Controller Design
PLC components glossary The following table describes the meaning and functionality of the single components und parts of a Mitsubishi PLC. Component
Description
Connection for expansion adapter boards
Optional expansion adapter boards can be connected to this interface. A variety of different 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 programming 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 Developer/FX).
EEPROM
Read/write memory in which the PLC program can be stored and read with the programming software. This solid-state memory retains its contents without power, even in the event of a power failure, and does not need a battery.
Slot for optional memory cassettes. Inserting a memory cassette disables the controller’s Memory cassette slot 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, buttons 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 executed and ERROR lights up when an error or malfunction is registered.
Memory battery
The battery protects the contents of the MELSELC PLC’s volatile RAM memory in the event of a power failure (FX2N, FX2NCand 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 PLC’s 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.
FX Beginners Manual
2–9
Page 26
Controller Design
2 – 10
Programmable Logic Controllers
MITSUBISHI ELECTRIC
Page 27
An Introduction to Programming
3
Structure of a Program Instruction
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 PLC program you 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 program instruction 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 instruction referring to the same device in several places in the program. The illustrations below show how program instructions are represented in the Ladder Diagram (LD, left) and Instruction List (IL, right) programming language formats: Device
X0
Device AND X0 Instruction
Instruction
The instruction describes what is to be done, i.e. the function you want the controller to perform. The operand or device is what you want to perform the function on. Its designation consists of two parts, the device name and the device address:
X0 Device name
Device address
Examples of devices: 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.
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
Page 28
Bits, Bytes and Words
3.2
An Introduction to Programming
Bits, Bytes and Words As in all digital technology, the smallest unit of information in a PLC is a “bit”. A bit 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. Bit 15
0
Bit 0
0
0
0
0
0
0
0
0
1 Byte
0
0
0
0
0
0
0
1 Byte 1 Word
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 system is the system we use most commonly in everyday life. It is a “positional 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 PLC can only really distinguish between two states, ON/OFF or 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.
3–2
–
Base: 2
–
Digits: 0 and 1
MITSUBISHI ELECTRIC
Page 29
An Introduction to Programming
Number Systems
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):
215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Base 2 Notation
Decimal Value
Base 2 Notation
Decimal Valuet
20
1
28
256
1
2
2
9
512
22
4
210
1024
23
8
211
2048
4
16
2
12
4096
25
32
213
8192
6
64
2
14
16384
27
128
215
32768*
2
2
2
* 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 29 + 1 x 24 + 1 x 23 + 1 x 20 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 technology and programmable logic controllers. In the controllers of the MELSEC FX family hexadecimal 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:
1A7FH 0
16 = 1 1 16 = 16 2 16 = 256 3 16 = 4096
FX Beginners Manual
(in this example: 15 x 1 (in this example: 7 x 16 (in this example: 10 x 256 (in this example: 1 x 4096
= 15) = 112) = 2560) = 4096) 6783 (decimal)
3–3
Page 30
Number Systems
An Introduction to Programming
The following example illustrates why it is so easy to convert binary values hexadecimal values:
1
1
1
1
0
1
1
0
1
0
1
1
1
0
0
1
Binary
15
5
11
9
Decimal*
F
5
B
9
Hexadecimal
* 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 MELSEC FX family. This is because the inputs and outputs of MELSEC PLCs are numbered using the octal number system, in which the digits 8 and 9 don’t 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
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
:
:
:
:
MITSUBISHI ELECTRIC