The text of a manual · part 2 of 11
MELSEC FX Family Programmable Logic Controllers Beginners Manual, pages 11 to 20
Pages 11 to 20 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 11
Contents
Contents 1
Introduction
1.1
About this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1
1.2
More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1
2
Programmable Logic Controllers
2.1
What is a PLC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-1
2.2
How PLCs Process Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2
2.3
The MELSEC FX Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-4
2.4
Selecting the Right Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-5
2.5
Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-6 2.5.1 Input and output circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-6 2.5.2 Layout of the MELSEC FX1S base units . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 2.5.3 Layout of the MELSEC FX1N base units . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 2.5.4 Layout of the MELSEC FX2N base units . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 2.5.5 Layout of the MELSEC FX2NC base units . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 2.5.6 Layout of the MELSEC FX3U base units . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 2.5.7 PLC components glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-9
3
An Introduction to Programming
3.1
Structure of a Program Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-1
3.2
Bits, Bytes and Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2
3.3
Number Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2
3.4
The Basic Instruction Set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-5 3.4.1 Starting logic operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6 3.4.2 Outputting the result of a logic operation . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 3.4.3 Using switches and sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-8 3.4.4 AND operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-9 3.4.5 OR operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-11 3.4.6 Instructions for connecting operation blocks . . . . . . . . . . . . . . . . . . . . . . 3-12 3.4.7 Pulse-triggered execution of operations . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 3.4.8 Setting and resetting devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15 3.4.9 Storing, reading and deleting operation results . . . . . . . . . . . . . . . . . . . . 3-17
FX Beginners Manual
V
Page 12
Contents
3.4.10Generating pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-18 3.4.11Master control function (MC and MCR instructions) . . . . . . . . . . . . . . . . . 3-19 3.4.12Inversion of an Operation Result. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20 3.5
Safety First! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-21
3.6
Programming PLC Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-23 3.6.1 An alarm system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-23 3.6.2 A rolling shutter gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-28
4
Devices in Detail
4.1
Inputs and Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-1
4.2
Relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3 4.2.1 Special relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3
4.3
Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4
4.4
Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-7
4.5
Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-9 4.5.1 Data registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-9 4.5.2 Special registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-10 4.5.3 File registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-11
4.6
Programming Tips for Timers and Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11 4.6.1 Specifying timer and counter setpoints indirectly . . . . . . . . . . . . . . . . . . . 4-11 4.6.2 Switch-off delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-14 4.6.3 Delayed make and break. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-15 4.6.4 Clock signal generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-16
5
More Advanced Programming
5.1
Applied Instructions Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-1 5.1.1 Entering applied instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-6
5.2
Instructions for Moving Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-7 5.2.1 Moving individual values with the MOV instruction . . . . . . . . . . . . . . . . . . . 5-7 5.2.2 Moving groups of bit devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-9 5.2.3 Moving blocks of data with the BMOV instruction . . . . . . . . . . . . . . . . . . . 5-10 5.2.4 Copying source devices to multiple destinations (FMOV) . . . . . . . . . . . . 5-11 5.2.5 Exchanging data with special function modules . . . . . . . . . . . . . . . . . . . . 5-12
VI
MITSUBISHI ELECTRIC
Page 13
Contents
5.3
Compare Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-15 5.3.1 The CMP instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-15 5.3.2 Comparisons within logic operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17
5.4
Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-20 5.4.1 Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-21 5.4.2 Subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-22 5.4.3 Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-23 5.4.4 Division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-24 5.4.5 Combining math instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-25
6
Expansion Options
6.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-1
6.2
Available Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-1 6.2.1 Modules for adding more digital inputs and outputs . . . . . . . . . . . . . . . . . . 6-1 6.2.2 Analog I/O modules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-1 6.2.3 Communications modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-2 6.2.4 Positioning modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-2 6.2.5 HMI control and display panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
FX Beginners Manual
VII
Page 14
Contents
VIII
MITSUBISHI ELECTRIC
Page 15
Introduction
About this Manual
1
Introduction
1.1
About this Manual This manual will help you to familiarise yourself with the use of the MELSEC FX family of programmable logic controllers. It is designed for users who do not yet have any experience with programming programmable logic controllers (PLCs). Programmers who already have experience with PLCs from other manufacturers can also use this manual as a guide for making the transition to the MELSEC FX family. The symbol „쏔“ is used as a placeholder to identify different controllers in the same range. For example, the designation "FX1S-10쏔-쏔쏔" is used to refer to all controllers whose name begins with FX1S-10, i.e. FX1S-10 MR-DS, FX1S-10 MR-ES/UL, FX1S-10 MT-DSS and FX1S-10 MT-ESS/UL.
1.2
More Information You can find more detailed information on the individual products in the series in the operating and installation manuals of the individual modules. See the MELSEC FX Family Catalogue, art. no. 167840, for a general overview of all the controllers in the MELSEC FX family. This catalogue also contains information on expansion options and the available accessories. For an introduction to using the programming software package see the GX Developer FX Beginner’s Manual, art. no. 166391. You can find detailed documentation of all programming instructions in the Programming Manual for the MELSEC FX family, art. no. 132738 and in the Programming Manual for the FX3U series, art. no. 168591. The communications capabilities and options of the MELSEC FX controllers are documented in detail in the Communications Manual, art. no. 070143. All Mitsubishi manuals and catalogues can be downloaded free of charge from the Mitsubishi website at www.mitsubishi-automation.com.
FX Beginners Manual
1–1
Page 16
More Information
1–2
Introduction
MITSUBISHI ELECTRIC
Page 17
Programmable Logic Controllers
What is a PLC?
2
Programmable Logic Controllers
2.1
What is a PLC? In contrast to conventional controllers with functions determined by their physical wiring the functions of programmable logic controllers or PLCs are defined by a program. PLCs also have to be connected to the outside world with cables, but the contents of their program memory can be changed at any time to adapt their programs to different control tasks. Programmable logic controllers input data, process it and then output the results. This process is performed in three stages: 쎲 an input stage, 쎲 a processing stage and 쎲 an output stage Programmable Logic Controller
Output
Input Switch
Contactors
Input Stage
Processing Stage
Output Stage
The input stage The input stage passes control signals from switches, buttons or sensors on to the processing stage. The signals from these components are generated as part of the control process and are fed to the inputs as logical states. The input stage passes them on to the processing stage in a pre-processed format. The processing stage In the processing stage the pre-processed signals from the input stage are processed and combined with the help of logical operations and other functions. The program memory of the processing stage is fully programmable. The processing sequence can be changed at any time by modifying or replacing the stored program. The output stage The results of the processing of the input signals by the program are fed to the output stage where they control connected switchable elements such as contactors, signal lamps, solenoid valves and so on.
FX Beginners Manual
2–1
Page 18
How PLCs Process Programs
2.2
Programmable Logic Controllers
How PLCs Process Programs A PLC performs its tasks by executing a program that is usually developed outside the controller and then transferred to the controller’s program memory. Before you start programming it is useful to have a basic understanding of how PLCs process these programs. A PLC program consists of a sequence of instructions that control the functions of the controller. The PLC executes these control instructions sequentially, i.e. one after another. The entire program sequence is cyclical, which means that it is repeated in a continuous loop. The time required for one program repetition is referred to as the program cycle time or period. Process image processing The program in the PLC is not executed directly on the inputs and outputs, but on a “process image” of the inputs and outputs:
Switch on PLC
Delete output memory Input signals
Input terminals
Poll inputs and signal states and save them in the process image of the inputs
PLC program Process image of inputs
Instruction 1 Instruction 2 Instruction 3 .... .... ....
Process image of outputs
Instruction n
Output terminals
Transfer process image to outputs
Output signals
Input process image At the beginning of each program cycle the system polls the signal states of the inputs and stores them in a buffer, creating a “process image” of the inputs.
2–2
MITSUBISHI ELECTRIC
Page 19
Programmable Logic Controllers
How PLCs Process Programs
Program execution After this the program is executed, during which the PLC accesses the stored states of the inputs in the process image. This means that any subsequent changes in the input states will not be registered until the next program cycle! The program is executed from top to bottom, in the order in which the instructions were programmed. Results of individual programming steps are stored and can be used during the current program cycle.
Program execution
X000 X001 0
M0
Store result
M6
M1 M8013 4
Y000 M2
Control output
M0 Y001
9
Process stored result
Output process image Results of logical operations that are relevant for the outputs are stored in an output buffer – the output process image. The output process image is stored in the output buffer until the buffer is rewritten. After the values have been written to the outputs the program cycle is repeated. Differences between signal processing in the PLC and in hard-wired controllers In hard-wired controllers the program is defined by the functional elements and their connections (the wiring). All control operations are performed simultaneously (parallel execution). Every change in an input signal state causes an instantaneous change in the corresponding output signal state. In a PLC it is not possible to respond to changes in input signal states until the next program cycle after the change. Nowadays this disadvantage is largely compensated by very short program cycle periods. The duration of the program cycle period depends on the number and type of instructions executed.
FX Beginners Manual
2–3
Page 20
The MELSEC FX Family
2.3
Programmable Logic Controllers
The MELSEC FX Family The compact micro-controllers of the MELSEC FX series provide the foundation for building economical solutions for small to medium-sized control and positioning tasks requiring 10 to 256 integrated inputs and outputs in applications in industry and building services. With the exception of the FX1S all the controllers of the FX series can be expanded to keep pace with the changes in the application and the user’s growing requirements. Network connections are also supported. This makes it possible for the controllers of the FX family to communicate with other PLCs and controller systems and HMIs (Human-Machine Interfaces and control panels). The PLC systems can be integrated both in MITSUBISHI networks as local stations and as slave stations in open networks like PROFIBUS/DP. In addition to this you can also build multi-drop and peer-to-peer networks with the controllers of the MELSEC FX family. The FX1N, FX2N and FX3U have modular expansion capabilities, making them the right choice for complex applications and tasks requiring special functions like analog-digital and digital-analog conversion and network capabilities. All the controllers in the series are part of the larger MELSEC FX family and are fully compatible with one another.
2–4
Specifications
FX1S
FX1N
FX2N
FX2NC
FX3U
Max integrated I/O points
30
60
128
96
80
Expansion capability (max. possible I/Os)
34
132
256
256
384
Program memory (steps)
2000
8000
16000
16000
64000
Cycle time per log. instruction (µs)
0,55 – 0,7
0,55 – 0,7
0,08
0,08
0,065
No. of instructions (standard / step ladder / special function)
27 / 2 / 85
27 / 2 / 89
27 / 2 / 107
27 / 2 / 107
27 / 2 / 209
Max. special function modules connectable, 2
8
4
8 right 10 left
MITSUBISHI ELECTRIC