FX3U Programming Manual
FX3U Programming Manual
Foreword
This manual contains text, diagrams and explanations which will guide the reader through the safe and
correct installation, use, and operation of the FX3U/FX3UC Series programmable controller. It should be read
and understood before attempting to install or use the unit.
Store this manual in a safe place so that you can take it out and read it whenever necessary. Always forward
it to the end user.
This manual confers no industrial property rights or any rights of any other kind, nor does it confer any patent licenses.
Mitsubishi Electric Corporation cannot be held responsible for any problems involving industrial property rights which
may occur as a result of using the contents noted in this manual.
1
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
Outline Precautions
This manual provides information for the use of the FX3U Series Programmable Controllers. The manual
has been written to be used by trained and competent personnel. The definition of such a person or
persons is as follows;
a) Any engineer who is responsible for the planning, design and construction of automatic equipment
using the product associated with this manual should be of a competent nature, trained and qualified
to the local and national standards required to fulfill that role. These engineers should be fully aware of
all aspects of safety with regards to automated equipment.
b) Any commissioning or service engineer must be of a competent nature, trained and qualified to the
local and national standards required to fulfill that job. These engineers should also be trained in the
use and maintenance of the completed product. This includes being completely familiar with all
associated documentation for the said product. All maintenance should be carried out in accordance
with established safety practices.
c) All operators of the completed equipment should be trained to use that product in a safe and
coordinated manner in compliance to established safety practices. The operators should also be
familiar with documentation which is connected with the actual operation of the completed equipment.
Note: the term 'completed equipment' refers to a third party constructed device which contains or uses
the product associated with this manual
This product has been manufactured as a general-purpose part for general industries, and has not been
designed or manufactured to be incorporated in a device or system used in purposes related to human life.
Before using the product for special purposes such as nuclear power, electric power, aerospace, medicine
or passenger movement vehicles, consult with Mitsubishi Electric.
This product has been manufactured under strict quality control. However when installing the product
where major accidents or losses could occur if the product fails, install appropriate backup or failsafe
functions in the system.
When combining this product with other products, please confirm the standard and the code, or regulations
with which the user should follow. Moreover, please confirm the compatibility of this product to the system,
machine, and apparatus with which a user is using.
If in doubt at any stage during the installation of the product, always consult a professional electrical
engineer who is qualified and trained to the local and national standards. If in doubt about the operation or
use, please consult the nearest Mitsubishi Electric distributor.
Since the examples indicated by this manual, technical bulletin, catalog, etc. are used as a reference,
please use it after confirming the function and safety of the equipment and system. Mitsubishi Electric will
accept no responsibility for actual use of the product based on these illustrative examples.
This manual content, specification etc. may be changed without a notice for improvement.
The information in this manual has been carefully checked and is believed to be accurate; however, you
have noticed a doubtful point, a doubtful error, etc., please contact the nearest Mitsubishi Electric
distributor.
Registration
Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the
United States and/or other countries.
The company name and the product name to be described in this manual are the registered trademarks or
trademarks of each company.
2
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
Table of Contents
Related manuals...................................................................................................................... 14
Generic Names and Abbreviations Used in Manuals .......................................................... 20
1. Introduction 22
3. Instruction List 56
4. Devices in Detail 72
3
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
4
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
5
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
6
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
7
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
8
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
9
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
28.1 FNC224~230 LD =, >, <, <>, <=, >= / Data Comparison ....................................................... 653
28.2 FNC232~238 AND=, >, <, < >, <=, >= / Data Comparison .................................................... 656
28.3 FNC240~246 OR=, >, <, < >, <=, >= / Data Comparison ...................................................... 659
10
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
32.1 FNC280 HSCT / High Speed Counter Compare With Data Table......................................... 711
11
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
12
FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instructions Edition Table of Contents
Appendix C: Applied Instruction List [by Instruction Type/in Alphabetic Order] 890
Warranty................................................................................................................................. 900
13
FX3U/FX3UC Series Programmable Controllers Related manuals
Programming Manual - Basic & Applied Instruction Edition
Related manuals
For detailed explanation of programming (basic instructions, applied instructions and step ladder instructions)
in FX3U/FX3UC PLCs, refer to this manual.
For hardware information on the PLC main unit, special extension units, etc., refer to each associated
manual.
For acquiring manuals, contact the distributor you have purchased the product from.
~Essential manual
{Manual required depending on application
UManual with additional manual for detailed explanation
Manual Model
Manual name Contents
number name code
Manuals for PLC main unit
FX3U PLC main unit
I/O specifications, wiring and installation of the
Supplied PLC main unit FX3U extracted from the FX3U
FX3U Series
U with JY997D18801 Series Users Manual - Hardware Edition. For
Hardware Manual
product detailed explanation, refer to the FX3U Series
Users Manual - Hardware Edition.
Details about the hardware including I/O
Additional FX3U Series Users Manual
~ JY997D16501 specifications, wiring, installation and 09R516
Manual - Hardware Edition
maintenance of the FX3U PLC main unit.
FX3UC PLC main unit
I/O specifications, wiring and installation of the
PLC main unit FX3UC (D, DSS) extracted from
Supplied
FX3UC(D, DSS)Series the FX3UC Series Users Manual - Hardware
U with JY997D28601
Hardware Manual Edition. For detailed explanation, refer to the
product
FX3UC Series Users Manual - Hardware
Edition.
Details about the hardware including I/O
Additional FX3UC Series Users
~ JY997D28701 specifications, wiring, installation and 09R519
Manual Manual - Hardware Edition
maintenance of the FX3UC PLC main unit.
Programming
FX3U/FX3UC Series Items related to programming in PLCs
Additional Programming Manual - including explanation of basic instructions,
~ JY997D16601 09R517
Manual Basic & Applied Instruction applied instructions and various devices in
Edition (this manual) FX3U/FX3UC PLCs.
Terminal block
Supplied
FX INPUT AND OUTPUT
{ with JY992D50401 Terminal block handling procedures.
TERMINAL BLOCKS
product
Manuals for communication control
Common
FX Series Users Manual - Details about simple N : N link, parallel link,
Additional
{ Data Communication JY997D16901 computer link and no-protocol communication 09R715
Manual
Edition (RS instruction and FX2N-232IF).
FX3U Series Users Manual
Additional Explains the MODBUS serial communication
{ - MODBUS Serial JY997D26201
Manual network in FX3U PLCs.
Communication Edition
Communication via RS-232C/RS-422/RS-485/USB
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Items about the system configuration of USB
Supplied communication expansion board and the
FX3U-USB-BD
U with JY997D13501 driver installation method.
Users Manual
product For use, refer to the FX Series Users Manual -
Data Communication Edition.
14
FX3U/FX3UC Series Programmable Controllers Related manuals
Programming Manual - Basic & Applied Instruction Edition
~Essential manual
{Manual required depending on application
UManual with additional manual for detailed explanation
Manual Model
Manual name Contents
number name code
Handling procedures of the RS-232C
Supplied
FX3U-232-BD communication expansion board.
U with JY997D12901
Installation Manual For use, refer to the FX Series Users Manual -
product
Data Communication Edition.
Communication via RS-232C/RS-422/RS-485/USB
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Handling procedures of the RS-232C
Supplied
FX3U-232ADP communication special adapter.
U with JY997D13701
Installation Manual For use, refer to the FX Series Users Manual -
product
Data Communication Edition.
Handling procedures of the RS-232C
communication special adapter.
For the MODBUS serial communication
network, refer to the FX3U Series Users
Supplied
FX3U-232ADP-MB Manual - MODBUS Serial Communication
U with JY997D26401
Installation Manual Edition.
product
For computer link or non-protocol
communication by RS and RS2 instructions,
refer to the FX Series Users Manual - Data
Communication Edition.
Handling procedures of the RS-232C
Supplied
FX2N-232IF communication special function block.
U with JY992D73501
Hardware Manual For use, refer to the FX Series Users Manual -
product
Data Communication Edition.
Handling procedures of the RS-422
Supplied
FX3U-422-BD communication expansion board.
U with JY997D13101
Installation Manual For use, refer to the FX Series Users Manual -
product
Data Communication Edition.
Handling procedures of the RS-485
Supplied
FX3U-485-BD communication expansion board.
U with JY997D13001
Installation Manual For use, refer to the FX Series Users Manual -
product
Data Communication Edition.
Handling procedures of the RS-485
Supplied
FX3U-485ADP communication special adapter.
U with JY997D13801
Installation Manual For use, refer to the FX Series Users Manual -
product
Data Communication Edition.
Handling procedures of the RS-485
communication special adapter.
For the MODBUS serial communication
network, refer to the FX3U Series Users
Supplied
FX3U-485ADP-MB Manual - MODBUS Serial Communication
U with JY997D26301
Installation Manual Edition.
product
For N:N link, parallel link, computer link or non-
protocol communication by RS and RS2
instructions, refer to the FX Series Users
Manual - Data Communication Edition.
Handling procedures of the RS-232C/RS-485
Supplied
FX-485PC-IF conversion interface.
U with JY992D81801
Hardware Manual For use, refer to the FX Series Users Manual -
product
Data Communication Edition.
CC-Link, MELSEC I/O LINK and AS-i system
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Handling procedures of the CC-Link master
Supplied
FX2N-16CCL-M special function block.
U with JY992D93201
Hardware Manual For use, refer to the FX2N-16CCL-M Users
product
Manual.
Additional FX2N-16CCL-M Details about the CC-Link master special
{ JY992D93101 09R710
Manual Users Manual function block.
15
FX3U/FX3UC Series Programmable Controllers Related manuals
Programming Manual - Basic & Applied Instruction Edition
~Essential manual
{Manual required depending on application
UManual with additional manual for detailed explanation
Manual Model
Manual name Contents
number name code
Supplied
FX2N-32CCL Handling procedures of the CC-Link remote
{ with JY992D71801 09R711
Users Manual device station special function block.
product
Supplied Remote I/O Stations and
For remote I/O stations and remote device stations for
{ with remote device stations for
CC-Link, refer to each manual and the related data.
product CC-Link
Handling procedures of the CC-Link/LT master
Supplied FX2N-64CL-M
special function block.
U with Users Manual JY997D05401
For use, refer to the FX2N-64CL-M Users
product [Hardware Volume]
Manual [Detailed Volume].
FX2N-64CL-M
Additional Details about the CC-Link/LT master special
{ Users Manual JY997D08501
Manual function block.
[Detailed Volume]
Supplied Remote device For remote device stations, remote I/O stations, power adapter
{ with Remote I/O and dedicated power supply for CC-Link/LT, refer to each
product Power Adapter manual and the related data.
Supplied
FX2N-16LNK-M Handling procedure of the master special
{ with JY992D73701 09R709
User's Manual function block for the MELSEC I/O LINK
product
Supplied
FX2N-32ASI-M Handling procedure of the master special
{ with JY992D76901
Users Manual function block for the AS-i system.
product
Manuals for analog control
Common
Detaileds about the analog special function
FX3U/FX3UC
Additional block (FX3U-4AD, FX3U-4DA, FX3UC-4AD)
{ Users Manual JY997D16701 09R619
Manual and analog special adapter
- Analog Control Edition
(FX3U--ADP).
Analog input, temperature input and temperature control
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Supplied
FX2N-2AD Handling procedures of the 2-channel analog
{ with JY992D74701
Users Guide input special function block.
product
Handling procedures of the 4-channel analog
Supplied
FX3U-4AD input special function block.
U with JY997D20701
Installation Manual For use refer to the FX3U/FX3UC Series Users
product
Manual - Analog Control Edition.
Handling procedures of the 4-channel analog
Supplied
FX3U-4AD-ADP input special adapter.
U with JY997D13901
Installation Manual For use, refer to the FX3U/FX3UC Series
product
Users Manual - Analog Control Edition.
Handling procedures of the 4-channel analog
Supplied
FX3UC-4AD input special function block.
U with JY997D14901
Installation Manual For use refer to the FX3U/FX3UC Series Users
product
Manual - Analog Control Edition.
Supplied
FX2N-4AD Handling procedures of the 4-channel analog
{ with JY992D65201
Users Guide input special function block.
product
Supplied
FX2NC-4AD Handling procedures of the 4-channel analog
{ with JY997D07801
Users Manual input special function block.
product
Supplied Handling procedures of the 8-channel analog
FX2N-8AD
{ with JY992D86001 input (and thermocouple input) special function 09R608
Users Manual
product block.
Handling procedures of the 4-channel PT-100
Supplied
FX3U-4AD-PT-ADP temperature sensor input special adapter.
U with JY997D14701
Users Manual For use, refer to the FX3U/FX3UC Series
product
Users Manual - Analog Control Edition.
16
FX3U/FX3UC Series Programmable Controllers Related manuals
Programming Manual - Basic & Applied Instruction Edition
~Essential manual
{Manual required depending on application
UManual with additional manual for detailed explanation
Manual Model
Manual name Contents
number name code
Supplied
FX2N-4AD-PT Handling procedures of the 4-channel PT-100
{ with JY992D65601
Users Guide temperature sensor input special function block.
product
Handling procedures of the 4-channel
Supplied
FX3U-4AD-TC-ADP thermocouple input special adapter.
U with JY997D14801
Users Manual For use, refer to the FX3U/FX3UC Series
product
Users Manual - Analog Control Edition.
Supplied
FX2N-4AD-TC Handling procedures of the 4-channel
{ with JY992D65501
Users Guide thermocouple input special function block.
product
Supplied Handling procedures of the 2-channel
FX2N-2LC
U with JY992D85601 temperature control special function block.
Users Guide
product For use, refer to the FX2N-2LC Users Manual
Additional FX2N-2LC Details about the 2-channel temperature
{ JY992D85801 09R607
Manual Users Manual control special function block.
Manuals for analog control
Analog output
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Supplied
FX2N-2DA Handling procedures of the 2-channel analog
{ with JY992D74901
Users Guide output special function block.
product
Handling procedures of the 4-channel analog
Supplied
FX3U-4DA output special function block.
U with JY997D20801
Installation Manual For use, refer to the FX3U/FX3UC Series
product
Users Manual - Analog Control Edition.
Handling procedures of the 4-channel analog
Supplied
FX3U-4DA-ADP output special adapter.
U with JY997D14001
Users Manual For use, refer to the FX3U/FX3UC Series
product
Users Manual - Analog Control Edition.
Supplied
FX2N-4DA Handling procedures of the 4-channel analog
{ with JY992D65901
Users Guide output special function block.
product
Supplied
FX2NC-4DA Handling procedures of the 4-channel analog
{ with JY997D07601
Users Manual output special function block.
product
Analog I/O (mixed)
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Supplied Handling procedures of the 2-channel analog
FX0N-3A
{ with JY992D49001 input/1-channel analog output special function
Users Guide
product block.
Supplied Handling procedures of the 4-channel analog
FX2N-5A
{ with JY997D11401 input/1-channel analog output special function 09R616
Users Manual
product block.
Manuals for positioning control
High speed counter
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Supplied
FX3U-4HSX-ADP Handling procedure of the special high speed
U with JY997D16301
Installation Manual input adapter.
product
Supplied
FX2N-1HC Handling procedures of the 1-channel high
{ with JY992D65401
Users Guide speed counter special function block.
product
17
FX3U/FX3UC Series Programmable Controllers Related manuals
Programming Manual - Basic & Applied Instruction Edition
~Essential manual
{Manual required depending on application
UManual with additional manual for detailed explanation
Manual Model
Manual name Contents
number name code
Manuals for positioning control
Common
FX3U/FX3UC Series
Additional Details about the positioning function built in
{ Users Manual - JY997D16801 09R620
Manual the FX3U/FX3UC Series.
Positioning Edition
Pulse output and positioning
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Handling procedure of the special high speed
Supplied
FX3U-2HSY-ADP output adapter.
U with JY997D16401
Installation Manual For use, refer to the FX3U/FX3UC Series
product
Users Manual - Positioning Edition.
Supplied
FX2N/FX-1PG-E Handling procedures of the 1-axis pulse output
{ with JY992D65301 09R610
Users Manual special function block.
product
Supplied Handling procedures of the 1-axis pulse output
FX2N-10PG
U with JY992D91901 special function block.
Installation Manual
product For use, refer to the FX2N-10PG Users Manual.
Additional FX2N-10PG Details about the 1-axis pulse output special
{ JY992D93401 09R611
Manual Users Manual function block.
Handling procedures of the 1-axis
Supplied
FX2N-10GM positioning special extension unit.
U with JY992D77701
Users Guide For use, refer to the FX2N-10GM/FX2N-20GM
product
Hardware/Programming Manaul
Handling procedures of the 2-axis
Supplied
FX2N-20GM positioning special extension unit.
U with JY992D77601
Users Guide For use, refer to the FX2N-10GM/FX2N-20GM
product
Hardware/Programming Manual
FX2N-10GM, FX2N-20GM
Additional Details on the 1-axis/2-axis positioning special
{ Hardware/Programming JY992D77801 09R612
Manual extension unit.
Manual
Programmable cam switch
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Supplied
FX2N-1RM-E-SET Handling procedures of the programmable
{ with JY992D71101 09R614
Users Manual cam switch special extension unit.
product
Manuals for FX3U-20SSC-H positioning Block
Handling procedures of the 2-axis positioning
Supplied
FX3U-20SSC-H special function block.
U with JY997D21101 -
Installation Manual For use, refer to the FX3U-20SSC-H
product
User's Manual.
Separate FX3U-20SSC-H Describes FX3U-20SSC-H Positioning block
{ JY997D21301 09R622
volume User's Manual details.
Supplied
FX Configurator-FP Describes operation details of FX
{ with JY997D21801 09R916
Operation Manual Configurator-FP Configuration Software.
product
Other manuals
When using each product, refer also to the Users Manual - Hardware Edition of the PLC main unit to which each
product is connected.
Connector conversion
Supplied Handling procedures of the connector
FX3U-CNV-BD
U with JY997D13601 conversion expansion board for special
Installation Manual
product adapter connection.
Battery (maintenance option)
Supplied
FX3U-32BL Battery
U with JY997D14101 Battery life and handling procedures
Hardware Manual
product
18
FX3U/FX3UC Series Programmable Controllers Related manuals
Programming Manual - Basic & Applied Instruction Edition
~Essential manual
{Manual required depending on application
UManual with additional manual for detailed explanation
Manual Model
Manual name Contents
number name code
Display module
Supplied
FX3U-7DM Procedures for mounting and handling the
U with JY997D17101
User's Manual display module
product
Display module holder
Supplied
FX3U-7DM-HLD Procedures for mounting and handling the
U with JY997D15401
User's Manual display module holder
product
Memorry cassette
Supplied Memorry cassette
Specifications and operating procedures of the
U with FX3U-FLROM-16/64/64L JY997D12801
memory cassette
product Hardware Manual
Extension power supply unit
Supplied
FX3U-1PSU-5V Specifications and operating procedures of
U with JY997D22501
Installation Manual the extension power supply unit
product
Supplied
FX3UC-1PS-5V Specifications and operating procedures of
U with JY997D12201
Installation Manual the FX3UC-1PS-5V
product
19
FX3U/FX3UC Series Programmable Controllers Generic Names and Abbreviations Used in Manuals
Programming Manual - Basic & Applied Instruction Edition
20
FX3U/FX3UC Series Programmable Controllers Generic Names and Abbreviations Used in Manuals
Programming Manual - Basic & Applied Instruction Edition
21
FX3U/FX3UC Series Programmable Controllers 1 Introduction
Programming Manual - Basic & Applied Instruction Edition 1.1 Programming Language in PLCs
1. Introduction
This chapter explains basic items related to programming in FX3U and FX3UC programmable controllers
(PLCs).
1. List programming
This method is the basis of programs.
1) Features
In this method, sequence instructions are input in the form of instruction words such as "LD", "AND" and
"OUT".
This input method is the basis of sequence programs.
2) Example of list display
2. Circuit programming
In this method, ladder formats are drawn on the graphic screen.
1) Features
In a circuit program, a sequence circuit is drawn on the graphic screen by sequence formats and device
numbers. Because a sequence circuit is expressed with contact symbols and coil symbols, the contents
of a program can be understood easily.
In the circuit display status, the PLC operations can be monitored.
2) Example of circuit display
X000 X002
Y005
Y005
This input method allows sequence design in accordance with the flow of machine operations.
1) Features
In an SFC (sequential function chart) program, sequences can be designed in accordance with the flow of
machine operations.
2) Compatibility between SFC programs and other programs
SFC programs can be converted into another program format. And when list programs and circuit
programs are created according to certain rules, they can be converted inversely into SFC programs.
22
FX3U/FX3UC Series Programmable Controllers 1 Introduction
Programming Manual - Basic & Applied Instruction Edition 1.1 Programming Language in PLCs
1
1.1.2 Compatibility among programs
Introduction
All sequence programs created by the aforementioned three types are stored in the form of instruction words
(contents as at the time of list program) in the program memory inside the PLC.
Programs created by these three types of input methods can be converted mutually, and then displayed
and edited as shown in the figure below. 2
Overview
List
Circuit SFC 3
List
Instruction
4
in Detail
Devices
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
23
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.1 Introduction of Convenient Functions
1. "High speed counter" function of one phase or two phases for counting high speed inputs
One-phase high speed counters can execute counting at up to 100 kHz (or 200 kHz when a special high
speed input adapter*1 is used) regardless of the operation time because they process high speed pulses from
specific input relays as interrupts. (Two-phase high speed counters can execute counting at up to 50 kHz (or
100 kHz when a special high speed input adapter*1 is used).)
The counting result can be immediately handled as high speed counter output interrupts by specific program
processing and high speed counter counted values by comparison instructions dedicated to high speed
counters.
*1. Can only be connected to the FX3U PLC.
Related instructions: High speed counter compare;
HSCS (FNC 53), HSCR (FNC 54) and HSZ (FNC 55)
If the number of high speed counters is insufficient, special extension equipment (high speed counter
blocks) can be connected.
By extending hardware counters in the high speed counter block, high speed pulses at up to 50 kHz can be
received (except 1 and 4 edge count).
FX2N-1HC high speed counter block
3. "Input filter adjustment" function for changing the time constant of input relays
Input relays in the PLC are equipped with a C-R filter of approximately 10 ms as countermeasures against
chattering and noise in input signals. Because a digital filter is adopted for the input relays X000 to X017*1,
however, the filter value can be changed in sequence programs.
Related instruction: Refresh and filter adjust instruction REFF (FNC 51)
*1. X000 to X007 in the FX3U-16M, FX3UC-16M.
24
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.1 Introduction of Convenient Functions
1
5. Three types of "interrupt" functions for receiving short-period pulses and priority
Introduction
processing
Refer to Chapter 35.
1) Input interrupt
Signals from specific input relays are monitored. At the rising edge or falling edge of the monitored input,
a specified interrupt routine is executed with highest priority. 2
Overview
2) Timer interrupt
Specified interrupt routines are executed with highest priority at every specified time.
3) Counter interrupt
Depending on the present value of a high speed counter, a specified interrupt routine is executed with
highest priority.
3
List
Instruction
2.1.2 Convenient functions for output processing
in Detail
Devices
I/O refresh instruction can get the latest input information and immediately output the operation result during
sequence operation.
Related instruction: Refresh REF (FNC 50)
Constant
Device &
Specified the
3. "Positioning" function for positioning control
Related instructions: DOG Search Zero Return DSZR (FNC150),
Interrupt Positioning DVIT (FNC151), Zero Return (FNC156),
Variable Speed Pulse Output PLSV (FNC157),
Drive to Increment DRVI (FNC158) and
6
Programming
Before
Drive to Absolute DRVA (FNC159)
1. "Constant scan" mode for making the operation cycle of the PLC constant 7
The operation cycle in the PLC adopting the cyclic operation method varies depending on the contents of the
Instruction
Basic
program execution.
In the constant scan mode (M8039 and D8039), the operation cycle can be made constant. As a result,
instructions executed in synchronization with the operation can be processed in a constant cycle.
2. "All outputs disable" mode for turning OFF all output signals
When the special auxiliary relay M8034 is driven, the output latch memory is cleared. Accordingly, all output
8
Program Flow
FNC00-FNC09
relays (Y) turn OFF while the PLC is continuing its operation.
However, the status of output relays (Y) in each device image memory is not cleared. As a result, when
devices are monitored using a programming tool, they may be regarded as the ON status.
3. "Memory hold stop" function for holding the output status during the RUN mode even in the
STOP mode 9
When the special auxiliary relay M8033 is driven, the PLC is stopped while the output status during the RUN
Move & Compare
FNC10-FNC19
mode is held.
10
Operation
Arith. & Logic
FNC20-FNC29
25
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.2 Introduction of Applied Instructions
26
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.2 Introduction of Applied Instructions
1
Multiplication (MUL/FNC 22) 7. Handy instructions and instructions for
Introduction
Division (DIV/FNC 23) external devices
Increment (INC/FNC 24) Initial state (IST/FNC 60)
Square root (SQR/FNC 48) Teaching timer (TTMR/FNC 64)
Trigonometry (FNC130 to FNC135) Alternate state (ALT/FNC 66) 2
Conversion from/to floating point Ramp variable value (RAMP/FNC 67)
Overview
(FNC 49, FNC118, FNC119 and FNC129) Rotary table control (ROTC/FNC 68)
Floating point arithmetic operations Ten-key input (TKY/FNC 70)
(FNC120 to FNC123)
Digital switch (thumbwheel input)
Floating point square root (ESQR/FNC127)
Refer to Chapter 10, Chapter 12 and
(DSW/FNC 72) 3
Seven-segment decoder (SEGD/FNC 73)
List
Instruction
Chapter 18.
Seven-segment with latch (SEGL/FNC 74)
4. Rotation and shift operation ASCII code data input (ASC/FNC 76)
Rotation right (ROR/FNC 30) BFM Read, BFM Write(FNC 78, FNC 79,
Rotation left (ROL/FNC 31) FNC278, and FNC279)
4
Rotation right with carry (RCR/FNC 32) Serial communication (FNC 80 and FNC 87)
in Detail
Devices
Rotation left with carry (RCL/FNC 33) Inverter communication (FNC270 to FNC274)
Bit shift right (SFTR/FNC 34) Hexadecimal to ASCII conversion
Bit shift left (SFTL/FNC 35) (ASCI/FNC 82)
ASCII to hexadecimal conversion
Word shift right (WSFR/FNC 36)
(HEX/FNC 83) 5
Word shift left (WSFL/FNC 37)
Constant
Device &
Specified the
Refer to Chapter 11. Cyclic redundancy check (CRC/FNC188)
Random number generation (RND/FNC184)
5. Data operation
Real time clock control (FNC160 to FNC167)
Zone reset (ZRST/FNC 40)
Hour meter (HOUR/FNC 169)
Decode (DECO/FNC 41)
Timing pulse generation (DUTY/FNC186)
6
Programming
Before
Encode (ENCO/FNC 42)
Logging R and ER (LOGR/FNC293)
Sum of active bits (SUM/FNC 43) Refer to Chapter 14, Chapter 15,
Mean (MEAN/FNC 45) Chapter 16, Chapter 21, Chapter 24, Chapter
30, Chapter 31 and Chapter 33.
Word to byte (WTOB/FNC141) and byte to
word (BTOW/FNC142) 8. Complicated control 7
4-bit linking/grouping of word data
Instruction
Basic
Search a data stack (SER/FNC 61)
(FNC143 and FNC144)
Sort tabulated data (FNC 69 and FNC149)
Limit control (LIMIT/FNC256)
PID control loop (PID/FNC 88)
Dead band control (BAND/FNC257) Refer to Chapter 14, Chapter 16 and
Zone control (ZONE/FNC258) Chapter 19. 8
Block data operation (FNC192 to FNC199)
Program Flow
FNC00-FNC09
9. Positioning control
Character string control (FNC200 to FNC209)
Dog search zero return (DSZR/FNC150)
Refer to Chapter 12, Chapter 19,
Chapter 25, Chapter 26 and Chapter 29. Interrupt positioning (DVIT/FNC151)
Batch data positioning mode (TBL/FNC152)
6. High speed processing
Absolute present value read (ABS/FNC155)
9
Refresh (REF/FNC 50)
Move & Compare
FNC10-FNC19
27
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.3 Analog/Positioning Special Control
2. Positioning control
SSCNET - Positioning Block.
Pulse output block (controlled by sequence
program)
Positioning unit (controlled by instructions
dedicated to positioning)
Cam switch (resolver detection)
Refer to the respective product manual.
28
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.4 Link and Communication
1
8. No-protocol communication
Introduction
No-protocol serial communication is available
between an FX PLC and interface equipment in
accordance with RS-232C/RS-485 such as bar
code reader, printer, personal computer and
measuring instrument.
Refer to the Data Communication Edition.
2
Overview
9. Inverter communication
An FX PLC can control up to eight inverters via
communication in accordance with RS-485.
Related instructions: IVCK (FNC270)
IVDR (FNC271) 3
IVRD (FNC272)
List
Instruction
IVWR (FNC273)
IVBWR (FNC274)
Refer to the Data Communication Edition.
in Detail
Devices
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
29
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.5 Introduction of Devices Constructing PLC
Input terminal or
input connector
Input relay: X
Input relays function as receiving ports when the PLC receives signals from external
input switches.
The assigned device mnemonic is "X".
The PLC has built-in input relays in accordance with its scale.
1234
Counter: C
Auxiliary relay: M Output relay: Y
There are many
There are many counters inside the Output relays
auxiliary relays PLC. function as ports
inside the PLC. when the PLC
The assigned drives external
The assigned device mnemonic loads.
device mnemonic is "C".
is "M". Timer: T There are many
There are many output relays inside
timers inside the the PLC.
State relay: S The assigned
PLC.
There are many device mnemonic
state relays inside The assigned
device mnemonic is "Y".
the PLC.
is "T".
The assigned
device mnemonic
is "S".
30
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.5 Introduction of Devices Constructing PLC
1
2.5.2 Device list
Introduction
1. Input relays (X) and output relays (Y) 4. Timers (T)
Refer to Section 4.2. Refer to Section 4.5.
Input relay numbers and output relay numbers
in octal are assigned to each main unit in the
A timer adds and counts clock pulses of 1, 10
or 100 ms, and its output contact turns ON or
2
Overview
way "X000 to X007, X010 to X017 , Y000 to OFF when the counted result reaches a
Y007, Y010 to Y017 " specified set value.
The input relay (X) numbers and output relay A timer can count from 0.001 to 3276.7
(Y) numbers in extension units and extension seconds depending on the clock pulse.
blocks are also serial numbers in octal
respectively in the order of connection to the
The timers T192 to T199 are dedicated to
subroutines and interrupt routines.
3
main unit.
List
Instruction
The timers T250 to T255 are retentive type
A digital filter is applied to the input filter of base clock timers for 100 ms pulses. It means
specific input relays, and the filter value can that the present value is retained even after
be changed by a program. Accordingly, for a the timer coil drive input turns OFF. And when
purpose requiring high speed receiving, the drive input turns ON again, a retentive type
assign such input relay numbers. timer will continue its counting from where it 4
(Refer to explanation of filter adjustment, input left off.
in Detail
Devices
interrupt, high speed counter, various applied
instructions, etc.) 5. Counters (C)
The following types of counters are provided, and
2. Auxiliary relays (M) can be used in accordance with the purpose or
Refer to Section 4.3. application.
5
Relays built into the PLC are auxiliary relays, 1) For latched (battery backed up) counters
Constant
Device &
Specified the
and are used for programs. Different from I/O Refer to Section 4.6.
relays, auxiliary relays cannot receive external Counters are provided for internal signals of
inputs or directly drive external loads. the PLC, and their response speed is usually
There are latched (battery backed) type relays tens of Hz or less.
whose ON/OFF status is stored even if the
PLC turns OFF.
- 16-bit counter: Provided for up-counting,
counting range: 1 to 32767
6
Programming
Before
- 32-bit counter: Provided for up-counting
3. State relays (S) and down-counting, counting range:
Refer to Section 4.4. 2,147,483,648 to +2,147,483,647
State relays are used in the step ladder or as 2) For latched (battery backed up) high speed
process numbers in the SFC expression.
When a state relay is not used as a process
counters
Refer to Section 4.7.
7
Instruction
Basic
number, it can be programmed as a general High speed counters can execute counting at
contact/coil in the same way as an auxiliary several kHz without regard to operations in
relay. the PLC.
- 32-bit counter: Provided for up-counting
State relays can be used as annunciators for
and down-counting, counting range:
external fault diagnosis.
2,147,483,648 to +2,147,483,647 (1- 8
phase 1-counting, 1-phase 2-counting and
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
31
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.5 Introduction of Devices Constructing PLC
9. Pointers (P)(I)
Refer to Section 4.11.
Pointers are classified into branch pointers and
interrupt pointers.
A branch pointer (P) specifies the jump
destination of the conditional jump CJ (FNC
00) or the call subroutine CALL (FNC 01)
instruction.
An interrupt pointer (I) specifies the routine of
an input interrupt, timer interrupt or counter
interrupt.
10.Constants (K)(H)(E)
Refer to Chapter 5.
Constant numerical values used in the PLC, "K"
indicates a decimal integer value, "H" indicates a
hexadecimal value, and "E" indicates a real
number (floating point data).
Constants are used as set values or present
values of timers and counters, or operands for
applied instructions.
32
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.6 Program Memory and Devices (Battery Backed)
1
2.6 Program Memory and Devices (Battery Backed)
Introduction
2.6.1 Memory structure
FX3U/FX3UC PLCs are supplied with RAM memory. 2
By mounting an optional memory device, the memory type can be changed.
Overview
1. When using the built-in memory (without attached optional memory)
List
Instruction
Built-in device memory (RAM)
[Bit device memory] [Data memory]
Contact image memory Data register (D)
Input relay (X) Output relay (Y) Timer present value register (T)
Auxiliary relay (M) State relay (S)
Timer contact and time counting coil
Counter present value register (C)
Index register (V, Z)
4
in Detail
Devices
Counter contact, counting coil, and reset coil
Extension register (R)
Optional memory
Built-in program memory
(flash memory)
(RAM)
Parameter
5
Constant
Device &
Specified the
Sequence program
Not attached
Comment
File register (D)
6
Programming
Before
2. When using an attached optional memory (without using the built-in memory)
Instruction
Basic
Built-in device memory (RAM)
[Bit device memory] [Data memory]
Contact image memory Data register (D)
Input relay (X) Output relay (Y) Timer present value register (T) 8
Auxiliary relay (M) State relay (S) Counter present value register (C)
Program Flow
FNC00-FNC09
Parameter
Sequence program
Not used
Comment
Attachment of an optional memory is automatically
recognized (when the power is ON), and the built-in
File register (D) 10
program memory is disconnected.
Operation
Arith. & Logic
FNC20-FNC29
(The priority is given to the optional memory.) Extension file register (ER)
33
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.6 Program Memory and Devices (Battery Backed)
1. Backup operation
The operations of the data memory, bit device memory and program memory in FX3U/FX3UC PLCs are
classified as shown below:
1) Types of program memory
Power
Item Power OFF STOPRUN RUNSTOP
OFFON
Parameter Does not change.*1
Sequence program Does not change.*1
Comment Can be secured by Does not change.*1
File register parameter setting. Does not change.*1
Extension file
File type Does not change.
register (ER)*4
Index register (V, Z) V, Z Cleared. Does not change.
Does not change. Cleared.
For 100 ms Cleared.
Does not change while M8033 is ON.
Does not change. Cleared.
For 10 ms Cleared.
Timer present value Does not change while M8033 is ON.
register (T)
Retentive type for 100 ms
(battery backed) Does not change.*2
Present value
Clock data
(battery backed) Does not change.*2
*1. Values become undefined when the battery voltage becomes lower than the holding voltage if not stored
in an attached memory cassette.
*2. Values become undefined when the battery voltage becomes lower than the holding voltage.
*3. Some devices are cleared when the PLC status switches from STOP to RUN.
For special data registers, refer to Chapter 36.
*4. An optional memory cassette is required.
34
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.6 Program Memory and Devices (Battery Backed)
1
3) Types of bit device memory
Introduction
Power
Item Power OFF STOPRUN RUNSTOP
OFFON
Does not
Cleared.
Input relay (X) Cleared.
change.
Does not change while M8033
2
Overview
is ON.
Does not
Cleared.
change.
Output relay (Y) Cleared.
Does not change while M8033
Does not
is ON.
3
Cleared.
List
Instruction
Contact image General type auxiliary relay change.
memory Cleared.
(M) Does not change while M8033
(X, Y, M, S) is ON.
latched (battery backed) type
Does not change.
auxiliary relay (M)
Special type auxiliary Set to initial
4
Cleared. Does not change.*1
in Detail
Devices
relay (M) values.*1
General type state relay (S) Does not change.
latched (battery backed) type
Does not change.
state relay (S)
Annunciator (S) Does not change. 5
Does not
Constant
Device &
Specified the
Cleared.
change.
For 100 ms Cleared.
Does not change while M8033
is ON.
Timer contact Does not
Cleared.
Time counting coil
(T)
For 10 ms Cleared.
change.
6
Does not change while M8033
Programming
Before
is ON.
Retentive type for
Does not change.
100 ms
Retentive type for 1 ms Does not change.
Does not
Cleared. 7
change.
Instruction
Basic
General type Cleared.
Does not change while M8033
is ON.
Does not
Counter contact Cleared.
change.
Counting coil latched (battery backed) type Cleared.
Reset coil (C) Does not change while M8033
is ON.
8
Program Flow
FNC00-FNC09
Does not
Cleared.
change.
High speed type Cleared.
Does not change while M8033
is ON.
*1. Some devices are cleared when the PLC status switches from STOP to RUN. 9
For special auxiliary relay names and definitions, refer to Chapter 36.
Move & Compare
FNC10-FNC19
Caution
When the battery voltage becomes low due to expiration of life or other reasons, programs (not stored in a
memory cassette), latched (battery backed) type devices and clock values become undefined. When they
become undefined, clear latched type devices, download the program again (without using a memory
cassette), and then set the initial values and clock if necessary.
10
For a rough guide to the life and replacement of the battery, refer to the respective PLC Users
Operation
Arith. & Logic
FNC20-FNC29
35
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.6 Program Memory and Devices (Battery Backed)
Item Description
Latched (battery
A lithium battery backs up the RAM memory, devices (battery backed) and clock data built in the PLC.
backed) contents
Rough guide of the life is 5 years (when the ambient temperature is 25C).
Maintenance
For rough guide of the replacement, refer to the Users Manual [Hardware Edition] of each PLC.
1) When the battery life is expired, sequence programs and other latched (battery backed) contents
are lost.
Cautions
2) When an optional memory cassette (flash memory) is mounted, it is not necessary to back up
sequence programs by the battery.
Item Description
Latched (battery 1) The flash memory built into the memory cassette backs up sequence programs.
backed) contents 2) A battery is required to back up latched (battery backed) devices and clock data from failure.
Maintenance Maintenance is not necessary.
The upper limit is set to the number of times for overwriting.
Cautions
(Refer to the Hardware Edition of the main unit.)
2.6.4 Change between general devices and latched (battery backed) devices
1. When using latched (battery backed) type devices as non-latch type devices
In FX3U/FX3UC PLCs, some latched (battery backed) type devices can be changed into non-latch type
devices by the parameter settings described later.
Devices dedicated to latched type cannot be changed into non-latch type devices even by the parameter
settings. Such devices can be handled as non-latch type devices by clearing all latched (battery backed) type
devices by the initial pulse (M8002) in a program.
2. When using non-latch type devices as latched (battery backed) type devices
In FX3U/FX3UC PLCs, non-latch type devices can be changed into latched (battery backed) type devices by
the parameter settings described later.
36
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.6 Program Memory and Devices (Battery Backed)
1
2. ZRST (FNC 40) instruction (zone reset)
Introduction
The ZRST instruction can clear multiple devices all at once.
(Because only a limited device range can be specified for the ZRST instruction, only a part of the latched type
devices can be cleared at a time.)
Program example: This program clears latched (battery backed) type devices for the ranges shown in the
table below. 2
Overview
Clear input
Latched (battery backed) type FNC 40 M500 M7679
device range ZRST
List
Instruction
Timer T246~T255 FNC 40 T246 T255
ZRST
C100~C199,
Counter
C220~C255 FNC 40 C100 C199
ZRST
Data register D200~D7999
FNC 40
ZRST
C220 C255 4
in Detail
Devices
FNC 40 D200 D7999
ZRST
For details on the ZRST (FNC 40) instruction, refer to Section 12.1.
For details on latched (battery backed) type devices, refer to Subsection 2.6.2 and Chapter 4.
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
37
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
38
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1
Classification Item Description
Introduction
This parameter sets interrupt inputs for the maximum speed, bias speed, creep speed,
Constant
zero return speed, acceleration time, deceleration time, and DVIT instruction.
Positioning setting
It is necessary to set the memory capacity.
setting
Detailed This parameter sets the operation table.
setting It is necessary to set the memory capacity. 2
This parameter sets protection to prevent erroneous read/incorrect write protection of a
Overview
sequence program. The entry code can be specified in 8 hexadecimal characters
Entry code among A to F and 0 to 9.
Others In FX3U and FX3UC PLCs Ver.2.20 or later, the second entry code (in 8 characters) can
be added to allow specification of the entry code in 16 characters.
Program title This parameter enables to set a character string to be used as the program title.
3
*1. X000 to X007 in the FX3U-16M, FX3UC-16M.
List
Instruction
2.7.2 Parameter initial values and available tools for changing parameter values
in Detail
Devices
GX
Item Developer Setting range GOT-F900
Initial value FX-10P(-E)*1 FX-PCS/ Series*2
*1 ET-940
FX-20P(-E)*1 WIN(-E)
Series*3
Program capacity 16000*4 2000 8000 8000 5
Constant
Device &
Specified the
Katakana character
0 0 0
comment capacity
Refer to
Memory File register capacity 0 0 0 0
Subsection
capacity (steps)
Special unit initial 2.7.3.
Not used
value setting*5
6
Positioning setting*5 Not used
Programming
Before
Auxiliary relay [M] 500 to 1023 0 to 1023 500 to 1023
State relay [S] 500 to 999 0 to 999 500 to 999
Latch range
Counter [C] (16 bits) 100 to 199 0 to 199 100 to 199
(battery backed)
Counter [C] (32 bits)
Data register [D]
220 to 255
200 to 511
200 to 255
0 to 511
220 to 255
200 to 511
7
Instruction
Basic
Program title Not registered Not registered
Entry code Not registered Not registered Not registered
Batteryless mode OFF Refer to OFF
Subsection
Modem initialization specification Not set Not set
RUN terminal input OFF
2.7.1.
Not used Not used (X0)
8
Program Flow
FNC00-FNC09
*1. These programming tools are not applicable to FX3U/FX3UC PLCs. The initial values in FX2N PLCs are
shown above.
*2. Parameter values can be changed only by the F940WGOT, F94GOT and F94 handy GOT.
*3. Only manuals in Japanese are available for the ET-940 Series.
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
39
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1) With regard to the comment capacity, up to 50 device comments can be set in one block.
2) With regard to the file register capacity, up to 500 (16-bit) file registers can be set in one block.
3) In the special unit initial value setting*1, 8 blocks (4000 steps) are used.
4) In the positioning setting*1, 18 blocks (9000 steps) are used.
*1. GX Developer Ver.8.23Z or later is applicable.
Caution
After changing the memory capacity setting, make sure to write both the programs and parameters to the
PLC.
If only the parameters are written to the PLC, program errors (such as parameter error, circuit error and
grammar error) may occur in the PLC.
40
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1
2.7.5 Entry code
Introduction
By registering the entry code in a PLC, the functions of programming tools, display modules, and display units
to change programs, monitor devices, and current value changing function in the PLC can be restricted
(access restriction).
For the operations and restricted functions of display modules,
refer to the PLC main unit Hardware Edition.
2
Overview
For the operations and restricted functions of display units,
refer to the respective display unit manual.
List
Instruction
characters versions
FX-20P(-E) /WIN(-E) ET-940 Series*2
Only reset of
0 to 9 and Ver.1.00 or Ver.2.00A
Entry code 8 Applicable Applicable Applicable entry code is
A to F later or later*1 allowed
8 (16 characters 4
which combined
in Detail
Devices
Second 0 to 9 and Ver.2.20 or Ver.8.23Z Not Not Not
keyword <entry Applicable
entry code A to F later or later applicable applicable applicable
code> and 2nd
keyword)
*1. Ver.2.00A or later support FX series PLC, however, Ver.8.13P or later is required for FX3UC series
PLCs and Ver.8.23Z or later is required for FX3U PLCs. 5
*2. Only manuals in Japanese are available for the ET-940 Series.
Constant
Device &
Specified the
The security by keyword (entry code) and 2nd keyword has its limits and is not always perfect.
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
41
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
2) When a programming tool or GOT does not support the second entry code
All online operations are disabled. The entry code cannot be changed or reset, and the
PLC memory cannot be cleared.
1) When using handy programming panel FX-10P(-E)/FX-20P(-E)
The programming tool performs the following operations in accordance with the head
character of the entry code (in 8 characters):
Head Program
Present value
character of Monitoring
Read Write change
entry code
All operations
A,D to F,0 to 9
When only the entry code is prohibited
set Read/Incorrect
write B 3 3
protection
Erroneous
C 3 3 3
write prohibited
2) When using any programming tool, data access unit or GOT other than the FX-10P(-E)/
FX-20P(-E)
Read/Incorrect write protection is set for all entry codes.
When neither the entry code
All operations are enabled.
nor second entry code are set
The entry codes are provided to restrict access from peripheral equipment to programs created by the
user. Take care to save/remember the entry codes.
If a registered entry code is forgotten, the online operations from the programming tool to the PLC are
disabled depending on the programming tool type and the contents of the registered entry code.
42
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1
Registering and changing the entry codes
Introduction
This section explains the operating procedure of GX Developer (Ver.8.23Z)
For the entry code registration/change procedure in FX-10P(-E), FX-20P(-E), and FX-PCS/WIN(-E),
refer to the manual of each product.
Overview
2. Set the entry code, second entry code*1, and registration condition*1.
List
Instruction
4
in Detail
Devices
Set item Contents of setting Remarks
Input 8 characters. Available
Keyword
characters are A to F and 0 to 9. 5
Input 8 characters. Available
Constant
Device &
Specified the
2nd Keyword*1 characters are A to F and 0 to 9.
Before setting the second entry code, set the entry code first.
Programming
Before
later.
Caution on registering the entry code
The entry codes are provided to restrict access from peripheral equipment to programs created by the
users. Keep the entry codes carefully.
If a registered entry codes is forgotten, the online operations from a programming tool to the PLC are
7
Instruction
Basic
disabled depending on the programming tool type and the contents of the registered entry code.
9
5. Click [OK] to register the entry codes to the PLC.
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
43
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1. Select [Online]-[Read from PLC...]/[Write to PLC...] to open "Input current keyword." dialog
box.
2. Input the entry code and second entry code*1 currently registered in the PLC.
*1. The second entry code can be set in FX3U and FX3UC PLCs Ver.2.20 or later.
3. Click [Execution] button to verify the entry codes you have input with the entry codes
currently registered in the PLC.
When the entry code inputs are verified, the PLC executes "Read from PC" or "Write to PC".
When the entry code inputs are not verified, the PLC does not execute "Read from PC" or "Write to PC".
2. Input the entry code and second entry code currently registered in the PLC.
3. Click [Execution] button to verify the entry codes you have input with the entry codes
currently registered in the PLC.
When the entry code inputs are verified, the PLC executes "Keyword Cancel".
When the entry code inputs are not verified, the PLC does not execute "Keyword Cancel".
44
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1
Resetting the entry codes, and validating the reset entry codes (Keyword Protect)
Introduction
This section explains the operating procedure of GX Developer (Ver.8.23Z)
For the entry code reset procedure in FX-10P(-E), FX-20P(-E), and FX-PCS/WIN(-E),
refer to the manual of each product.
Overview
2. Input the entry code and second entry code.
List
Instruction
4
in Detail
Devices
Set item Contents of setting
Keyword Input 8 characters. Available characters are A to F and 0 to 9.
Keyword Disable
2nd Keyword*1 Input 8 characters. Available characters are A to F and 0 to 9.
5
Keyword Protect*1 Reset entry codes are made valid again.
Constant
Device &
Specified the
*1. The second entry code and entry code protect function can be set in FX3U/FX3UC PLCs Ver.2.20 or
later.
3. Click [Execution] button to reset the entry codes or validate the reset entry codes again.
6
2.7.6 Special unit initial value setting [GX Developer Ver.8.23Z or later]
Programming
Before
The initial values of the buffer memory (BFM) in special function blocks/units connected to an FX3U/FX3UC
PLC (Ver.2.20 or later) can be set as a parameter in GX Developer (Ver.8.23Z or later).
7
Instruction
Basic
When this parameter is used, it is not necessary to execute initial setting in a user program for special
function blocks/units requiring initial setting. The special unit initial value setting uses 4000 steps (8 blocks) in
the memory capacity.
For the setting procedure, refer to Subsection 2.7.8.
2.7.7 Positioning setting [for TBL (FNC152) instruction] [GX Developer Ver.8.23Z or later] 8
Program Flow
FNC00-FNC09
In the positioning setting in an FX3U/FX3UC PLC (Ver.2.20 or later), table and constants for added TBL
(FNC152) instruction can be set. Make sure to set this parameter when using TBL (FNC152) instruction. 9
The positioning setting for TBL (FNC152) instruction uses 9000 steps (18 blocks) in the memory capacity.
Move & Compare
FNC10-FNC19
For details on TBL (FNC152) instruction, refer to the Positioning Control Manual.
For the setting procedure, refer to the Positioning Control Manual or Subsection 2.7.8.
10
Operation
Arith. & Logic
FNC20-FNC29
45
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
46
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1
3
Introduction
Setting devices
1. Click "Device" tab, and set devices.
Overview
3
List
Instruction
4
in Detail
Devices
Set item Contents of setting Setting range
Supplemental relay Set the latched (battery backed) auxiliary relay range. Initial value: 500 to 1023 0 to 1023 5
Constant
Device &
Specified the
State Set the latched (battery backed) state relay range. Initial value: 500 to 999 0 to 999
Timer The setting displayed here cannot be changed.
Counter (16bit) Set the latched (battery backed) 16-bit counter range. Initial value: 100 to 199 0 to 199
Counter (32bit) Set the latched (battery backed) 32-bit counter range. Initial value: 220 to 255 220 to 255
Data register Set the data register range (battery backed). Initial value: 200 to 511 0 to 511
All extension registers are latched (battery backed).
6
Extended register
This setting is fixed, and cannot be changed.
Programming
Before
4 Setting the PC name
1. Click "PLC name" tab, and input the program title.
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
47
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
5 Assigning I/Os and setting the initial values for special unit
1. Click "I/O assignment" tab, and then set the I/O assignment and special function blocks/
units.
When inputting "Special Unit" field, it is necessary to put a check mark to "Special Function
Block Settings" on "Memory capacity" tab.
48
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1
2. On "Special Function Block Settings" dialog box, set the initial values of special function
Introduction
blocks and units.
Overview
3
List
Instruction
4
in Detail
Devices
Set item Contents of setting Setting range
"Unit No." tab Select the unit number of a special function block/unit to be set.
Set the name of a special function block/unit whose initial values are to
32 half-width 5
characters
Constant
Device &
Specified the
Unit Name be set.
(or 16 full-width
(The contents set on "I/O assignment" tab are displayed.)
characters)
This column indicates the order of initial value setting in the selected unit
No. number.
Numbers 1 to 98 can be set.
Set the buffer memory address (BFM number) in a decimal value whose
6
Address *1
Programming
Before
initial value is to be set.
This column is displayed when device comments are registered.
Comment On the above screen, "Input mode of CH1 to CH4" is registered as the
device comment for "U0\G0" (unit No. 0, BFM #0).
Set a value to be set as the initial value of the buffer memory address
Value (BFM number). *2 7
Set the data length and type of the set value in "Size/Type" column.
Instruction
Basic
Select the size and type of a value set to the buffer memory among the
following:
16bit/DEC
Size/Type
32bit/DEC
16bit/HEX
32bit/HEX 8
Insert This button inserts a line in the currently selected position.
Program Flow
FNC00-FNC09
Identification code Set the model code of the special function block/unit. *3
*1. Input buffer memory addresses (BFM numbers) that in the connected special function block/unit hold.
*2. To each buffer memory address (BFM number), set a value within the allowed range in the connected
special function block/unit.
*3. Refer to the manual of the connected special function block/unit. 10
Operation
Arith. & Logic
FNC20-FNC29
3. Click [End] button to finish the setting and close "Special Function Block Settings" dialog
box.
49
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
50
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1
7
Introduction
Setting the PLC system (2)
1. Click "PLC system (2)" tab.
2. Only when a latch (battery backed) area for a serial port exists through an extended PLC,
select a channel to be set and put a check mark to "Operate communication setting." 2
When not performing the communication setting for a serial port, do not put a check mark
Overview
to "Operate communication setting."
Channel selection 3
List
Instruction
4
in Detail
Devices
5
Constant
Device &
Specified the
Set item Contents of setting Setting range
Channel selection Select a channel in which a serial port is set. CH1,CH2
Put a check mark when using the selected serial port in "computer link",
Operate communication
"no-protocol communication" or "inverter communication". 6
Do not put a check mark when transferring and monitoring sequence
setting
Programming
Before
programs in GX Developer or when using the selected serial port in
simple N : N link or parallel link.
Protocol
Data length
Parity
7
Stop bit
Instruction
Basic
Transmission speed
Header
Terminator
Set each item in accordance with application.
Control line For details on each item, refer to the Data Communication Edition manual.
H/W type 8
Program Flow
FNC00-FNC09
Control mode
Sum check
Transmission control
procedure
Station number setting
Time out judge time
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
51
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
8 Setting positioning
The positioning setting function is available in FX3U/FX3UC PLCs Ver.2.20 or later.
52
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
Introduction
Set item Contents of setting Set range
Set the bias speed for each output number of pulse. 1/10 or less of the
Bias speed [Hz]
Initial value: 0 maximum speed
Set the maximum speed for each output number of pulse.
Max. speed [Hz] *1
Initial value: 100,000
Set the creep speed in DSZR (FNC150) instruction for each output
2
Creep speed [Hz] number of pulse. *2
Overview
10 to 32767
Initial value: 1000
Set the zero point return speed in DSZR (FNC150) instruction for each
Zero return speed [Hz] output number of pulse. *1
Initial value: 50000
List
Instruction
Set the deceleration time for each output number of pulse.
Deceleration time [ms] 50 to 5000
Initial value: 100
Set the interrupt input*3 for DVIT (FNC151) instruction for each output
number of pulse. Specify a user interrupt command device (M) for a
in Detail
Devices
Pulse output destination Y001: X001 X000 to X007, M8461
Pulse output destination Y002: X002 X000 to X007, M8462
Pulse output destination Y003*4: X003 X000 to X007, M8463
Y0 They are set items for the pulse output destination Y000.
Y1 They are set items for the pulse output destination Y001. 5
Y2 They are set items for the pulse output destination Y002.
Constant
Device &
Specified the
Y3*4 They are set items for the pulse output destination Y003.
This button displays "Positioning instruction settings" dialog box for
Individual setting setting the table used in TBL (FNC152) instruction.
For the setting procedure, refer to the next step.
*1. The setting range is from 10 to 100,000 Hz in FX3U/FX3UC PLCs. 6
The setting range is from 10 to 200,000 Hz in FX3U PLCs when the pulse output destination is the
Programming
Before
FX3U-2HSY-ADP.
*2. The creep speed should satisfy the relationship "Bias speed Creep speed Maximum speed."
*3. An interrupt input set here cannot be used jointly with a high speed counter, input interrupt, pulse
catch input, input in SPD (FNC 67) instruction, or interrupt input in DVIT (FNC151) instruction.
7
*4. Y003 cannot be set in FX3U PLCs except when two FX3U-2HSY-ADP units are connected.
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
53
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
3. Click [Individual setting] button to display "Positioning instruction settings" dialog box.
In this dialog box, set the positioning table for each pulse output destination.
54
FX3U/FX3UC Series Programmable Controllers 2 Overview (Sequence Program)
Programming Manual - Basic & Applied Instruction Edition 2.7 Types and Setting of Parameters
1
Set item Contents of setting Setting range
Introduction
A check mark here means not to transfer the positioning setting when
PLC turns ON.
Positioning table settings will
Put a check mark when changing the positioning setting from a display
not be initialized when the
unit, etc., and then using the changed contents even after restoring the
PLC is powered on
power. At this time, set a latched (battery backed) type device to "Head
Address". 2
Overview
This button writes from "Head Address" up to 1600 devices, the contents
Write
of the positioning table created here
This button reads the existing positioning table contents starting from
Read "Head Address" up to 1600 devices but does not read the device
numbers without "positioning instruction" set.
*1. Y003 cannot be set in FX3UC PLCs except when two FX3U-2HSY-ADP units are connected to FX3U 3
PLCs.
List
Instruction
9 Transferring parameters (and sequence program) to the PLC
1. Select [Online]-[Write to PLC...] from the tool menu to display "Write to PLC" dialog box.
4
in Detail
Devices
FX3U(C)*1
Constant
Device &
Specified the
6
Programming
Before
*1. For Ver. 8.13P to 8.24A of GX Developer, the PLC type is FX3UC.
Instruction
Basic
The selected contents are transferred to the PLC.
The transferred parameters become valid when the PLC switches from RUN to STOP.
When the communication setting is changed in step 7 "PLC system (2)", restore the PLC power.
Caution
8
After changing the memory capacity setting, make sure to write both the programs and parameters to the
Program Flow
FNC00-FNC09
PLC.
If only the parameters are written to the PLC, program errors (such as parameter error, circuit error and
grammar error) may occur in the PLC.
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
55
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.1 Basic Instructions
3. Instruction List
This chapter introduces a list of instructions available in programming.
Instructions added in FX3U and FX3UC PLCs are shaded in the list.
Contact Instruction
Initial logical operation
Applicable devices
LD Load contact type NO X,Y,M,S,D.b,T,C Section 7.1
(normally open)
Initial logical operation
LDI Load Inverse Applicable devices contact type NC X,Y,M,S,D.b,T,C Section 7.1
(normally closed)
Parallel connection of NO
OR OR X,Y,M,S,D.b,T,C Section 7.4
Applicable devices (normally open) contacts
Parallel connection of NC
ORI OR Inverse X,Y,M,S,D.b,T,C Section 7.4
Applicable devices (normally closed) contacts
Parallel connection of
ORP OR Pulse X,Y,M,S,D.b,T,C Section 7.5
Applicable devices Rising edge pulse
Parallel connection of
ORF OR Falling Pulse X,Y,M,S,D.b,T,C Section 7.5
Applicable devices Falling/trailing edge pulse
56
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.1 Basic Instructions
Introduction
Mnemonic Name Symbol Function Applicable devices Reference
Connection Instruction
Serial connection of
ANB AND Block Section 7.7
multiple parallel circuits
2
Overview
Parallel connection of
ORB OR Block Section 7.6
multiple contact circuits
List
Instruction
MRD Memory Read MRD the internal PLC Section 7.8
operations
Pops (recalls and
MPP Memory POP MPP removes) the currently Section 7.8
stored result
in Detail
Devices
operations
Conversion of
MEP MEP operation result Section 7.11
to leading edge pulse
Conversion of operation
5
MEF MEF Section 7.11
result to trailing edge pulse
Constant
Device &
Specified the
Out Instruction
Programming
Before
SET SET SET Applicable devices SET Bit device latch ON Y,M,S,D.b Section 7.13
Y,M,S,D.b,T,C,
RST Reset RST Applicable devices RESET Bit device OFF Section 7.13
D,R,V,Z
PLS Pulse PLS Applicable devices Rising edge pulse Y,M Section 7.12 7
Instruction
Basic
PLF Pulse Falling PLF Applicable devices Falling/trailing edge pulse Y,M Section 7.12
End Instruction
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
57
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.2 Step Ladder Instructions
STL Step Ladder STL Applicable devices Starts step ladder S Chapter 34
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
Program Flow
Section
00 CJ CJ Pn Conditional Jump 3 3 3 3 3 3 3
8.1
Section
01 CALL CALL Pn Call Subroutine 3 3 3 3 3 3 3
8.2
Section
02 SRET SRET Subroutine Return 3 3 3 3 3 3 3
8.3
Section
03 IRET IRET Interrupt Return 3 3 3 3 3 3 3
8.4
Section
04 EI EI Enable Interrupt 3 3 3 3 3 3 3
8.5
Section
05 DI DI Disable Interrupt 3 3 3 3 3 3 3
8.6
Section
06 FEND FEND Main Routine Program End 3 3 3 3 3 3 3
8.7
Section
07 WDT WDT Watchdog Timer Refresh 3 3 3 3 3 3 3
8.8
Section
08 FOR FOR S Start a FOR/NEXT Loop 3 3 3 3 3 3 3
8.9
Section
09 NEXT NEXT End a FOR/NEXT Loop 3 3 3 3 3 3 3
8.10
Section
10 CMP CMP S1 S2 D Compare 3 3 3 3 3 3 3
9.1
58
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
1
*1: The instruction is provided in the FX2N/FX2NC Series Ver.3.00 or later.
Introduction
*2: The function is changed in the FX3UC Series Ver.1.30 or later. *4: The function is changed in the FX3UC Series Ver.2.20 or later.
*3: The instruction is provided in the FX3UC Series Ver.1.30 or later. *5: The instruction is provided in the FX3UC Series Ver.2.20 or later.
Applicable PLC
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
2
Overview
Section
11 ZCP ZCP S1 S2 S D Zone Compare 3 3 3 3 3 3 3
9.2
Section
12 MOV MOV S D Move 3 3 3 3 3 3 3
9.3
Section
3
13 SMOV SMOV S m1 m2 D n Shift Move 3 3 3 3
List
Instruction
9.4
Section
14 CML CML S D Complement 3 3 3 3
9.5
in Detail
Devices
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
59
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
Move and Compare
Section
16 FMOV FMOV S D n Fill Move 3 3 3 3
9.7
Section
17 XCH XCH D1 D2 Exchange 3 3 3 3
9.8
Section
19 BIN BIN S D Conversion to Binary 3 3 3 3 3 3 3
9.10
Section
20 ADD ADD S1 S2 D Addition 3 3 3 3 3 3 3
10.1
Section
21 SUB SUB S1 S2 D Subtraction 3 3 3 3 3 3 3
10.2
Section
22 MUL MUL S1 S2 D Multiplication 3 3 3 3 3 3 3
10.3
Section
23 DIV DIV S1 S2 D Division 3 3 3 3 3 3 3
10.4
Section
24 INC INC D Increment 3 3 3 3 3 3 3
10.5
Section
25 DEC DEC D Decrement 3 3 3 3 3 3 3
10.6
Section
26 WAND WAND S1 S2 D Logical Word AND 3 3 3 3 3 3 3
10.7
Section
27 WOR WOR S1 S2 D Logical Word OR 3 3 3 3 3 3 3
10.8
Section
28 WXOR WXOR S1 S2 D Logical Exclusive OR 3 3 3 3 3 3 3
10.9
Section
29 NEG NEG D Negation 3 3 3 3
10.10
Section
30 ROR ROR D n Rotation Right 3 3 3 3
11.1
Section
31 ROL ROL D n Rotation Left 3 3 3 3
11.2
Section
32 RCR RCR D n Rotation Right with Carry 3 3 3 3
11.3
Section
33 RCL RCL D n Rotation Left with Carry 3 3 3 3
11.4
Section
34 SFTR SFTR S D n1 n2 Bit Shift Right 3 3 3 3 3 3 3
11.5
60
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
1
*1: The instruction is provided in the FX2N/FX2NC Series Ver.3.00 or later.
Introduction
*2: The function is changed in the FX3UC Series Ver.1.30 or later. *4: The function is changed in the FX3UC Series Ver.2.20 or later.
*3: The instruction is provided in the FX3UC Series Ver.1.30 or later. *5: The instruction is provided in the FX3UC Series Ver.2.20 or later.
Applicable PLC
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
2
Overview
Rotation and Shift Operation
Section
35 SFTL SFTL S D n1 n2 Bit Shift Left 3 3 3 3 3 3 3
11.6
Section
36 WSFR WSFR S D n1 n2 Word Shift Right 3 3 3 3
11.7 3
List
Instruction
Section
37 WSFL WSFL S D n1 n2 Word Shift Left 3 3 3 3
11.8
Section
38 SFWR SFWR S D n Shift write [FIFO/FILO control] 3 3 3 3 3 3 3
11.9
Section
4
39 SFRD SFRD S D n Shift Read [FIFO Control] 3 3 3 3 3 3 3
in Detail
Devices
11.10
Data Operation
Section
40 ZRST ZRST D1 D2 Zone Reset 3 3 3 3 3 3 3
12.1
Section
5
41 DECO DECO S D n Decode 3 3 3 3 3 3 3
Constant
Device &
Specified the
12.2
Section
42 ENCO ENCO S D n Encode 3 3 3 3 3 3 3
12.3
Programming
Before
Section
44 BON BON S D n Check Specified Bit Status 3 3 3 3
12.5
Section
45 MEAN MEAN S D n Mean 3 3 3 3
12.6
7
Section
Instruction
Basic
46 ANS ANS S m D Timed Annunciator Set 3 3 3 3
12.7
Section
47 ANR ANR Annunciator Reset 3 3 3 3
12.8
Section
49 FLT FLT S D Conversion to Floating Point 3 3 3 3
12.10
Section
51 REFF REFF n Refresh and Filter Adjust 3 3 3 3
13.2
Section
52 MTR MTR S D1 D2 n Input Matrix 3 3 3 3 3 3 3
13.3
10
Section
Operation
Arith. & Logic
FNC20-FNC29
61
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
High Speed Processing
Section
54 HSCR HSCR S1 S2 D High Speed Counter Reset 3 3 3 3 3 3 3
13.5
Section
56 SPD SPD S1 S2 D Speed Detection 3 3 3 3 3 3 3
13.7
Section
57 PLSY PLSY S1 S2 D Pulse Y Output 3 3 3 3 3 3 3
13.8
Section
58 PWM PWM S1 S2 D Pulse Width Modulation 3 3 3 3 3 3 3
13.9
Acceleration/Deceleration Section
59 PLSR PLSR S1 S2 S3 D 3 3 3 3 3 3 3
Setup 13.10
Handy Instruction
Section
60 IST IST S D1 D2 Initial State 3 3 3 3 3 3 3
14.1
Section
61 SER SER S1 S2 D n Search a Data Stack 3 3 3 3
14.2
Section
62 ABSD ABSD S1 S2 D n Absolute Drum Sequencer 3 3 3 3 3 3 3
14.3
Section
63 INCD INCD S1 S2 D n Incremental Drum Sequencer 3 3 3 3 3 3 3
14.4
Section
64 TTMR TTMR D n Teaching Timer 3 3 3 3
14.5
Section
65 STMR STMR S m D Special Timer 3 3 3 3
14.6
Section
66 ALT ALT D Alternate State 3 3 3 3 3 3 3
14.7
Section
67 RAMP RAMP S1 S2 D n Ramp Variable Value 3 3 3 3 3 3 3
14.8
Section
68 ROTC ROTC S m1 m2 D Rotary Table Control 3 3 3 3
14.9
Section
69 SORT SORT S m1 m2 D n SORT Tabulated Data 3 3 3 3
14.10
Section
70 TKY TKY S D1 D2 Ten Key Input 3 3 3 3
15.1
Section
71 HKY HKY S D1 D2 D3 Hexadecimal Input 3 3 3 3
15.2
62
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
1
*1: The instruction is provided in the FX2N/FX2NC Series Ver.3.00 or later.
Introduction
*2: The function is changed in the FX3UC Series Ver.1.30 or later. *4: The function is changed in the FX3UC Series Ver.2.20 or later.
*3: The instruction is provided in the FX3UC Series Ver.1.30 or later. *5: The instruction is provided in the FX3UC Series Ver.2.20 or later.
Applicable PLC
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
2
Overview
External FX I/O Device
Section
73 SEGD SEGD S D Seven Segment Decoder 3 3 3 3
15.4
Section
74 SEGL SEGL S D n Seven Segment With Latch 3 3 3 3 3 3 3
15.5 3
List
Instruction
Section
75 ARWS ARWS S D1 D2 n Arrow Switch 3 3 3 3
15.6
Section
76 ASC ASC S D ASCII Code Data Input 3 3 3 3
15.7
Section
4
77 PR PR S D Print (ASCII Code) 3 3 3 3
in Detail
Devices
15.8
79 TO TO m1 m2 S n
Write To A Special Function
Block
3 3 3 3 3 3
Section
15.10 5
Constant
Device &
Specified the
External FX Device
Section
80 RS RS S m D n Serial Communication 3 3 3 3 3 3 3
16.1
Programming
Before
Hexadecimal to ASCII Section
82 ASCI ASCI S D n 3 3 3 3 3 3 3
Conversion 16.3
Instruction
Basic
84 CCD CCD S D n Check Code 3 3 3 3 3 3 3
16.5
Section
87 RS2 RS2 S m D n n1 Serial Communication 2 3 3
16.6
Section
88 PID PID S1 S2 S3 D PID Control Loop 3 3 3 3 3 3 3
16.7
9
Move & Compare
FNC10-FNC19
89 to 99
Data Transfer 2
100,
101
10
Section
Operation
Arith. & Logic
FNC20-FNC29
63
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
Data Transfer 2
Section
103 ZPOP ZPOP D Batch POP of Index Register 3 *5
17.2
104 to
109
Floating Point
Section
110 ECMP ECMP S1 S2 D Floating Point Compare 3 3 3 3
18.1
Section
111 EZCP EZCP S1 S2 S D Floating Point Zone Compare 3 3 3 3
18.2
Section
112 EMOV EMOV S D Floating Point Move 3 3
18.3
113 to
115
Section
120 EADD EADD S1 S2 D Floating Point Addition 3 3 3 3
18.8
Section
121 ESUB ESUB S1 S2 D Floating Point Subtraction 3 3 3 3
18.9
Section
122 EMUL EMUL S1 S2 D Floating Point Multiplication 3 3 3 3
18.10
Section
123 EDIV EDIV S1 S2 D Floating Point Division 3 3 3 3
18.11
Section
124 EXP EXP S D Floating Point Exponent 3 3
18.12
Section
127 ESQR ESQR S D Floating Point Square Root 3 3 3 3
18.15
Section
128 ENEG ENEG D Floating Point Negation 3 3
18.16
64
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
1
*1: The instruction is provided in the FX2N/FX2NC Series Ver.3.00 or later.
Introduction
*2: The function is changed in the FX3UC Series Ver.1.30 or later. *4: The function is changed in the FX3UC Series Ver.2.20 or later.
*3: The instruction is provided in the FX3UC Series Ver.1.30 or later. *5: The instruction is provided in the FX3UC Series Ver.2.20 or later.
Applicable PLC
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
2
Overview
Floating Point
Section
130 SIN SIN S D Floating Point Sine 3 3 3 3
18.18
Section
131 COS COS S D Floating Point Cosine 3 3 3 3
18.19 3
List
Instruction
Section
132 TAN TAN S D Floating Point Tangent 3 3 3 3
18.20
Section
133 ASIN ASIN S D Floating Point Arc Sine 3 3
18.21
Section
4
134 ACOS ACOS S D Floating Point Arc Cosine 3 3
in Detail
Devices
18.22
Section
135 ATAN ATAN S D Floating Point Arc Tangent 3 3
18.23
Constant
Device &
Specified the
Floating Point Radians to Section
137 DEG DEG S D 3 3
Degrees Conversion 18.25
138,
139
Data Operation 2
6
Programming
Before
Section
140 WSUM WSUM S D n Sum of Word Data 3 *5
19.1
Section
141 WTOB WTOB S D n WORD to BYTE 3 *5
19.2
7
Section
Instruction
Basic
142 BTOW BTOW S D n BYTE to WORD 3 *5
19.3
Section
143 UNI UNI S D n 4-bit Linking of Word Data 3 *5
19.4
145,
146
Section
147 SWAP SWAP S Byte Swap 3 3 3 3
19.6
9
Move & Compare
FNC10-FNC19
148
Section
149 SORT2 SORT2 S m1 m2 D n Sort Tabulated Data 2 3 *5
19.7
10
Operation
Arith. & Logic
FNC20-FNC29
65
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
Positioning Control
Section
150 DSZR DSZR S1 S2 D1 D2 DOG Search Zero Return 3 *4
20.1
*2, Section
151 DVIT DVIT S1 S2 D1 D2 Interrupt Positioning 3
4 20.2
Section
152 TBL TBL D n Batch Data Positioning Mode 3 *5
20.3
153,
154
Section
155 ABS ABS S D1 D2 Absolute Current Value Read 3 3 3 3 *1 3 *1
20.4
Section
156 ZRN ZRN S1 S2 S3 D Zero Return 3 *4 3 3 3
20.5
Section
157 PLSV PLSV S D1 D2 Variable Speed Pulse Output 3 3 3 3 3
20.6
Section
158 DRVI DRVI S1 S2 D1 D2 Drive to Increment 3 3 3 3 3
20.7
Section
159 DRVA DRVA S1 S2 D1 D2 Drive to Absolute 3 3 3 3 3
20.8
Section
160 TCMP TCMP S1 S2 S3 S D RTC Data Compare 3 3 3 3 3 3 3
21.1
Section
161 TZCP TZCP S1 S2 S D RTC Data Zone Compare 3 3 3 3 3 3 3
21.2
Section
162 TADD TADD S1 S2 D RTC Data Addition 3 3 3 3 3 3 3
21.3
Section
163 TSUB TSUB S1 S2 D RTC Data Subtraction 3 3 3 3 3 3 3
21.4
Section
164 HTOS HTOS S D Hour to Second Conversion 3 3
21.5
Section
165 STOH STOH S D Second to Hour Conversion 3 3
21.6
Section
166 TRD TRD D Read RTC data 3 3 3 3 3 3 3
21.7
Section
167 TWR TWR S Set RTC data 3 3 3 3 3 3 3
21.8
168
Section
169 HOUR HOUR S D1 D2 Hour Meter 3 3 3 3 *1 3 *1
21.9
66
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
1
*1: The instruction is provided in the FX2N/FX2NC Series Ver.3.00 or later.
Introduction
*2: The function is changed in the FX3UC Series Ver.1.30 or later. *4: The function is changed in the FX3UC Series Ver.2.20 or later.
*3: The instruction is provided in the FX3UC Series Ver.1.30 or later. *5: The instruction is provided in the FX3UC Series Ver.2.20 or later.
Applicable PLC
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
2
Overview
External Device
List
Instruction
172 to
175
in Detail
Devices
Block 22.4
178,
179
Extension Function
Constant
Device &
Specified the
(FX2N/FX2NC)
Others
181
Section
6
182 COMRD COMRD S D Read Device Comment Data 3 *5
Programming
Before
24.1
183
Instruction
Basic
185
Section
186 DUTY DUTY n1 n2 D Timing Pulse Generation 3 *5
24.3
8
187
Program Flow
FNC00-FNC09
Section
188 CRC CRC S D n Cyclic Redundancy Check 3 3
24.4
190,
191
Section
193 BK- BK- S1 S2 D n Block Data Subtraction 3 *5
25.2
67
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
Block Data Subtraction
Block Data Compare Section
194 BKCMP= BKCMP= S1 S2 D n 3 *5
S1 = S2 25.3
Section
202 $+ $+ S1 S2 D Link Character Strings 3 3
26.3
Section
208 INSTR INSTR S1 S2 D n Character string search 3 *5
26.9
Section
209 $MOV $MOV S D Character String Transfer 3 3
26.10
Data Operation 3
Section
210 FDEL FDEL S D n Deleting Data from Tables 3 *5
27.1
Section
211 FINS FINS S D n Inserting Data to Tables 3 *5
27.2
68
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
1
*1: The instruction is provided in the FX2N/FX2NC Series Ver.3.00 or later.
Introduction
*2: The function is changed in the FX3UC Series Ver.1.30 or later. *4: The function is changed in the FX3UC Series Ver.2.20 or later.
*3: The instruction is provided in the FX3UC Series Ver.1.30 or later. *5: The instruction is provided in the FX3UC Series Ver.2.20 or later.
Applicable PLC
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
2
Overview
Data Operation 3
Section
213 SFR SFR D n Bit Shift Right with Carry 3 3
27.4
Section
214 SFL SFL D n Bit Shift Left with Carry 3 3
27.5 3
List
Instruction
215 to
219
Data Comparison
220 to
223
4
in Detail
Devices
Section
224 LD= LD= S1 S2 Load Compare S1 = S2 3 3 3 3 3 3 3
28.1
Section
225 LD> LD> S1 S2 Load Compare S1 > S2 3 3 3 3 3 3 3
28.1
Section
5
226 LD< LD< S1 S2 Load Compare S1 < S2 3 3 3 3 3 3 3
Constant
Device &
Specified the
28.1
227
Section
228 LD<> LD<> S1 S2 Load Compare S1 S2 3 3 3 3 3 3 3
28.1 6
Programming
Before
Section
229 LD<= LD<= S1 S2 Load Compare S1 S2 3 3 3 3 3 3 3
28.1
Section
230 LD>= LD>= S1 S2 Load Compare S1 S2 3 3 3 3 3 3 3
28.1
7
231
Instruction
Basic
Section
232 AND= AND= S1 S2 AND Compare S1 = S2 3 3 3 3 3 3 3
28.2
Section
234 AND< AND< S1 S2 AND Compare S1 < S2 3 3 3 3 3 3 3
28.2
235
9
Section
Move & Compare
FNC10-FNC19
Section
237 AND<= AND<= S1 S2 AND Compare S1 S2 3 3 3 3 3 3 3
28.2
239
69
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
Data Comparison
Section
240 OR= OR Compare S1 = S2 3 3 3 3 3 3 3
28.3
OR= S1 S2
Section
241 OR> OR Compare S1 > S2 3 3 3 3 3 3 3
OR> S1 S2 28.3
Section
242 OR< OR Compare S1 < S2 3 3 3 3 3 3 3
OR< S1 S2 28.3
243
Section
244 OR<> OR Compare S1 S2 3 3 3 3 3 3 3
28.3
OR<> S1 S2
Section
245 OR<= OR Compare S1 S2 3 3 3 3 3 3 3
28.3
OR<= S1 S2
Section
246 OR>= OR Compare S1 S2 3 3 3 3 3 3 3
OR>= S1 S2 28.3
247 to
249
250 to
255
Section
256 LIMIT LIMIT S1 S2 S3 D Limit Control 3 3
29.1
Section
257 BAND BAND S1 S2 S3 D Dead Band Control 3 3
29.2
Section
258 ZONE ZONE S1 S2 S3 D Zone Control 3 3
29.3
Scaling Section
259 SCL SCL S1 S2 D 3 3
(Coordinate by Point Data) 29.4
262 to
268
Scaling 2 Section
269 SCL2 SCL2 S1 S2 D 3 *3
(Coordinate by X/Y Data) 29.7
70
FX3U/FX3UC Series Programmable Controllers 3 Instruction List
Programming Manual - Basic & Applied Instruction Edition 3.3 Applied Instructions ... in Ascending Order of FNC Number
1
*1: The instruction is provided in the FX2N/FX2NC Series Ver.3.00 or later.
Introduction
*2: The function is changed in the FX3UC Series Ver.1.30 or later. *4: The function is changed in the FX3UC Series Ver.2.20 or later.
*3: The instruction is provided in the FX3UC Series Ver.1.30 or later. *5: The instruction is provided in the FX3UC Series Ver.2.20 or later.
Applicable PLC
FX3UC
FX3U
FNC No. Mnemonic Symbol Function Reference
FX1NC
FX2NC
FX1N
FX2N
FX1S
2
Overview
External Device Communication (Inverter Communication)
Section
270 IVCK IVCK S1 S2 D n Inverter Status Check 3 3
30.1
Section
271 IVDR IVDR S1 S2 S3 n Inverter Drive 3 3
30.2 3
List
Instruction
Section
272 IVRD IVRD S1 S2 D n Inverter Parameter Read 3 3
30.3
Section
273 IVWR IVWR S1 S2 S3 n Inverter Parameter Write 3 3
30.4
Section
4
274 IVBWR IVBWR S1 S2 S3 n Inverter Parameter Block Write 3 3
in Detail
Devices
30.5
275 to
277
Data Transfer 3
Section
5
278 RBFM RBFM m1 m2 D n1 n2 Divided BFM Read 3 *5
Constant
Device &
Specified the
31.1
Section
279 WBFM WBFM m1 m2 S n1 n2 Divided BFM Write 3 *5
31.2
Programming
Before
HSCT S1 m S2 D n With Data Table 32.1
281 to
289
Instruction
Basic
LOADR S n 33.1
Section
291 SAVER SAVER S m D Save to ER 3 3
33.2
Section
293 LOGR LOGR S m D1 n D2 Logging R and ER 3 3
33.4
Section
294 RWER RWER S n Rewrite to ER 3 *3
33.5
9
Section
Move & Compare
FNC10-FNC19
296 to
299
10
Operation
Arith. & Logic
FNC20-FNC29
71
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.1 Device Number List
4. Devices in Detail
This chapter explains how numeric values are handled in the PLC as well as the roles and functions of
various built-in devices including I/O relays, auxiliary relays, state relays, counters and data registers.
The following content provides a basis for handling the PLC.
72
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.1 Device Number List
1
Device name Description Reference
Introduction
Counter
General type up counter
C0 to C99 100 points Counts 0 to 32,767
(16 bits) [variable]
The setting can be changed between the
Latched (battery backed)
type up counter C100 to C199 100 points
latched (battery backed) type and the non-
latched type using parameters.
2
(16 bits) [variable]
Overview
General type Section 4.6
bi-directional counter C200 to C219 20 points 2,147,483,648 to
(32 bits) [variable] +2,147,483,647 counts
Latched (battery backed) The setting can be changed between the
type
bi-directional counter
C220 to C234 15 points
latched (battery backed) type and the non-
latched type using parameters. 3
List
Instruction
(32 bits) [variable]
*1. Available device numbers vary depending on the PLC. For details, refer to Section 4.2.
*2. For supported functions, refer to Chapter 36.
For handling the battery latched (battery backed) area, refer to Section 2.6.
High speed counter 4
8 points maximum can be used among C235 to C255
in Detail
Devices
1-phase 1-counting input
C235 to C245 [latched (battery backed) type].
Bi-directional (32 bits)
The setting can be changed between the latched (battery
backed) type and the non-latch type using parameters.
1-phase 2-counting input 2,147,483,648 to 2,147,483,647 counts
C246 to C250
Bi-directional (32 bits)
Hardware counter*1
1 phase: 100 kHz 6 points, 10 kHz 2 points Section 4.7 5
2 phases: 50 kHz (1 edge count),
Constant
Device &
Specified the
50 kHz (4 edge count)
2-phase 2-counting input Software counter
C251 to C255
Bi-directional (32 bits) 1 phase: 40 kHz
2 phases: 40 kHz (1 edge count),
10 kHz (4 edge count)
Data register (32 bits when used in pair form)
6
Programming
Before
General type (16 bits)
D0 to D199 200 points
[variable] The setting can be changed between the
latched (battery backed) latched (battery backed) type and the non-
type (16 bits) D200 to D511 312 points latched type using parameters.
[variable] Section 4.8
Instruction
Basic
type (16 bits) <D1000 to <7000
can be set as file registers in units of 500
[fixed] <file register> D7999> points>
points.
Special type (16 bits)*2 D8000 to D8511 512 points Chapter 36
Index type (16 bits) V0 to V7, Z0 to Z7 16 points Section 4.10
Extension register/Extension file register 8
Program Flow
FNC00-FNC09
Input interrupt
I0 to I5 6 points
Input delay interrupt Section 4.11
Timer interrupt I6 to I8 3 points
Counter interrupt I010 to I060 6 points For HSCS instruction
Nesting
For master control N0 to N7 8 points For MC instruction
10
Operation
Arith. & Logic
FNC20-FNC29
73
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.1 Device Number List
*1. When the FX3U-4HSX-ADP is connected to an FX3U PLC, the maximum input frequency is set as
follows:
1 phase: 200 kHz
2 phases: 100 kHz (1 edge count). 100 kHz (4 edge count)
*2. For supported functions, refer to Chapter 36.
For handling of the latched (battery backed) area, refer to Section 2.6.
74
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.2 I/O Relays [X, Y]
1
4.2 I/O Relays [X, Y]
Introduction
Some input relays and output relays are secured in the main unit, and others are assigned to extension
devices according to the connection order. Because I/O replays are numbered in octal, numeric values such
as "8" and "9" do not exist.
2
4.2.1 Numbers of I/O relays
Overview
The table below shows input relay (X) and output relays (Y) numbering (Relay numbers are assigned in
octal.)
Model
name
FX3UC-16M FX3UC-32M FX3UC-64M FX3UC-96M
When
extended
3
256
List
Instruction
X000 to X007 X000 to X017 X000 to X037 X000 to X057 X000 to X367
FX3UC (D, DSS) PLC Input points
8 points 16 points 32 points 48 points 248 points
in total
Y000 to Y007 Y000 to Y017 Y000 to Y037 Y000 to Y057 Y000 to Y367
Output
8 points 16 points 32 points 48 points 248 points
Model When
4
FX3UC-32MT-LT
name extended
in Detail
Devices
256
X000 to X017 X000 to X357
FX3UC-32MT-LT PLC Input points
16 points 240 points
in total
Y000 to Y017 Y000 to Y357
Output
16 points 240 points
5
Model
Constant
Device &
Specified the
FX3U-16M FX3U-32M FX3U-48M FX3U-64M FX3U-80M FX3U-128M
name
FX3U X000 to X007 X000 to X017 X000 to X027 X000 to X037 X000 to X047 X000 to X077
Input
PLC 8 points 16 points 24 points 32 points 40 points 64 points
Y000 to Y007 Y000 to Y017 Y000 to Y027 Y000 to Y037 Y000 to Y047 Y000 to Y077
Output
8 points 16 points 24 points 32 points 40 points 64 points
6
Programming
Before
Model When
name extended
256
FX3U X000 to X367
Input points
PLC 248 points
in total
Output
Y000 to Y367
248 points 7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
75
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.2 I/O Relays [X, Y]
0V
External power
supply
24V COM1
Program example
S/S
Input X000 X001
signal Y000 Y000
X000 X000
Load
Y000
X000 Y000
Input NO contact
terminal X000 Y000 Output terminal
PLC NC contact
The PLC receives signals from external switches The PLC outputs signals to external loads through
through input terminals. output terminals. Contacts for external output
An input relay (X) connected to an input terminal (output devices such as relay contacts, TRIACs and
inside the PLC is an electronic relay isolated transistors) of output relays are connected to output
optically, and has many NO contacts and NC terminals inside the PLC. An output relay has many
contacts. These contacts can be arbitrarily used electronic NO contacts and NC contacts. These
inside the PLC. contacts can be arbitrarily used inside the PLC.
These input relays cannot be driven by the program. Differences in operations between external output
contacts (output devices) and internal contacts are
explained on the next page.
76
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.2 I/O Relays [X, Y]
1
4.2.3 Operation timing of input relays
Introduction
The PLC executes sequence control by repeatedly executing the following processing procedure. In this
batch I/O method, not only are there driving times of input filters and output devices but also response delays
caused by operation cycles. (Refer to Section 6.3.)
Overview
1) Read-in Input processing
Before executing a program, the PLC reads the ON/
X000 OFF status of all input terminals inside the PLC into
X001 the input image memory.
Even if inputs change while the program is
Input terminal
List
Instruction
Memory from OFF to ON, its ON/OFF status is judged after
the response delay (approximately 10 ms) caused
by the input filter.
(When the input filter is a digital type input terminal ,
its value can be overwritten by a sequence
program.)
in Detail
Devices
2) Read-out Program processing Program processing
The PLC reads the ON/OFF status of each device
X000 from the input image memory and other device
Y000 image memories according to the contents of
3) Write
Device
instructions in the program memory, executes
operations in sequence from step 0, and then writes
5
4) Read-
Constant
Device &
Specified the
out the operation result to the image memory.
M0 Image Accordingly, the contents of the image memory for
Y000 5) Write each device change as the program is executed.
Memory The operation of a contact inside an output relay is
Auxiliary determined by the contents of the output image
relay memory.
Programming
Before
(scan time).]
operation is called operation cycle
[The time required for a cyclic
Repeated operation
6) Output
Output processing Output processing
When execution of all instructions is finished, the 7
ON/OFF status of the image memory of outputs (Y)
Instruction
Basic
Y000 is transferred to the output latch memory. This is
Y001 the actual output of the PLC.
External output contacts inside the PLC operate
Output terminal
Output Y002 after the response delay time of the output devices.
Latch
Memory 8
Program Flow
FNC00-FNC09
The above method is called the batch I/O method (or refresh method).
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
77
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.3 Auxiliary Relay [M]
*1. This area is not latched (battery backed). It can be changed to a latched (battery backed) area by
setting the parameters.
*2. This area is latched (battery backed). It can be changed to a non-latched (non-battery-backed) area
by setting the parameters.
*3. The characteristics of latch (battery backup) cannot be changed in the parameters.
When simple N : N link or parallel link is used, some auxiliary relays are occupied for the link.
Refer to the Data Communication Edition manual.
1. General type
All of general type auxiliary relays turn OFF when the PLC turns OFF.
M100 When the ON/OFF status of auxiliary relays just before power failure is
required in control, use latched (battery backed) type auxiliary relays.
M100
NO contact
M100
NC contact
78
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.3 Auxiliary Relay [M]
1
2. Latched (battery backed) type
Introduction
When the power is turned OFF while the PLC is operating, all of the output relays and general type auxiliary
relays turn OFF.
When restoring the power again, all of the output relays and general type auxiliary relays remain OFF except
those whose input condition is ON. In some output relays and auxiliary relays, however, the ON/OFF status
just before power failure should be stored and then replicated when restoring the power, depending on control
targets. In such a case, use latched (battery backed) type auxiliary relays.
2
Overview
Latch type devices are backed up by the battery built in to the PLC.
For details on backup method against power failure,
refer to Section 2.6.
X000 X001
The figure on the left shows an operation example of
M600 (latched [battery backed] type device) in a self-
M600
holding circuit. 3
M600 When X000 turns ON and M600 turns ON in this circuit,
List
Instruction
M600 holds its operation by itself even if X000 is
PLC
Backup against power failure opened.
(self-holding circuit) Because M600 is a latched (battery backed) type
device, it remains activated when the operation is
restarted even after X000 has turned OFF due to power
failure. If an NC contact of X001 is opened when the
4
in Detail
Devices
operation is restarted, however, M600 is deactivated.
X000
SET M600 The figure on the left shows a circuit using the SET and
RST instructions.
X001
RST M600 5
Constant
Device &
Specified the
PLC
Backup against power failure
(set/reset circuit)
Programming
Before
LS1 (X000) LS2 (X001)
power failure.
7
Table in reciprocating motion
Instruction
Basic
Motor with brake
X000 X001 X000 = ON (at the left limit) M600 = ON The table
M600 Rightward is driven rightward. The power is turned OFF. The
drive table is stopped in an intermediate position. The table
M600 command is restarted (M600 = ON). X001 = ON (at the right 8
limit) M600 = OFF, M601 = ON The table is driven
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
2) Method for using a fixed latched (battery backed) type auxiliary relay as a general type auxiliary relay
When using a fixed latched (battery backed) type auxiliary relay as a general type auxiliary relay, provide
a reset circuit shown in the figure below around the head step in the program.
M8002
FNC 040
Initial pulse
ZRST
M1024 M1999 10
Operation
Arith. & Logic
FNC20-FNC29
79
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.4 State Relay [S]
*1. This area is not latched (battery backed). It can be changed to a latched (battery backed) area by
setting the parameters.
*2. This area is latched (battery backed). It can be changed to a non-latched (non-battery-backed) area
by setting the parameters.
*3. The characteristics of latch (battery backup) cannot be changed in the parameters.
1. General type
Initial state In the stepping type process control shown in the left
S 2 figure, when the start signal X000 turns ON, the state
Start relay S20 is set (turned ON) and the solenoid valve
X000
TRAN Y000 for moving down turns on.
Start When the lower limit switch X001 turns ON the state
Moving down relay S21 is set (turned ON) and the solenoid valve
S 20 Y000 Y001 for clamping turns on.
Lower limit When the clamp confirmation limit switch X002 turns
X001 ON, the state relay S22 is set (turned ON).
Lower TRAN When the operation proceeds to the next step, the
limit
Clamping state relay in the preceding step is automatically reset
S 21 Y001
(turned OFF).
Clamping When the PLC turns OFF, all of general type state
X002
Clamping TRAN relays are turned OFF.
When the ON/OFF status just before power failure is
Moving up required, use latched (battery backed) type state
S 22 Y002 relays.
Upper limit
Upper X003
limit TRAN
State relays have many NO contacts and NC contacts in the same way as X001
auxiliary relays, and such contacts can be used arbitrarily in sequence S10
programs.
When state relays (S) are not used for step ladder instructions, they can S10
be used in general sequences in the same way as auxiliary relays (M) (as M30
shown in the figure on the right).
Y005
80
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.4 State Relay [S]
1
2. Latched (battery backed) type
Introduction
Latched (battery backed) type state relays store their ON/OFF status even if the power is shut down while
the PLC is operating, so the operation can be restarted from the last point in the process.
Latched (battery backed) type state relays are backed up by the battery built into the PLC.
For details on each backup method, refer to Section 2.6.
When using latched (battery backed) type state relays as M8002
2
general type state relays, provide a reset circuit shown in the FNC 040
Overview
0 S1000 S1200
right figure around the head step in the program. ZRST
Initial pulse
S1000 to S1200 are initialized.
3. Annunciator type
3
List
Instruction
Annunciator type state relays can be used as outputs for external fault diagnosis.
For example, when an external fault diagnosis circuit shown in the figure below is created and the contents of
the special data register D8049 are monitored, the smallest number out of the active state relays S900 to
S999 is stored in D8049.
If two or more faults have occurred, the smallest state number having a fault is displayed at first. When the 4
fault is cleared, the next smallest state number having a fault is stored.
in Detail
Devices
M8000
When the special auxiliary relay M8049 is driven,
M8049 monitoring becomes valid.
RUN monitor
5
Y000 X000
Constant
Device &
Specified the
FNC 46 If the forward end detection input X000 is not
T 0 K 10 S900 activated within 1 second after the forward output
ANS
Y000 is driven, S900 is activated.
X001 X002
FNC 46 T 1 K 20 S901
If both the upper limit detection input X001 and the
lower limit detection input X002 are deactivated at the
6
ANS
Programming
Before
same time for 2 seconds or more, S901 is activated.
Instruction
Basic
M8048
When any annunciator among S900 to S999 turns
Y010 ON, the special auxiliary relay M8048 is activated and
the fault display output Y010 is activated.
8
X005 The state relays activated by the external fault
Program Flow
FNC00-FNC09
10
Operation
Arith. & Logic
FNC20-FNC29
81
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.5 Timer [T]
Timer numbers not used for timers can be used as data registers for storing numeric values.
*1. Retentive timers are backed up by battery.
General type
X000 When the drive input X000 of the timer coil T200 turns ON, the
T200 K123 current value counter for T200 adds and counts clock pulses of
T200 Set value 10 ms. When the counted value becomes equivalent to the set
Y000 (constant) value K123, the output contact of the timer turns on.
A data register
can be In other words, the output contact turns on 1.23 seconds after the
specified also. coil is driven.
1.23 sec When the drive input X000 turns OFF or when the power is
X000 turned off the timer is reset and the output contact returns.
Current Set value
value
Y000
Retentive type
X001 Set value When the drive input X001 of the timer coil T250 turns ON, the
T250 K345 (constant) current value counter for T250 adds and counts clock pulses of
T250 A data register 100 ms. When the counted value becomes equivalent to the set
Y001 can be
specified also. value K345, the output contact of the timer turns on.
X002 Even if the drive input X001 turns OFF or the power is turned off
RST T250
during counting, the timer continues counting when the operation
restarts. The retentive operating time is 34.5 seconds.
When the reset input X002 turns ON, the timer is reset and the
Retentive time
t1 t2
t1 + t2 = 34.5 sec output contact is returned.
X001
Current Set value
value
Y001
X002
82
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.5 Timer [T]
1
4.5.3 Set value specification method
Introduction
1. Specifying a constant (K)
Constant T10 is a 100 ms (0.1 sec) type timer.
(decimal integer) When the constant "100" is specified, T10 works as a
X003
T10 K100 10-second timer 10-second timer (0.1 sec 100 = 10 sec). 2
Overview
2. Indirectly specifying a data register
Turns on when T10 reaches the indirectly specified
X001 value of the defined data register, previously set by a
FNC 12
MOV
K100 D 5 digital switch. 3
Note that the set value of a latched (battery backed)
D5 = K100
List
Instruction
X003 10-second type register can change randomly indefinite when the
T10 D5 timer battery voltage is low.
in Detail
Devices
1) Use timers T192 to T199 in subroutines and interrupt routines. These timers execute counting when a
coil instruction or END instruction is executed.
When such a timer reaches the set value, its output contact turns on when a coil instruction or END
instruction is executed.
Because general type timers execute counting only when a coil instruction is executed (Refer to "4.5.5 5
Details of timer operation and timer accuracy" below.), they do not execute counting and do not operate
Constant
Device &
Specified the
normally if they are used in subroutines or interrupt routines in which a coil instruction is executed only in
a certain condition.
2) When a retentive timer for 1 ms pulses (T246 to T249) is used in a subroutine or interrupt routine, note
that its output contact turns on when the first coil instruction is executed after the retentive timer has
reached the set value. 6
Programming
Before
4.5.5 Details of timer operation and timer accuracy
A timer (except interrupt execution type) starts counting when a coil is driven, and its output contact turns on
when the first coil instruction is executed after the timer has reached timeout.
Counting operation (If the operation cycle is long, 7
it automatically counts two or more clocks.)
Instruction
Basic
Contact is not
Input processing X010 = OFFON activated at this point
X010 Timer starts counting
T 0
T 0 Contact is
K12 1.2 sec activated
T 0
time-
out 8
Y010
Program Flow
FNC00-FNC09
Y010 ON
1st cycle 2nd cycle "n"th cycle "n+1"th cycle
As shown in the above operation diagram, the accuracy of operation of the timer contact after the coil is
driven until the contact turns on is shown in the following outline:
9
T
+T0 : 0.001 sec (timer for 1 ms), 0.01 sec (timer for 10 ms) or 0.1 sec (timer for 100 ms)
T : Timer set value (sec)
Move & Compare
FNC10-FNC19
If the contact is programmed before the timer coil, "+2T0" is obtained in the worst case.
When the timer set value is "0", the output contact turns on when a coil instruction is executed in the next
cycle. An interrupt execution type timer for 1 ms pulses counts clock pulses of 1 ms as an interrupt
processing after a coil instruction has been executed. 10
Operation
Arith. & Logic
FNC20-FNC29
83
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.5 Timer [T]
Off-delay timer
X001 T5
Y000 X001
Y000 X001
T 5 K200 Y000 T5 (20 sec)
T 2 One
Y000 ( ) operation
cycle
In addition, the flicker operation can be performed by the ALT (FNC 66) instruction.
X000
10 10 M0 is an off-delay timer.
M0
sec sec
Flicker timer
M 2
In addition, the timer time can be set according to the switch input time by the teaching timer instruction
TTMR (FNC 64).
84
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.5 Timer [T]
1
4.5.7 Handling timers as numeric devices
Introduction
In timers, the output contact operating in accordance with the set value is used in some cases, and the
present value is used as numeric data for control in other cases.
The figures below show the structure of the timer present value registers. When a timer number is specified
in an operand of an applied instruction, the timer is handled as a device storing 16-bit or 32-bit data in the
same way as data registers.
2
Overview
1. Structure of timer present value register
1) 16-bit
High 16 bits Low Available numeric value range
order order
b15 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 b0
16-bit : 0 to 32,767
32-bit : -2,147,483,648 to +2,147,483,647
3
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
List
Instruction
*1
Sign
0: Positive
number
1: Negative
number
*1 The sign is valid only when a timer is handled as a substitute for data register.
4
2) 32-bit
in Detail
Devices
High 32 bits Low
order order
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
b31 b0
1,073,741,824
536,870,912
268,435,456
134,217,728
67,108,864
33,554,432
16,777,216
8,388,608
4,194,304
2,097,152
1,048,576
524,288
262,144
131,072
65536
32768
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
Sign
0: Positive 5
number
Constant
Device &
Specified the
1: Negative
number
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
85
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.6 Counter [C]
*1. This area is not latched (battery backed). It can be changed to a latched (battery backed) area by
setting the parameters.
*2. This area is latched (battery backed). It can be changed to a non-latched (non-battery-backed) area
by setting the parameters.
Counter numbers not used as counters can be converted as data registers for storing numeric values.
86
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.6 Counter [C]
1
4.6.4 Functions and operation examples
Introduction
1. General type and latched (battery backed) type 16-bit up counters
The valid set range of 16-bit binary up counter is from K1 to K32767 (decimal constant).
K0 provides the same operation as K1, and the output contact turns on at the first counting. 2
In general type counters, the counter value is cleared when the PLC turns off. In latch type counters,
Overview
however, the counter value just before power failure is stored (backed up by the battery); The counter
value in the subsequent operations can be added to the last counter value.
Every time the coil C0 is driven by the counting input X011, the current value of the counter increases.
When a coil instruction is executed 10 times, the output contact turns on.
After that, the current value of the counter does not change even if the counting input X011 turns on after 3
that.
List
Instruction
When the RST input X010 turns ON and then RST instruction is executed, the current value of the counter
is reset to "0" and the output contact returns.
X010 X010
RST C 0
X011 X011 4
C 0 K10 10
in Detail
Devices
9
C 0 Set value (constant) 8
Y000 7
It can be specified Current 6
indirectly also. value 5
4
3
0
1
2
5
Constant
Device &
Specified the
Y000
The counter set value can be set by a constant (K) as shown above, or indirectly specified by a data
register number. For example, when D10 is specified and the contents of D10 are "123", it is equivalent to
"K123". 6
If data beyond the set value is written to the current value register by MOV instruction, etc., the OUT coil
Programming
Before
turns ON and the current value register becomes the set value when the next counting input is received.
In a latch type counter, the current value, output contact operation and reset status of the counter are
latched (battery backed) by the battery built in the PLC.
For details on backup methods against power failure, refer to Section 2.6.
7
2. General type and latched (battery backed) type 32-bit bi-directional counters
Instruction
Basic
The valid set range of 32-bit binary bi-directional counters is from 2,147,483,648 to +2,147,483,647 (decimal
constant). The counting direction (up or down) is specified by special auxiliary relays M8200 to M8234.
When M8UUU is driven for CUUU, a counter executes down-counting. When M8UUU is not driven, a
counter executes up-counting. (Refer to the previous page.)
The set value (positive or negative) can be specified by a constant (K) or the contents of data registers (D). 8
When data registers are used, 32-bit data composed of paired serial devices are treated as set values.
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
87
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.6 Counter [C]
When the coil C200 is driven by the counting input X014, a counter starts up-counting or down-counting.
When the current value of a counter increases from "6" to "5", the output contact is set. When the
current value decreases from "5" to "6", the output contact is reset.
The current value increases or decreases regardless of the operation of the output contact. When a
counter executes up-counting from "+2,147,483,647", the counter value becomes "2,147,483,648". In the
same way, when a counter executes down-counting from "2,147,483,648", the counter value becomes
"+2,147,483,647". (This type of counter is called ring counter.)
When the reset input X013 turns ON and then RST instruction is executed, the current value of the counter
is reset to "0" and the output contact returns.
In a latch type counter, the current value, output contact operation and reset status of the counter are
latched (battery backed) by the battery built in the PLC.
For details on backup methods against power failure, refer to Section 2.6.
A 32-bit counter can be used as a 32-bit data register. 32-bit counters cannot be handled as target devices
in 16-bit applied instructions.
If data beyond the set value is written to the current value register by DMOV instruction, etc., the counter
continues counting and the contact does not change when the next counting input is received.
1. 16-bit counter
1) Specification by constant (K)
Constant (decimal constant): 1 to 32767
X003 100 counts
C0 K100
D5 = 100
100 counts
88
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.6 Counter [C]
1
2. 32-bit counter
Introduction
1) Specification by constant (K)
Constant (decimal constant):
X003 2,147,483,648 to +2,147,483,647
C200 K43,210 43210 counts
2
Overview
2) Indirect specification (D)
X003
does not overlap with other programs because it is not
shown in ladder format. 3
C200 D5(D6)
List
Instruction
4.6.6 Response speed of counters
Counters execute counting by cyclic operating for contact operations of internal signals X, Y, M, S, C, etc. 4
inside the PLC.
in Detail
Devices
For example, when X011 is specified as counting input, its ON duration and OFF duration should be longer
than the cycle time of the PLC (which is tens of Hz or less usually).
On the other hand, high speed counters described later execute counting as an interrupt processing for
specific input, and can execute counting at 5 k to 6 kHz regardless of the cycle time.
For high speed counters, refer to Section 4.7.
5
Constant
Device &
Specified the
4.6.7 Handling counters as numeric devices
Counters use output contacts operating in accordance with the set value or use the counter value (current
value) as numeric data for control.
The figure below shows the structure of the current value register of a counter. When a counter number is
specified in an operand of an applied instruction in execution, the counter is handled as a device storing 16-bit 6
or 32-bit data in the same way as data register.
Programming
Before
A 32-bit counter is handled as 32-bit data.
Instruction
Basic
order order 16-bit counter: 0 to 32767
b15 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 b0 32-bit counter: 2,147,483,648 to
+2,147,483,647
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
*1
Sign
0: Positive
number
1: Negative
number 8
*1. The sign is valid only when a counter is handled as a substitute for data register.
Program Flow
FNC00-FNC09
2) 32-bit
Sign
Move & Compare
FNC10-FNC19
0: Positive
number
1: Negative
number
10
Operation
Arith. & Logic
FNC20-FNC29
89
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.6 Counter [C]
90
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1
4.7 High Speed Counter [C]
Introduction
4.7.1 Types and device numbers of high speed counters
Overview
The main unit has built-in 32-bit high speed bi-directional counters (1-phase 1-count, 1-phase 2-count and 2-
phase 2-count). These high speed counters are classified into hardware type or software type according to
the counting method. Some high speed counters are capable of using an external reset input terminal and an
external start input terminal (for counting start).
List
Instruction
software counters depending on the operating condition.
For the condition handled as software counters,
refer to Subsection 4.7.9.
Software counters: These types of counters execute counting as CPU interrupt processing.
It is necessary to use each software counter within both limitations of maximum 4
response frequency and total frequency.
in Detail
Devices
For the limitation of response frequency depending on the total frequency,
refer to Subsection 4.7.10.
Constant
Device &
Specified the
Down-count or up-count is specified
by turning on or off M8235 to
1-phase
UP/DOWN M8245.
1-count input
ON: Down-counting
OFF: Up-counting
A counter executes up-count or
6
Programming
Before
+1 +1 +1 down-count as shown on the left.
1-phase UP The counting direction can be
2-count input 1 1 1 checked with M8246 to M8250.
DOWN ON: Down-counting
OFF: Up-counting
A phase A phase 7
1 edge +1 +1 1 1
Instruction
Basic
A counter automatically executes
count B phase B phase up-count or down-count according to
Up-counting Down-counting changes in the input status of the A/
2-phase
B phase as shown on the left.
2-count +1 +1 +1 +1 +1 1 1 1 1 1
The counting direction can be
input A phase A phase
4 edge
count
checked with M8251 to M8255.
ON: Down-counting 8
B phase B phase OFF: Up-counting
Program Flow
FNC00-FNC09
+1 +1 +1 +1 1 1 1 1
Up-counting Down-counting
Encoders adopting the voltage output method and absolute encoders cannot be connected to high speed
counter inputs.
For the wiring, refer to the Hardware Edition of the main unit.
Output method of encoder which can be directly connected Open collector transistor output method compatible with 24V
to input terminal in main unit DC
Output method of encoder which can be directly connected Differential line driver output method 10
to input terminal in FX3U-4HSX-ADP (output voltage: 5V DC or less)
Operation
Arith. & Logic
FNC20-FNC29
*1. A rotary encoder adopting the output method shown above may not operate correctly depending on
the electrical compatibility. Check the specifications before connecting an encoder.
91
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
*1. They are handled as software counters depending on the operating condition. When they are handled
as software counters, they have limitations on both maximum response frequency and total
frequency.
For the condition handled as software counters,
refer to Subsection 4.7.9.
For the total frequency, refer to Subsection 4.7.10.
*2. Cautions on wiring should be considered for these high speed counters.
For the wiring, refer to the Hardware Edition of the main unit.
*3. C244, C245 and C248 are usually used as software counters, but can be used as hardware counters
C244 (OP), C245 (OP) and C248 (OP) by combining a special auxiliary relay (M8388, M8390 to
M8392).
For the method to switch the counter function, refer to Subsection 4.7.7.
*4. 2-phase 2-input counter is usually 1 edge count counter, but can be used as a 4 edge count counter by
combining a special auxiliary relay (M8388, M8198 or M8199).
For the method to use a 2-phase 2-input 4 edge count counter,
refer to Subsection 4.7.8.
*5. The external reset input is usually reset by turning ON, but can be changed to be reset by turning OFF
by combining special auxiliary relays (M8388 and M8389).
For the method to change the logic of the external reset input, refer to Subsection 4.7.6.
*6. The counter C253 is usually used as a hardware counter, but can be used as the counter C253 (OP)
not equipped with reset input by combining special auxiliary relays (M8388 and M8392).
In this case, C253 (OP) is handled as a software counter.
92
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1
Notation of high speed counter devices
Introduction
For some high speed counters in FX3U and FX3UC PLCs, the assignment of input terminals will switch when
special auxiliary relays are used.
Such high speed counter devices are classified below. Note that description as (OP) is not available in
programming.
Standard Device Standard Device
2
Switched Device Numbers Switched Device Numbers
Overview
Numbers Numbers
C244 C244(OP) C248 C248(OP)
C245 C245(OP) C253 C253(OP)
List
Instruction
4
in Detail
Devices
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
93
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
H/W: Hardware counter S/W: Software counter U: Up-counting input D: Down-counting input
A: A phase input B: B phase input R: External reset input S: External start input
*1. Cautions on wiring should be considered for these high speed counters.
For the wiring, refer to the Hardware Edition of the main unit.
*2. Hardware counters are switched to software counters when a comparison set/reset instruction for high
speed counter (DHSCS, DHSCR, DHSZ or DHSCT) is used.
The counter C253 is switched to a software counter when the logic of the external reset input signal is
reversed.
For the condition under which it is handled as a software counter, refer to Subsection 4.7.9.
*3. When a special auxiliary relay is driven in a program, the input terminals and their associated
functions are switched.
For the method to use a software counter as a hardware counter, refer to Subsection 4.7.7.
*4. In a 2-phase 2-count input counter, the edge count is usually 1. But the edge count can be set to 4 by
combining a special auxiliary relay.
For the method on how to use a 2-phase 2-count input counter with on edge count of 4,
refer to Subsection 4.7.8.
94
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1
Restriction to overlap input numbers
Introduction
Inputs X000 to X007 are used for high speed counters, input interrupt, pulse catch, SPD/ZRN/DSZR/DVIT
instructions and general-purpose inputs. When assigning functions, there should be no overlap between
those input terminals.
For example, when C251 is used, X000 and X001 are occupied. As a result, "C235, C236, C241, C244,
C246, C247, C249, C252 and C254", "input interrupt pointers I000 and I101", "pulse catch contacts M8170 2
and M8171" and "SPD, ZRN, DSZR and DVIT instructions using X000 and/or X001" cannot be used.
Overview
Since the FX3U-4HSX-ADP and FX3UC PLC main unit share the same assigned input terminal numbers,
only one of them may be used in operation. If both input terminals are used, intended operation is not
enabled because the inputs of the FX3U-4HSX-ADP and PLC main unit operate in an "OR" relationship.
List
Instruction
1. 1-phase 1-count input
X010 C235 counts "OFF ON" of the input X000 while X012
M8235 Down/up count is ON.
X011 When X011 turns ON and then RST instruction is 4
Reset executed, C235 is reset.
in Detail
Devices
RST C235
The counting direction of the counters C235 to C245 is
X012 switched to down-count or up-count when M8235 to
C235 K-5
M8245 turns ON or OFF.
X010
Down/up count
C244 immediately starts counting when the input X006
turns ON while X012 is ON. The counting input is X000.
5
M8244
Constant
Device &
Specified the
In this example, the set value is indirectly specified by
X011 the contents of data registers (D1 and D0).
RST C244 Reset A high speed counter can be reset using X011 in a
X012
sequence as shown in the figure, but C244 immediately
C244 D0(D1) reset without any program when X001 is closed. So a
program with X011 is not necessary. 6
The counting direction of the counters C235 to C245 is
Programming
Before
Set value is (D1, D0)
switched to down-count or up-count when M8235 to
M8245 turns ON or OFF.
Operation example
The counter C235 shown above operates as follows:
X010 Up counting Down counting Up counting
7
Instruction
Basic
X011 Reset input
X000
Counting
8
5
Program Flow
FNC00-FNC09
input 4 4
C235 3 3
2 2
Current 1 1
value 0 0 0
1
When output has
already been activated
2
3
4 4
3 9
5 5
Move & Compare
FNC10-FNC19
6 6
7 7
8
C235 output contact
When counting with input X000, C235 executes up-count or down-count as an interrupt.
When the current value of a counter increases from "6" to "5", the output contact is set. When the 10
current value decreases from "5" to "6", the output contact is reset.
Operation
Arith. & Logic
FNC20-FNC29
95
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
The current value increases or decreases without regard to the operation of the output contact. When a
counter executes up-count from "+2,147,483,647", the counter value becomes "2,147,483,648". In the
same way, when a counter executes down-count from "2,147,483,648", the counter value becomes
"+2,147,483,647". (This type of counter is called a ring counter.)
When the reset input X011 turns ON and RST instruction is executed, the current value of the counter is
reset to "0" and the output contact is restored.
In a latch type high speed counter, the current value, output contact operation and reset status of the
counter are latched (battery backed) by the backup battery built in the PLC.
96
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1
A 2-phase encoder generates outputs for the A phase and B phase by a phase difference of 90. With
Introduction
these outputs, a high speed counter automatically executes up-count and down-count as shown in the
figure below.
- When the counter is operating at the 1 edge count
A phase A phase
+1 +1 1 1 2
B phase B phase
Overview
Up-counting Down-counting
- When the counter is operating at the 4 edge count
+1 +1 +1 +1 +1 1 1 1 1 1
A phase A phase
3
B phase B phase
List
Instruction
+1 +1 +1 +1 1 1 1 1
Up-counting Down-counting
The down/up-count operation of C251 to C255 can be checked with M8251 to M8255.
ON status: Down-counting
OFF status: Up-counting
4
4.7.4 Current value update timing and comparison of current value
in Detail
Devices
1. Current value update timing
A high speed counter executes up-count or down-count when a pulse is input to its input terminal, but the
current value is updated at the timing shown in the table below. When using the current value of a hardware
counter in a MOV, CMP or applied instruction such as the comparison instruction, special care must be taken 5
since the current value update timing is affected by the ladder scans as shown in the table.
Constant
Device &
Specified the
Current value update timing
Hardware counter When OUT or HCMOV instruction is executed for the counter
Software counter Every time a pulse is input
Programming
Before
1) Using the comparison instruction (CMP), zone comparison instruction (ZCP) or comparison contact
instruction
When the comparison result is necessary during counting operation*1, comparison may be executed in
the main program if the HCMOV instruction is used just before the comparison instruction (CMP or ZCP)
or comparison contact instruction.
*1. If it is necessary to execute comparison to update an output contact with the high-speed counter's
7
Instruction
Basic
changing value, use comparison instructions for high speed counters (HSCS, HSCR, HSZ or
HSCT).
2) Using comparison instructions for high speed counters (HSCS, HSCR, HSZ or HSCT)
The comparison instructions for high speed counters (HSCS, HSCR, HSZ and HSCT) execute a
comparison and output the comparison result during high speed counting. The number of times these
instructions can be used is limited as shown in the table below. 8
When an output relay is specified for the comparison result, the comparison result is directly updated at
Program Flow
FNC00-FNC09
the ON/OFF status of the output regardless of the output refresh by END instruction.
Mechanical operation delay (about 10 ms) cannot be avoided in a relay output type PLC. Use a transistor
output type PLC.
Instruction Limitation in number of instruction
HSCS 9
HSCR Can be used up to 32 times including HSCT instruction.
Move & Compare
FNC10-FNC19
HSZ*1
HSCT*1 Can be used only once.
*1. When HSZ or HSCT instruction is used, the maximum response frequency and total frequency of
all software counters are affected.
For the maximum response frequency and total frequency of software counters,
10
refer to Subsection 4.7.10.
Operation
Arith. & Logic
FNC20-FNC29
97
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1. Devices used to switch the counting direction of 1-phase 1-count input counters
Type Counter No. Specifying device Up-counting Down-counting
C235 M8235
C236 M8236
C237 M8237
C238 M8238
C239 M8239
1-phase
C240 M8240 OFF ON
1-counting input
C241 M8241
C242 M8242
C243 M8243
C244 M8244
C245 M8245
2. Devices used to check the counting direction of 1-phase 2-count input counters and
2-phase 2-count input counters
Type Counter No. Monitoring device OFF ON
C246 M8246
C247 M8247
1-phase
C248 M8248
2-counting input
C249 M8249
C250 M8250
Up-counting Down-counting
C251 M8251
C252 M8252
2-phase
C253 M8253
2-counting input
C254 M8254
C255 M8255
*1. Cleared when the PLC mode switches from STOP to RUN.
98
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1
4.7.6 Changing the logic of external reset input signal
Introduction
The counters C241 to C245, C247 to C250 and C252 to C255 are usually reset when the external reset input
turns ON.
By using the program shown below, the logic can be inverted so that these counters are reset when the
external reset input turns OFF. 2
Counter No. When inverting logic of external reset input signal Description
Overview
M8388 The logic of the external reset input is
C241 to C245 M8389 inverted so that the counters are reset
C247 to C250 when the input turns OFF.
C252 to C255 (The logic is inverted for all target
C2
K{{{
counters.) 3
List
Instruction
Caution
The counter C253 is switched to a software counter when the logic of the external reset input signal is
inverted.
in Detail
Devices
The assignment of the input terminal and the function of the software counters C244, C245, C248 and C253
are changed as shown below when combined with the following special auxiliary relays.
In a program, put a special auxiliary relay just before a target counter.
Counter No. When using software counter as hardware counter Description
5
M8388 The counting input is changed from
Constant
Device &
Specified the
M8390 X000 to X006.
C244(OP) Reset input is not provided.
Start input is not provided.
C244 It operates as a hardware counter.
K{{{
Programming
Before
X002 to X007.
C245(OP) Reset input is not provided.
Start input is not provided.
C245
It operates as a hardware counter.
K{{{
M8388 7
M8392
Instruction
Basic
Reset input is not provided.
C248(OP)
It operates as a hardware counter.
C248
K{{{
M8388
M8392 8
Reset input is not provided.
C253(OP)
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
99
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
4.7.8 How to use 2-phase 2-count input counters C251 to C255 with
4 edge counting
For the 2-phase 2-count input counters C251 to C255, the edge count is usually set to 1. By using the
programs shown in the table below, the edge count may be set to 4.
When using 2-phase 2-count input counters with 4 edge
Counter No. Description
counting
M8000
M8198
C251
C251
K{{{ 1 edge count (before change)
M8000 A phase
M8198 +1 +1
C252 B phase
C252 Up-counting
K{{{
M8000 A phase
M8199 1 1
C253 B phase
C253 Down-counting
K{{{
4 edge count (after change)
M8000
M8199 +1 +1 +1 +1 +1
M8388 A phase
C253(OP) M8392
B phase
C253 +1 +1 +1 +1
K{{{ Up-counting
1 1 1 1 1
M8000
M8198 A phase
C254
B phase
C254 1 1 1 1
K{{{ Down-counting
M8000
M8199
C255
C255
K{{{
100
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1
4.7.9 Conditions for hardware counters to be handled as software counters
Introduction
High speed counters are classified into hardware counters and software counters. In some conditions,
however, hardware counters are handled as software counters.
In this case, use hardware counters within the range of maximum response frequency and total frequency as
determined for software counters. 2
Conditions under which counters are handled as software counters
Overview
Hardware
Condition in which hardware counters are handled as software counters
counter No.
Because hardware counters execute counting at the hardware level of the FX3U/FX3UC, they can
execute counting regardless of the total frequency.
However, when hardware counters are handled as software counters with the following conditions, their 3
maximum response frequency and total frequency are limited in the same way as the software counters.
List
Instruction
Use M8380 to M8387 to check whether high speed counters are handled as hardware counters or
software counters.
When DHSCS (FNC 53), DHSCR (FNC 54), DHSZ (FNC 55) or DHSCT (FNC280) instruction is used
for a hardware counter number, the hardware counter is handled as a software counter.
Example: C235
4
C235
in Detail
Devices
C235 K{{{
C236
DHSCS K100 C235 Y000
C237
C238
In this case, C235 is handled as a software counter.
C239
C240
C244(OP)
When an index register is used for a counter number specified in DHSCS (FNC 53), DHSCR 5
(FNC 54), DHSZ (FNC 55) or DHSCT (FNC280) instruction, all hardware counters are handled as
Constant
Device &
Specified the
C245(OP)
software counters.
C246
Example: C235Z0
C248(OP)
C251
DHSCS K100 C235Z0 Y000
C253
C253 (hardware counter) is handled as a software counter by inverting the logic using the external 6
reset input signal logic changing function.
Programming
Before
Example: The logic of the C253 external reset input signal is inverted.
For logic inversion of the external reset input signal, refer to Subsection 4.7.6.
M8388
M8389
7
C253
Instruction
Basic
K{{{
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
101
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
*1. When an index register is added to a counter number specified by a HSCS, HSCR, HSZ or HSCT
instruction, all hardware counters are switched to software counters.
*2. The high speed counters C244 (OP) and C245 (OP) can count up to 10 kHz.
102
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1
2) When special analog adapters and FX3U/FX3UC Series special function blocks/units are used
Introduction
Counter type Response frequency and total frequency according to instruction use condition
When HSZ and HSCT
Following Magnifica- When only HSCT When only HSZ When both HSZ and HSCT
instructions are not
software tion for instruction is used instruction is used instructions are used
used
Software counter with calculating
counter HSCS, HSCR, total Maximum Maximum Maximum Maximum
2
Total Total Total Total
HSZ or HSCT frequency response response response response
frequency frequency frequency frequency
instruction*1 frequency frequency frequency frequency
(kHz) (kHz) (kHz) (kHz)
(kHz) (kHz) (kHz) (kHz)
Overview
C241,
C242, C235, C236,
C243, C237, C238, 1 30 25
1-phase C244, C239, C240
1-counting input
C245
C244(OP),
1 10 10
30 - (Num-
ber of
25-(Number 3
C245(OP) 50 of instruc- 50
List
Instruction
instruc-
1.5(Num tion)*2 1.5(Num
C247, tion)*2
60 50 ber of ber of
1-phase C248, C246, instruc- instruc-
2-counting input C249,
1 30 25
C248(OP) tion) tion)
C250
2- 1 edge
phase count C252,
1 30 25 4
2- C253(OP), (30-Num-
in Detail
Devices
count- 4 edge C254,
C251, C253 (25-Number
ber of
ing count C255
4 7.5 6.2 instruc-
of instruction)
input 4
tion) 4
*1. When an index register is added to a counter number specified by a HSCS, HSCR, HSZ or HSCT
instruction, all hardware counters are switched to software counters.
*2. The high speed counters C244 (OP) and C245 (OP) can count up to 10 kHz.
5
Constant
Device &
Specified the
3. Calculation of the total frequency
Total frequency Sum of "Response frequency of high speed counter
Magnification for calculating total frequency"
For a calculation example, see below. 6
Programming
Before
4. Calculation example
When only HSZ instruction is used 6 times in a program, the total frequency and response frequency are
calculated as follows in accordance with the columns for "When only HSZ instruction is used" shown above.
This calculation example is provided for a system configuration not including special analog adapters and
FX3U/FX3UC Series special function blocks/units.
Magnification
7
Input Maximum response frequency Used
Instruction
Basic
Used high speed counter No. for calculating
frequency calculation instruction
total frequency
Operates as
C237 30 kHz 40 6 (times) = 34 kHz 1
software counter HSZ
C241 20 kHz 40 6(times) = 34 kHz 1 instruction 6
C253(OP) Software counter
4 kHz {40 6(times)} 4 = 8.5 kHz 4
times 8
[4 edge count]
Program Flow
FNC00-FNC09
1) The total frequency is calculated as follows because HSZ instruction is used 6 times:
Total frequency = 80 1.5 6 = 71 kHz
2) The sum of the response frequencies of the high speed counters
being used is calculated as follows:
"30 kHz 1[C237]" + "20 kHz 1[C241]" + "4kHz 4[C253(OP)]" = 66 kHz 71 kHz
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
103
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
For a contact to drive the coil of a high speed counter, use a contact which is normally ON during high
speed counting.
Program a contact which is If a number of input relay for counting is specified, high
normally ON during counting. speed counter cannot execute accurate counting.
If the operation of a high speed counter is triggered by a device such as a switch, the counter may
malfunction due to extra noise from switch chattering or contact bounce.
The input filter of an input terminal for a high speed counter in the main unit is automatically set to 5 s
(X000 to X005) or 50 s (X006 and X007).
Accordingly, it is not necessary to use the REFF instruction or special data register D8020 (input filter
adjustment).
The input filter for input relays not being used for high speed counters remains at 10 ms (initial value).
The inputs X000 to X007 are used for high speed counters, input interrupt, pulse catch, SPD/DSZR/DVIT/
ZRN instructions and general-purpose inputs. There should be no overlap between each input number.
For example, when C251 is used, X000 and X001 are occupied. As a result, "C235, C236, C241, C244,
C246, C247, C249, C252 and C254", "input interrupt pointers I00* and I10*", "pulse catch contacts M8170
and M8171" and "SPD instruction using X000 and/or X001" cannot be used.
When a counting pulse is not provided, none of the high speed counter output contacts will turn ON, even
if the PLC executes an instruction where "present value = set value."
Counting may be started or stopped for a high speed counter when the output coil (OUT C***) is set to ON
or OFF. Program this output coil in the main routine. If the output coil is programmed in a step ladder
(SFC) circuit, subroutine or interrupt routine, counting cannot be started or stopped until the step ladder or
routine is executed.
Make sure that the signal speed for high speed counters does not exceed the response frequency
described above. If an input signal exceeds the response frequency, a WDT error or parallel link
malfunction may occur.
When a high speed counter is reset by the RST instruction, it cannot count until the RST instruction is set
to OFF.
1) Program example
X010
RST C235 C235 is reset while X010 turns ON.
2) Timing chart
X000
X010
RST
C235 C235 remains reset
104
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.7 High Speed Counter [C]
1
Write the following program to "reset only the current value of a high speed counter (and does not turn OFF
Introduction
the contact)".
3) Program example
X010*
FNC 12 K0 C235
DMOV
The current value of C235 is cleared (to "0").
2
Overview
* When the driving contact is the continuous execution type, the current value of the counter is reset to "0"
at each scan while X010 remains ON.
4) Timing chart
X000
3
List
Instruction
4
3 3
Current 2 2
value of C235 1 1
X010
4
in Detail
Devices
Because X010 turns ON, Because the driving contact is the
"FNC12 DMOV" is executed. pulse execution type, C235 executes
The current value of C235 is counting normally after that.
reset to "0".
Write the following program to "turn OFF the contact and reset the current value of a high speed counter". 5
5) Program example
Constant
Device &
Specified the
X010*
RST C235 ----- A
M8001
RUN Monitor
RST C235 ----- B
6
(normally OFF)
Programming
Before
* When the driving contact is the continuous execution type, the current value of the counter is reset to "0"
and the counter reset status is cleared at each scan while X010 remains ON.
6) Timing chart
X000 7
Instruction
Basic
4
3 3
Current 2 2
value of C235 1 1
Because the reset instruction
X010
is deactivated, C235 executes
counting. 8
Program Flow
FNC00-FNC09
RST
C235
10
Operation
Arith. & Logic
FNC20-FNC29
105
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.8 Data Register and File Register [D]
*1. This area is not latched (battery backed). It can be changed to the latched (battery backed) area by
setting parameters.
*2. This area is latched (battery backed). It can be changed to the non-latched (non-battery-backed) area
by setting parameters.
*3. The latch (battery backup) characteristics cannot be changed using parameters.
*4. Data registers D1000 and later can be used as file registers in units of 500 points by setting
parameters.
When computer link PCs or parallel link is used, some data registers are occupied for the link.
Refer to the Data Communication Edition.
106
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.8 Data Register and File Register [D]
1
4.8.2 Structures of data registers and file registers
Introduction
1) 16-bit type
One (16-bit) data register or file register can store a numeric value within the range from -32768 to
+32767.
High D 0 (16 bits) Low
2
order 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 order
Overview
b15 16384 b0
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
Sign
0: Positive
number
1: Negative
number 3
A numeric value can be read from or written to a data register by an applied instruction usually.
List
Instruction
Or a numeric value can be directly read from or written to a data register from a display unit, display
module, or programming tool.
2) 32-bit type
Two serial data registers or file registers can express 32-bit data.
- A data register with a larger device number handles high-order bits, and a data register with a smaller 4
device number handles low-order bits.
in Detail
Devices
- In the index type, V handles high-order bits, and Z handles low-order bits.
Two data registers or file registers can store a numeric value within the range from -2,147,483,648 to
+2,147,483,647.
Constant
Device &
Specified the
1,073,741,824
536,870,912
268,435,456
134,217,728
67,108,864
33,554,432
16,777,216
8,388,608
4,194,304
2,097,152
1,048,576
524,288
262,144
131,072
65536
32768
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
Sign
0: Positive
number
1: Negative
number
6
Programming
Before
In the case of 32-bit type, when a data register or file register on the low-order side (example: D0) is
specified, the subsequent number on the high-order side (example: D1) is automatically occupied.
Either an odd or even device number can be specified for the low-order side, but it is recommended to
specify an even device number for the low-order side under consideration of the monitoring function of
display units, display modules, and programming tools.
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
107
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.8 Data Register and File Register [D]
108
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.8 Data Register and File Register [D]
1
3. Operation examples
Introduction
Data registers can be used in various control with numeric data.
This section explains the operations of representative basic instructions and applied instructions among
various applications.
For the full use of data registers, refer to the explanation of applied instructions later.
1) Data registers in basic instructions 2
Specifying the set value of a timer or counter
Overview
T 2 D0 A counter or timer operates while regarding the
contents of a specified data register as its set value.
C 10 D 20 3
List
Instruction
2) Data registers using applied instructions
Operation examples using MOV (FNC 12) instruction
a) Changing the current value of a counter
FNC 12 D 5 C 2
The current value of the counter C2 is changed to 4
MOV the contents stored in D5.
in Detail
Devices
b) Reading the current value of a timer or counter to a data register
Constant
Device &
Specified the
16-bit
FNC 12 K200 D 10 "200 (decimal value)" is transferred to D10.
MOV
32-bit 6
"80000 (decimal value)" is transferred to D10 and D11.
FNC 12
Programming
Before
K80000 D10(D11) Because a numeric value larger than 32767 is 32-bit
DMOV data, a 32-bit operation is required. When a data
register on the low-order side (D10) is specified, a
data register on the high-order side (D11) is
automatically occupied.
Instruction
Basic
FNC 12 D 10 D 20 The contents of D10 are transferred to D20.
MOV
C 20
As in the case of data registers, when 16-bit timers or counters are used as 32-bit devices, two timers or
two counters (example: C1 and C0) store 32-bit numeric data.
One 32-bit counter (example: C200) can store 32-bit numeric data.
10
Operation
Arith. & Logic
FNC20-FNC29
109
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.8 Data Register and File Register [D]
In parameter settings, 1 to 14 blocks can be specified. One block secures 500 file registers, but uses the
program memory area by 500 steps.
When some of file registers D1000 and later are set as file registers, the remaining registers can be used
as latched (battery backed) type data registers.
Remaining area can be used as latched (battery backed) type data registers
for general purpose.
The data stored in data registers set as file registers are automatically copied from the file register area [A]
to the data register area [B] when restoring the power.
110
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.8 Data Register and File Register [D]
1
When a file register is monitored from peripheral equipment, the data register area [B] inside the data
Introduction
memory is read.
When "file register device current value change", "file register device forced reset" or "PLC memory all
clear" is executed from peripheral equipment, the file register area [A] inside the program memory is
changed, and then the data is automatically transferred to the data register area [B].
Accordingly, when file register devices are overwritten, the program memory should be "built-in memory
(RAM)" or "memory cassette (flash memory) whose protect switch is set to OFF". (The memory cassette
2
Overview
(flash memory) cannot be overwritten from peripheral equipment if its protect switch is set to ON.)
2. File register Data register <updating the same number registers by BMOV (FNC 15)
instruction>
When the same file register is specified for both S and D in BOMV (FNC 15) instruction, this
instruction specifies the same-number register update mode and executes the following operation: 3
List
Instruction
Inside built-in RAM Inside system Read
memory or RAM
memory cassette BMOV
D0 OFF
direction
Program Data M8024
inverse:
memory memory
Program/
S D
OFF
n 4
Data register X002
in Detail
Devices
comment FNC 15
D1100 D1100 BMOVP D1100 D1100 K400
D1000
500 points File register Data register
Read Same file register number is specified.
14 blocks
[A] [B]
maximum D1499 D1499 When X002 is set to ON while BMOV instruction direction
(7000 points
maximum) Data register reverse flag M8024 is OFF, the contents of a file register 5
D7999 are transferred to the data register area [B] inside the data
Constant
Device &
Specified the
memory as shown in the figure on the left.
Programming
Before
S D n
Program/ Data X003
register FNC 15
comment BMOVP D1100 D1100 K400
D1000 D1100 D1100
500 points File Data
Same file register number is specified.
14 blocks
maximum
register Write register
M8001 BMOV 7
[A] D1499 D1499 [B] M8024 direction
Instruction
Basic
(7000 points
maximum) Data register Always OFF inverse:
D7999 during operation OFF
left.
When updating the contents of a file register in the same-number update mode, make sure that the file
register numbers at S and D are equal to each other. Also make sure that the number of transfer
points specified by "n" does not exceed the file register area. If the number of transfer points exceeds the
file register area, an operation error occurs and the instruction is not executed. 9
Move & Compare
FNC10-FNC19
When S and D are indexed, the instruction is executed if the actual device number is within the
file register area and if the number of transfer points is within the file register area also.
10
Operation
Arith. & Logic
FNC20-FNC29
111
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.8 Data Register and File Register [D]
Write
comment
D1000 D1100 D1100 When X001 is set to ON, data is transferred to
500 points the data register area [B] and file register area [A]
File register Write Data register
14 blocks as shown in the figure on the left.
[A] [B]
maximum
D1499 D1499 If data cannot be written to the file register area
(7000 points [A] because the protect switch of the memory
maximum) Data register
D7999 cassette (flash memory) is ON, data is written to
only the data register area [B].
When a file register device is specified for D
in a general applied instruction, data is
transferred to only the data register area [B].
A file register can be specified for S . If
D is the same as S , the same-number
register update mode is selected.
For the same-number register update mode, refer to the previous page.
By controlling BMOV instruction direction reverse flag M8024 for BMOV (FNC 15) instruction, data can be
transferred in both directions in one program (as shown in the figure below).
X001 BMOV S D Batch transfer of data registers
M8024 direction M8024(OFF):D1100 D200
inverse
S D n
X000 S D Batch transfer of data registers
FNC 15
BMOVP D1100 D200 K400 and writing to file register
M8024(ON) :D1100 D200
M8001 BMOV
M8024
direction
Always OFF during
inverse: OFF
operation
Cautions on reading
When a file register (D1000 or later) is specified for the source of BMOV (FNC 15) instruction and the same
number file register is not specified for the destination, the contents of the file register area [A] inside the
program memory are not read.
1) When a file register is specified for the source and a data register is specified for the destination
112
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.8 Data Register and File Register [D]
1
2) When file registers of different device numbers are specified for the source and destination
Introduction
Inside built-in RAM Write
Inside system
memory or RAM M8024
memory cassette
D0 OFF
n
Program
memory
Data
memory X001
FNC 15
S D
2
D1100 D1400 K100
Overview
BMOVP
Program/ Data register
comment
D1000 When X001 is set to ON, the contents of the data
Write D1100
500 points register area [B] are transferred to the data
File register Data register
Write
D1400 D1199
14 blocks register area [B] and file register area [A] as
maximum [A]
D1499
[B] D1400
D1499
shown in the figure on the left. 3
(7000 points If data cannot be written to the file register area
List
Instruction
maximum) Data register
D7999 [A] because the protect switch of the memory
cassette (flash memory) is ON, data is written to
only the data register area [B].
in Detail
Devices
1. Cautions on using a memory cassette
When changing the contents of file registers stored in the flash memory inside the memory cassette, observe
the following condition:
Set to OFF the protect switch in the memory cassette.
Allowable writing to a flash memory is up to 10000 times.
5
Constant
Device &
Specified the
When writing data using a continuous operation type instruction in a program, data is written to the flash
memory in every operation cycle of the PLC.
For preventing this, make sure to use a pulse operation type instruction (BMOVP).
It takes 66 to 132 ms to write data to one serial block (500 points) in the flash memory. Execution of the
program is paused during this period. Because the watchdog timer is not refreshed at this time, it is
necessary to take proper countermeasures such as insertion of WDT instruction in a user program.
6
Programming
Before
2. Cautions on handling file registers in the same-number register update mode in BMOV (FNC
15) instruction
When updating the contents of the same number file register, make sure that the file register number at
S and D are equal to each other.
7
Make sure that the number of transfer points specified by "n" does not exceed the file register area.
Instruction
Basic
If the number of transfer points specified by "n" exceeds the file register area, an operation error (M8067)
occurs and the instruction is not executed.
In the case of indexing
When S and D are indexed, the instruction is executed if the actual device number is within the
file register area and the number of transfer points is within the file register area also. 8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
113
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
*1. Available only while a memory cassette is mounted (because they are stored in the flash memory
inside a memory cassette.)
114
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
1
4.9.3 Structures of extension registers and extension file registers
Introduction
One extension register consists of 16 bits. Extension registers can be used in 16-bit and 32-bit applied
instructions in the same way as data registers.
1) 16-bit type
One extension register (consisting of 16 bits) can handle a numeric ranging from 32768 to +32767. 2
R0, ER0 (16 bits)
Overview
High Low
order 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 order
b15 b0
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
Sign
0: Positive
number
1: Negative 3
number
List
Instruction
A numeric value is usually read from and written to an extension register by applied instructions.
However, a numeric value can also be directly read from and written to an extension register from a
display unit, display module, or programming tool.
2) 32-bit type
Two serial extension registers (consisting of 32 bits) can express a 32-bit numeric value ranging from 4
2,147,483,648 to +2,147,483,647. (A larger number register handles high-order 16 bits, and a smaller
in Detail
Devices
number register handles low-order 16 bits.)
High R1, ER1 (high-order 16 bits) R0, ER0 (low-order 16 bits) Low
order 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 order
b31 b0
5
1,073,741,824
536,870,912
268,435,456
134,217,728
67,108,864
33,554,432
16,777,216
8,388,608
4,194,304
2,097,152
1,048,576
524,288
262,144
131,072
65536
32768
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
Sign
0: Positive
Constant
Device &
Specified the
number
1: Negative
number
In the case of 32 bit type, when an extension register on the low-order side (example: R0) is specified, the
subsequent serial number on the high-order side (example: R1) is automatically occupied.
6
Programming
Before
Either an odd or even device number can be specified for the low-order side, but it is recommended to
specify an even device number for the convenience of the monitoring function for display units, display
modules, and programming tools.
Instruction
Basic
or when the PLC mode switches from STOP to RUN.
When initializing the contents of extension registers, clear them using a sequence program or GX Developer.
Command
FNC 16 K0 R0 K200
FMOVP
When initializing extension registers and extension file registers in sector units
Example: When initializing R0 to R4095 and ER0 to ER4095 (initializing two sectors starting from R0 and 9
ER0)
Move & Compare
FNC10-FNC19
Command
FNC 292 The current value in Ro to R4095 is initialized
R0 K2 to "FFFFH".
INITRP
This operation initializes the contents of timers, counters, data registers, file registers and extension registers.
115
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
C 10 R 20
116
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
1
4.9.6 Functions and operation examples of extension file registers
Introduction
Extension file registers (ER) are usually used as log data storage destinations and set data storage
destinations.
Extension file registers can be handled only with dedicated instructions shown in the table below. When
using data contents with other instructions, transfer them to an extension register of the same device number,
and then use the extension register.
2
Overview
However, note that extension file registers are available only while a memory cassette is mounted.
Instruction Description
LOADR(FNC290) This (transfer) instruction reads data of extension file registers (ER)*1 to extension registers (R).
This (transfer) instruction writes data of extension registers (R) to extension file registers (ER)*1 in 2048
SAVER(FNC291) point (1 sector) units. Use this instruction to store newly created sectors (2048 points) of data to 3
extension file registers (ER)*1.
List
Instruction
This instruction initializes extension registers (R) and extension file registers (ER)*1 in 2048 point (1
INITR(FNC292) sector) units. Use this instruction to initialize extension registers (R) and extension file registers (ER)*1
before starting to log data by the LOGR instruction.
This instruction logs specified data, and writes it to extension registers (R) and extension file registers
LOGR(FNC293)
(ER)*1. 4
in Detail
Devices
This (transfer) instruction writes specified extension registers (R) to extension file registers (ER)*1.This
RWER(FNC294) instruction is supported in FX3UC PLCs Ver.1.30 or later.Use this instruction to store the contents of any
extension register (R) to extension file register (ER)*1.
This instruction initializes extension file registers (ER)*1 in 2048 point (1 sector) units. This instruction is
INITER(FNC295) supported in FX3UC PLCs Ver.1.30 or later.Use this instruction to initialize extension file registers (ER)*1
before executing SAVER instruction.
5
Constant
Device &
Specified the
*1. Extension file registers are only accessible when a memory cassette is mounted.
Programming
Before
SAVER instruction cassette mounted
(sector units)
RWER instruction
(arbitrary number of
R0 2048 points) ER0 2048 1 sector
General-purpose device
General
R2048
points
2048 ER2048
points
2048
7
(sequence program) points LOADR instruction points
Instruction
Basic
applied
instruction R4096 (point units) ER4096
2048 2048
points points
INITER instruction ER6144 2048
INITER (initialization) points
LOGR (sector units) 16
instruction sectors 8
Program Flow
FNC00-FNC09
INITR instruction
(initialization) All points are
(sector units) written at one
R30720 time ER30720
9
R32767 ER32767
Move & Compare
FNC10-FNC19
Nonvolatile
memory
Programming tool
GX Developer
10
Operation
Arith. & Logic
FNC20-FNC29
117
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
118
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
1
4.9.8 Registration of data in extension registers and extension file registers
Introduction
This subsection explains the operating procedures of GX Developer (Ver.8.23Z or later).
For details on GX Developer operating procedures, refer to the GX Developer manual.
Overview
Click [Start]-[All Programs]-[MELSOFT Application]-[GX Developer] in Microsoft Windows.
List
Instruction
PLC series FXCPU
PLC Type FX3U(C)*1
in Detail
Devices
*1
Constant
Device &
Specified the
6
Programming
Before
*1. For Ver. 8.13P to 8.24A of GX Developer, the PLC type is FX3UC. 7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
119
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
3. Click the [OK] button to display the dialog box for confirmation.
FX3U(C)*1
*1. For Ver. 8.13P to 8.24A of GX Developer, the PLC type is FX3UC.
120
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
1
5. Input a device number to be set to "Device Label", and click the [Display] button.
Introduction
6. Select the data type to be set in the two selection boxes to the right of the [Display] button.
Overview
3
List
Instruction
4
in Detail
Devices
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
121
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.9 Extension Register [R] and Extension File Register [ER]
FX3U(C)*1
*1. For Ver. 8.13P to 8.24A of GX Developer, the PLC type is FX3UC.
2. Put a check mark next to "MAIN (prepared device memory name)" under "Device memory."
3. Click the "Device data" tab, and add "Ext. file register" to target devices.
By default, "Ext. file register" is not included for reading/writing.
To add it, click the blank space on the left side of "Ext. file register" to change it to "".
In GX Developer Ver.8.18U or later, the range of extension file registers to be written can be specified.
FX3U(C)*1
*1. For Ver. 8.23Z or 8.24A of GX Developer, the PLC type is FX3UC.
122
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.10 Index Register [V and Z]
1
4.10 Index Register [V and Z]
Introduction
Index registers can be used in the same way as of data registers. But they are special registers since they
can change the contents of device numbers and numeric values by program when combined with another
device number or numeric value in operands of applied instructions.
2
4.10.1 Numbers of index registers
Overview
The table below shows numbers of index registers (V and Z). (Numbers are assigned in decimal.)
When only "V" or "Z" is specified, it is handled as "V0" or "Z0" respectively.
Index type
V0 (V) to V7, Z0 (Z) to Z7 3
FX3U/FX3UC PLC *1
List
Instruction
16 points
*1. The characteristics related to protection against power failure cannot be changed by parameters.
in Detail
Devices
1. 16-bit type
Index registers have the same structures as data registers.
16 bits 16 bits
V Z
V0 to V7:
8 points
Z0 to Z7:
8 points 5
Constant
Device &
Specified the
2. 32-bit type
Make sure to use Z0 to Z7 when indexing a device in a 32-bit applied instruction or handling a numeric value
outside the 16-bit range.
This is because FX PLCs handle Z as the low-order side of a 32-bit
32 bits
V0 (high-order side) Z0 (low-order side) register as shown in combinations of V and Z in the figure on the left. 6
Even if V0 to V7 on the high-order side is specified, indexing is not
Programming
Before
V1 (high-order side) Z1 (low-order side) executed.
When index registers are specified as a 32-bit device, both V (high-
V2 (high-order side) Z2 (low-order side)
order side) and Z (low-order side) are referred to at the same time.
V3 (high-order side) Z3 (low-order side) If a numeric value for another purpose remains in V (high-order side),
consequently the numeric value here becomes extremely large, thus
V4 (high-order side) Z4 (low-order side) an operation error occurs. 7
Example of writing to 32-bit index registers
V5 (high-order side) Z5 (low-order side)
Instruction
Basic
V6 (high-order side) Z6 (low-order side) FNC 12 K300 Z2
DMOV
V7 (high-order side) Z7 (low-order side) K300(V2,Z2)
Even if an index value in a 32-bit applied instruction does not exceed
the 16-bit numeric range, use a 32-bit operation instruction such as
DMOV instruction for writing a numeric value to Z as shown in the
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
123
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.10 Index Register [V and Z]
124
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.11 Pointer [P and I]
1
4.11 Pointer [P and I]
Introduction
4.11.1 Numbers of pointers
The table below shows numbers of pointers (P and I). (Numbers are assigned in decimal.) 2
When using a pointer for input interrupt, an input number assigned to it cannot be used together with a "high
Overview
speed counter" or "speed detection (FNC 56)" which uses the same input range.
FX3U/ P0 to P62
I00(X000) I30(X003) I6 I010 I040 3
P63 I10(X001) I40(X004) I7 I020 I050
List
Instruction
FX3UC P64 to P4095
1 point I20(X002) I50(X005) I8 I030 I060
PLC 4095 points
6 points 3 points 6 points
in Detail
Devices
Because all of these pointers are combined with applied instructions, refer to the explanation of each
instruction for the detailed method.
For details on interrupt function, refer to Chapter 35.
Constant
Device &
Specified the
X001
FNC 00 P 0 When X001 turns ON, the PLC jumps to a label
CJ position specified by CJ (FNC 00) instruction,
and executes the subsequent program.
Jump
Label
P0
6
Programming
Before
CALL (FNC 01) call subroutine
X001
FNC 01 P 1 When X001 turns ON, the PLC executes a
CALL subroutine in the label position specified by
Main program CALL (FNC 01) instruction, and then returns to 7
Jump the original position by SRET (FNC 02)
Instruction
Basic
FNC 06 instruction.
FEND
Label
P1 Subroutine
FNC 02 program
SRET Return 8
Program Flow
FNC00-FNC09
125
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.11 Pointer [P and I]
*1. Cleared when the PLC mode switches from RUN to STOP.
Non-overlap of input numbers
Inputs X000 to X007 are used for high speed counters, input interrupt, pulse catch, SPD/ZRN/DSZR/DVIT
instructions and general-purpose inputs. When assigning functions, there should be no overlap between
those input terminals.
For example, when the input interrupt pointer I001 is used, X000 is occupied. As a result, "C235, C241,
C244, C246, C247, C249, C251, C252 and C254", "input interrupt pointer I000", "pulse catch contact M8170"
and "SPD instruction using X000" cannot be used.
Delay function of input interrupt
This input interrupt has a function to delay the execution of interrupt routine in units of 1ms.
The delay time is specified by the following pattern program.
This delay function can electrically adjust the mounting position of sensors for input interrupts without shifting
the actual position.
Contact for setting delay time
I
M8393
FNC 12 Delay time specifying program
K{{{* D8393 Make sure to describe the delay time specifying
MOV
program shown on the left at the head of an
[1] Delay time (unit: ms) interrupt routine program.
Because this is a pattern program, change only
the delay time [1].
Program to be processed by input interrupt Only a constant (K) or data register (D) can be
used to specify the delay time*.
FNC 03 Interrupt program is finished
IRET
126
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.11 Pointer [P and I]
1
Operations
Introduction
FNC 04 Interrupt is usually disabled in the PLC.
If interrupt is enabled by EI instruction, when
EI X000 or X001 turns ON while a program is
scanned, the PLC executes the interrupt
Interrupt enabled
range
routine [1] or [2], and then returns to the main
program by IRET instruction. 2
Overview
FNC 06
Pointer for FEND
interrupt Rising edge of X000 is detected 3
I001 Make sure to program a pointer for interrupt
List
Instruction
(I***) as a label after FEND instruction.
Interrupt routine [1]
FNC 03
IRET
Pointer for
interrupt Rising edge of X001 is detected
I101
4
in Detail
Devices
Interrupt routine [2]
FNC 03
IRET
END
5
Constant
Device &
Specified the
2. Pointers for timer interrupt: 3 points
For details on timer interrupt function, refer to Section 35.5.
The PLC executes an interrupt routine program at every specified interrupt cycle time (10 to 99 ms).
Use these pointers for control requiring cyclic processing regardless of the operation cycle of the PLC.
Input No. Interrupt cycle (ms) Interrupt disabling flag 6
Programming
Before
I6 M8056*1
An integer in the range from 10 to 99 is put in "" portion of the
I7 pointer name. M8057*1
Ex: I610 = Timer interrupt at every 10 ms
I8 M8058*1
*1. Cleared when the PLC mode switches from RUN to STOP.
7
Caution
Instruction
Basic
It is recommended to set the timer interrupt time to 10 ms or more. When the timer interrupt time is set to 9
ms or less, the timer interrupt processing may not be executed at an accurate cycle in the following cases:
When the processing time of the interrupt program is long
When an instruction requiring long processing time is used in the main program
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
127
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.11 Pointer [P and I]
Operations
Step FNC 04 Interrupt is Timer interrupt is enabled after EI instruction.
0 enabled It is not necessary to program DI (disable
EI interrupt) instruction when no zone to disable
timer interrupt is needed.
Main
program
END
*1. Cleared when the PLC mode switches from RUN to STOP.
128
FX3U/FX3UC Series Programmable Controllers 4 Devices in Detail
Programming Manual - Basic & Applied Instruction Edition 4.11 Pointer [P and I]
1
Operations
Introduction
Step Enable interrupt after EI instruction, and
0 FNC 04
EI describe the main program.
M8000
Drive the coil of a high speed counter, and
2
C255 K2,147,483,647
Overview
specify an interrupt pointer in DHSCS (FNC 53)
RUN instruction.
monitor FNC 53
DHSCS K1000 C255 I010
When the current value of C255 changes from
"999" to "1000" or from "1001" to "1000", the
Interrupt pointer interrupt routine is executed.
For example of interrupt program, refer to an
FNC 06
FEND
number is
specified
input interrupt described above. 3
Pointer for
List
Instruction
interrupt Counter interrupt is specified
I010
Interrupt routine
(interrupt program)
4
in Detail
Devices
FNC 03 Interrupt return
IRET
END
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
129
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.1 Numeric Values Handled in PLCs (Octal, Decimal, Hexadecimal and Real Numbers)
130
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.1 Numeric Values Handled in PLCs (Octal, Decimal, Hexadecimal and Real Numbers)
1
6. Real numbers (floating point data)
Introduction
FX3U and FX3UC PLCs have the floating point operation function to achieve high accuracy operation.
In floating point operations, binary floating points (real numbers) are used, and scientific notation (real
numbers) are used for monitoring them.
Overview
Numeric values handled in FX PLCs can be converted as shown in the table below:
Decimal number Hexadecimal number
Octal number (OCT) Binary number (BIN) BCD
(DEC) (HEX)
0 0 00 0000 0000 0000 0000
1 1 01 0000 0001 0000 0001 3
2 2 02 0000 0010 0000 0010
List
Instruction
3 3 03 0000 0011 0000 0011
4 4 04 0000 0100 0000 0100
5 5 05 0000 0101 0000 0101
6
7
6
7
06
07
0000
0000
0110
0111
0000
0000
0110
0111
4
in Detail
Devices
8 10 08 0000 1000 0000 1000
9 11 09 0000 1001 0000 1001
10 12 0A 0000 1010 0001 0000
11 13 0B 0000 1011 0001 0001
12 14 0C 0000 1100 0001 0010 5
13 15 0D 0000 1101 0001 0011
Constant
Device &
Specified the
14 16 0E 0000 1110 0001 0100
15 17 0F 0000 1111 0001 0101
16 20 10 0001 0000 0001 0110
99 143 63 0110 0011 1001 1001
Programming
Before
Major applications
Decimal number Hexadecimal number
Octal number (OCT) Binary number (BIN) BCD
(DEC)
Constants (K) and
(HEX)
7
BCD digital switches
Instruction
Basic
numbers of internal Numbers of internal Processing inside
Constants (H) and seven-segment
devices except I/O I/O relays PLC
display units
relays
8
5.1.3 Handling of numeric values in floating point operations
Program Flow
FNC00-FNC09
operations.
10
Operation
Arith. & Logic
FNC20-FNC29
131
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.1 Numeric Values Handled in PLCs (Octal, Decimal, Hexadecimal and Real Numbers)
The sign bit b31 states whether data is positive or negative, but is not handled as a complement.
Handling of the zero (M8020), borrow (M8021) and carry (M8022) flags
These flags operate as follows in floating point operations.
The most significant bit of D0 and D1 specifies the positive or negative sign respectively, and is handled as
the complement of 2 respectively.
The mantissa D0 does not allow "100", for example. In the case of "100", it is handled as "1000 101".
The scientific notation (real number) range is as follows:
132
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.2 Specification of Constants K, H and E (Decimal, Hexadecimal and Real Number)
1
Scientific notation (real number) is valid in the following instructions:
Introduction
- Conversion from binary floating point (real number) into scientific notation (real number): FNC118
([D]EBCD)
- Conversion from scientific notation (real number) into binary floating point (real number): FNC119
([D]EBIN)
2
5.2 Specification of Constants K, H and E
Overview
(Decimal, Hexadecimal and Real Number)
When handling constants in a sequence program, use constant K (decimal), H (hexadecimal) or E (floating
point).
In peripheral equipment for programming, add "K" to a decimal number, "H" to a hexadecimal number and "E"
3
List
Instruction
to a floating point (real number) for operations associated with numeric values in instructions. (Examples:
K100 (decimal number), H64 (hexadecimal number) and E1.23 (or E1.23 + 10) (real number))
The roles and functions of constants are described below.
in Detail
Devices
"K" indicates a decimal integer, and is mainly used to specify the set value of timers and counters and
numeric values as operands in applied instructions. (Example: K1234)
The decimal constant specification range is as follows:
Constant
Device &
Specified the
5.2.2 Constant H (hexadecimal number)
"H" indicates a hexadecimal number, and is mainly used to specify numeric values as operands in applied
instructions. (Example: H1234)
When using digits 0 to 9, the bit status (1 or 0) of each bit is equivalent to the BCD code, so BCD data can be 6
specified also.
Programming
Before
(Example: H1234 ... When specifying BCD data, specify each digit of hexadecimal number in 0 to 9.)
The hexadecimal constant setting range is as follows:
- When word data (16 bits) is used ... H0 to HFFFF (H0 to H9999 in the case of BCD data)
- When double data (32 bits) is used ... H0 to HFFFFFFFF (H0 to H99999999 in the case of BCD data) 7
Instruction
Basic
5.2.3 Constant E (real number)
"E" indicates a real number (floating point data), and is mainly used to specify numeric values as operands in
applied instructions. (Example: E1.234 or E1.234 + 3)
The real number setting range is from 1.0 2128 to 1.0 2126, 0 and 1.0 2126 to 1.0 2128. 8
In a sequence program, a real number can be specified in two methods, "normal expression" and "exponent
Program Flow
FNC00-FNC09
expression".
10
Operation
Arith. & Logic
FNC20-FNC29
133
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.3 Character Strings
M7679 to
M211 to M196 00H 13th character M7664 "n"th character "(n-1)"th character
"00H" indicating the "00H" indicating the end of character string
end of the character cannot be detected from the specified
string can be device to the end device number.
detected. <Example 2> 16 bits
M7623 to M7608 2nd character 1st character
M7639 to M7624 4th character 3rd character
M7655 to M7640 6th character 5th character
M7671 to M7656 8th character 7th character
M7679 to M7672 00H
Because the data "00H" indicating the end
of the character string does not reach 16
bits, the end of the character string cannot
be recognized.
134
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.4 Specification of Digits for Bit Devices (Kn[ ]***)
1
5.4 Specification of Digits for Bit Devices (Kn[ ]***)
Introduction
Handling of bit devices
Devices which handle only the ON/OFF information such as X, Y, M and S are called bit devices.
On the other hand, devices handling numeric values such as T, C, D and R are called word devices. 2
Even bit devices can handle a numeric value when they are combined. In this case, the number of digits Kn
Overview
and the head device number are combined.
The number of digits is expressed in 4 bit units (digits); K1 to K4 are used for 16-bit data, and K1 to K8 are
used for 32-bit data.
For example, "K2M0" indicates two-digit data expressed by M0 to M7.
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 3
List
Instruction
Sign bit (0 = Positive, 1: Negative) D0 Low order
Transferred
Do not change
K2M0
0 1 0 1 0 1 0 1
M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0 4
Transferred
in Detail
Devices
Sign bit (0 = Positive, 1: Negative) D1 Low order
0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1
When 16-bit data is transferred to K1M0 to K3M0, the highest-order bits are not transferred due to insufficient
data length.
32-bit data is transferred in the same way. 5
When the number of digits specified for bit devices is K1 to K3 (or K1 to K7) in a 16-bit (or 32-bit) operation,
Constant
Device &
Specified the
the insufficient high-order bits are always regarded as "0". It means that such data is always positive.
Programming
Before
A bit device number can be specified arbitrarily, but it is recommended to set the least significant digit to "0"
for X or Y. (In other words, it is recommended to specify "X000, X010, X020 ... Y000, Y010, Y020 ...")
For M and S, multiples of "8" are ideal, but it is recommended to specify "M0, M10, M20 ..." to prevent
confusion.
7
Specification of consecutive words
Instruction
Basic
A series of data registers starting from D1 means "D1, D2, D3, D4 ....."
In the case of word devices with digit specification, when such word devices are handled as a series, they are
specified as shown below:
Use the above devices in digit units so that devices are not skipped.
When "K4Y000" is used in a 32-bit operation, the high-order 16 bits register as "0".
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
135
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.5 Bit Specification of a Word Device (D[ ].b)
D0 F E D C B A 9 8 7 6 5 4 3 2 1 0
16 bits
136
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.7 Indexing
1
5.7 Indexing
Introduction
The functions and structures of index registers are explained in detail in "4.10 Index Register [V and Z]".
Refer to Section 4.10 in advance.
Overview
In the case of bit devices
Bit devices [X, Y, M (except special auxiliary relays), T, and C (C0 to C199)] used in LD, LDI, AND, ANI, OR,
ORI, OUT, SET, RST, PLS, and PLF instructions can be indexed with index registers.
The figure shown on the right explains an indexing operation with
X030
3
the index register Z(0) for X000 and M0 in the LD instruction. FNC 12
List
Instruction
K5 Z(0)
Transfer K5 or K10 to the index register Z(0) in advance. MOVP
If Z(0) is "5", "X(0+5) = X005". When X005 turns ON, Y000 turns ON K5 Z(0)
and "M(0+5) = M5". When M5 turns ON, Y001 turns ON. X030
FNC 12
If Z(0) is "10", "X(0+10) = X012*1". When X012*1 turns ON, Y000 MOVP
K10 Z(0)
turns ON and "M(0+10) = M10". When M10 turns ON, Y001 turns K10 Z(0) 4
ON.
in Detail
Devices
X000Z(0)
*1. Refer to the caution 3) below. Y000
The index registers Z0 to Z7 and V0 to V7 can be used for
indexing. M0Z(0)
Y001
In OUT instruction for a timer or counter, the timer number (or
counter number) and the device specified for the set value can be
Z(0)=5 : X005=ON Y000=ON
M5=ON Y001=ON
5
indexed. Z(0)=10 : X012*2=ON Y000=ON
Constant
Device &
Specified the
M10=ON Y001=ON
Cautions *2 Refer to the caution 3).
Programming
Before
3) When an octal device number of X or Y is indexed with an index register, the contents of the index
register are converted into octal, and then added to the device number.
For example, when the value of an index register added to the input X000 is changed in the order "K0
K8 K16", the device number converted into octal is added to the input X000 and the input number is
changed in the order "X(000+0) = X000 X(000+8) = X10 X(000+16) = X20".
7
In the case of word devices and constants
Instruction
Basic
The set value of word devices used in OUT instruction of T and C(0~199) can be indexed with index registers.
The indexing operation is explained in an example in which the set
value D0 of T0 used in the index register V2 indexes OUT X030
FNC 12 K0 V2
instruction(as shown in the right figure). MOVP
Transfer K0 or K10 to the index register V2 in advance. K0 V2 8
When X001 is set to ON, "D(0+0) = D0" if V2 is "0", and T0 operates
Program Flow
FNC00-FNC09
X030
with the set value D0. FNC 12 K10 V2
When X001 is set to ON, "D(0+10) = D10" if V2 is "10", and T0 MOVP
operates with the set value D10. K10 V2
Caution X001
T0
9
1) When a 32-bit counter is used in OUT instruction, the set value D0V2
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
137
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.7 Indexing
138
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.7 Indexing
1
Cautions
Introduction
1) When even if a numeric value written to index registers does not exceed the 16-bit numeric value range
(0 to 32767), make sure to overwrite both V and Z using a 32-bit instruction. If only Z is overwritten and
another numeric value remains in V, the numeric value will be extremely large. Thus an operation error
occurs.
2) It is not permitted to use 16-bit counters as 32-bit counters by executing indexing.
2
Overview
When 32-bit counters are required, add Z0 to Z7 to counters C200 and later.
3) It is not permitted to index V and Z themselves.
4) Direct specification of buffer memory in special function blocks/units
In the direct specification of buffer memory "U\G", the buffer memory number can be indexed with
index registers. 3
The unit number cannot be indexed with index registers.
List
Instruction
("U0\G0Z0" is valid, but "U0Z0\G0" is invalid.)
5) Indexing in bit digit specification
It is not permitted to index "n" in "Kn" used for digit specification.
("K4M0Z0" is valid, but "K0Z0M0" is invalid.)
6) Indexing of I/O relays (octal device numbers)
X030
4
When octal device numbers of X, Y, KnX, and KnY are indexed FNC 12
in Detail
Devices
K0 V3
with index register, the contents of an index register are MOVP
converted into octal, and then added to the device number. K0V3
In the example shown in the figure on the right, Y007 to Y000 X031
FNC 12 K8 V3
are output by MOV instruction, and inputs are switched by MOVP
indexing X007 to X000, X017 to X010, and X027 to X020.
When rewriting the index value as "K0", "K8", "K16", the device X032
K8V3 5
FNC 12 K 16 V3
Constant
Device &
Specified the
number converted into octal is added "X000 + 0 = X000", "X000 MOVP
+ 8 = X10", "X000 + 16 = X20", and the input terminal working as K16 V 3
the source is changed accordingly. X033
FNC 12 K2X0V3 K2Y0
MOV
Programming
Before
A sequence to display the present value of the timers T0 to T9 can
be programmed index registers.
M8000
FNC 19 K1X000 Z0 Digital switch input
5
BIN for setting timer
RUN monitor
(X003 to X000)BCD(Z0)BIN
number X003 to X000 7
Instruction
Basic
FNC 18 PLC
T 0Z0 K4Y000
BCD
(T0Z0)BIN(Y017 to Y000)BCD
"T0Z0 = T0 to T9" according to "Z0 = 0 to 9"
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
139
FX3U/FX3UC Series Programmable Controllers 5 How to Specify Devices and Constants to Instructions
Programming Manual - Basic & Applied Instruction Edition 5.7 Indexing
X013
FNC 70 X000V0 D0V1 M0V2
TKY
TKY Input Data Data Head Device
Instruction Head Storage Number of
Device Destinati Pressed Key
Number on Information
140
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.1 How to Read Explanation of Instructions
Introduction
6. What to Understand before Programming
This chapter explains the I/O processing, relationship among instructions and programming method which 2
should be understood before creating sequence programs.
Overview
6.1 How to Read Explanation of Instructions
In this manual, applied instructions are explained in the following form.
For the expression methods and basic rules for applied instructions, read in advance "6.5 General rules for
3
List
Instruction
applied instructions" described later.
4
Indicates applicable
in Detail
Devices
PLC versions.
Applicable series
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
The above is different from the actual page, as it is provided for explanation only.
10
Operation
Arith. & Logic
FNC20-FNC29
141
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.1 How to Read Explanation of Instructions
Outline
1. Instruction format
1) The applied instruction number (FNC No.) and instruction mnemonic are indicated. The table below
shows the meaning of simplified expression.
Applicable
Mark Description instruction
(example)
FNC 12 No. Dotted lines on the upper left and lower left sides indicate an independent
WDT(FNC 07)
Instruction
MOV name P instruction not associated with the 16-bit or 32-bit type.
FNC 12 No. Continuous lines on the upper left side indicates that 16-bit type is available.
MOV(FNC 12)
D MOV name
Instruction P "D" on the lower left side indicates that the 32-bit type is available.
Dotted lines on the lower left side indicate that the 32-bit type does not exist.
FNC 12 No.
Continuous lines on the upper left side indicate that only the 16-bit type is CJ(FNC 00)
D Instruction
MOV name P available.
FNC 12 No. Dotted lines on the upper left side indicate that the 16-bit type does not exist.
HSCS(FNC 53)
D Instruction
MOV name P "D" on the lower left side indicates that only the 32-bit type is available.
Continuous lines on the upper right side indicate that the continuous operation
FNC 12 No.
type is available. "P" on the lower right side indicates that the pulse operation CMP(FNC 10)
DInstruction
MOV name P type is available.
Dotted lines on the lower right side indicate that the pulse operation type does
FNC 12 No.
not exist. Continuous line on the upper right side indicate that only the MTR(FNC 52)
DInstruction
MOV name P continuous operation type is available.
" "on the upper right side indicates that the contents of the destination
FNC 12 No. change in every operation cycle when the continuous operation type is used. INC(FNC 24)
DMOV name P
Instruction When operation should be executed only during the driving of an instruction,
use the pulse operation type indicated by "P" on the lower right side.
2. Set data
The contents of devices that can be specified as operands in instructions and available data types are
described below:
1) Contents
The contents of operands in each instruction are described below.
2) Indexing of the source and destination
In operands to which " " is added such as S and S1 , indexing is available.
Operands not allowing indexing are expressed as S and S1 .
3) Data types
- Bit : Bit device
- 16-bit BIN : 16-bit binary code
- 32-bit BIN : 32-bit binary code
- 64-bit BIN : 64-bit binary code
- 16/32-bit BIN : 16-bit or 32-bit binary code
- 32/64-bit BIN : 32-bit or 64-bit binary code
- 4-digit BCD : 4-digit (16-bit) BCD code
- 8-digit BCD : 8-digit (32-bit) BCD code
- 4/8-digit BCD : 4-digit (16-bit) or 8-digit (32-bit) BCD code
- Character string : Character code such as ASCII code and shift JIS code
- Character string (only ASCII) : ASCII code
- Real number (binary) : Binary floating point
- Real number (decimal) : Scientific notation
142
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.1 How to Read Explanation of Instructions
1
Applicable devices
Introduction
Devices which can be specified in operands of instructions are shown.
When a device supports an instruction, "3" is added to the device.
Overview
M : Auxiliary relay (M) KnX: Input relay (X) with digit specification*1
S : State relay (S)
KnY: Output relay (Y) with digit specification*1
etc.
KnM: Auxiliary relay (M) with digit specification*1
KnS: State relay (S) with digit specification*1
T : Timer (T) current value
C : Counter (C) current value 3
D : Data register (file register)
List
Instruction
V, Z: Index register
Modify: Availability of indexing using index register
etc.
in Detail
Devices
The function of each instruction is explained.
Cautions
Cautions on using each instruction are described.
5
Constant
Device &
Specified the
Errors
Major errors that are possible to occur in each instruction are described.
For details on errors, refer to "Chapter 37. Errors and Error Code List".
Program examples 6
Concrete program examples using each instruction are described.
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
143
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.2 Cautions on Creation of Fundamental Programs
(5)OUT (4)OUT
(5)OUT (4)OUT
(4)ANB
(3)OR (2)OR
Executed
(1)
(5)
(3)
(7) (9) (10)
(2)
(6)
(4)
(8)
(11)
144
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.2 Cautions on Creation of Fundamental Programs
1
6.2.2 Double output (double coil) operation and countermeasures
Introduction
1. Operation of double outputs
When a coil gives double outputs (double coils) in a sequence program, the priority is given to the latter one.
Overview
X001 = ON X002 = OFF
For example, suppose the X001 is ON and X002 is OFF.
First
In the first coil Y003, the image memory turns ON and the output X001
Y004 turns ON also because the input X001 is ON. Y003
In the second coil Y003, however, the image memory is set to 3
OFF because the input X002 is OFF.
List
Instruction
Accordingly, the actual output to the outside is "Y003 = OFF, Y003
Y004 = ON". Y004
Second
X002
Y003 4
in Detail
Devices
2. Countermeasures against double outputs
Double outputs (double coils) do not cause illegal input (program Output processing
Y003 = OFF Y004 = ON
error), but the operation is disrupted as described above.
Change the program as shown in the example below.
A B 5
A B Y000
Constant
Device &
Specified the
Y000
C E
.....
Ignored D
C E
6
Programming
Before
Y000
D
A B
M100
.....
or
7
C E
Instruction
Basic
M101
D
.....
M100
Y000 8
Program Flow
FNC00-FNC09
M101
SET, RST or jump instruction can be used instead, or a same output coil can be programmed at each state by
step ladder instructions.
When step ladder instructions are used, if an output coil located in the main routine is also used in a state, it is 9
handled as a double coil. It is better to avoid such programming.
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
145
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.2 Cautions on Creation of Fundamental Programs
1. Bridge circuit
A circuit in which the current flows in both directions should be changed as shown in the figure on the right (so
that a circuit without D and a circuit without B are connected in parallel).
A B C E B
F F
A
E
A E D
C D
C
B D
E C
146
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.3 I/O Processing and Response Delay
1
6.3 I/O Processing and Response Delay
Introduction
1. Operation timing of I/O relays and response delay
FX PLCs execute the I/O processing by repeating
(1) [Input The ON/OFF status of input
the process (1) to process (3).
Accordingly, the control executed by PLCs contains
processing]
Input image
terminals is received at one time. 2
Input image is read,
Overview
not only the drive time of input filters and output memory is read
and operation is
devices but also the response delay caused by the Scan time (2) [Program processing] executed according
Image memory of to program.
operation cycle. (operation
cycle) each device is
updated
List
Instruction
output latch
immediately outputting the operation result in the Batch I/O method memory are driven
(refresh method)
middle of the operation cycle shown above, the I/O
refresh instruction is available.
in Detail
Devices
response delay".
When the response delay of the input filter "10 ms" is considered and the cycle time is supposed as "10 ms",
the ON duration and OFF duration should be at least 20 ms respectively.
Accordingly, PLCs cannot handle input pulses at 25 Hz (1000 / (20 + 20) = 25) or more. However, the
situation can be improved by PLC special functions and applied instructions. 5
Constant
Device &
Specified the
Convenient functions for improvement
By using the following functions, PLCs
can receive pulses shorter than the This "input ON" can be received
operation cycle: "Input ON" cannot This "input OFF"
be received cannot be received
High speed counter function
OFF ON ON OFF 6
Input interrupt function
Programming
Before
Program Program Program Program
Pulse catch function processing processing processing processing
Input filter value adjustment function Input processing
Operation cycle
Output processing ( Time)
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
147
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.4 Mutual Relationship Among Program Flow Control Instructions
Top line
MC-MCR CJ-P EI-DI FOR-NEXT STL-RET
Left line
3 octet 3 Example 3 3 3
1
MC-MCR
Example
2 3
3 3 3 3 3
CJ-P
3
3 3 3 3 3
EI-DI
3 3 3 3 3
3 3 3 quintet
FOR-NEXT
3 *2
inside
3 3 one
STL
STL-RET
3
3 3 3
P-SRET
3
3 3 3
I-IRET
3
3 3 3 3
FEND-END
*1
3 3 3 3 3
O-FEND
3 3
O-END 3 3 3 3 3
(no FEND)
*1
148
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.4 Mutual Relationship Among Program Flow Control Instructions
Introduction
2
Overview
3:This combination can be used without any problem.
:This combination is not allowed; Operation error will be occurs.
U:This combination is allowed, but is better not to be used because the operation will be complicated.
List
Instruction
*1 The DI skip status occurs, but this is not an
error.
*2 4
FOR FOR NEXT NEXT
in Detail
Devices
3
The operation indicated by continuous lines is
*1 discribed.
3 3
5
3 3 3 *3 The first FEND or END is valid, but the intended
Constant
Device &
Specified the
processes will not occur. But this is not an
error.
Programming
Before
Instructions having containment relationship can
be combined except some combinations as
follows: 7
Instruction
Basic
1) MC-MCR cannot be used in FOR-NEXT, STL-RET,
P-SRET and I-RET.
*3
3 3 be interrupted by I, IRET, SRET, FEND, END, etc.
*3
*3
9
Move & Compare
FNC10-FNC19
*3
*3
*3
10
Operation
Arith. & Logic
FNC20-FNC29
149
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.5 General Rules for Applied Instructions
- In applied instructions, the program step of the instruction part always occupies 1 step, but each
operand occupies 2 or 4 steps depending on whether the instruction is 16-bit type or 32-bit type.
150
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.5 General Rules for Applied Instructions
1
Instruction form and operation type
Introduction
Applied instructions are classified into "16-bit type" or "32-bit type" by the size of handled numeric values.
And by the operation type, applied instructions are classified into "continuous operation type" or "pulse
operation type".
Some applied instructions have every combination of this form and type, and others do not.
Overview
- Applied instructions handling numeric values are classified into the 16-bit type or the 32-bit type by the
bit length of the numeric value data.
Command 1
FNC 12 D10 D12 This instruction transfers the contents of D10 to D12.
Command 2
MOV
This instruction transfers the contents of D21 and D20 to
3
FNC 12
List
Instruction
D20 D22 D23 and D22.
DMOV
in Detail
Devices
For avoiding confusion, it is recommended to specify an even device number (which will be the low-
order side) for an operand in a 32-bit instruction.
- 32-bit counter (C200 to C255) is regarded as 32 bits, and cannot be used as an operand in a 16-bit
instruction.
Constant
Device &
Specified the
Pulse operation type
In the example shown in the figure on the right, when X000 turns X000
ON from OFF, the instruction is executed only once, and is not FNC 12 D10 D12
MOVP
executed in any other case.
When it is not necessary to continually execute an instruction,
use the pulse operation type. 6
The symbol "P" indicates the pulse operation type.
Programming
Before
"DMOVP" indicates also the pulse operation type.
Instruction
Basic
In the continuous operation type of some instructions such as FNC 24 (INC) and FNC 25 (DEC), the
contents of the destination change in every operation cycle.
For applied instructions requiring attention in using the continuous operation type, the symbol " " is
added to the title of the explanation of such instructions as shown in the figure below.
8
Program Flow
FNC00-FNC09
FNC 12 No.
D MOV name P
Instruction
In any case, instructions are not executed while the drive input X000 or X001 is OFF. And the destinations
do not change except when instructions specify otherwise.
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
151
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.5 General Rules for Applied Instructions
152
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.5 General Rules for Applied Instructions
1
1. Program containing many flags (example of instruction execution complete flag M8029)
Introduction
When two or more instruction execution complete flags M8029 are programmed together for applied
instructions, it is difficult to determine which instruction executes which flag.
For using flags in any positions other than directly under applied instructions, refer to the next page.
Good example
2
...
Overview
M8000
FNC 72 X10 Y10 D0 K1
DSW
M8029
FNC 22
M8029 works as
Execution is
completed
MUL
D0 K10 D20
3
List
Instruction
a flag to indicate
...
that execution of
DSW is
completed.
X000
SET M0
M0
FNC 57
4
K1000 D20 Y000
in Detail
Devices
DPLSY
M8029 works as
a flag to indicate
that execution of M8029
DPLSY is RST M0
completed. Execution is
completed
Constant
Device &
Specified the
Bad example M8029 works as M8029
a flag to indicate Program for the second DPLSY
that execution of RST M0
instruction
...
Programming
Before
M8029 works as
a flag to indicate X000
that execution of M0
DSW is SET
completed.
M0
FNC 57
DPLSY
K1000 D20 Y000 First DPLSY instruction 7
Instruction
Basic
M8029 works as
a flag to indicate
that execution of M8029
FNC 22 Program for DSW
the first DPLSY D0 K10 D20
is completed. Execution is MUL instruction
completed
M1
FNC 57 K1000 D22 Y001
Second DPLSY 8
DPLSY instruction
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
153
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.5 General Rules for Applied Instructions
2. Introduction of method for using flags in any positions other than directly under applied
instructions
When two or more applied instructions are programmed, general flags turn ON or OFF when each applied
instruction turns ON.
Accordingly, when using a flag in any position other than directly under an applied instruction, set to ON or
OFF another device just under the applied instruction, and then use the contact of the device as the
command contact.
...
M8000
FNC 72 X10 Y10 D0 K1
DSW
It works as DSW
execution
complete flag.
M100
FNC 22 D0 K10 D20
MUL
It works as
DPLSY execution
complete flag.
M200
Y030
154
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.5 General Rules for Applied Instructions
1
6.5.3 Handling of operation error flag
Introduction
When there is an error in the applied instruction configuration, target device or target device number range
and an error occurs while operation is executed, the following flag turns ON and the error information is
stored.
1. Operation error 2
Overview
Device storing error occurrence Device storing error
Error flag Device storing error code
step occurrence step*1
M8067 D8067 D8315, D8314 D8069
*1. Compatible with the FX0, FX0S, FX0N, FX1, FX2, FX2C, FX1S, FX1N, FX2N, FX1NC and FX2NC Series.
3
List
Instruction
When an operation error has occurred, M8067 is set, D8067 stores the operation error code number, and
D8315 and D8314 (32 bits in total) store the step number in which the error has occurred.
When the error occurrence step is up to the 32767th step, the error occurrence step can be checked in
D8069 (16 bits).
If another error occurs in another step, the stored data is updated in turn to the error code and step number 4
of the new error. (These devices are set to OFF when errors are cleared.)
in Detail
Devices
When the PLC mode switches from STOP to RUN, these devices are cleared instantaneously, and then
set to ON again if errors have not been cleared.
Constant
Device &
Specified the
device (32 bits) device*1
M8068 D8313, D8312 D8068
*1. Compatible with the FX0, FX0S, FX0N, FX1, FX2, FX2C, FX1S, FX1N, FX2N, FX1NC and FX2NC Series.
When an operation error has occurred, M8068 is set, and D8313 and D8312 store the step number in 6
Programming
Before
which the error has occurred.
Even if another error has occurred in another step, the stored data is not updated, and remains held until
these devices are forcibly reset or until the power turns OFF.
When the error occurrence step is up to the 32767th step, the error occurrence step can be checked in
D8068 (16 bits). 7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
155
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.5 General Rules for Applied Instructions
- For returning this XCH instruction to the normal XCH Same number
instruction, it is necessary to set M8160 to OFF. M8160
When using an instruction requiring the function extension flag in an interrupt program, program DI instruction
(for disabling interrupt) before driving the function extension flag, and program EI instruction (for enabling
interrupt) after turning OFF the function extension flag.
When using above instructions beyond the allowable number of times of use
For instructions whose operands allow indexing, device numbers and numeric values in such instructions can
be changed by index registers.
By indexing, when driving multiple instances simultaneously is not required, such instruction can be used as if
they were used beyond the allowable number of times.
Refer to "Subsection 5.7.3. Indexing example in instruction with limited number of use".
156
FX3U/FX3UC Series Programmable Controllers 6 What to Understand before Programming
Programming Manual - Basic & Applied Instruction Edition 6.5 General Rules for Applied Instructions
1
Limitation in simultaneous instances of instructions
Introduction
Some applied instructions can be programmed two or more times, but the number of simultaneous instances
is limited.
Even in instructions not shown below, if two or more instructions are driven at the same time for a same I/O
number, it is regarded as double outputs. In some combinations of instructions, the operation may be
disrupted, or the instructions cannot be executed. 2
For details, refer to the caution described in each instruction page.
Overview
For combinations of instructions, refer to "6.4 Mutual relationship among program flow control instructions".
1. Positioning instructions
Do not drive FNC 57 (PLSY), FNC 58 (PWM), FNC 59 (PLSR), FNC150 (DSZR), FNC151 (DVIT), FNC156
(ZRN), FNC157 (PLSV), FNC158 (DRVI) and FNC159 (DRVA) instructions at the same time for the same
output number. 3
List
Instruction
2. High speed processing instructions
In FNC 53 (HSCS), FNC 54 (HSCR) and FNC 55 (HSZ) instructions (including FNC280 (HSCT) instruction),
make sure that up to 32 instructions are driven at the same time. [FNC280 (HSCT) instruction can be used
only once.]
Note that "FNC280 (HSCT) instruction", "table high speed comparison mode of FNC 55 (HSZ) instruction)"
and "frequency control mode of FNC 55 (HSZ) instruction" can each only be used once.
4
in Detail
Devices
3. External device communication instructions
In FNC 80 (RS) and FNC 87 (RS2) instructions, do not drive two or more instructions at the same time for
the same port.
It is impossible to combine and use FNC 80 (RS), FNC 87 (RS2), FNC270 (IVCK), FNC271 (IVDR),
FNC272 (IVRD), FNC273 (IVWR) and FNC274 (IVBWR) instructions for the same port.
5
Constant
Device &
Specified the
In FNC270 (IVCK), FNC271 (IVDR), FNC272 (IVRD), FNC273 (IVWR) and FNC274 (IVBWR) instructions,
two or more instructions can be driven at the same time for the same port.
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
157
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7. Basic Instruction
This chapter explains types and functions of basic sequence instructions.
For beginners to sequence control, we offer "Introduction Course" and "Relay Ladder Course" learning texts
for reference.
We can also offer the PLC learning software "Beginner Course".
Mnemonic Name Symbol Function Applicable devices Reference
Contact Instruction
Initial logical operation
Applicable devices
LD Load contact type NO (normally X,Y,M,S,D.b,T,C Section 7.1
open)
Initial logical operation
LDI Load Inverse Applicable devices contact type NC (normally X,Y,M,S,D.b,T,C Section 7.1
closed)
Parallel connection of NO
OR OR X,Y,M,S,D.b,T,C Section 7.4
Applicable devices (normally open) contacts
Parallel connection of NC
ORI OR Inverse X,Y,M,S,D.b,T,C Section 7.4
Applicable devices (normally closed) contacts
Parallel connection of
ORP OR Pulse X,Y,M,S,D.b,T,C Section 7.5
Applicable devices rising edge pulse
Parallel connection of
ORF OR Falling Pulse X,Y,M,S,D.b,T,C Section 7.5
Applicable devices falling/trailing edge pulse
158
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
Introduction
Mnemonic Name Symbol Function Applicable devices Reference
Connection Instruction
Serial connection of
ANB AND Block Section 7.7
multiple parallel circuits
2
Overview
Parallel connection of
ORB OR Block Section 7.6
multiple contact circuits
List
Instruction
MRD the initial PLC operations
Pops (recalls and
MPP Memory POP MPP removes) the currently Section 7.8
stored result
INV Inverse
INV Invert the current result of
the internal PLC Section 7.10
4
in Detail
Devices
operations
Conversion of
MEP MEP operation result Section 7.11
to leading edge pulse
MEF MEF
Conversion of
operation result Section 7.11 5
to trailing edge pulse
Constant
Device &
Specified the
Out Instruction
Programming
Before
Y,M,S,D.b,T,C,
RST Reset RST Applicable devices Reset bit device OFF Section 7.13
D,R,V,Z
PLS Pulse PLS Applicable devices Rising edge pulse Y,M Section 7.12
7
Instruction
Basic
PLF Pulse Falling PLF Applicable devices Falling/trailing edge pulse Y,M Section 7.12
End Instruction 9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
159
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.1 LD, LDI
Outline
LD and LDI instructions are contacts connected to bus lines.
When combined with ANB instruction described later, LD and LDI instructions can be used for the start of
branches.
1. Instruction format
Basic Instruction Mnemonic Operation Condition
LD Continuous
LD Operation
Load Pulse (Single)
Operation
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S S S
LD 3 3 3 S2 3
1 1 2
S S S
LDI 3 3 3 S2 3
1 1 2
S1: Special auxiliary relays (M) and 32-bit counters (C) cannot be indexed with index registers (V and Z).
S2: State relays (S) and "D.b" cannot be indexed with index registers (V and Z).
LD instruction
X000 0000 LD X000 Connection to bus line
Y000 0001 OUT Y000
Bus line
Timing chart
X000 ON ON
Y000 ON ON
160
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.1 LD, LDI
1
2. LDI instruction (initial logical operation, NC contact type)
Introduction
Circuit program List program
LDIinstruction
X000 0000 LDI X000 Connection to bus line
Y000 0001 OUT Y000
Bus line
2
Overview
Timing chart
X000 ON ON
3
Y000 ON ON
List
Instruction
3. Indexing
Devices used in LD and LDI instructions allow indexing with index registers (V and Z).
(State relays (S), special auxiliary relays (M), 32-bit counters (C), and "D.b" cannot be indexed.)
4
V0 to V7 and Z0 to Z7 are available in
in Detail
Devices
Circuit program List program
indexing.
When used devices are inputs (X) and
outputs (Y), values of index registers (V and
X000V0 0000 LD X000V0 Z) are converted into octal numbers, and then
Y000 0003 OUT Y000
added.
Example:When the value of V0 is 10, LD 5
contact is set to ON (becomes
Constant
Device &
Specified the
conductive) or OFF (becomes non-
conductive) by X012.
Programming
Before
When specifying a bit in data register, input "."
Circuit program List program
after a data register (D) number, and then
input a bit number (0 to F) consecutively.
Only 16-bit data registers are available.
D0.3 0000 LD D0.3 Specify a bit number as "0, 1, 2, ... 9, A, B, ...
Y000 0003 OUT Y000
F" from the least significant bit. 7
Example:In the example shown on the left, LD
Instruction
Basic
contact is set to ON (becomes
conductive) or OFF (becomes non-
conductive) by the bit 3 of D0.
Errors 8
Program Flow
FNC00-FNC09
When an I/O number used in LD or LDI instruction does not exist due to indexing, M8316 (Non-existing I/O
specification error) turns ON.
When the device number of a device (M, T or C) other than I/O used in LD or LDI instruction does not exist
due to indexing, an operation error (error code: 6706) occurs.
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
161
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.2 OUT
7.2 OUT
Outline
OUT instruction drives coils of output relays (Y), auxiliary relays (M), state relays (S), timers (T) and counters
(C).
1. Instruction format
Basic Instruction Mnemonic Operation Condition
OUT Continuous
OUT Operation
OUT Pulse (Single)
Operation
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S S S
OUT 3 3 S2 3
1 1 2
Set
3 3 3 3 3
value
S1: Special auxiliary relays (M) and 32-bit counters (C) cannot be indexed with index registers (V and Z).
S2: State relays (S) and "D.b" cannot be indexed with index registers (V and Z).
162
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.2 OUT
Introduction
Timing chart
ON ON
X000
Overview
X001 ON ON
OUT instruction
3
M101 ON
List
Instruction
2. When a timer or counter is used
The set value is required after OUT instruction for the counting coil of a timer or counter.
The set value can be specified directly by a decimal number (K) or indirectly using a data register (D) or
extension register (R). 4
1) Direct specification
in Detail
Devices
The set value of a timer or counter can be
Circuit program List program
specified directly by a decimal number (K).
X000 0000 LD X000
T0 K30
0001 OUT T0
(SP) K30
X001
K30
0004 LDI
0005 OUT
X001
T1
5
T1
Constant
Device &
Specified the
(SP) K30
0008 OUT C0
(SP) K50
C0 K50
2) Indirect specification 6
The set value of a timer or counter can be
Programming
Before
Circuit program List program set by a data register (D) or extension data
X000 0000 LD X000 register (R). At this time, the current value
T10 D10
0001 OUT T10 of the data register (D) or extension
(SP) D10 register (R) is regarded as the set value of
X001
T11 R15
0004 LDI
0005 OUT
X001
T11 the timer or counter. 7
(SP) R15 It is necessary to write in advance the set
Instruction
Basic
0008 OUT C10 value to a data register (D) or extension
(SP) D20
C10 D20 register (R) used for the set value by MOV
instruction, DSW instruction or display unit
before driving the timer or counter.
3) Setting range of timers and counters
The table below shows the set value range of timers and counters, the actual timer constants and the
8
Program Flow
FNC00-FNC09
number of program steps (including the set value) for OUT instruction.
Setting range
Timer/counter Actual set value Number of steps
(Value of K or current value of D or R)
1 ms timer 1 to 32767 0.001 to 32.767 sec 3
10 ms timer
1 to 32767
0.01 to 327.67 sec
3 9
100 ms timer 0.1 to 3276.7 sec
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
163
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.2 OUT
3. Indexing
Devices used in OUT instruction can be indexed with index registers (V and Z).
(State relays (S), special auxiliary relays (M), 32-bit counters (C), and "D.b" cannot be indexed.)
Caution
When a special internal relay (M), timer or counter is used, program steps increase as described in "Setting
range of timers and counters" on the previous page.
Errors
When an I/O number used in OUT instruction does not exist due to indexing, M8316 (Non-existing I/O
specification error) turns ON.
When the device number of a device (M, T or C) other than I/O used in OUT instruction does not exist due
to indexing, an operation error (error code: 6706) occurs.
164
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.3 AND, ANI
1
7.3 AND, ANI
Introduction
Outline
AND and ANI instructions connect one contact in series.
The number of contacts connected in series is not limited, so AND and ANI instructions can be used
2
Overview
consecutively as many times as necessary.
Output to another coil by way of a contact after OUT instruction is called cascade output.
Such cascade output can be repeated as many times as necessary as far as the order is correct.
1. Instruction format
Basic Instruction Mnemonic Operation Condition
3
AND Continuous
List
Instruction
AND Operation
Pulse (Single)
AND Operation
in Detail
Devices
Pulse (Single)
AND Inverse Operation
2. Applicable devices
Bit Devices Word Devices Others
5
Constant
Device &
Specified the
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S S S
AND 3 3 3 S2 3
1 1 2
S S S
6
ANI 3 3 3 S2 3
1 1 2
Programming
Before
S1: Special auxiliary relays (M) and 32-bit counters (C) cannot be indexed with index registers (V and Z).
S2: State relays (S) and "D.b" cannot be indexed with index registers (V and Z).
Instruction
Basic
1. AND instruction (serial connection of NO (normally open) contacts)
Circuit program List program
AND instruction
X002 X000 0000 LD X002
0001 AND X000 Contact connected
8
Y003
in series
Program Flow
FNC00-FNC09
Timing chart
LD instruction X002 ON ON
9
Move & Compare
FNC10-FNC19
Y003 ON
10
Operation
Arith. & Logic
FNC20-FNC29
165
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.3 AND, ANI
ANI instruction
X002 X000 0000 LD X002
Y003 0001 ANI X000 Contact connected
0002 OUT Y003 in series
Timing chart
LD instruction X002 ON ON
Y003 ON ON
3. Indexing
Devices used in AND and ANI instruction can be indexed with index registers (V and Z).
(State relays (S), special auxiliary relays (M), 32-bit counters (C), and "D.b" cannot be indexed.)
Errors
When an I/O number used in AND or ANI instruction does not exist due to indexing, M8316 (Non-existing I/
O specification error) turns ON.
When the device number of a device (M, T or C) other than I/O used in AND or ANI instruction does not
exist due to indexing, an operation error (error code: 6706) occurs.
166
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.3 AND, ANI
1
Program examples
Introduction
Circuit program List program
AND instruction
0000 LD X000
X000 X001
Y003
0001
0002
AND
OUT
X001
Y003
Contact connected
in series 2
ANI instruction 0003 LD X002
Overview
0004 ANI X003 Contact connected
X002 X003 0005 OUT Y004 in series
Y004 0006 AND X004 Contact connected
0007 OUT T0 in series
(SP) K30
AND instruction 0010 LD X005 Contact connected
X004
K30
0011 ANI
0012 OUT
T0
Y005
in series
3
T0
List
Instruction
ANI instruction
X005 T0
Y005
in Detail
Devices
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
167
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.4 OR, ORI
Outline
OR and ORI instructions are used to connect one contact in parallel.
If two or more contacts are connected in series, use ORB instruction described later to connect such a serial
circuit block to another circuit in parallel.
A step containing OR or ORI instruction is connected in parallel to a preceding step containing LD or LDI
instruction. There is no limitation in the number of times of parallel connection.
1. Instruction format
Basic Instruction Mnemonic Operation Condition
OR Continuous
OR Operation
Pulse (Single)
OR Operation
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S S S
OR 3 3 3 S2 3
1 1 2
S S S
ORI 3 3 3 S2 3
1 1 2
S1: Special auxiliary relays (M) and 32-bit counters (C) cannot be indexed with index registers (V and Z).
S2: State relays (S) and "D.b" cannot be indexed with index registers (V and Z).
Timing chart
LD instruction X000 ON ON
OR instruction X001 ON ON
Y000 ON ON ON
168
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.4 OR, ORI
1
2. ORI instruction (parallel connection of NC (normally closed) contacts)
Introduction
Circuit program List program
Overview
Timing chart
LD instruction X000 ON ON 3
List
Instruction
ORI instruction ON ON ON
X002
Y001 ON ON ON
4
3. Relationship with ANB instruction
in Detail
Devices
The parallel connection by OR or ORI
LD ANB LD instruction is connected to the preceding LD
or LDI instruction in principle. After ANB
instruction, however, the parallel connection
by OR or ORI instruction is connected to the 5
second preceding LD or LDI instruction.
Constant
Device &
Specified the
OR OR
Before ANB
OR instruction
OR
6
Programming
Before
After ANB instruction
4. Indexing
Devices used in OR and ORI instruction can be indexed with index registers (V and Z).
(State relays (S), special auxiliary relays (M), 32-bit counters, and "D.b" cannot be indexed.) 7
Instruction
Basic
The index registers V0 to V7 and Z0 to Z7 are
Circuit program List program
available for indexing.
When a used device is an input (X) or output
(Y), the value of an index register (V or Z) is
X000 0000 LD X000
Y000 0001 OR X001V0
0004 OUT Y000
converted into an octal number, and then
added.
8
X001V0
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
169
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.4 OR, ORI
Errors
When an I/O number used in OR or ORI instruction does not exist due to indexing, M8316 (Non-existing I/
O specification error) turns ON.
When the device number of a device (M, T or C) other than I/O used in OR or ORI instruction does not
exist due to indexing, an operation error (error code: 6706) occurs.
170
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
1
7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
Introduction
Outline
LDP, ANDP, and ORP instructions for contacts detect the rising edge, and become active during one
operation cycle only at the rising edge of a specified bit device (that is, when the bit device turns ON from
2
Overview
OFF).
Contact instructions LDF, ANDF and ORF detect the falling edge, and become active during one operation
cycle only at the falling edge of a specified bit device (that is, when the bit device turns OFF from ON).
1. Instruction format
Basic Instruction Mnemonic Operation Condition
3
LDP Continuous
List
Instruction
Operation
Load Pulse LDP Pulse (Single)
Operation
in Detail
Devices
LDF Operation
Constant
Device &
Specified the
Basic Instruction Mnemonic Operation Condition
ANDF Continuous
Operation
AND Falling Pulse ANDF Pulse (Single)
Operation
Programming
Before
Continuous
Operation
OR Pulse ORP Pulse (Single)
Operation
ORF
Basic Instruction Mnemonic
Operation Condition
Continuous 7
Operation
Instruction
Basic
OR Falling Pulse ORF Pulse (Single)
Operation
2. Applicable devices
Bit Devices Word Devices Others
8
Program Flow
FNC00-FNC09
ANDF 3 3 3 3 3 3 3
ORP 3 3 3 3 3 3 3
ORF 3 3 3 3 3 3 3
10
Operation
Arith. & Logic
FNC20-FNC29
171
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
LDP instruction
X000 0000 LDP X000
M0 0002 ORP X001
0004 OUT M0
X001 ORP instruction
0005 LD M8000
0006 ANDP X002
ANDP instruction
M8000 X002 0008 OUT M1
M1
RUN monitor
Timing chart
ON during one
M0 operation cycle
M8000 ON
ON during
one opera-
M1 tion cycle
In the example shown above, M0 or M1 is ON during only one operation cycle when X000 to X002 turn ON
from OFF.
172
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
1
2. LDF, ANDF, and ORF instructions (initial logical operation of falling/trailing edge pulse,
Introduction
serial connection of falling/trailing edge pulse, and parallel connection of falling/trailing
edge pulse)
Circuit program List program
2
LDF instruction
X000
Overview
0000 LDF X000
M0
0002 ORF X001
X001 0004 OUT M0
ORF instruction 0005 LD M8000
ANDF instruction 0006 ANDF X002
M8000 X002
M1
0008 OUT M1 3
List
Instruction
RUN monitor
Timing chart
ON ON
LDF instruction X000
4
in Detail
Devices
ORF instruction X001 ON ON
ON during
one opera-
M0 tion cycle
Constant
Device &
Specified the
M8000 ON
ON during
one opera-
6
M1 tion cycle
Programming
Before
In the example shown above, M0 or M1 is ON during only one operation cycle when X000 to X002 turn OFF
from ON.
Instruction
Basic
When specifying a bit in data register, input "."
Circuit program List program
after a data register (D) number, and then
input a bit number (0 to F) consecutively.
Only 16-bit data registers are available.
D0.3 0000 LDP D0.3 Specify a bit number as "0, 1, 2, ... 9, A, B, ...
Y000 0003 OUT Y000
F" from the least significant bit. 8
Example:In the example shown on the left,
Program Flow
FNC00-FNC09
10
Operation
Arith. & Logic
FNC20-FNC29
173
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
X010
Operation Operation
M 6 cycle cycle
In each circuit, M6 is ON during only one operation cycle when X010 turns ON from OFF.
In each circuit, MOV instruction is executed only once when X020 turns ON from OFF.
174
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
1
5. Differences in the operation caused by auxiliary relay (M) numbers
Introduction
When an auxiliary relay (M) is specified as a device in LDP, LDF, ANDP, ANDF, ORP and ORF instructions,
the operation varies depending on the device number range as shown in the figure below.
Overview
SET M50
The contacts [1] to [3] detect the rising edge of M0.
X000 Because of LD instruction, the contact [4] is conductive
M0
while M0 is ON.
[2] M0
SET M51 3
[3]
List
Instruction
M0
SET M52
[4] M0
M53
4
<M2800 to M3071>
in Detail
Devices
From M2800 driven by X000, the program is divided into the
M2800 upper block (block A) and the lower block (block B). In each of
SET M0 the blocks A and B, only the first contact which detects the
M2800 rising or falling edge is activated.
Block A
SET M1 Because of LD instruction, the contact in the block C is 5
conductive while M2800 is ON.
Constant
Device &
Specified the
X000 By utilizing these characteristics, "transition of state by same
M2800 signal" in a step ladder circuit can be efficiently programmed.
M2800
SET M2
M2800 6
SET M3
Programming
Before
Block B
M2800
SET M4
M2800
SET M5 7
M2800
Instruction
Basic
SET M6
M2800
M7 Block C
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
175
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
Cautions
1. Cautions when LDP, LDF, ANDP, ANDF, ORP, or ORF instruction programmed in a same
step is executed two or more times within one operation cycle
When LDP, LDF, ANDP, ANDF, ORP or ORF instruction programmed in a same step is executed two or
more times within one operation cycle, the following operation results:
176
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.6 ORB
1
7.6 ORB
Introduction
Outline
A circuit in which two or more contacts are connected in series is called serial circuit block.
2
1. Instruction format
Overview
Basic Instruction Mnemonic Operation Condition
ORB Continuous
ORB Operation
1 step
OR Block Pulse (Single)
Operation
3
List
Instruction
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
ORB
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V
There are no applicable devices.
Z Modify K H E "" P
4
in Detail
Devices
Explanation of function and operation
1. ORB instruction (parallel connection of multiple contact circuits)
When connecting serial circuit blocks in parallel, use LD or LDI instruction at the start of branch, and use
ORB instruction at the end of branch.
5
Constant
Device &
Specified the
ORB instruction is an independent instruction not associated with any device number in the same way as
ANB instruction described later.
When there are many parallel circuits, ORB instruction can be used for each circuit block to connect them.
Programming
Before
Y006 0000 LD X000 0000 LD X000
0001 AND X001 0001 AND X001
0002 LD X002 0002 LD X002
ORB instruction
0003 AND X003 0003 AND X003
X002 X003 0004 ORB 0004 LDI X004
0005 LDI X004 0005 AND X005 7
0006 AND X005 0006 ORB
Instruction
Basic
ORB instruction 0007 ORB 0007 ORB
0008 OUT Y006 0008 OUT Y006
X004 X005
Caution
There is no limitation in the number of parallel circuits which can be connected by ORB instructions (in the
case of appropriate program shown above).
Though ORB instructions can be used at one time, note that the repeated use of LD or LDI instruction is 9
limited to 8 or less (in the case of inappropriate program shown above).
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
177
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.7 ANB
7.7 ANB
Outline
Use ANB instruction to connect a branch circuit (parallel circuit block) to the preceding circuit in series.
Use LD or LDI instruction at the start of branch. After completing a parallel circuit block, connect the parallel
circuit block to the preceding circuit in series by ANB instruction.
When there are many parallel circuits, ANB instruction can be used in each circuit block to connect them.
1. Instruction format
Basic Instruction Mnemonic Operation Condition
ANB Continuous
ANB Operation
1 step
AND Block Pulse (Single)
Operation
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
ANB There are no applicable devices.
Caution
There is no limitation in the number of ANB instruction.
Though ANB instructions can be used at one time, note that the repeated use of LD or LDI instruction is
limited to 8 or less in the same way as ORB instruction.
178
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.8 MPS, MRD, MPP
1
7.8 MPS, MRD, MPP
Introduction
Outline
FX3U and FX3UC PLCs have 11 memories called "Stack" which store the intermediate result (ON or OFF) of
operations.
2
Overview
1. Instruction format
Basic Instruction Mnemonic Operation Condition
MPS MPS Continuous
1 step Operation
Memory Point Store Pulse (Single)
Operation 3
List
Instruction
Basic Instruction Mnemonic Operation Condition
MRD MRD Continuous
1 step Operation
Memory Read Pulse (Single)
Operation
4
Basic Instruction Mnemonic Operation Condition
in Detail
Devices
MPP MPP Continuous
1 step Operation
Memory POP Pulse (Single)
Operation
2. Applicable devices 5
Bit Devices Word Devices Others
Constant
Device &
Specified the
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
MPS There are no applicable devices.
MRD There are no applicable devices. 6
MPP There are no applicable devices.
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
179
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.8 MPS, MRD, MPP
1. MPS, MRD, and MPP instructions (stores the current result of the internal PLC operations,
reads the current result of the internal PLC operations, and pops (recalls and removes) the
currently stored result)
MPS
X004 X005 0018 LD X004
18 Y002
0019 MPS MPP
X006 1 [2]
0020 AND X005 MRD
Y003 2 [1]
0021 OUT Y002
MRD 3 MPS
Y004 0022 MRD
0023 AND X006
MRD X007 MPP
Y005 0024 OUT Y003
0025 MRD
MPP 10
0026 OUT Y004
11
0027 MPP
Stack
0028 AND X007
0029 OUT Y005
0030 END
Use MPS instruction to store the intermediate result of operation, and then drive the output Y002.
Use MRD instruction to read the stored data, and then drive the output Y003.
MRD instruction can be programmed as many times as necessary.
In the final output circuit, use MPP instruction instead of MRD instruction.
MPP instruction reads the stored data described above, and then resets it.
Error
MPS instruction can be used two or more times.
However, the difference between number of MPS instructions and the number of MPP instructions should be
11 or less, and should be 0 at the end.
180
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.8 MPS, MRD, MPP
1
Program examples
Introduction
1) Program example 1: One stack
Only one stack is used in this example.
Overview
0000 LD X000
Y000 0001 AND X001
0002 MPS
Y001 0003 AND X002
0004 OUT Y000
MPP 0005 MPP 3
MPS 0006 OUT Y001
List
Instruction
X003 X004 0007 LD X003
Y002 0008 MPS
X005 0009 AND X004
Y003 0010 OUT Y002
MPP
0011 MPP 4
0012 AND X005
in Detail
Devices
0013 OUT Y003
MPS 0014 LD X006
X006 X007 0015 MPS
Y004 0016 AND X007
X010
0017
0018
OUT
MRD
Y004
5
Y005
Constant
Device &
Specified the
0019 AND X010
MRD X011 0020 OUT Y005
Y006 0021 MRD
0022 AND X011
MRD X012
0023 OUT Y006
Y007
0024 MPP 6
MPP 0025 AND X012
Programming
Before
0026 OUT Y007
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
181
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.8 MPS, MRD, MPP
182
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.8 MPS, MRD, MPP
1
4) Program example 4: Four stacks
Introduction
Circuit program List program
Overview
0002 AND X001 0011 OUT Y001
Y001 0003 MPS 0012 MPP
0004 AND X002 0013 OUT Y002
MPP
0005 MPS 0014 MPP
Y002
0006 AND X003 0015 OUT Y003
MPP 0007 MPS 0016 MPP 3
Y003 0008 AND X004 0017 OUT Y004
List
Instruction
MPP
Y004
MPP
in Detail
Devices
X000 0000 LD X000
Y004 0001 OUT Y004
0002 AND X001
X001
Y003 0003 OUT Y003 5
0004 AND X002
Constant
Device &
Specified the
X002
0005 OUT Y002
Y002
0006 AND X003
X003 0007 OUT Y001
Y001 0008 AND X004
X004 0009 OUT Y000 6
Y000
Programming
Before
In programming a circuit on the upper side, it is necessary to MPS instruction three times.
By changing the circuit on the upper side into the circuit on the lower side, the same contents can be
programmed easily without MPS instruction.
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
183
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.9 MC, MCR
Outline
When MC instruction is executed, the bus line (LD or LDI point) is moved to a position after MC contact.
The bus line can be returned to the original position by MCR instruction.
By changing a device (Y or M) number, MC instruction can be used as many times as necessary.
If a same device number is used twice, however, it results in the double coil operation in the same way as
OUT instruction.
1. Instruction format
Basic Instruction Mnemonic Operation Condition
MC MC Continuous
Operation
Master Control Pulse (Single)
Operation
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
MC 3 S
MCR There are no applicable devices.
184
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.9 MC, MCR
Introduction
Circuit program List program
0000 LD X000
X000
MC N 0 M100 0001 MC N000
Three-step instruction
N0 M100 0004
SP
LD
M100
X001
2
Overview
0005 OUT Y000
X001 0006 LD X002
Y000 0007 OUT Y001
0008 MCR N 0 Two-step instruction
X002
Y001
3
List
Instruction
MCR N 0 Write MCR N0 instruction.
Program examples 4
1) When the nesting structure is not adopted
in Detail
Devices
Circuit program List program
0000 LD X000
X000
MC N 0 M100 0001 MC
SP
N000
M100
Three-step instruction 5
Constant
Device &
Specified the
N0 M100 0004 LD X001
0005 OUT Y000
X001 0006 LD X002
Y000 0007 OUT Y001
0008 MCR N000 Two-step instruction
X002
Y001
6
Programming
Before
MCR N 0 Return to the bus line ("N0" shows the
nest level.)
X003
7
Instruction
Basic
MC N 0 M150 When not adopting the nesting structure,
use "N0" again. There is no limitation in
N0 M150 the number of "N0".
Only in the nesting structure, increase
the nest level "N" in the way "N0
X004 N1 ... N6 N7" as shown in the
Y002 example 2 on the next page. 8
Program Flow
FNC00-FNC09
X005
Y003
MCR N 0
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
185
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.9 MC, MCR
Circuit program
While X000
is OFF X000 N0
MC N 0 M100
[A]
N0 M100
X001 Level N0
Y000
The bus line B is active while X000 is ON.
[B]
While
X002 is X002
OFF N1
MC N 1 M101
N1 M101
X003 Level N1
Y001 The bus line C is active while both X000 and
[C] X002 are ON.
While
X004 X004
is OFF N2
MC N 2 M102
N2 M102
X005 Level N2
Y002 The bus line D is active while all of X000,
X002 and X004 are ON.
[D]
MCR N 2
N2
X006
Y003 Level N1
The bus line returns to the status of the bus
line C by "MCR N2".
[C] MCR N 1
N1
X007
Y004 Level N0
The bus line returns to the status of the bus
line B by "MCR N1".
[B]
MCR N 0
N0
Initial status
X010 The bus line returns to the initial status of the
Y005 bus line A by "MCR N0". Accordingly, Y005
turns ON or OFF by turning ON or OFF of
X010 without regard to X000, X002 and X004.
[A]
186
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.10 INV
1
7.10 INV
Introduction
Outline
1. Instruction Format 2
INV instruction inverts the operation result up to just before INV instruction, and does not require device
Overview
number specification.
Basic Instruction Mnemonic Operation Condition
INV INV Continuous
1 step Operation
Inverse Pulse (Single)
Operation 3
List
Instruction
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 4
INV There are no applicable devices.
in Detail
Devices
Explanation of function and operation
1. INV instruction (inverts the result of operations)
Circuit program List program Timing chart 5
ON
Constant
Device &
Specified the
0 LD X000 X000 OFF OFF
X000
Y000 1 INV
2 OUT Y000
Y000 ON OFF
ON
Programming
Before
OFF ON
ON OFF
Inverted
In the figure above, Y000 turns ON when X000 is OFF, and Y000 turns OFF when X000 is ON. 7
INV instruction can be used in a same position as serial contact instructions (AND, ANI, ANDP and ANDF).
Instruction
Basic
Different from LD, LDI, LDP and LDF instructions shown in the list, INV instruction cannot execute connection
to bus lines. Different from OR, ORI, ORP and ORF instructions, INV instruction cannot be used
independently in parallel to a contact instruction.
2. Operation range of INV instruction
When INV instruction is used in a complicated circuit containing ORB and ANB instructions, the operation 8
range of INV instruction is as shown in the figure below:
Program Flow
FNC00-FNC09
LD LD
9
Move & Compare
FNC10-FNC19
LD LD
LD LD
INV instruction inverts the operation result after LD, LDI, LDP or LDF instruction located before INV 10
Operation
Arith. & Logic
FNC20-FNC29
instruction.
Accordingly, if INV instructions are used inside ORB and ANB instructions, blocks after LD, LDI, LDP or LDF
instruction seen from each INV instruction are regarded as the target of INV operation.
187
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.11 MEP, MEF
Outline
MEP and MEF commands are instructions that change the operation results to pulses so that device numbers
do not have to be specified.
1) MEP
The operation results up to the MEP instruction become conductive when the driving contacts turn ON
from OFF.
The use of MEP instructions simplifies the process of changing driving contacts to pulses when multiple
contact points connect in a series.
2) MEF
The operation results up to the MEF instruction become conductive when the driving contacts turn OFF
from ON.
The use of MEF instructions simplifies the process of changing driving contacts to pulses when multiple
contact points connect in a series.
1. Instruction format
Basic Instruction Mnemonic Operation Condition
MEP Continuous
1 step Operation
MEP MEP Pulse (Single)
Operation
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
MEP There are no applicable devices.
MEF There are no applicable devices.
M0 OFF ON
M0 OFF ON
188
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.11 MEP, MEF
1
Caution
Introduction
1. MEP and MEF instructions may not operate normally if the indexed contact is modified and
changed to pulses by sub-routine programs, the FOR and NEXT instructions, etc.
2. As the MEP and MEF instructions operate using the operation results immediately before
them, use at the list program as the AND instruction.
2
Overview
The MEP and MEF instructions cannot be used at the list program as LD or OR.
List
Instruction
2) Pulse instruction during falling edge of operation (MEF command) results
After writing to the circuit with MEF instructions during RUN , the MEF instruction result turns OFF (non-
conductive), regardless of the operation results up to the MEF instruction. The operation results of MEF
instruction turns ON (conductive) when the operation results up to the MEF instruction turn OFF.
Operation Results up to MEP/MEF Instruction
(while writing is excuted during RUN)
MEP Instruction MEF Instruction 4
in Detail
Devices
OFF OFF (non-conductive) OFF (non-conductive)
ON ON (conductive) OFF (non-conductive)
Error
There are no calculation errors in the MEP and MEF instructions.
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
189
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.12 PLS, PLF
Outline
When PLS instruction is executed, an applicable device is activated during only one operation cycle after a
drive input turns ON.
When PLF instruction is executed, an applicable device is activated during only one operation cycle after a
drive input turns OFF.
For example, when PLC mode is changed in the way "RUN STOP RUN" while a drive input remains
ON, "PLS M0" operates, but "PLS M600 (backed up by the battery)" does not operate (when the PLC mode
switches from STOP to RUN) because the status of M600 is latched even while the PLC is in the STOP
mode.
1. Instruction format
Basic Instruction Mnemonic Operation Condition
PLS Continuous
Operation
Pulse PLS Pulse (Single)
Operation
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
PLS 3 S 3
PLF 3 S 3
In the figure above, M0 is ON during only one operation cycle when X000 changes from OFF to ON.
In the figure above, M1 is ON during only one operation cycle when X000 changes from ON to OFF.
190
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.12 PLS, PLF
1
3. Output drive side
Introduction
The following two circuits cause a same operation.
Overview
X000
M1
X000 ON
ON during
one operation 3
M 0 cycle
List
Instruction
M 1 ON
In each case, M0 is ON during only one operation cycle when X000 changes from OFF to ON.
in Detail
Devices
X000 X000
FNC12
PLS M0 MOVP K10 D0
M0
FNC12
MOV K10 D0
In each case, MOV instruction is executed only once when X000 changes from OFF to ON. 5
Constant
Device &
Specified the
Caution
1. Cautions on write during RUN
1) Instructions for falling edge pulse
When write during RUN is completed for a circuit including an instruction for falling edge pulse (LDF, 6
ANDF, or ORF instruction), the instruction for falling edge pulse is not executed without regard to the ON/
Programming
Before
OFF status of the target device of the instruction for falling edge pulse.
When write during RUN is completed for a circuit including an instruction for falling edge pulse (PLF
instruction), the instruction for falling edge pulse is not executed without regard to the ON/OFF status of
the operation condition device.
It is necessary to set to ON the target device or operation condition device once and then set it to OFF for 7
executing the instruction for falling edge pulse.
Instruction
Basic
2) Instructions for rising edge pulse
When write during RUN is completed for a circuit including an instruction for rising edge pulse, the
instruction for rising edge pulse is executed if a target device of the instruction for rising edge pulse or the
operation condition device is ON.
Target instructions for rising edge pulse: LDP, ANDP, ORP, and pulse operation type applied instructions
(such as MOVP)
8
Program Flow
FNC00-FNC09
10
Operation
Arith. & Logic
FNC20-FNC29
191
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.13 SET, RST
Outline
1) Setting a bit device (SET instruction (set bit device latch ON))
When the command input turns ON, SET instruction sets to ON an output relay (Y), auxiliary relay (M),
state relay (S) and bit specification of word device.
Even if the command input turns OFF after that, the device which was set to ON by SET instruction
remains ON.
2) Resetting a bit device (RST instruction (reset bit device OFF))
RST instruction resets an output relay (Y), auxiliary relay (M), state relay (S), Timer (T), counter (C) or bit
specification of a word device.
Use the RST instruction to reset (set to OFF) a device which was set to ON by SET instruction.
3) Clearing the present value of a word device (RST instruction reset bit device OFF))
RST instruction clears the current value of a timer (T), counter (C), data register (D), extension register
(R) or index register (V)(Z).
RST instruction can be used to clear to "0" the contents of a data register (D) or index register (V)(Z).
(The same result can be obtained by MOV instruction which transfers the constant K0.)
RST instruction can be used also to reset the current value and return the contact of retentive type timers
T246 to T255.
SET and RST instructions can be used for a same device as many times as necessary in an arbitrary
order.
1. Instruction format
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S S
SET 3 S2 3
1 2
S S S S S S S S S
RST 3 3 S2 3
1 1 2 2 2 2 2 2 2
S1: Special auxiliary relays (M) and 32-bit counters (C) cannot be indexed with index registers (V and Z).
S2: State relays (S) and "D.b" cannot be indexed with index registers (V and Z).
192
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.13 SET, RST
1
Explanation of function and operation
Introduction
SET instruction drives the coil for an output relay (Y), auxiliary relay (M), state relay (S) and bit specification of
data register (D).
Overview
Circuit program List program Timing chart
X000 X000 ON
0 LD X000
SET Y000 1 SET Y000
X001 2 LD X001 X001 ON 3
RST Y000 3 RST Y000
List
Instruction
Y000 ON
SET RST
instruction instruction
in Detail
Devices
1) Program example of an internal counter
X010
C0 up-counts the number of turning ON from OFF at X011.
RST C 0 When the counting result reaches the set value K10, the output
contact C0 is activated. Even if X011 changes from OFF to ON
X011
C 0
K10 after that, the current value of the counter remains unchanged
and the output contact remains activated.
5
Constant
Device &
Specified the
C 0 For clearing the counter and returning the output contact, X010
Y000 is set to ON.
It is necessary to specify a constant K or data register number
for indirect specification after OUT C instruction.
In the case of latched (battery backed) type counters, the
current value and the operation status/reset status of the output 6
contact are latched even after power failure.
Programming
Before
2) Program example of a high speed counter
Counting direction For 1-phase 1-input counters C235 to C245, use special
X010 auxiliary relays M8235 to M8245 for specifying the counting
M8UUU direction.
X010 in ON status: Specifies down counting. 7
X010 in OFF status: Specifies up counting.
Instruction
Basic
Sequence reset When X011 turns ON, the output contact of the counter
circuit
X011 CUUU is returned and the current value of the counter
RST CUUU CUUU is reset to "0".
In counters with reset input (C241, C242 ...), the same situation
is achieved by interrupt operation when the corresponding reset
Counting coil input turns ON, but any program is not required for this 8
operation.
Program Flow
FNC00-FNC09
X012
CUUU When X012 turns ON, turning ON/OFF of a counting input X000
to X005 determined according to the counter number is
K or D
counted.
In counters having start input (C244, C245 ...), counting is
CUUU started only after the corresponding input turns ON. 9
Y002 When the current value of a counter increases and reaches the
Move & Compare
FNC10-FNC19
As a contact driving the counting coil of a high speed counter, program a contact which is normally ON
when high speed counting is executed. 10
If an input relay (X000 to X005) assigned for high speed counters is used for driving the counting coil,
Operation
Arith. & Logic
FNC20-FNC29
193
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.13 SET, RST
Cautions on using RST instruction for a jumped program, subroutine program or interrupt program
When RST instruction for a timer or counter is executed in a jumped program, subroutine program or
interrupt program, the timer or counter may be kept in the reset status and the timer or counter may be
disabled.
For details, refer to the following sections:
For a jumped program, refer to Subsection 8.1.1.
For a subroutine program, refer to Subsection 8.2.1.
For an interrupt program, refer to Subsection 35.2.3.
3. Indexing
Devices used in SET and RST instructions can be indexed with index registers (V)(Z).
(State relays (S), special auxiliary relays (M), 32-bit counters, "D.b", and word devices cannot be indexed.)
Caution
When SET and RST instructions are executed for an output relay (Y) in a same operation, the result of the
instruction located nearest the END instruction (which specifies the end of program) is output.
Errors
When an I/O number used in SET or RST instruction does not exist due to indexing, M8316 (Non-existing
I/O specification error) turns ON.
When the device number of a device (M, T or C) other than I/O used in SET or RST instruction does not
exist due to indexing, an operation error (error code: 6706) occurs.
194
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.14 NOP
1
7.14 NOP
Introduction
Outline
NOP instruction specifies no operation.
When a program is erased completely, all steps are replaced with NOP instructions.
2
Overview
When NOP instruction is located between general instructions, PLCs ignore NOP instruction.
If NOP instructions are put in the middle of a program, fluctuation of step numbers is minimized when the
program is changed or added. But excessive program steps are required.
Note that circuits are considerably changed if already written instructions are replaced with NOP instructions.
1. Instruction format 3
List
Instruction
Basic Instruction Mnemonic Operation Condition
NOP Continuous
1 step NOP Operation
Pulse (Single)
No Operation Operation
2. Applicable devices 4
in Detail
Devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
NOP There are no applicable devices.
5
Constant
Device &
Specified the
Explanation of function and operation
1. NOP instruction (no operation or null step)
NOP instruction specifies no operation.
If NOP operation is written in the middle of a program, PLCs ignore it in executing the program.
When an existing program is replaced with NOP instructions, it means that former instructions are deleted. 6
Programming
Before
OUT NOP (error)
Instruction
Basic
ORI NOP
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
195
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.15 END
7.15 END
Outline
END instruction specifies the end of a program.
(Do not write the END instruction in the middle of a program.)
1. Instruction format
Basic Instruction Mnemonic Operation Condition
END Continuous
1 step END Operation
Pulse (Single)
END Operation
2. Applicable devices
Bit Devices Word Devices Others
Instruc- Special Con- Real Charac-
System User Digit Specification System User Index Pointer
tion Unit stant Number ter String
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
END There are no applicable devices.
Step 000
001 LD X000
002
OUT Y000
END
NOP
NOP
NOP
Output processing
Caution
Do not write END instruction in the middle of a program.
When a program is transferred from a programming tool, all steps after END instruction are replaced with
NOP (no operation) instructions.
196
FX3U/FX3UC Series Programmable Controllers 7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition 7.16 Number of Instruction Steps and Specified Devices
1
7.16 Number of Instruction Steps and Specified Devices
Introduction
For ORB, ANB, MPS, MRD, MPP, MCR, INV, MEP, MEF, NOP and END instructions, refer to pages
explaining these instructions.
Instruction
LDP, LDF,
2
LD, LDI,
Overview
PLS, ANDP,
Device AND, ANI, OUT SET RST MC
PLF ANDF,
OR, ORI
ORP, ORF
X000 to X357 1 2
Y000 to Y357 1 1 1 1 2 2 3
M0 to M1535 1 1 1 1 2 2 3 3
List
Instruction
M1536 to M3583 2 2 2 2 2 2 3
M3584 to M7679 3 3 3 3 3 3 4
S0 to S1023 1 2 2 2 2
S1024 to S4095 2 2 2 2 2
Bit devices
T0 to T191,
T200 to T245
1 3 2 2 4
in Detail
Devices
T192 to T199,
1 3 2 2
T246 to T511
C0 to C199 1 3 2 2
C200 to C255 1 5 2 2
Special auxiliary relays
M8000 to M8255
1 2 2 2 2 5
Constant
Device &
Specified the
Special auxiliary relays
2 2 2 2 2
M8256 to M8511
X000 to X357 3
Y000 to Y357 3 3 3 3 3
M0 to M7679 3 3 3 3 3
6
T0 to T511 3 4
Programming
Before
Bit devices
with index S0 to S4095
C0 to C199 3 4 3
C200 to C255
Special auxiliary relays
M8000 to M8511
3 3 3 3
7
D0 to D7999,
Instruction
Basic
Special data registers 3
Word devices D8000 to D8511
R0 to R32767 3
D0 to D7999,
Word devices
with index
Special data registers
D8000 to D8511,
8
Program Flow
FNC00-FNC09
R0 to R32767
D.b,
Bit specification
Special auxiliary relays 3 3 3 3 3
in word device
D.b
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
197
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition
Section
09 NEXT NEXT End a FOR/NEXT Loop
8.10
198
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.1 FNC 00 CJ / Conditional Jump
1
8.1 FNC 00 CJ / Conditional Jump
Introduction
Outline
CJ or CJP instruction jumps to a pointer (P); The sequence program steps between CJ or CJP instruction and
the pointer are not executed.
2
Overview
CJ and CJP instructions reduce the cycle time, and allow programs with double coils.
1. Instruction format
FNC 00 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
CJ P 3 steps CJ Continuous
Operation 3
CJP Pulse (Single)
List
Instruction
Operation
2. Set data
Operand type Description Data type
Pn
Pointer number (P) indicating the label number for the jump destination
(n = 0 to 4095) (P63 jumps to END instruction.)
Pointer number 4
in Detail
Devices
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V
Unit
Z Modify K H
stant Number ter String
E "" P
5
Constant
Device &
Specified the
Pn 3 3
Programming
Before
number).
1) In the case of CJ instruction
User program
Command Command ON
7
CJ Pn
Instruction
Basic
Jumps to the pointer while the input
command is ON.
Label
User program
8
Pn
Program Flow
FNC00-FNC09
User program
ON
9
Command Command
Move & Compare
FNC10-FNC19
CJP Pn
Pn input
Jumps to the pointer only in one
operation while the command is ON.
User program
CJP
which is skipped and is not executed in one operation cycle
when the command turns ON Executed in one scan.
Label
10
User program
Operation
Arith. & Logic
FNC20-FNC29
Pn
199
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.1 FNC 00 CJ / Conditional Jump
Cautions
1. Relationship between the label input position and the list program
The figure below shows programming of a label.
When creating a circuit program, move the cursor to the left side of the bus line in the ladder diagram, and
input a label (P) at the head of the circuit block.
X030 FNC 00 P 20 LD X030
CJ CJ P 20
X031 Pointer
Y010 LD X031
OUT Y010
X032 P 20
Label
P 20 Y011 LD X032
Bus OUT Y011
line Label
X022
FNC 00 P 10
CJ
X021
FNC 00 P 9
CJ
Label
P 9
X030 FNC 00
CJ
P9 Good
Label
P9 User program
Label
Bad P9 User program
END
200
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.1 FNC 00 CJ / Conditional Jump
1
5. Label unnecessary for the pointer P63
Introduction
The pointer P63 specifies jump to END step. Do not program P63.
If P63 is programmed, PLCs will display the error code 6507 (defective label definition) and stop.
FNC 00 P 63
CJ
2
Overview
Label
P 63 END
List
Instruction
Any label cannot be shared by CALL instruction and CJ instruction.
Command
FNC 00
CJ
P15 Bad
4
X000
in Detail
Devices
FNC 01
CALLP
P15 Good
X001 K10
C0
FNC 06
FEND Subroutine program
5
Label dedicated to CALL
Constant
Device &
Specified the
M8000 instruction
P15 User program
RUN monitor Program a label (P) after
(normally ON) FEND instruction.
FNC 02
SRET
6
7. Unconditional jump if the command contact is normally ON
Programming
Before
Because M8000 is normally ON while a PLC is operating, unconditional jump is specified when M8000 is
used in the following example:
M8000 FNC00
RUN monitor CJ
P5
7
Instruction
Basic
User program
(It is skipped, and is not executed.)
Label
P5 User program
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
201
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.1 FNC 00 CJ / Conditional Jump
Program example
1. When jump is necessary after the OFF processing
In one operation cycle after X023 changes to ON from OFF, CJ P7 instruction becomes valid.
By using this method, jump can be executed after all outputs between CJ P7 instruction and the label P7 turn
OFF.
X023
PLS M0
M0
FNC00 P7
CJ
X023
Label
P7 User program
202
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.1 FNC 00 CJ / Conditional Jump
1
8.1.1 CJ instruction and operations of contact and coil
Introduction
In the program example shown below, when X000 turns ON, the program execution jumps from CJ instruction
in the first circuit to the label P8.
While X000 is OFF, jump is not executed; The program is executed from the 1st step in turn, and then the
program execution jumps from CJ instruction in the 11th circuit to the label P9.
Instructions skipped by jump are not executed.
2
Overview
1. Circuit example 1 for explaining operations
1st
X000
FNC 00
Double coil operation of output Y001
0 P 8 While X000 is OFF, output Y001 is activated by X001.
circuit CJ
While X000 is ON, output Y001 is activated by X012.
4
X001
Y001 Even in a program divided by conditional jumps, if a 3
same coil (Y000 in this case) is programmed two or
List
Instruction
X002
6 M1 more times within the jump area or outside the jump
X003 area, such a coil is handled as double coil.
8 S1
X004 When the reset (RST) instruction for the retentive type
11 T0 K 10
timer T246 is located outside the jump area 4
X005 Even if the counting coil (OUT T246) is jumped, reset
in Detail
Devices
15 RST T246
(return of the contact and clearing of the current value)
X006 is valid.
18 T246 K1000
X007
22 RST C 0 When the reset (RST) instruction for the counter C0 is
X010 located outside the jump area 5
25 C0 K 20 Even if the counting coil is jumped, reset (return of the
Constant
Device &
Specified the
X011 contact and clearing of the current value) is valid.
FNC 12 K 3 D 0
29
MOV
Operation of the routine timers T192 to T199
Label
P 8 A routine timer continues its operation even if it is
11th 35
X000
FNC 00 P 9
jumped after the coil is driven, and the output contact is 6
circuit CJ activated.
Programming
Before
X012
40 Y001
Operation of the high speed counters C235 to C255
Label A high speed counter continues its operation even if it is
P 9 jumped after the coil is driven, and the output contact is
42
X013
RST T246
activated. 7
Instruction
Basic
RST C 0
When each input changes during jump in the above
program, each coil executes the following operation:
Contact status before
Classification
jump
Coil operation during jump 8
X001, X002, X003 OFF Y001, M1 and S1 turn OFF.
Program Flow
FNC00-FNC09
Y, M, S
(Y001, M1, S1) X001, X002, X003 ON Y001, M1 and S1 turn ON
10 ms timer and X004 OFF Timer is not activated.
100 ms timer (T0) X004 ON Counting is paused (, and is restarted after X000 turns OFF).
X005 OFF Timer is not activated.
1 ms timer X006 OFF The deactivation status is reset when X013 turns ON. 9
(T246) X005 OFF Counting is continued (, and the contact is activated after X000 turns
Move & Compare
FNC10-FNC19
X006 ON OFF).
X007 OFF Counting is not activated.
Counter X010 OFF The deactivation status is reset when X013 turns ON.
(C0) X007 OFF
Counting is paused (, and is restarted after X000 turns OFF).
Applied instruction
X010 ON
X011 OFF FNC instruction is not executed during jump.
10
Operation
Arith. & Logic
FNC20-FNC29
203
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.1 FNC 00 CJ / Conditional Jump
2. Circuit example 2 for explaining operations (when only an RST instruction for a timer or
counter is jumped)
When X011 turns ON while the RST instruction for
X012
C0 the counter C0 is operating (X010 is ON), the
K10 program execution jumps past the RST instruction
X011 FNC 00 due to the CJ (FNC 00) instruction.
P0
CJ In this jump status, the counter C0 remains reset.
X010 Accordingly, the current value of C0 remains "0"
RST C0 even if X012 turns ON.
Label
To clear this reset status, it is necessary to turn
P0 OFF the RST instruction for counter C0. (Refer to
the program shown below.)
Timing chart
Jump operation by CJ
instruction driven by X011
X012
Because C0 remains
Counter reset, its current value
3 is reset. remains unchanged
Current 2 even if X012 turns ON. 2
value of C0 1 1
X010 ON
RST
C0 Remains reset.
Program example for activating a timer and counter even during a jump
X012
C0
K10
X011 FNC 00 P0
CJ
X010
RST C0
Label
P0
M8000
RST C0 Clears the reset status of
counter C0 during jump.
Timing chart
Jump operation by CJ
instruction driven by X011
X012
5
Counter 4
3 is reset. 3
Current 2 2
value of C0 1 1
X010 ON
RST
C0 *1 In the same operation cycle as the
reset, the reset status of counter
*1 C0 is cleared.
204
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.1 FNC 00 CJ / Conditional Jump
1
8.1.2 Relationship between master control instruction and jump instruction
Introduction
The figure below shows the contents of operation and the relationship between the master control instruction.
Avoid using [2], [4] and [5] because the operation will be complicated.
CJ P 0
[1] Jump from outside MC
2
to outside MC
Overview
Jump is available
CJ P 1 arbitrarily.
MC N 0 M 1
Master control
[2] Jump from outside MC
to inside MC
MC N 0 M 0 Jump is executed CJ P 4
P 1
regardless of the MC
operation.
[5] Jump from
inside MC 3
Even if M0 is OFF, M0 MCR N 0 to inside
List
Instruction
is regarded as ON after another
P1. MC
MC N 0 M 2
Master control
Master control
Jump is disabled while P 4
M0 is OFF.
in Detail
Devices
P 2
MCR N 0
Constant
Device &
Specified the
In circuits after jump, M2 is regarded as ON
M0 is ON, but MCR is
MCR N 0 invalid. regardless of the actual ON/OFF status of M2.
And the first MCR N0 is ignored.
P 3
6
P 0
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
205
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.2 FNC 01 CALL / Call Subroutine
Outline
This instruction calls and executes a program which should be processed commonly in a sequence program.
This instruction saves the number of program steps, and achieves efficient program design.
For creating a subroutine program, FEND (FNC 06) and SRET (FNC 02) instructions are required.
1. Instruction format
FNC 01 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
CALL P 3 steps CALL Continuous
Operation
CALLP Pulse (Single)
Operation
2. Set data
Operand type Description Data type
Pointer number (P) indicating the label number for the jump destination
Pn Pointer number
(P0 to P62 and P64 to P4095)
For the pointer Pn in CALL instruction, P0 to P62 and P64 to P4095 can be specified.
Because P63 is dedicated to CJ (FNC 00) instruction (for jump to END step), it cannot be used as a pointer
for CALL (FNC 01) instruction.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Pn 3 3
User program
Command
FNC 01 Pn
Pn
CALL Main program
Program area from the step 0 to FEND
User program instruction
FNC 06
FEND
Label M8000
Pn User program
RUN monitor Subroutine program
(normally ON) Program area from a label Pn to SRET
FNC 02 instruction
SRET
206
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.2 FNC 01 CALL / Call Subroutine
1
Caution
Introduction
1. Using a label (P) number two or more times
In CALL instructions, a same number can be used two or more times in operands (P).
However, do not use a label (P) and number used in another instruction (CJ instruction).
X020 FNC 00
2
P9
Overview
CJ
X030 FNC 01
CALLP
P9 Bad
Label
3
List
Instruction
P9 User program
Program examples
1. Example of fundamental use (no nesting) 4
X000
in Detail
Devices
FNC 01 P 10
CALL
Main program
While X000 is ON, the program execution jumps to a
step with the label P10.
FNC 06
FEND
5
Label
Constant
Device &
Specified the
P 10
Subroutine program
When SRET instruction is executed after the subroutine
program has executed, the program execution returns to
the original step +1.
FNC 02
SRET 6
Programming
Before
END
Instruction
Basic
X001
FNC 01 P 11
CALLP Main program
When X001 turns ON from OFF, the program execution
FNC 06 jumps to the label P11 only once.
FEND
Label
Subroutine program 1
8
P 11
Program Flow
FNC00-FNC09
10
Operation
Arith. & Logic
FNC20-FNC29
207
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.2 FNC 01 CALL / Call Subroutine
FNC 06
FEND
X000
P0 RST C0
Y007
FNC 02
SRET
2) Timing chart
Execution of Subroutine is executed.
subroutine P0
triggered by X000
X001
RST
C0 Remains reset.
208
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.2 FNC 01 CALL / Call Subroutine
1
Example for resetting held outputs (countermeasures)
Introduction
1) Program example
X000 FNC 01 P0
CALLP
X001
C0
K10 2
Overview
X002
RST Y007 Y007 is reset at an arbitrary timing.
FNC 06
FEND 3
List
Instruction
X000
P0 RST C0 A
M8001 B
RUN monitor
RST C0 The preceding RST C0 instruction is
deactivated in the subroutine.
4
(normally OFF)
in Detail
Devices
Y007
FNC 02
SRET
5
2) Timing chart
Constant
Device &
Specified the
Subroutine is
Execution of P0 is executed.
triggered by X000
X001
6
Programming
Before
3 4
Current 3
2 2
value of C0 1 1
Counter is reset (part Counter reset instruction is deactivated
RST
C0
A in above program). (part B in above program).
7
Instruction
Basic
Y007
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
209
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.3 FNC 02 SRET / Subroutine Return
Outline
This instruction returns the program execution from a subroutine to the main program.
1. Instruction format
FNC 02 Independent Inst. Mnemonic Operation Condition
SRET Continuous This instruction is the independent type, and
1 step SRET Operation does not require drive contact.
2. Set data
Operand type Description Data type
There is no set data.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
There are no applicable devices.
210
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.4 FNC 03 IRET / Interrupt Return
1
8.4 FNC 03 IRET / Interrupt Return
Introduction
Outline
This instruction returns the program execution from an interrupt routine to the main program.
2
1. Instruction format
Overview
FNC 03 Independent Inst. Mnemonic Operation Condition
IRET Continuous This instruction is the independent type, and
1 step IRET Operation does not require drive contact.
List
Instruction
2. Set data
Operand type Description Data type
There is no set data.
3. Applicable devices 4
Bit Devices Word Devices Others
in Detail
Devices
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
There are no applicable devices.
5
Explanation of function and operation
Constant
Device &
Specified the
When an interrupt (input, timer or counter) is generated while the main program is executed, the program
execution jumps to an interrupt (I) routine.
IRET instruction returns the program execution to the main routine.
The table below shows three types of jump to an interrupt routine.
Programming
Before
Function Interrupt No. Description Reference
Section 35.3
Executes the interrupt processing when an input (X) signal turns
Input interrupt I00* to I50* and
ON or OFF.
Section 35.4
Instruction
Basic
Executes the interrupt processing when a high speed counter
Counter interrupt I010 to I060 Section 35.6
reaches its set value.
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
211
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.4 FNC 03 IRET / Interrupt Return
Program example
FNC 04
Interrupts are usually disabled in PLCs.
EI Use EI instruction to enable interrupts.
When X000 turns ON while the main program is executed,
M8000
C255 instructions after the interrupt routine pointer I001 are
Main program executed, and the program execution returns to the
original main program by IRET instruction.
FNC 06
FEND
Interrupt
pointer The rising edge of X000 is detected.
I001
Input interrupt
routine The timer interrupt of the pointer I620 is executed every
FNC 03 timer time of 20 ms, and the program execution is
IRET
returned to the original main program by IRET instruction
Interrupt
pointer Interrupt every 20 ms each time.
I620
Timer interrupt The high speed counter interrupt of the pointer I010 is
routine executed when the current value of a high speed counter
FNC 03 becomes equivalent to a value specified by DHSCS (FNC
IRET
Interrupt 53) instruction.
pointer High speed counter The program execution returns to the original main
I010 program by IRET instruction.
High speed counter
routine Make sure to program an interrupt pointer (I***) as a label
FNC 03
after FEND instruction.
IRET
212
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.5 FNC 04 EI / Enable Interrupt
1
8.5 FNC 04 EI / Enable Interrupt
Introduction
Outline
Interrupts are usually disabled in PLCs.
This instruction enables interrupts in PLCs.
2
Overview
Use this instruction for using the input interrupt, timer interrupt and counter interrupt functions.
1. Instruction format
FNC 04 Independent Inst. Mnemonic Operation Condition
EI
1 step EI Continuous
Operation
This instruction is the independent type, and
does not require drive contact.
3
List
Instruction
2. Set data
Operand type Description Data type
There is no set data.
4
in Detail
Devices
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V
There are no applicable devices.
Z Modify K H E "" P
5
Constant
Device &
Specified the
Explanation of function and operation
EI instruction is the independent type, and does not require command (drive) contact.
For the interrupt function, refer to Chapter 35.
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
213
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.6 FNC 05 DI / Disable Interrupt
Outline
This instruction disables interrupts after interrupts were enabled by EI (FNC 04) instruction.
1. Instruction format
FNC 05 Independent Inst. Mnemonic Operation Condition
DI Continuous This instruction is the independent type, and
1 step DI Operation does not require drive contact.
2. Set data
Operand type Description Data type
There is no set data.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
There are no applicable devices.
Cautions
Interrupts (requests) generated after DI instruction are processed after EI (FNC 04) instruction is executed
214
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.7 FNC 06 Main Routine Program End
1
8.7 FNC 06 Main Routine Program End
Introduction
Outline
This instruction indicates the end of the main program.
2
1. Instruction format
Overview
FNC 06 Independent Inst. Mnemonic Operation Condition
FEND Continuous This instruction is the independent type, and
1 step FEND Operation does not require drive contact.
3
List
Instruction
2. Set data
Operand type Description Data type
There is no set data.
3. Applicable devices 4
Bit Devices Word Devices Others
in Detail
Devices
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
There are no applicable devices.
5
Explanation of function and operation
Constant
Device &
Specified the
FEND instruction works in the same way as END instruction.
When FEND instruction is executed, output processing, input processing and watchdog timer refresh are
executed, and then the program execution returns to the step 0.
FEND instruction is required in creating subroutine programs and interrupt programs.
Programming
Before
0 Main routine
program
When X010 is OFF
X010
FNC 00
CJ
P 20
7
Instruction
Basic
Main routine
Jump
program
FNC 06
FEND
8
When X010 is ON
Program Flow
FNC00-FNC09
FNC 06
FEND
9
Move & Compare
FNC10-FNC19
END
10
Operation
Arith. & Logic
FNC20-FNC29
215
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.7 FNC 06 Main Routine Program End
Main routine
program
FNC 06
FEND
P21 Subroutine
program
I100
Interrupt routine
program
END
Cautions
1. When FEND instruction is programmed two or more times
Put a subroutine program or interrupt routine program between last FEND instruction and END instruction.
216
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.8 FNC 07 WDT / Watchdog Timer Refresh
1
8.8 FNC 07 WDT / Watchdog Timer Refresh
Introduction
Outline
This instruction refreshes the watchdog timer in a sequence program.
2
1. Instruction format
Overview
FNC 07 Independent Inst. Mnemonic Operation Condition
WDT P WDT Continuous
1 step Operation
WDTP Pulse (Single)
Operation
3
List
Instruction
2. Set data
Operand type Description Data type
There is no set data.
3. Applicable devices 4
Bit Devices Word Devices Others
in Detail
Devices
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
There are no applicable devices.
5
Explanation of function and operation
Constant
Device &
Specified the
When the operation cycle (time until END or FEND instruction is executed after the step 0) of a PLC exceeds
200 ms, a watchdog timer error (indicating abnormal operation) occurs; The CPU error LED lights, and the
PLC stops.
When the operation cycle is long, insert WDT instruction in the middle of the program to avoid the watchdog
timer error. 6
Command
Programming
Before
contact
Command
input
FNC 07
WDTP One scan is executed.
Command
Command
contact 7
Instruction
Basic
input
FNC 07
WDT
Each scan is
executed.
8
Related device
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
217
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.8 FNC 07 WDT / Watchdog Timer Refresh
Cautions
1. When a watchdog timer error occurs
A watchdog timer error may occur in the following cases. To avoid the error, input a program shown below
near the head step to extend the watchdog timer time, or shift FROM/TO instruction execution timing.
1) Caution when many special extension devices are connected
In such configuration that many special extension devices (such as positioning units, cam switches,
analog units and link units) are connected, the buffer memory initialization time may become longer, thus
the operation time may become longer, and a watchdog timer error may occur.
2) Caution when many FROM/TO instructions are driven at one time
When many FROM/TO instructions are executed or when many buffer memories are transferred, the
extension time may become longer, and a watchdog timer error may occur.
3) Caution when there are many high speed counters (software counters)
When many high speed counters are provided and high frequency are counted at one time, the operation
time may become longer, and a watchdog timer error may occur.
Program examples
1. When the operation cycle is long and causes an error
For example, by dividing a program whose operation cycle is 240 ms into two portions and inserting WDT
instruction between them, the operation cycle becomes less than 200 ms in both the former half portion and
the latter half portion.
Program whose
Program operation cycle
whose is 120 ms
operation cycle
is 240 ms FNC07
WDT
Program whose
END operation cycle
is 120 ms
END
2. When a label (P) of CJ instruction is located in a step number smaller than the step number
of CJ instruction
Put WDT instruction after the label (P).
If an input relay (X) is used as the
M8000 command contact, input refresh is
Label FNC 07
Pn RUN monitor WDT disabled, so the program execution
cannot be returned from the area
When the command
Program contact turns ON between P and CJ.
As the command contact, use such
Command
FNC00 device that can be set to OFF in a
Pn
CJ program being jumped.
218
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.8 FNC 07 WDT / Watchdog Timer Refresh
1
3. When FOR/NEXT instruction is repeated many times
Introduction
Put WDT instruction between FOR and NEXT instructions.
FNC 08
K30000
FOR
2
Program
Overview
FNC 07
WDT
FNC 09
NEXT 3
List
Instruction
4
in Detail
Devices
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
219
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.9 FNC 08 FOR / Start a FOR/NEXT Loop
Outline
FOR instruction specifies the number of repetition of the loop between FOR and NEXT (FNC 09) instructions.
1. Instruction format
FNC 08 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FOR Continuous
3 steps FOR Operation
2. Set data
Operand type Description Data type
Number of repetition of the loop between FOR and NEXT instructions
S [ S = K1 to K32767] 16-bit binary
(A value from 32768 to 0 is handled as "1".)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Related instruction
FOR instruction and NEXT (FNC 09) instruction are set as a pair in programming.
220
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.10 FNC 09 NEXT / End a FOR/NEXT Loop
1
8.10 FNC 09 NEXT / End a FOR/NEXT Loop
Introduction
Outline
NEXT instruction specifies the end position of the loop.
2
1. Instruction format
Overview
FNC 09 Independent Inst. Mnemonic Operation Condition
NEXT Continuous This instruction is the independent type, and
1 step NEXT Operation does not require drive contact.
3
List
Instruction
2. Set data
Operand type Description Data type
There is no set data.
3. Applicable devices 4
Bit Devices Word Devices Others
in Detail
Devices
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
There are no applicable devices.
5
Explanation of function and operation
Constant
Device &
Specified the
The loop between FOR and NEXT instructions is repeated "n" times (which is specified by the source data).
After the loop is repeated by the specified number of times, steps after NEXT instruction are executed.
FNC 08
FOR
S
Repeated " S "
6
Programming
Before
times.
FNC 09
NEXT
Related instruction 7
NEXT instruction and FOR (FNC 08) instruction are set as a pair in programming.
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
221
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.10 FNC 09 NEXT / End a FOR/NEXT Loop
Caution
1. Limitation in the number of nesting
FOR-NEXT loop can be nested up to 5 levels.
FOR FOR
FOR FOR
1st
level
FOR NEXT
1st 2nd 3rd 2nd
level level level level
NEXT FOR
1st
level
NEXT NEXT
NEXT NEXT
Errors
1. Watchdog timer error
When FOR-NEXT loop is repeated many times, the operation cycle (D8010) is too long, and a watchdog
timer error may occur. In such a case, change the watchdog timer time or reset the watchdog timer.
For details on changing the watchdog timer time, refer to Subsection 36.2.2.
For resetting the watchdog timer, refer to WDT (FNC 07) instruction.
NEXT FOR
When number of FOR instructions is not When NEXT instruction is located after FEND or
equivalent to the number of NEXT instructions END instruction
FOR FOR
FOR FEND
NEXT NEXT
NEXT
222
FX3U/FX3UC Series Programmable Controllers 8 Program Flow FNC 00 to FNC 09
Programming Manual - Basic & Applied Instruction Edition 8.10 FNC 09 NEXT / End a FOR/NEXT Loop
1
Program example
Introduction
1. Program with three FOR-NEXT loops
FNC 08
FOR
K 4 2
Overview
The loop [3] is repeated 4 times.
FNC 08 D 0Z
FOR
When the data value (current value) of D0Z
X010 (D4 when Z is "4") is "6", the loop [2] is
FNC 00
CJ
P 22 repeated 6 times. 3
List
Instruction
FNC 08 K1X000 When X010 is OFF
FOR When K1X000 is "7", the loop [1] is repeated
[1] [2] [3]
7 times.
When X010 is ON
FNC 09
NEXT 7
times
The program execution jumps to the pointer P22, 4
P 22 and the loop [1] is skipped.
in Detail
Devices
FNC 09 Number of times of repeating the loops [1],
NEXT 6 [2] and [3]
times
X010 = OFF X010 = ON
FNC 09 1] 7 6 4 =168 times 0 time
NEXT
4
times 2] 6 4 = 24 times 24 times 5
3] 4 times 4 times
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
223
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition
Section
19 BIN BIN S D Conversion to Binary
9.10
224
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.1 FNC 10 CMP / Compare
1
9.1 FNC 10 CMP / Compare
Introduction
Outline
This instruction compares two values, and outputs the result (smaller, equal or larger) to bit devices (3
points).
2
For the contact comparison instruction, refer to Chapter 28.
Overview
For floating point comparison, refer to Section 18.1.
1. Instruction format
D
FNC 10
CMP P
16-bit Instruction Mnemonic
CMP
Operation Condition
Continuous
32-bit Instruction Mnemonic
DCMP
Operation Condition
Continuous
3
7 steps Operation 13 steps Operation
List
Instruction
CMPP Pulse (Single) DCMPP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description
Data or device number handled as comparison value
Data Type
16- or 32-bit binary
4
S1
in Detail
Devices
S2 Date or device number handled as comparison source 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
5
Oper-
Constant
Device &
Specified the
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 6
Programming
Before
D 3 3 3 S 3
Instruction
Basic
The comparison value S1 and the comparison source S2 are compared with each other. According to
the result (smaller, equal or larger), either one among D , D +1 and D +2 turns ON.
The source data S1 S2 are handled as binary values.
Comparison is executed algebraically. Example: 10 < 2 8
Command Command
Program Flow
FNC00-FNC09
input input
FNC 10
S1 S2 D 51
CMP
50
D Turns ON in the case of 49
" [ S1 > S2 ] ". 48
Turns ON in the case of
S2 S1
9
D +1 D
Move & Compare
FNC10-FNC19
" [ S1 = S2 ] ".
Latched
D +2 Turns ON in the case of
D +1
" [ S1 < S2 ] ".
Latched
D +2
10
Operation
Arith. & Logic
FNC20-FNC29
Latched
Even if the command input turns OFF and CMP instruction is not executed, D , D +1 and D +2 latch
the status just before the command input turns OFF from ON.
225
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.1 FNC 10 CMP / Compare
Latched
Even if the command input turns OFF and DCMP instruction is not executed, D , D +1 and D +2 latch
the status just before the command input turns OFF from ON.
Caution
1. Number of occupied devices
From the device specified as D , three devices are occupied. Make sure not to use those devices in another control.
Program examples
1. When comparing the current value of a counter
S1 S2 D
X000 X000
FNC 10
K100 C 20 M 0 101
CMP
100
M 0 99
Turns ON in the case of C20
"K100 > C20 (Current value)" .
M 1 M0
Turns ON in the case of
"K100 = C20 (Current value)" .
M1
M 2 Turns ON in the case of
"K100 < C20 (Current value)" . M2
Latched Latched Latched
in the in the in the
ON ON ON
status. status. status.
If it is necessary to clear the comparison result when the instruction is not executed, add the following
contents under the above program.
1) RST instruction
X000
RST M0
RST M1
RST M2
2) ZRST instruction
X000
FNC 40
M0 M2 M0 to M2 are reset.
ZRST
226
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.2 FNC 11 ZCP / Zone Compare
1
9.2 FNC 11 ZCP / Zone Compare
Introduction
Outline
This instruction compares two values (zone) with the comparison source, and outputs the result (smaller,
equal or larger) to bit devices (3 points).
2
For the contact comparison instruction, refer to Chapter 28.
Overview
For floating point comparison, refer to Section 18.2.
1. Instruction format
FNC 11 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
3
D ZCP P 9 steps
ZCP Continuous
17 steps
DZCP Continuous
List
Instruction
Operation Operation
ZCPP Pulse (Single) DZCPP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type 4
in Detail
Devices
S1 Data or device number handled as lower comparison value 16- or 32-bit binary
S2 Data or device number handled as upper comparison value 16- or 32-bit binary
Constant
Device &
Specified the
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V
3 3 3 3 3 3 3 3 3 3 3
Z Modify K H
3 3 3
E "" P
6
S1
Programming
Before
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 S 3
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
227
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.2 FNC 11 ZCP / Zone Compare
Even if the command input turns OFF and ZCP instruction is not executed, D , D +1 and D +2 latch
the status just before the command input turns OFF from ON.
Even if the command input turns OFF and ZCP instruction is not executed, D , D +1 and D +2 latch
the status just before the command input turns OFF from ON.
228
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.2 FNC 11 ZCP / Zone Compare
1
Cautions
Introduction
1. Number of occupied devices
From the device specified as D , three devices are occupied. Make sure not to use devices used in
another control.
Overview
The lower comparison value S1 should be smaller than the upper comparison value S2 .
1) When the lower comparison value S1 is smaller than the upper comparison value S2
S1 S2 S D X000
X000
ZCP K100 K120 C30 M3 121 3
120
List
Instruction
119
M 3
Turns ON in the case of 100
"K100 > C30 (Current value)" . C30 99
M 4
Turns ON in the case of M3
"K100 C30 (Current value) K120" . 4
M 5 M4
in Detail
Devices
Turns ON in the case of
"K120 < C30 (Current value)" .
M5
2) When the lower comparison value S1 is larger than the upper comparison value S2
S1 S2 S D 5
X000
X000
Constant
Device &
Specified the
ZCP K120 K100 C30 M3 121
120
119
It is handled as
100
K120 S1 . 99
M 3
Turns ON in the case of
C30
6
"K120 > C30 (Current value)" . M3
Programming
Before
M 4
Turns ON in the case of M4
"K120 = C30 (Current value)" .
M 5 M5
Turns ON in the case of
"K120 < C30 (Current value)" .
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
229
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.3 FNC 12 MOV / Move
Outline
This instruction transfers (copies) the contents of a device to another device.
1. Instruction format
FNC 12 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D MOV P 5 steps
MOV Continuous
9 steps
DMOV Continuous
Operation Operation
MOVP Pulse (Single) DMOVP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type
S Transfer source data or device number storing data 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
Y000 OFF ON
Y001 ON OFF
D
Y002 ON OFF
Y003 ON
230
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.3 FNC 12 MOV / Move
1
When a word device is specified
Introduction
The word device transfers 1 point.
Command
input
FNC 12 D10 D50
MOV
2
Overview
S :D10 D :D50 Command contact ON
Before
execution K50 K0
S 50
Transfer
After
execution K50 K50 D 0 50 3
List
Instruction
2. 32-bit operation (DMOV and DMOVP)
The contents of the transfer source [ S +1, S ] are transferred to the transfer destination [ D +1,
D ].
4
While the command input is OFF, the transfer destination D does not change.
in Detail
Devices
When a constant (K) is specified as the transfer source [ S +1, S ], it is automatically converted into
binary.
Command
input
FNC 12 S D [ S +1, S ][ D +1, D ] 5
DMOV
Constant
Device &
Specified the
When specifying digits of a bit device (K8X000 K8Y000)
The bit device transfers a maximum of 32 points (multiple of 4).
Command
input
FNC 12
6
K8X000 K8Y000
Programming
Before
DMOV
S :K8X000 D :K8Y000 ON
Command contact
Before X37 to X1 X0 Y37 to Y1 Y0
execution X000 ON
7
ON OFFOFF ON ON ON ON OFF
X001 OFF
Transfer S
OFF
Instruction
Basic
After X37 to X1 X0 Y37 to Y1 Y0
execution X037 ON
ON OFFOFF ON ON OFFOFF ON
Y000 OFF ON
Y001 ON OFF
D
ON OFF 8
Y037 ON
Program Flow
FNC00-FNC09
DMOV
Transfer
S 500000
10
Operation
Arith. & Logic
FNC20-FNC29
After
execution K500000 K500000 D 4321 500000
231
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.3 FNC 12 MOV / Move
Program examples
1. When reading the current value of a timer and counter
X001 (Current value of T0) (D20)
FNC 12 T 0 D 20
MOV The operation is the same as a counter.
X001
M8000 Y001
FNC 12 K1X000 K1Y000
MOV X002
RUN monitor Y002
X003
Y003
232
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.4 FNC 13 SMOV / Shift Move
1
9.4 FNC 13 SMOV / Shift Move
Introduction
Outline
This instruction distributes and composes data in units of digit (4 bits).
2
1. Instruction format
Overview
FNC 13 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
List
Instruction
2. Set data
Operand Type Description Data Type
S Word device number storing data whose digits will be moved 16-bit binary
m1 Head digit position to be moved 16-bit binary 4
m2 Number of digits to be moved 16-bit binary
in Detail
Devices
D Word device number storing data whose digits are moved 16-bit binary
n Head digit position of movement destination 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others 5
Oper-
Constant
Device &
Specified the
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3 3
m1 3 3
6
m2 3 3
Programming
Before
D 3 3 3 3 3 3 3 3 3 3 3
n 3 3
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
233
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.4 FNC 13 SMOV / Shift Move
While the command input is OFF, the transfer destination D does not change.
When the command input turns ON, only the specified digits in the transfer destination D are changed.
The transfer source S and unspecified digits in the transfer destination D do not change.
Command
input
FNC 13 m1 m2 n
S D
SMOV
2. Extension function
When M8168 is set to ON first and then SMOV instruction is executed, conversion from binary to BCD is not
executed.
Data is moved in units of 4 bits.
M8168
X010
FNC 13 D 1 K 4 K 2 D 2 K 3
SMOV
Program example
The data on three-digit digital switches are composed, and stored as binary data to D2.
234
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.5 FNC 14 CML / Complement
1
9.5 FNC 14 CML / Complement
Introduction
Outline
This instruction inverts data in units of bit, and then transfers (copies) the inverted data.
2
1. Instruction format
Overview
FNC 14 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D CML P 5 steps
CML Continuous
9 steps
DCML Continuous
Operation Operation
CMLP Pulse (Single) DCMLP Pulse (Single)
Operation Operation
3
List
Instruction
2. Set data
Operand Type Description Data Type
S Data to be inverted or word device number storing data 16- or 32-bit binary
in Detail
Devices
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 5
Constant
Device &
Specified the
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
Programming
Before
Each bit of a device specified as S is inverted (from 0 to 1 or from 1 to 0), and then transferred to D .
When a constant (K) is specified as S , it is automatically converted into binary.
This operation is useful when a logically inverted output is required as an output from a PLC.
Command
input
7
Instruction
Basic
FNC 14 D
S D S
CML
D 0 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1
10
Operation
Arith. & Logic
FNC20-FNC29
235
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.5 FNC 14 CML / Complement
D 0 1 0 1 0 1 0 1 1 0 0 0 1 0 1
Program examples
1. When receiving an inverted input
The sequence program shown below can be written by CML instruction.
X000 X000
M0 M0
X001 X001
M1 M1
X002 X002
M2 M2
X003 X003
M3 M3
M8000
FNC 14 K1X000 K1M0
CML
RUN monitor
2. When four bits are specified for a device with digit specification
S D
X000
FNC 14 D 0 K1Y000 (D 0) (K1Y000)
CML
D 0 1 0 1
K1Y000 Y017 Y016 Y015 Y014 Y013 Y012 Y011 Y010 Y007 Y006 Y005 Y004 Y003 Y002 Y001 Y000
236
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.6 FNC 15 BMOV / Block Move
1
9.6 FNC 15 BMOV / Block Move
Introduction
Outline
This instruction transfers (copies) a specified number of data at one time.
2
1. Instruction format
Overview
FNC 15 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
List
Instruction
2. Set data
Operand Type Description Data Type
S Transfer source data or device number storing data 16-bit binary
in Detail
Devices
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
5
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Constant
Device &
Specified the
S 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
n 3 3 3
6
Explanation of function and operation
Programming
Before
BMOV instruction transfers "n" points of data from S to D at one time.
If the device number range is exceeded, data is transferred within the possible range.
Command
input
FNC 15 S D
7
S D n
Instruction
Basic
BMOV S +1 D +1
"n" points
S +n D +n
To prevent overwriting before transfer of source data, data is automatically transferred in the order "[1] [2]
[3]" according to the number overlap status.
X001 [1]
FNC 15 D 10 D 9 K 3 D 10 D 9
[2]
BMOV D 11
[3]
D 10 9
D 12 D 11
Move & Compare
FNC10-FNC19
X002 [3]
FNC 15 D 10 D 11
D 10 D 11 K 3 [2]
BMOV D 11 D 12
[1]
D 12 D 13
10
Operation
Arith. & Logic
FNC20-FNC29
237
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.6 FNC 15 BMOV / Block Move
X001 *1
BMOV
M8024 BMOV direction Transfer
direction inverse flag direction
S , D
inverse flag
S D n D5 D10
X000 M8024*1 : OFF S D D6 D11
FNC 15
BMOVP D5 D10 K3 D7 D12
D5 D10
M8001 *1BMOV
M8024*1 : ON S D D6 D11
M8024 direction
Normally OFF inverse flag: D7 D12
during operation OFF
*1. M8024 is cleared when the PLC mode is changed from RUN to STOP.
Caution
When specifying digits of bit devices, specify a same number of digits for S and D .
S D n
M8000
FNC 15 K1M0 K1Y000 K 2 M 0 Y000
BMOV M 1 Y001
M 2 Y002
Specify a same number M 3 Y003
of digits.
n=2
(Example: K1)
M 4 Y004
M 5 Y005
M 6 Y006
M 7 Y007
238
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.6 FNC 15 BMOV / Block Move
1
9.6.1 Function of transfer between file registers and data registers
Introduction
BMOV (FNC 15) instruction has a special function for file registers (D1000 and later).
For details on file registers, refer to Section 4.8.
Overview
program memory area.
1) Outline of setting
File registers (D1000 to D7999) do not exist in the initial status. They are valid only when some number
of file registers are secured by parameter setting in a programming tool.
2) Number of file registers
In parameter setting, set 500 file registers as 1 block.
3
List
Instruction
1 to 14 blocks (each of which has 500 file registers) can be set.
1 block occupies 500 steps in the program memory area.
3) Difference between BMOV (FNC 15) instruction and other instructions
The table below shows the difference between BMOV (FNC 15) instruction and other instructions with
regard to file registers (D1000 and later).
4
in Detail
Devices
Instruction Contents of transfer Remarks
BMOV Can read from and write to the file register
instruction area [A] inside the program memory.
Because the data register area [B] is provided
Can read from and write to the data register
Other applied inside the system RAM in PLCs, its contents can be
instructions
area [B] inside the program memory in the
same way as general data registers.
arbitrarily changed without regard to the optional 5
memory format.
Constant
Device &
Specified the
When restoring the power, data registers set as file registers are automatically copied from the file
register area [A] to the data register area [B].
Programming
Before
Program When power Data
memory is turned ON memory
When PLC Devices D1000 and later specified as
Program/ Data register
mode is operands in applied instructions other
comment
changed from than BMOV (FNC 15) , indirectly
D1000 D1000
500 points File register
STOP to
RUN Data register
specified values for timers or
Write counters or devices in RST
7
14 blocks
Instruction
Basic
[A] [B] instruction are read from and written
maximum
to the area [B] in the same way as
(7000 points Read
Data register general data registers.
maximum) D7999
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
239
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.6 FNC 15 BMOV / Block Move
2. Cautions on use
1) When updating the contents of a file register with a same number (same-number update mode), make
sure that the file register number is equivalent between S and D .
2) When using file registers in the same-number update mode, make sure that the number of transfer points
specified by "n" does not exceed the file register area.
3) If the file register area is exceeded while file registers are used in the same-number update mode, an
operation error (M8067) is caused and the instruction is not executed.
4) In the case of indexing (in the same-number update mode)
When S and D are indexing with index, the instruction is executed if the actual device number is
within the file register area and the number of transfer points does not exceed the file register area.
5) Handling of flash memory
When changing the contents of file registers secured inside the flash memory, observe the following
condition:
- Set the protect switch to OFF in the memory cassette.
- When writing data using a continuous operation type instruction in a program, data is written to the flash
memory in every operation cycle of the PLC.
To prevent this, make sure to use a pulse operation type instruction (BMOVP) so that the number of
times of writing is reduced.
- It takes 66 to 132 ms to write data of one serial block (500 points) to the flash memory. Execution of the
program is paused during this period. Because the watchdog timer is not refreshed at this time, it is
necessary to take proper countermeasures such as insertion of WDT instruction in a user program.
6) File register operation
File registers are secured inside the built-in memory or memory cassette.
Different from general data registers, file registers can be read and written only by peripheral equipment
or BMOV (FNC 15) instruction.
7) If a file register is not specified as the destination in BMOV (FNC 15) instruction, the file register is not
accessed.
a) Outline of memory operation
Program/
D599 Data register
comment
Read
D1000
500 points File register D1100 Data register
14 blocks [A] [B]
maximum D1499
(7000 points Data register
maximum) D7999
b) Program example
When X000 is set to ON, the data register area [B] is read.
S D n
X000
FNC 15
BMOVP D1100 D200 K400
A file register can be specified as D . But if a same number with S is specified, the same-
number register update mode is selected.
However, even if a file register having different number is specified for S and D respectively,
data cannot be transferred from the file register area to another file register area. In such a case, read
the contents of a file register specified as S in the same-number register update mode to the data
register area [B] once, and then write the data.
For the same-number register update mode of file registers, refer to Subsection 4.8.2.
240
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.7 FNC 16 FMOV / Fill Move
1
9.7 FNC 16 FMOV / Fill Move
Introduction
Outline
This instruction transfers same data to specified number of devices.
2
1. Instruction format
Overview
FNC 16 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D FMOV P 7 steps
FMOV Continuous
13 steps
DFMOV Continuous
Operation Operation
FMOVP Pulse (Single) DFMOVP Pulse (Single)
Operation Operation
3
List
Instruction
2. Set data
Operand Type Description Data Type
S Transfer source data or device number storing data 16- or 32-bit binary
D
Head word device number of transfer destination (Same data is transferred from
the transfer source at one time.)
16- or 32-bit binary 4
in Detail
Devices
n Number of transfer points [K1 n K512, H1 n H1FF] 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Unit
Index
Con- Real Charac-
stant Number ter String
Pointer 5
Type
Constant
Device &
Specified the
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
n 3 3
6
Programming
Before
Explanation of function and operation
1. 16-bit operation (FMOV and FMOVP)
The contents of S are transferred to "n" devices starting from D .
The contents will be same among all of "n" devices. 7
If the number of points specified by "n" exceeds the device number range, data is transferred within the
Instruction
Basic
possible range.
While the command input is OFF, the transfer destination D does not change.
While the command input is ON, the data of the transfer source S does not change.
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
241
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.7 FNC 16 FMOV / Fill Move
When a constant (K) is specified as the transfer source S , it is automatically converted into binary.
Command
input
FNC 16 n
S D
FMOV
S D
D +1
D +2 n
D +3
D +4
S +1, S D +1, D
D +3, D +2
D +5, D +4 n
D +7, D +6
D +9, D +8
242
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.7 FNC 16 FMOV / Fill Move
1
Program example
Introduction
1. When writing specified data to two or more devices
S D n
X000
FNC 16
FMOV
K 0 D 0 K 5 2
Overview
Before After
S D execution execution
K0 K0 D0 K 3 K 0
K0 D1 K 5 K 0
3
List
Instruction
K0 D2 K 65 K 0
K0 D3 K 7 K 0
4
K0 D4 K100 K 0
in Detail
Devices
Values before execution are
shown as examples.
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
243
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.8 FNC 17 XCH / Exchange
Outline
This instruction exchanges data between two devices.
1. Instruction format
FNC 17 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand Type Description Data Type
D1 Device number storing data to be exchanged. 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
D1 3 3 3 3 3 3 3 3 3 3 3
D2 3 3 3 3 3 3 3 3 3 3 3
D2 = K36 K10 = D2
Exchange
244
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.8 FNC 17 XCH / Exchange
1
Extension function (function compatible between the FX2 Series and the FX2C Series)
Introduction
When the instruction is executed while M8160 is ON, high-order 8 bits (byte) and low-order 8 bits (byte) of a
word device are exchanged each other.
Because this instruction works in the same way as SWAP (FNC147) instruction, use SWAP instruction when
programming new exchange.
In a 32-bit operation, high-order 8 bits (byte) and low-order 8 bits (byte) of each word device are exchanged 2
for each other.
Overview
X000
M8160 SWAP
FNC 17
DXCH
D 10 D 10 3
List
Instruction
D 11 D 10
Error 4
in Detail
Devices
An operation error occurs in the following case. The error flag M8067 turns ON, and the error code is stored
in D8067.
When M8160 is ON, and the device number is different between D1 and D2
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
245
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.9 FNC 18 BCD / Conversion to Binary Coded Decimal
Outline
This instruction converts binary (BIN) data into binary-coded decimal (BCD) data.
Binary data is used in operations in PLCs. Use this instruction to display numeric values on the seven-
segment display unit equipped with BCD decoder.
1. Instruction format
FNC 18 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BCD P 5 steps
BCD Continuous
9 steps
DBCD Continuous
Operation Operation
BCDP Pulse (Single) DBCDP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type
S Word device number storing the conversion source (binary) data 16- or 32-bit binary
D Word device number of the conversion destination (binary-coded decimal) data 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
BCD
246
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.9 FNC 18 BCD / Conversion to Binary Coded Decimal
1
2. 32-bit operation (DBCD and DBCDP)
Introduction
This instruction converts the binary (BIN) data of [ S +1, S ] into binary-coded decimal (BCD) data, and
transfers the converted BCD data to [ D +1, D ].
The data of [ S +1, S ] can be converted if it is within the range from K0 to K99999999 (BCD).
The table below shows digit specification for [ S +1, S ] and [ D +1, D ]. 2
Overview
Command
input
FNC 18 BIN
S D PLC
DBCD DBCD (FNC 18)
List
Instruction
BCD
in Detail
Devices
[ D +1, D ] Number of digits Data range
K1Y000 1 0 to 9
K2Y000 2 00 to 99
K3Y000 3 000 to 999
5
K4Y000 4 0000 to 9999
Constant
Device &
Specified the
K5Y000 5 00000 to 99999
K6Y000 6 000000 to 999999
K7Y000 7 0000000 to 9999999
K8Y000 8 00000000 to 99999999
6
Programming
Before
Related instruction
Instruction Function
BIN (FNC 19) Converts binary-coded decimal (BCD) data into binary (BIN) data.
Cautions 7
Instruction
Basic
1. When using SEGL (FNC 74) or ARWS (FNC 75) instruction
Because conversion between binary-coded decimal data and binary data is automatically executed in SEGL
(FNC 74) and ARWS (FNC 75) instructions, BCD instruction is not required.
decrement instructions.
When receiving the digital switch information in the binary-coded decimal (BCD) format into a PLC, use
BIN (FNC 19) instruction for converting BCD data into binary data.
When outputting data to the seven-segment display unit handling binary-coded decimal (BCD) data, use
BCD (FNC 18) instruction for converting binary data into BCD data. 9
Move & Compare
FNC10-FNC19
Errors
In BCD or BCDP (16-bit type) instructions, an operation error occurs when the S value is outside the
range from 0 to 9999.
In DBCD or DBCDP (32-bit type) instructions, an operation error occurs when the S value is outside the
range from 0 to 99,999,999. 10
Operation
Arith. & Logic
FNC20-FNC29
247
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.9 FNC 18 BCD / Conversion to Binary Coded Decimal
Program examples
1. When the seven-segment display unit has 1 digit
X000
FNC 18 D0 K1Y000 PLC
BCD
K4 K3 K2 K1
D1,D0 Output
destination
In the case of 5 digits: K5
In the case of 6 digits: K6
In the case of 7 digits: K7
In the case of 8 digits: K8
K8 K7 K6 K5 K4 K3 K2 K1
248
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.10 FNC 19 BIN Conversion to Binary
1
9.10 FNC 19 BIN Conversion to Binary
Introduction
Outline
This instruction converts binary-coded decimal (BCD) data into binary (BIN) data.
Use this instruction to convert a binary-coded decimal (BCD) value such as a value set by a digital switch into
2
Overview
binary (BIN) data and to receive the converted binary data so that the data can be handled in operations in
PLCs.
1. Instruction format
FNC 19 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
3
D BIN P 5 steps
BIN Continuous
9 steps
DBIN Continuous
List
Instruction
Operation Operation
BINP Pulse (Single) DBINP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type 4
in Detail
Devices
S Word device number storing the conversion source (binary-coded decimal) data 16- or 32-bit binary
D Word device number of the conversion destination (binary) 16- or 32-bit binary
3. Applicable devices
Oper-
Bit Devices Word Devices Others 5
Special Con- Real Charac-
Constant
Device &
Specified the
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3 3 3
D
6
Programming
Before
Explanation of function and operation
1. 16-bit operation (BIN and BINP)
This instruction converts the binary-coded decimal (BCD) data of S into binary (BIN) data, and transfers
the converted binary data to D . 7
The data of S can be converted if it is within the range from K0 to K9999 (BCD).
Instruction
Basic
The table below shows digit specification for S and D .
Command
input BCD
FNC 19
BIN
S D
6 7 8 9 8
Program Flow
FNC00-FNC09
When "K4X000"
is specified
249
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.10 FNC 19 BIN Conversion to Binary
When "K8X000"
is specified
Related instruction
Instruction Function
BCD (FNC 18) Converts binary (BIN) data into binary-coded decimal (BCD) data.
Cautions
1. When using DSW (FNC 72) instruction
Because conversion between binary-coded decimal data and binary data is automatically executed in DSW
(FNC 72) instruction, BIN instruction is not required.
Error
M8067 (operation error) turns ON when the source data is not binary-coded decimal (BCD).
250
FX3U/FX3UC Series Programmable Controllers 9 Move and Compare FNC 10 to FNC 19
Programming Manual - Basic & Applied Instruction Edition 9.10 FNC 19 BIN Conversion to Binary
1
Program examples
Introduction
1. When the digital switch has 1 digit
X000
FNC 19 K1X000 D0
BIN 6 2
Overview
MOV instruction can be used instead.
X000
FNC 12 K1X000 D0
MOV PLC
List
Instruction
X000 K4 K3 K2 K1
FNC 19 K2X000 D0
BIN
6 7 8 9
In the case of 2 digits: K2 Output
destination
In the case of 3 digits: K3
In the case of 4 digits: K4 Digital switch 4
input
in Detail
Devices
PLC
Constant
Device &
Specified the
DBIN
2 3 4 5 6 7 8 9
In the case of 5 digits: K5 Output
In the case of 6 digits: K6 destination
In the case of 7 digits: K7 Digital switch
In the case of 8 digits: K8 input
6
PLC
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
251
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition
Section
20 ADD ADD S1 S2 D Addition
10.1
Section
21 SUB SUB S1 S2 D Subtraction
10.2
Section
22 MUL MUL S1 S2 D Multiplication
10.3
Section
23 DIV DIV S1 S2 D Division
10.4
Section
24 INC INC D Increment
10.5
Section
25 DEC DEC D Decrement
10.6
Section
26 WAND WAND S1 S2 D Logical Word AND
10.7
Section
27 WOR WOR S1 S2 D Logical Word OR
10.8
Section
28 WXOR WXOR S1 S2 D Logical Exclusive OR
10.9
Section
29 NEG NEG D Negation
10.10
252
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.1 FNC 20 ADD / Addition
1
10.1 FNC 20 ADD / Addition
Introduction
Outline
This instruction executes addition by two values to obtain the result (A + B = C).
For the floating point addition instruction EADD (FNC120), refer to Section 18.8.
2
Overview
1. Instruction format
FNC 20 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ADD P 7 steps ADD Continuous
13 steps DADD
Continuous
ADDP
Operation
Pulse (Single)
Operation
DADDP
Operation
Pulse (Single)
Operation
3
List
Instruction
2. Set data
Operand type Description Data type
S1 Data for addition or word device number storing data 16- or 32-bit binary
4
S2 Data for addition or word device number storing data 16- or 32-bit binary
in Detail
Devices
D Word device number storing the addition result 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
5
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Constant
Device &
Specified the
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3 6
Programming
Before
Explanation of function and operation
1. 16-bit operation (ADD and ADDP)
The contents of S2 are added to S1 in the binary format, and the addition result is transferred to .
Command
D
7
Instruction
Basic
input FNC 20 S1 S2 D S1 + S2 D
ADD
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are added
algebraically.
5 + (8) = 3 8
Program Flow
FNC00-FNC09
When a constant (K) is specified in S1 or S2 , it is automatically converted into the binary format.
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are added
algebraically.
5500 + (8540) = 3040 10
Operation
Arith. & Logic
FNC20-FNC29
253
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.1 FNC 20 ADD / Addition
Related devices
1. Relationship between the flag operation and the sign (positive or negative) of a numeric
value
For the flag operations, refer to Subsection 6.5.2.
Device Name Description
ON : When the operation result is 0
M8020 Zero
OFF: When the operation result is not 0
ON : When the operation result is less than 32768 (in 16-bit operation) or
2,147,483,648 (in 32-bit operation)
M8021 Borrow
OFF: When the operation result is not less than 32768 (in 16-bit operation) or
2,147,483,648 (in 32-bit operation)
ON : When the operation result is more than 32767 (in 16-bit operation) or
2,147,483,647 (in 32-bit operation)
M8022 Carry
OFF: When the operation result is not more than 32767 (in 16-bit operation) or
2,147,483,647 (in 32-bit operation)
2, 1, 0, 32768 1, 0, 1 32767, 0, 1, 2
2, 1, 0, 2,147,483,648 1, 0, 1 2,147,483,647, 0, 1, 2
Cautions
1. When using a 32-bit operation instruction (DADD or DADDP)
When specifying word devices, a 16-bit word device on the low-order side is specified first, and a word device
with the subsequent device number is automatically set for the high-order 16 bits.
To prevent number overlap, it is recommended to always specify an even number, for example.
254
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.1 FNC 20 ADD / Addition
1
Program example
Introduction
1. Difference between ADD instruction and INC instruction caused by a program for adding
"+1"
When ADD[P] is executed, "1" is added to the contents of D0 every time X001 turns ON from OFF.
ADD[P] instruction is similar to INCP instruction described later except the contents shown in the table below: 2
Overview
ADD, ADDP, DADD or
INC, INCP, DINC, DINCP instruction
DADDP instruction
Flag (zero, borrow or carry) Operates Does not operate
operation
S +(1)= D 21032768 3
List
Instruction
32-bit S +(+1)= D +2,147,483,6470+1+2 +2,147,483,6472,147,483,6482,147,483,647
operation 2102,147,483,648
S +(1)= D
S1 S2 D
X001
FNC 20
4
D 0 K 1 D 0 (D 0) + 1(D 0)
in Detail
Devices
ADDP
X001
FNC 24 D 0 (D 0) + 1(D 0) 5
INCP
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
255
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.2 FNC 21 SUB / Subtraction
Outline
This instruction executes subtraction using two values to obtain the result (A B = C).
For the floating point subtraction instruction ESUB (FNC121), refer to Section 18.9.
1. Instruction format
FNC 21 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D SUB P 7 steps SUB Continuous
13 steps DSUB
Continuous
Operation Operation
SUBP Pulse (Single) DSUBP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
S1 Data for subtraction or word device number storing data 16- or 32-bit binary
S2 Data for subtraction or word device number storing data 16- or 32-bit binary
D Word device number storing the subtraction result 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are subtracted
algebraically.
5 (8) = 13
When a constant (K) is specified in S1 or S2 , it is automatically converted into the binary format.
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are subtracted
algebraically.
5500 (8540) = 14040
When a constant (K) is specified in [ S1 +1, S1 ] or [ S2 +1, S2 ], it is automatically converted into
the binary format.
256
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.2 FNC 21 SUB / Subtraction
1
Related devices
Introduction
1. Relationship between the flag operation and the sign (positive or negative) of a numeric
value
For the flag operations, refer to Subsection 6.5.2.
Device Name Description 2
ON : When the operation result is 0
Overview
M8020 Zero
OFF: When the operation result is other than 0
ON : When the operation result is less than 32768 (in 16-bit operation) or
2,147,483,648 (in 32-bit operation)
M8021 Borrow
OFF: When the operation result is not less than 32768 (in 16-bit operation) or
2,147,483,648 (in 32-bit operation)
3
ON : When the operation result is more than 32767 (in 16-bit operation) or
List
Instruction
2,147,483,647 (in 32-bit operation)
M8022 Carry
OFF: When the operation result is not more than 32767 (in 16-bit operation) or
2,147,483,647 (in 32-bit operation)
in Detail
Devices
Borrow flag The most The most Carry flag
significant bit of significant bit
data becomes of data
Zero flag "1". becomes "0". Zero flag
5
2, 1, 0, 2,147,483,648 1, 0, 1 2,147,483,647, 0, 1, 2
Constant
Device &
Specified the
Borrow flag Zero flag Carry flag
Cautions
6
1. When using a 32-bit operation instruction (DSUB or DSUBP)
Programming
Before
When specifying word devices, a 16-bit word device on the low-order side is specified first, and then a word
device with the subsequent device number is automatically set for the high-order 16 bits.
For preventing number overlap, it is recommended to always specify an even number, for example.
Instruction
Basic
In this case, note that the addition result changes in every operation cycle if a continuous operation type
instruction (SUB or DSUB) is used.
X001
FNC 21 D 0 K 25 D 0 (D 0) 25(D 0)
SUB
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
257
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.2 FNC 21 SUB / Subtraction
Program example
1. Difference between SUB instruction and DEC instruction caused by a program for
subtracting "1"
"1" is subtracted from the contents of D0 every time X001 turns ON from OFF.
SUB[P] instruction is similar to DECP instruction described later except the contents shown in the table
below:
operation +327670+1+2
S (1)= D
S1 S2 D
X001
FNC 21 D 0 K 1 D 0 (D 0) 1(D 0)
SUBP
X001
FNC 25 D 0 (D 0) 1(D 0)
DECP
258
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.3 FNC 22 MUL / Multiplication
1
10.3 FNC 22 MUL / Multiplication
Introduction
Outline
This instruction executes multiplication by two values to obtain the result (A x B = C).
For the floating point multiplication instruction EMUL (FNC122), refer to Section 18.10.
2
Overview
1. Instruction format
FNC 22 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D MUL P 7 steps MUL Continuous
13 steps DMUL
Continuous
MULP
Operation
Pulse (Single)
Operation
DMULP
Operation
Pulse (Single)
Operation
3
List
Instruction
2. Set data
Operand type Description Data type
S1 Data for multiplication or word device number storing data 16- or 32-bit binary
4
S2 Data for multiplication or word device number storing data 16- or 32-bit binary
in Detail
Devices
D Head word device number storing the multiplication result 32- or 64-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
5
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Constant
Device &
Specified the
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 S 3 6
Programming
Before
S : Available only in 16-bit operations (Not available in 32-bit operations)
Instruction
Basic
to 32-bit [ D +1, D1 ] .
Command BIN BIN BIN
input FNC 22 S1 S2 D ( S1 ) ( S2 ) ( D +1, D )
MUL
16 bits 16 bits 32 bits
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are multiplied
8
Program Flow
FNC00-FNC09
algebraically.
5 (8) = 40
When a constant (K) is specified in S1 or S2 , it is automatically converted into the binary format.
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
259
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.3 FNC 22 MUL / Multiplication
S1 K53(H0035)
S2 K15(H000F)
K795(H031B)
Sign bit (0: Positive, 1: Negative)
Y027 Y026 Y025 Y013 Y012 Y011 Y010 Y007 Y006 Y005 Y004 Y003 Y002 Y001 Y000
D 0 0 0 0 0 1 1 0 0 0 1 1 0 1 1
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are multiplied
algebraically.
5500 (8540) = 46,970,000
When a constant (K) is specified in [ S1 +1, S1 ] or [ S2 +1, S2 ], it is automatically converted
into the binary format.
When a digit (K1 to K8) is specified for [ D +3, D +2, D +1, D ]
The result is obtained only for low-order 32 bits, and is not obtained for high-order 32 bits.
Transfer the data to word devices once, then execute the operation.
S1 S2 D
Command
input FNC 22 (D51,D50) (D103,D102,D101,D100)
D50 K150 D100 K100 K150 K15000
DMUL
260
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.3 FNC 22 MUL / Multiplication
1
Related devices
Introduction
1. Relationship between flag operation and numeric value
Devicee Name Description
ON: When the operation result is 0.
M8304*1 Zero
OFF: When the operation result is a number other than 0. 2
Overview
*1. Available in Ver. 2.30
Cautions
1. Devices specified in D
3
In a 32-bit operation (by DMUL or DMULP), Z cannot be specified in D .
List
Instruction
2. When monitoring the operation result in a programming tool
Even if word devices are used, the operation result (64 bits) cannot be monitored at one time.
In such a case, floating point operation is recommended.
For the floating point operation, refer to Chapter 18.
4
in Detail
Devices
Program examples
1. 16-bit operation
S1 S2 D
X000
FNC 22 D 0 D 2 D 4 (D 0) (D 2) (D 5,D 4) 5
MUL 8 9 72
Constant
Device &
Specified the
2. 32-bit operation
S1 S2 D
X001
FNC 22
DMUL
D 0 D 2 D 4
(D 1,D 0) (D 3,D 2) (D 7,D 6,D 5,D 4)
1756 327 574,212 6
Programming
Before
Function Changes According to Versions
Compatible Versions
FX3U FX3UC
Item Function Summary 7
Instruction
Basic
Turns the special device M8304 ON when the operation result of MUL
Ver. 2.30 or later Ver. 2.30 or later Zero Flag
command is 0.
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
261
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.4 FNC 23 DIV / Division
Outline
This instruction executes division by two values to obtain the result (A B = C ... ).
For the floating point division instruction EDIV (FNC123), refer to Section 18.11.
1. Instruction format
FNC 23 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D DIV P 7 steps DIV Continuous
13 steps DDIV
Continuous
Operation Operation
DIVP Pulse (Single) DDIVP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
S1 Data for division or word device number storing data (dividend) 16- or 32-bit binary
S2 Data for division or word device number storing data (divisor) 16- or 32-bit binary
D Head word device number storing the division result (quotient and remainder) 32- or 64-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 S 3
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are divided
algebraically.
36 (5) = 7 (quotient) ... 1 (remainder)
Two devices in total starting from D are occupied to store the operation result (quotient and
remainder). Make sure that these two devices are not used for another control.
When a constant (K) is specified as S1 or S2 , it is automatically converted into the binary format.
262
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.4 FNC 23 DIV / Division
1
2. 32-bit operation (DDIV and DDIVP)
Introduction
[ S1 +1, S1 ] indicates the dividend, [ S2 +1, S2 ] indicates the divisor, the quotient is transferred to
[ D +1, D ]), and the remainder is transferred to [ D +3, D +2].
Command
input FNC 23
DDIV
S1 S2 D
2
Overview
Dividend Divisor Quotient Remainder
BIN BIN BIN BIN
[ S1 +1, S1 ] [ S2 +1, S2 ] [ D +1, D ] ... [ D +3, D +2]
32 bits 32 bits 32 bits 32 bits
Four devices in total starting from D are occupied to store the operation result (quotient and 3
remainder). Make sure that these four devices are not used for another control.
List
Instruction
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data are divided
algebraically.
5500 (540) = 10 (quotient) ... 100 (remainder)
When a constant (K) is specified in [ S1 +1, S1 ] or [ S2 +1, S2 ], it is automatically converted into
the binary format. 4
in Detail
Devices
Related devices
1. Relationship between flag operation and numeric value
Devicee Name Description
ON : When the operation result is 0.
5
M8304*1 Zero
Constant
Device &
Specified the
OFF : When the operation result is a number other than 0.
ON : Carry flag operates when the operation result is over 32,767 (16-bit opera-
tion) or2,147,483,647 (32-bit operation).
M8306*1 Carry
OFF : When the operation result is less than 32,767 (16-bit operation) or
2,147,483,647 (32-bit operation).
Programming
Before
Cautions
1. Operation result
The most significant bit of the quotient and remainder indicates the sign (positive: 0, negative: 1)
respectively.
7
Instruction
Basic
The quotient is negative when either the dividend or divisor is negative.
The remainder is negative when the dividend is negative.
2. Device specified as D
The remainder is not obtained when a bit device is specified with digit specification. 8
In a 32-bit operation (by DDIV or DDIVP), Z cannot be specified as D .
Program Flow
FNC00-FNC09
Error
When the divisor S2 is "0", an operation error is caused and the instruction is not executed.
A operation error results when the operation result is over 32,767 (16-bit operation) or 2,147,483,647 (32- 9
bit operation). (Turns the carry flag ON.)
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
263
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.4 FNC 23 DIV / Division
Program examples
1. 16-bit operation
S1 S2 D
X000 Dividend Divisor Quotient Remainder
FNC 23 D 0 D 2 D 4 (D 0) (D 2) (D 4) ... (D 5)
DIV 100 33 3 1
2. 32-bit operation
S1 S2 D
X001 Dividend Divisor Quotient Remainder
FNC 23 D 0 D 2 D 4 (D 1,D 0) (D 3,D 2) (D 5,D 4) ... (D 7,D 6)
DDIV 100,000 3333 30 10
264
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.5 FNC 24 INC / Increment
1
10.5 FNC 24 INC / Increment
Introduction
Outline
This instruction increments the data of a specified device by "1".
2
1. Instruction format
Overview
FNC 24 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D INC P 3 steps INC Continuous
5 steps DINC
Continuous
Operation Operation
INCP Pulse (Single) DINCP Pulse (Single)
Operation Operation
3
List
Instruction
2. Set data
Operand type Description Data type
D Word device number storing data to be incremented by "1" 16- or 32-bit binary
3. Applicable devices
4
in Detail
Devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
D 3 3 3 3 3 3 3 3 3 3 3 5
Constant
Device &
Specified the
Explanation of function and operation
1. 16-bit operation (INC and INCP)
The contents of D are incremented by "1", and the increment result is transferred to D .
Command
6
Programming
Before
input FNC 24 D D +1 D
INCP
Instruction
Basic
Command
input FNC 24 D [ D +1, D ] + 1 [ D + 1, D ]
DINCP
Cautions 8
Program Flow
FNC00-FNC09
1. Note that data is incremented in every operation cycle in a continuous operation type
instruction.
2. Flag operations
1) 16-bit operation 9
When "+32767" is incremented by "1", the result is "32768". Flags (zero, carry and borrow) are not
Move & Compare
FNC10-FNC19
265
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.5 FNC 24 INC / Increment
Program example
X010
FNC 12 K 0 Z 0 (Z) Z is cleared by the reset input X010.
MOVP
M 1
266
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.6 FNC 25 DEC / Decrement
1
10.6 FNC 25 DEC / Decrement
Introduction
Outline
This instruction decrements the data of a specified device by "1".
2
1. Instruction format
Overview
FNC 25 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D DEC P 3 steps DEC Continuous
5 steps DDEC
Continuous
Operation Operation
DECP Pulse (Single) DDECP Pulse (Single)
Operation Operation
3
List
Instruction
2. Set data
Operand type Description Data type
D Word device number storing data to be decremented by "1" 16- or 32-bit binary
3. Applicable devices
4
in Detail
Devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
D 3 3 3 3 3 3 3 3 3 3 3 5
Constant
Device &
Specified the
Explanation of function and operation
1. 16-bit operation (DEC and DECP)
The contents of D are decremented by "1", and the decremented result is transferred to D .
Command
6
Programming
Before
input FNC 25 D D 1 D
DECP
Instruction
Basic
Command
input FNC 25 D [ D +1, D ] 1 [ D + 1, D ]
DDECP
Cautions 8
Program Flow
FNC00-FNC09
1. Flag operations
1) 16-bit operation
When "32768" is decremented by "1", the result is "+32767". Flags (zero, carry and borrow) are not
activated at this time.
2) 32-bit operation 9
Move & Compare
FNC10-FNC19
When "2,147,483,648" is decremented by "1", the result is "+2,147,483,647". Flags (zero, carry and
borrow) are not activated at this time.
10
Operation
Arith. & Logic
FNC20-FNC29
267
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.7 FNC 26 WAND / Logical Word AND
Outline
This instruction executes the logical product (AND) operation of two numeric values.
1. Instruction format
W FNC 26 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D AND P 7 steps WAND Continuous
13 steps DAND
Continuous
Operation Operation
WANDP Pulse (Single) DANDP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
S1 Data used for logical product or word device number storing data 16- or 32-bit binary
S2 Data used for logical product or word device number storing data 16- or 32-bit binary
D Word device number storing the logical product result 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
While the command input is OFF, the data of the transfer destination D does not change.
While the command input is ON, the data of the transfer sources S1 and S2 do not change.
When a constant (K) is specified in the transfer sources S1 and S2 , it is automatically converted into
the binary format.
The logical product operation is executed in units of bit as shown in the table below (1 1 = 1, 0 1 = 0, 1
0 = 0, 0 0 = 0).
1: ON, 0: OFF
D
S1 S2
WAND (FNC 26) instruction
0 0 0
Logical operation 1 0 0
(unit: bit) 0 1 0
1 1 1
268
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.7 FNC 26 WAND / Logical Word AND
1
2. 32-bit operation (DAND and DANDP)
Introduction
The logical product (AND) operation is executed to the contents of [ S1 +1, S1 ] and [ S2 +1, S2 ] in
units of bit, and the result is transferred to [ D +1, D ].
Command
input FNC 26
DAND
S1 S2 D S1 +1, S1 S2 +1, S2 D +1, D
2
Overview
While the command input is OFF, the data of the transfer destination [ D +1, D ] does not change.
While the command input is ON, the data of the transfer source [ S1 +1, S1 ] [ S2 +1, S2 ] do not
change.
When a constant (K) is specified in the transfer source [ S1
automatically converted into the binary format.
+1, S1 ] [ S2 +1, S2 ], it is 3
List
Instruction
The logical product operation is executed in units of bit as shown in the table below (1 1 = 1, 0 1 = 0, 1
0 = 0, 0 0 = 0).
1: ON, 0: OFF
D +1, D
S1 +1, S1 S2 +1, S2
DAND (FNC 26) instruction 4
in Detail
Devices
0 0 0
Logical operation 1 0 0
(unit: bit) 0 1 0
1 1 1
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
269
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.8 FNC 27 WOR / Logical Word OR
Outline
This instruction executes the logical sum (OR) operation of two numeric values.
1. Instruction format
W FNC 27 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D OR P 7 steps WOR Continuous
13 steps DOR
Continuous
Operation Operation
WORP Pulse (Single) DORP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
S1 Data used for logical sum or word device number storing data 16- or 32-bit binary
S2 Data used for logical sum or word device number storing data 16- or 32-bit binary
D Word device number storing the logical sum result 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
While the command input is OFF, the data of the transfer destination D does not change.
While the command input is ON, the data of the transfer sources S1 and S2 do not change.
When a constant (K) is specified in the transfer sources S1 and S2 , it is automatically converted into
the binary format.
The logical sum operation is executed in units of bit as shown in the table below (1 1 = 1, 0 1 = 1,
0 0 = 0, 1 0 = 1).
1: ON, 0: OFF
D
S1 S2
WOR (FNC 27) instruction
0 0 0
Logical operation 1 0 1
(unit: bit) 0 1 1
1 1 1
270
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.8 FNC 27 WOR / Logical Word OR
1
2. 32-bit operation (DOR and DORP)
Introduction
The logical sum (OR) operation is executed to the contents of [ S1 +1, S1 ] and [ S2 +1, S2 ] in units
of bit, and the result is transferred to [ D +1, D ].
Command
input FNC 27
DOR
S1 S2 D S1 +1, S1 S2 +1, S2 D +1, D 2
Overview
While the command input is OFF, the data of the transfer destination [ D +1, D ] does not change.
While the command input is ON, the data of the transfer source [ S1 +1, S1 ] [ S2 +1, S2 ] do not
change.
When a constant (K) is specified in the transfer source [ S1 +1, S1 ] [ S2 +1, S2 ], it is 3
automatically converted into the binary format.
List
Instruction
The logical sum operation is executed in units of bit as shown in the table below (1 1 = 1, 0 1 = 1,
0 0 = 0, 1 0 = 1).
1: ON, 0: OFF
D +1, D
S1 +1, S1 S2 +1, S2
DOR (FNC 27) instruction
4
in Detail
Devices
0 0 0
Logical operation 1 0 1
(unit: bit) 0 1 1
1 1 1
5
Constant
Device &
Specified the
6
Programming
Before
7
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
271
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.9 FNC 28 WXOR / Logical Exclusive OR
Outline
This instruction executes the exclusive logical sum (XOR) operation of two numeric values.
1. Instruction format
W FNC 28 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D XOR P 7 steps WXOR Continuous
13 steps DXOR
Continuous
Operation Operation
WXORP Pulse (Single) DXORP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
S1 Data used for exclusive logical sum or word device number storing data 16- or 32-bit binary
S2 Data used for exclusive logical sum or word device number storing data 16- or 32-bit binary
D Word device number storing the exclusive logical sum result 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
While the command input is OFF, the data of the transfer destination D does not change.
While the command input is ON, the data of the transfer sources S1 and S2 do not change.
When a constant (K) is specified in the transfer sources S1 and S2 , it is automatically converted into
the binary format.
The logical exclusive sum operation is executed in units of bit as shown in the table below (1 1 = 0,
0 0 = 0, 1 0 = 1, 0 1 = 1).
1: ON, 0: OFF
D
S1 S2
WXOR (FNC 28) instruction
0 0 0
Logical operation 1 0 1
(unit: bit) 0 1 1
1 1 0
272
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.9 FNC 28 WXOR / Logical Exclusive OR
1
2. 32-bit operation (DXOR and DXORP)
Introduction
The exclusive logical sum (XOR) operation is executed to the contents of [ S1 +1, S1 ] and [ S2 +1,
S2 ] in units of bit, and the result is transferred to [ D +1, D ].
Command
input FNC 28
DXOR
S1 S2 D S1 +1, S1 S2 +1, S2 D +1, D
2
Overview
While the command input is OFF, the data of the transfer destination [ D +1, D ] does not change.
While the command input is ON, the data of the transfer source [ S1 +1, S1 ] [ S2 +1, S2 ] do not
change.
When a constant (K) is specified in the transfer source [ S1 +1, S1 ] [ S2 +1, S2 ], it is 3
automatically converted into the binary format.
List
Instruction
The exclusive logical sum operation is executed in units of bit as shown in the table below (1 1 = 0,
0 0 = 0, 1 0 = 1, 0 1 = 1).
1: ON, 0: OFF
D +1, D
S1 +1, S1 S2 +1, S2
DXOR (FNC 28) instruction
4
in Detail
Devices
0 0 0
Logical operation 1 0 1
(unit: bit) 0 1 1
1 1 0
5
Program example
Constant
Device &
Specified the
By combining WXOR and CML (FNC 14) instructions, the exclusive logical sum not (XORNOT) operation can
be executed.
X000
FNC 28
WXOR
D 10 D 12 D 14
6
Programming
Before
FNC 14 D 14 D 14
CML
Instruction
Basic
8
Program Flow
FNC00-FNC09
9
Move & Compare
FNC10-FNC19
10
Operation
Arith. & Logic
FNC20-FNC29
273
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.10 FNC 29 NEG / Negation
Outline
This instruction obtains the complement of a numeric value (by inverting each bit and adding "1").
This instruction can be used to negate the sign of a numeric value.
For the Floating point negation ENEG (FNC128), refer to Section 18.16.
1. Instruction format
FNC 29 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D NEG P 3 steps NEG Continuous
5 steps DNEG
Continuous
Operation Operation
NEGP Pulse (Single) DNEGP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
Word device number which stores data for obtaining complement and will store
D the operation result (The operation result will be stored in the same word device 16- or 32-bit binary
number.)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
D 3 3 3 3 3 3 3 3 3 3 3
Caution
Note that the complement is obtained in every operation cycle in a continuous operation type instruction.
274
FX3U/FX3UC Series Programmable Controllers 10 Arithmetic and Logical Operation (+, , , ) FNC 20 to FNC 29
Programming Manual - Basic & Applied Instruction Edition 10.10 FNC 29 NEG / Negation
1
Program examples
Introduction
The program examples below are provided to obtain the absolute value of a negative binary value.
Overview
M 0
FNC 29 D10 D10 NEGP instruction is executed for D10 only when M0
D 10 turns ON.
NEGP
List
Instruction
Even if NEG instruction is not used, D30 always stores the absolute value of the difference.
X000
FNC 10 D 10 D 20 M 10 (D 10) > (D 20) (D10) = (D 20) (D 10) < (D 20)
CMP M 10 = ON M 11 = ON M 12 = ON
M 10
FNC 21 D 10 D 20 D 30 In the case of "D10 D20", 4
SUB D10 D20 D30.
in Detail
Devices
M 11
M 12
FNC 21 D 20 D 10 D 30 In the case of "D10 < D20",
D20 D10 D30.
SUB
5
Constant
Device &
Specified the
Negative value expression and absolute value (reference)
In PLCs, a negative value is expressed in 2s complement.
When the most significant bit is "1", it is a negative value, and its absolute value can be obtained by NEG
instruction.
(D 10) = 2
6
Programming
Before
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
(D 10) = 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
(D 10) = 0
7
Instruction
Basic
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(D 10) = 1 (D 10) + 1 = 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
(D 10) = 2 (D 10) + 1 = 2 8
Program Flow
FNC00-FNC09
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
......
......
9
(D 10) = 32767 (D 10) + 1 = 32767
Move & Compare
FNC10-FNC19
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
275
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition
ROR D n Section
30 ROR Rotation Right
11.1
ROL D n Section
31 ROL Rotation Left
11.2
RCR D n Section
32 RCR Rotation Right with Carry
11.3
RCL D n Section
33 RCL Rotation Left with Carry
11.4
SFTR S D n1 n2 Section
34 SFTR Bit Shift Right
11.5
SFTL S D n1 n2 Section
35 SFTL Bit Shift Left
11.6
WSFR S D n1 n2 Section
36 WSFR Word Shift Right
11.7
WSFL S D n1 n2 Section
37 WSFL Word Shift Left
11.8
SFWR S D n Section
38 SFWR Shift write [FIFO/FILO control]
11.9
SFRD S D n Section
39 SFRD Shift read [FIFO control]
11.10
276
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.1 FNC 30 ROR / Rotation Right
11
11.1 FNC 30 ROR / Rotation Right
Shift
Rotation and
FNC30-FNC39
Outline
This instruction shifts and rotates the bit information rightward by the specified number of bits without the
carry flag.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 30 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ROR P 5 steps ROR Continuous
9 steps DROR
Continuous
Operation Operation
RORP Pulse (Single)
Operation
DRORP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
D Word device number storing data to be rotated rightward 16- or 32-bit binary
n
Number of bits to be rotated
16- or 32-bit binary
14
[n 16 (16-bit instruction), n 32 (32-bit instruction)]
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
D S S S 3 3 3 3 3 3 3 3
n 3 3 3 3
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (ROR and RORP)
"n" bits out of 16 bits of D are rotated rightward.
Command
input
17
FNC 30 D n
Transfer 2
Data
FNC100-FNC109
RORP
The contents of
b3 are stored.
277
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.1 FNC 30 ROR / Rotation Right
Related device
For the carry flag use method, refer to Subsection 6.5.2.
Device Name Description
M8022 Carry Turns ON when the bit shifted last from the lowest position is "1".
Cautions
1. In the case of continuous operation type instructions (ROR and DROR)
Note that shift and rotation are executed in every scan time (operation cycle).
278
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.2 FNC 31 ROL / Rotation Left
11
11.2 FNC 31 ROL / Rotation Left
Shift
Rotation and
FNC30-FNC39
Outline
This instruction shifts and rotates the bit information leftward by the specified number of bits without the carry
flag.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 31 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ROL P 5 steps ROL Continuous
9 steps DROL
Continuous
Operation Operation
ROLP Pulse (Single)
Operation
DROLP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
D Word device number storing data to be rotated leftward 16- or 32-bit binary
n
Number of bits to be rotated
16- or 32-bit binary
14
[n 16 (16-bit instruction), n 32 (32-bit instruction)]
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
D S S S 3 3 3 3 3 3 3 3
n 3 3 3 3
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (ROL and ROLP)
"n" bits out of 16 bits of D are rotated leftward.
Command
input
17
FNC 31 D n
Transfer 2
Data
FNC100-FNC109
ROLP
execution M8022 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
After the
instruction
is executed
once
b12 (16n) to
b15 are moved. 19
The status of
Operation 2
Data
FNC140-FNC149
The contents of
b12 are stored.
279
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.2 FNC 31 ROL / Rotation Left
Related device
For the carry flag use method, refer to Subsection 6.5.2.
Device Name Description
M8022 Carry Turns ON when the bit shifted last from the highest position is "1".
Cautions
1. In the case of continuous operation type instructions (ROL and DROL)
Note that shift and rotation are executed in every scan time (operation cycle).
280
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.3 FNC 32 RCR / Rotation Right with Carry
11
11.3 FNC 32 RCR / Rotation Right with Carry
Shift
Rotation and
FNC30-FNC39
Outline
This instruction shifts and rotates the bit information rightward by the specified number of bits together with
the carry flag.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 32 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D RCR P 5 steps RCR Continuous
9 steps DRCR
Continuous
Operation Operation
RCRP Pulse (Single)
Operation
DRCRP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
D Word device number storing data to be rotated rightward 16- or 32-bit binary
n
Number of bits to be rotated
16- or 32-bit binary
14
[n 16 (16-bit instruction), n 32 (32-bit instruction)]
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
D S S S 3 3 3 3 3 3 3 3
n 3 3 3 3
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (RCR and RCRP)
"n" bits out of 16 bits of D and 1 bit (carry flag M8022) are rotated rightward.
Command
input
17
FNC 32 D n
Transfer 2
Data
FNC100-FNC109
RCRP
instruction to b0 are
is b3 (n1)
b2 (n2) to b0 and the head bit executed moved.
indicating the carry flag ON/OFF once The status of the final bit b3
status are moved.
(bit "n1") is stored.
Rightward
"n" bits rotation
High order Low order 19
After b15b14b13b12b11b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
Operation 2
Data
FNC140-FNC149
281
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.3 FNC 32 RCR / Rotation Right with Carry
Related device
For the carry flag use method, refer to Subsection 6.5.2.
Device Name Description
M8022 Carry Turns ON when the bit shifted last from the lowest position is "1".
Cautions
1. In the case of continuous operation type instructions (RCR and DRCR)
Note that shift and rotation are executed in every scan time (operation cycle).
282
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.4 FNC 33 RCL / Rotation Left with Carry
11
11.4 FNC 33 RCL / Rotation Left with Carry
Shift
Rotation and
FNC30-FNC39
Outline
This instruction shifts and rotates the bit information leftward by the specified number of bits together with the
carry flag.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 33 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D RCL P 5 steps RCL Continuous
9 steps DRCL
Continuous
Operation Operation
RCLP Pulse (Single)
Operation
DRCLP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
D Word device number storing data to be rotated leftward 16- or 32-bit binary
n
Number of bits to be rotated
16- or 32-bit binary
14
[n 16 (16-bit instruction), n 32 (32-bit instruction)]
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
D S S S 3 3 3 3 3 3 3 3
n 3 3 3 3
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (RCL and RCLP)
"n" bits out of 16 bits of D and 1 bit (carry flag M8022) are rotated leftward.
Command
input FNC 33
17
D n
Transfer 2
Data
FNC100-FNC109
RCLP
1
Carry flag After the
When M8022 instruction is
is ON executed once b15 to b13 (16n+1) and the head
bit indicating the carry flag ON/OFF
Leftward "n" bits
status are moved.
High order
rotation
Low order 19
b15b14b13b12b11b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
After
Operation 2
Data
FNC140-FNC149
283
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.4 FNC 33 RCL / Rotation Left with Carry
Leftward
rotation
High order Low order
The status b31b30b29b28b27b26b25b24b23b22b21b20b19b18b17b16b15b14b13b12b11b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
After of the final
execution bit b28 (bit 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
"32n") is
stored.
Before shift b27 to b0 Before shift
b31 to b29
0 Carry flag M8022
Before shift
Before shift b28 Carry flag M8022
Related device
For the carry flag use method, refer to Subsection 6.5.2.
Device Name Description
M8022 Carry Turns ON when the bit shifted last from the highest position is "1".
Cautions
1. In the case of continuous operation type instructions (RCL and DRCL)
Note that shift and rotation are executed in every scan time (operation cycle).
284
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.5 FNC 34 SFTR / Bit Shift Right
11
11.5 FNC 34 SFTR / Bit Shift Right
Shift
Rotation and
FNC30-FNC39
Outline
This instruction shifts bit devices of the specified bit length rightward by the specified number of bits.
After shift, the bit device S is transferred by "n2" bits from the most significant bit.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 34 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
SFTR P 9 steps SFTR Continuous
Operation
SFTRP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S Head bit device number to be stored to the shift data after rightward shift Bit
Instruction
Handy
FMC60-FNC69
n1 Bit length of the shift data n2 n1 1024 16-bit binary
n2 Number of bits to be shifted rightward n2 n1 1024 16-bit binary
3. Applicable devices
Oper-
Bit Devices Word Devices Others 15
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Device
External FX I/O
FNC70-FNC79
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 S 3
D 3 3 3 3
n1 3 3 16
Device
External FX
FNC80-FNC89
n2 3 3 3 3
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
285
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.5 FNC 34 SFTR / Bit Shift Right
S +2 S +1 S
Before
execution n1 (in the case of "n1=9")
D +8 D +7 D +6 D +5 D +4 D +3 D +2 D +1 D
[2] [1]
"n2" bits are Overflow (data to
[3] Copy shifted rightward be deleted)
(n2=3).
After D +8 D +7 D +6 D +5 D +4 D +3 D +2 D +1 D
execution
Caution
Note that "n2" bits are shifted every time the command input turns ON from OFF in SFTRP instruction, but
that "n2" bits are shifted in each scan time (operation cycle) in SFTR instruction.
Error
If the transfer source S is equivalent to the shifted device D , an operation error occurs (error code:
K6710).
286
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.6 FNC 35 SFTL / Bit Shift Left
11
11.6 FNC 35 SFTL / Bit Shift Left
Shift
Rotation and
FNC30-FNC39
Outline
This instruction shifts bit devices of the specified bit length leftward by the specified number of bits.
After shift, the bit device S is transferred by "n2" bits from the least significant bit.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 35 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
SFTL P 9 steps SFTL Continuous
Operation
SFTLP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S Head bit device number to be stored to the shift data after leftward shift Bit
Instruction
Handy
FMC60-FNC69
n1 Bit length of the shift data n2 n1 1024 16-bit binary
n2 Number of bits to be shifted leftward n2 n1 1024 16-bit binary
3. Applicable devices
Oper-
Bit Devices Word Devices Others 15
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Device
External FX I/O
FNC70-FNC79
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 S 3
D 3 3 3 3
n1 3 3 16
Device
External FX
FNC80-FNC89
n2 3 3 3 3
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
287
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.6 FNC 35 SFTL / Bit Shift Left
S +2 S +1 S
Before
execution n1 (in the case of "n1=9")
D +8 D +7 D +6 D +5 D +4 D +3 D +2 D +1 D
[1] [2]
Overflow (data to "n2" bits are
be deleted) shifted rightward [3] Copy
(n2=3).
After D +8 D +7 D +6 D +5 D +4 D +3 D +2 D +1 D
execution
Caution
Note that "n2" bits are shifted every time the command input turns ON from OFF in SFTLP instruction, but
that "n2" bits are shifted in each operation cycle in SFTL instruction.
Error
If the transfer source S is equivalent to the shifted device D , an operation error occurs (error code:
K6710).
288
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.6 FNC 35 SFTL / Bit Shift Left
11
Program example (conditional stepping of 1-bit data)
Shift
Rotation and
FNC30-FNC39
By setting X000 to X007 to ON in turn, Y000 to Y007 are activated in turn.
If the order is wrong, activation is disabled.
X000 M8046
Data
M 0 Head data
12
input
Data Operation
FNC40-FNC49
*1
M8046 X000
FNC 35 M 0 S 0 K 8 K 1
SFTL
S 0 X001
S 1 X002
Bit 1 of M0 is regarded as the head input, and 8-bit shift register is
constructed by S0 to S7. 13
Processing
High Speed
FNC50-FNC59
*1 By using a state relay (S), the state under operation can be monitored
by the dynamic monitoring function of the state relay.
S 7 X000
14
M8000
Instruction
Handy
FMC60-FNC69
FNC 12 K2S 0 K2Y000 (S 7 to S 0) (Y007 to Y000)
MOV
END 15
Device
External FX I/O
FNC70-FNC79
X000
X001
Even if X000 is set to ON, Y000 is not activated.
X007
16
Device
External FX
FNC80-FNC89
Y000
Y001
Y007
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
289
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.6 FNC 35 SFTL / Bit Shift Left
1. F1 and F2 PLCs
M100: Input data
M101 to M117 (octal number): 15-step shift register
290
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.7 FNC 36 WSFR / Word Shift Right
11
11.7 FNC 36 WSFR / Word Shift Right
Shift
Rotation and
FNC30-FNC39
Outline
This instruction shifts word devices with "n1" data length rightward by "n2" words.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 36 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
WSFR P 9 steps WSFR Continuous
Operation
WSFRP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S Head device number to be stored to the shift data after rightward shift 16-bit binary
Head word device number storing data to be shifted rightward 16-bit binary
D
n1 Word data length of the shift data n2 n1 512 16-bit binary
14
Instruction
Handy
FMC60-FNC69
n2 Number of words to be shifted rightward n2 n1 512 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Unit
Index
Con- Real Charac-
stant Number ter String
Pointer 15
Type
Device
External FX I/O
FNC70-FNC79
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
n1 3 3
n2 3 3 3 3 16
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (WSFR and WSFRP)
For "n1" word devices starting from D , "n2" words are shifted rightward ([1] and [2] shown below).
After shift, "n2" words starting from S are shifted to "n2" words starting from [ D +n1-n2] ([3] shown
17
Transfer 2
Data
FNC100-FNC109
below).
Command
input FNC 36 S D n1 n2
WSFRP
S +2 S +1 S
Before
execution n1 (in the case of "n1=9")
D +8 D +7 D +6 D +5 D +4 D +3 D +2 D +1 D
19
Operation 2
Data
FNC140-FNC149
[2] [1]
"n2" bits are Overflow (data to
[3] Copy shifted rightward be deleted)
(n2=3).
After D +8 D +7 D +6 D +5 D +4 D +3 D +2 D +1 D 20
execution
Control
Positioning
FNC150-FNC159
291
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.7 FNC 36 WSFR / Word Shift Right
Caution
Note that "n2" words are shifted when the drive input turns ON in WSFRP instruction, but that "n2" words are
shifted in each operation cycle in WSFR instruction.
Error
If the transfer source S is equivalent to the shifted device D , an operation error occurs (error code:
K6710).
Program example
1. Shifting devices with digit specification
S D n1 n2
X000
FNC 36 K1X000 K1Y000 K 4 K 2
WSFRP
Specify a same digit for devices with digit specification.
[2] [1]
292
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.8 FNC 37 WSFL / Word Shift Left
11
11.8 FNC 37 WSFL / Word Shift Left
Shift
Rotation and
FNC30-FNC39
Outline
This instruction shifts the word data information leftward by the specified number of words.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 37 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
WSFL P 9 steps WSFL Continuous
Operation
WSFLP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S Head device number to be stored to the shift data after leftward shift 16-bit binary
Head word device number storing data to be shifted leftward 16-bit binary
D
n1 Word data length of the shift data n2 n1 512 16-bit binary
14
Instruction
Handy
FMC60-FNC69
n2 Number of words to be shifted leftward n2 n1 512 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Unit
Index
Con- Real Charac-
stant Number ter String
Pointer 15
Type
Device
External FX I/O
FNC70-FNC79
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
n1 3 3
n2 3 3 3 3 16
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (WSFL and WSFLP)
For "n1" word devices starting from D , "n2" words are shifted leftward ([1] and [2] shown below).
After shift, "n2" words starting from S are shifted to "n2" words starting from D ([3] shown below).
17
Transfer 2
Data
FNC100-FNC109
Command
input FNC 37 S D n1 n2
WSFLP
Before
execution n1 (in the case of "n1=9")
D +8 D +7 D +6 D +5 D +4 D +3 D +2 D +1 D
19
[1] [2]
Operation 2
Data
FNC140-FNC149
After D +8 D +7 D +6 D +5 D +4 D +3 D +2 D +1 D
execution 20
Control
Positioning
FNC150-FNC159
293
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.8 FNC 37 WSFL / Word Shift Left
Caution
Note that "n2" words are shifted every time the drive input turns ON from OFF in WSFLP instruction, but that
"n2" words are shifted in each operation cycle in WSFL instruction.
Error
If the transfer source S is equivalent to the shifted device D , an operation error occurs (error code:
K6710).
Program example
1. Shifting devices with digit specification
S D n1 n2
X000
FNC 37 K1X000 K1Y000 K 4 K 2
WSFLP
Specify a same digit for devices with digit specification.
[3]
Y017 Y016 Y015 Y014 Y013 Y012 Y011 Y010 Y007 Y006 Y005 Y004 Y003 Y002 Y001Y000
[1]
[2]
294
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.9 FNC 38 SFWR / Shift Write [FIFO/FILO Control]
11
11.9 FNC 38 SFWR / Shift Write [FIFO/FILO Control]
Shift
Rotation and
FNC30-FNC39
Outline
This instruction writes data for first-in first-out (FIFO) and last-in first-out (LIFO) control.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 38 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
SFWR P 7 steps SFWR Continuous
Operation
SFWRP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S Word device number storing data to be put in first 16-bit binary
Head word device number storing data (The first word device works as the
D
pointer, and data is stored in D +1 and later)
16-bit binary 14
Instruction
Handy
FMC60-FNC69
n Number of store points plus "1"*1 2 n 512 16-bit binary
3. Applicable devices
Oper-
Bit Devices Word Devices Others 15
Special Con- Real Charac-
Device
External FX I/O
FNC70-FNC79
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D
n
3 3 3 3 3 3 3 3 3
3 3
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
295
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.9 FNC 38 SFWR / Shift Write [FIFO/FILO Control]
S
n
Before
execution
D+n ... D+10 D+9 D+8 D+7 D+6 D+5 D+4 D+3 D+2 D+1 D
After Pointer
execution
Executed at the 2nd time
S D +1 D
(K1) (K2)
D+n ... D+10 D+9 D+8 D+7 D+6 D+5 D+4 D+3 S S D
Pointer
1) When X000 turns ON from OFF, the contents of S are stored to D +1. So the contents of
D +1 become equivalent to S .
2) When the contents of S are changed and then the command input is set to ON from OFF again, the
new contents of S are stored to D +2. So the contents of D +2 become equivalent to S .
(When the continuous operation type SFWR instruction is used, the contents are stored in each operation
cycle. Use the pulse operation type SFWRP instruction in programming.)
3) Data are stored from the right end in the same way, and the number of stored data is specified by the
contents of the pointer D .
Related device
For the carry flag use method, refer to Subsection 6.5.2.
Device Name Description
When the contents of the pointer D exceeds "n-1", no operation is executed (so data is
M8022 Carry
not written) and the carry flag M8022 turns ON.
Related instructions
Instruction Description
SFRD (FNC 39) Shift read (for FIFO control)
POP (FNC212) Shift last data read (for FILO control)
Caution
1. In the case of continuous operation type (SFWR) instruction
Note that data are stored (overwritten) in each scan time (operation cycle).
296
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.9 FNC 38 SFWR / Shift Write [FIFO/FILO Control]
11
Program example
Shift
Rotation and
FNC30-FNC39
1. Example of first-in first-out control
For a program example of FILO, refer to Section 27.3.
In the example below, the shift write (SFWR) and shift read (SFRD) instructions are used.
1) Contents of operation 12
- In this circuit example, a product number to be taken out now is output according to "first-in first-out" rule
Data Operation
FNC40-FNC49
while products which were put into a warehouse with their product numbers registered are taken out of
the warehouse.
- The product number is hexadecimal, and up to 4 digits. Up to 99 products can be stored in the
warehouse.
2) Program 13
Processing
High Speed
FNC50-FNC59
Button for request to put a
product into warehouse
X020
FNC 12 The product number is input from X000 to X017, and
K4X000 D256 transferred to D256.
MOVP
Instruction
Handy
FMC60-FNC69
Button for request to take a
product out of warehouse
X021 The product number of a product put into first is output
FNC 39 D257 D357 K100 to D357 in response to the request to put a product out
SFRDP
M8000
of the warehouse.
The product number to be taken out is output to Y000
15
FNC 12 D357 K4Y000
Device
External FX I/O
FNC70-FNC79
MOV to Y017 in a four-digit hexadecimal number.
RUN
monitor
Device
External FX
FNC80-FNC89
X017 to X000 X20 X21 Y017 to Y000
Command Command
17
Transfer 2
Data
FNC100-FNC109
MOV instruction
+1 1
6 D257 5 4 Shift
1 0320 D258 0320 D357 0320 0232
2 0232 D259 0232 0462 18
3 0462 MOV instruction D260 0462 0539
Floating Point
FNC110-FNC139
0
19
Operation 2
Data
FNC140-FNC149
99 0 D355 0 0
100 0 SFWRP instruction D356 0 SFRDP instruction 0
is executed. is executed.
20
Control
Positioning
FNC150-FNC159
297
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.10 FNC 39 SFRD / Shift Read [FIFO Control]
Outline
This instruction reads data for first-in first-out control.
1. Instruction format
FNC 39 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
SFRD P 7 steps SFRD Continuous
Operation
SFRDP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head word device number storing data
S (The first word device works as the pointer, and data is stored in S +1 and 16-bit binary
later.)
D Word device number storing data taken out first 2 n 512 16-bit binary
n Number of store points plus "1"*1 2 n 512 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
n 3 3
298
FX3U/FX3UC Series Programmable Controllers 11 Rotation and Shift Operation FNC 30 to FNC 39
Programming Manual - Basic & Applied Instruction Edition 11.10 FNC 39 SFRD / Shift Read [FIFO Control]
11
Shift
Rotation and
FNC30-FNC39
D
n
Before
execution
S+n ... S+10 S+9 S+8 S+7 S+6 S+5 S+4 S+3 S+2 S+1 S S =n
Pointer
12
Executed at the 1st time
Data Operation
FNC40-FNC49
D S+1 S 1 S
S+n S+n ... S+10 S+9 S+8 S+7 S+6 S+5 S+4 S+3 S+2 S
Processing
High Speed
FNC50-FNC59
D S+2 S 1 S
S+n S+n S+n ... S+10 S+9 S+8 S+7 S+6 S+5 S+4 S+3 S
Instruction
Handy
FMC60-FNC69
1) When the command input turns ON, the contents of S +1 are transferred (read) to D .
2) Accompanied by this transfer, the contents of the pointer S decrease, and the data on the left side
are shifted rightward by 1 word. (When the continuous operation type SFRD instruction is used, the
contents are stored in turn in each operation cycle. Use the pulse operation type SFRDP instruction in
programming.) 15
Device
External FX I/O
FNC70-FNC79
Related device
For the zero flag use method, refer to Subsection 6.5.2.
Device Name Description
Data is always read from S +1. When the contents of the pointer become "0", the
M8020 Zero
zero flag M8020 turns ON.
S
16
Device
External FX
FNC80-FNC89
Related instructions
Instruction Description
SFWR (FNC 38) Shift write (for FIFO/FILO control)
POP (FNC212) Shift last data read (for FILO control) 17
Transfer 2
Data
FNC100-FNC109
Caution
1. Data after reading was executed
The contents of S +n do not change by reading.
18
2. In the case of continuous operation type (SFRD) instruction
Floating Point
FNC110-FNC139
Data is read in turn in each scan time (operation cycle), but the contents of S +n do not change.
3. When pointer S is 0
Data is not processed, and the contents of D do not change.
19
Program example
Operation 2
Data
FNC140-FNC149
Refer to the program example provided for SFWR (FNC 38) instruction.
For the program example, refer to Section 11.9.
20
Control
Positioning
FNC150-FNC159
299
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition
Section
40 ZRST ZRST D1 D2 Zone Reset
12.1
Section
41 DECO DECO S D n Decode
12.2
Section
42 ENCO ENCO S D n Encode
12.3
Section
43 SUM SUM S D Sum of Active Bits
12.4
Section
44 BON BON S D n Check Specified Bit Status
12.5
Section
45 MEAN MEAN S D n Mean
12.6
Section
46 ANS ANS S m D Timed Annunciator Set
12.7
Section
47 ANR ANR Annunciator Reset
12.8
Section
48 SQR SQR S D Square Root
12.9
Section
49 FLT FLT S D Conversion to Floating Point
12.10
300
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.1 FNC 40 ZRST / Zone Reset
11
12.1 FNC 40 ZRST / Zone Reset
Shift
Rotation and
FNC30-FNC39
Outline
This instruction resets devices located in a zone between two specified devices at one time.
Use this instruction for restarting operation from the beginning after pause or after resetting control data.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 40 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
S
D11 Head bit or word device number to be reset at one time SD11 D2
Specify same type of
16-bit binary
14
D2 Last bit or word device number to be reset at one time devices. 16-bit binary
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
S
D11 3 3 3 3 3 3 3 3 3
D2 3 3 3 3 3 3 3 3 3
Device
External FX
FNC80-FNC89
1. 16-bit operation (ZRST and ZRSTP)
Same type of devices from D1 to D21 are reset at one time.
Transfer 2
Data
FNC100-FNC109
Command
input FNC 40 D1 D2 Devices D1 through D2 are reset at one time.
ZRST
Before
execution
D2 D1 +9 D1 +8 D1 +7 D1 +6 D1 +5 D1 +4 D1 +3 D1 +2 D1 +1 D1 18
Floating Point
FNC110-FNC139
Executed
OFF
After
execution 19
OFF OFF OFF OFF OFF OFF OFF OFF OFF OFF OFF
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
301
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.1 FNC 40 ZRST / Zone Reset
Before
D2 D1 +9 D1 +8 D1 +7 D1 +6 D1 +5 D1 +4 D1 +3 D1 +2 D1 +1 D1
execution
Executed
K0
After
execution
K0 K0 K0 K0 K0 K0 K0 K0 K0 K0 K0
Related instructions
1. RST instruction
As an independent reset instruction for devices, RST instruction can be used for bit devices (Y, M and S) and
word devices (T, C, D and R).
X001
RST M0 M0 is reset.
RST D0 D0 is reset.
Cautions
1. Caution on specifying devices
Specify same type of devices in D1 and D21 . The device number of D1 should be smaller than or
equal to the device number of D21 .
If the device number of D1 is larger than the device number of D21 , only one device specified in D1 is
reset.
302
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.1 FNC 40 ZRST / Zone Reset
11
2. When specifying high speed counters (C235 to C255)
Shift
Rotation and
FNC30-FNC39
ZRST instruction is handled as the 16-bit type, but 32-bit counters can be specified in D1 and D21 .
However, it is not possible to specify a 16-bit counter in D1 and specify a 32-bit counter in D21 ; D1
and D21 should be a same type.
Example
12
Data Operation
FNC40-FNC49
Command Command
input FNC 40 input FNC 40
C180 C230 C180 C199
ZRST ZRST
16-bit 32-bit FNC 40
counter counter C200 C230
ZRST
13
Processing
High Speed
FNC50-FNC59
Program example
1. When using devices in the latch area as non-latch type devices
In the program shown below, when the power of the PLC is turned ON or when the PLC mode is changed to
RUN, the specified ranges of bit devices and word devices are reset at one time. 14
Instruction
Handy
FMC60-FNC69
D1 D2
M8002
FNC 40 M500 M599 M500 to M599 are reset at one time.
Initial pulse ZRST
D1 D2
FNC 40 C235 C255
C235 to C255 are reset at one time. 15
ZRST ("0" is written to them, and their contacts are reset.)
Device
External FX I/O
FNC70-FNC79
D1 D2
FNC 40 S500 S599 S500 to S599 are reset at one time.
ZRST
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
303
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.2 FNC 41 DECO / Decode
Outline
This instruction converts numeric data into ON bit.
A bit number which is set to ON by this instruction indicates a numeric value.
1. Instruction format
FNC 41 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
SS1 Data to be decoded or word device number storing data 16-bit binary
D Bit or word device number storing the decoding result 16-bit binary
Number of bits of device storing the decoding result (n = 1 to 8)
n 16-bit binary
(No processing is executed in the case of "n = 0".)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3 3
n 3 3
1
4
2
K8 K7 K6 K5 K4 K3 K2 K1 n
Turns ON when all
bits of S are OFF.
Up to Up to Up to Up to
M255 M127 M63 M31
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 When D is M0
M255 M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
Up to 256 bits (The number of occupied bits varies depending on the specified "n" value.)
304
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.2 FNC 41 DECO / Decode
11
2) When DD1 is a word device (1 n 4)
Shift
Rotation and
FNC30-FNC39
The numeric value (expressed in 2n on the low-order side) of DS1 is decoded to DD1 .
- When all bits of DS1 are "0", b0 of the word device DD1 turns ON.
- In the case of "n 3", all of high-order bits of DD1 become "0" (turn OFF).
12
When it is T,C,D,R,U\G,V,Z,K or H
Data Operation
FNC40-FNC49
Command
input FNC 41 S D n
DECO
(1 n 4)
Ignored 4 bits
When "n" is "4"
13
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
Processing
High Speed
FNC50-FNC59
1 0 1 0 0 0 0 1 0 1 0 0 1 1 1 1 When S is D0
2n
1
4
2
K4 K3 K2 K1 n
Turns ON when all bits
of S are OFF. 14
Instruction
Handy
FMC60-FNC69
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 When D is D2
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
Up to 16 bits
15
Device
External FX I/O
FNC70-FNC79
Caution
While the command input is OFF, the instruction is not executed. The activated decode output is held in
the previous ON/OFF status.
When "n" is "0", the instruction executes no processing. 16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
305
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.2 FNC 41 DECO / Decode
Program example
1. When setting bit devices to ON according to the value of a data register
The value of D0 (whose current value is "14" in this example) is decoded to M0 to M15.
S D n
M8000
FNC 41 D 0 M 0 K 4
DECO
4 bits
Ignored (D0 b0 to b3)
(D0 b4 to b15)
b15 7 6 5 4 3 2 1 b0
0 0 0 0 1 1 1 0 S When the value of b0 to
2n b3 of D0 is "14"
128
64
32
16
8
1
4
2
K8 K7 K6 K5 K4 K3 K2 K1 n = K4
When the value of b0 to b3 of D0 is "14 (= 0 + 2 + 4 + 8)", M14 (which is the 15th from M0) becomes "1"
(turn ON).
When the value of D0 is "0", M0 becomes "1" (turns ON).
When "n" is set to "K4", either one point among M0 to M15 turns ON according to the value of D0 (0 to 15).
By changing "n" from K1 to K8, D0 can correspond to numeric values from 0 to 255.
However, because the device range of DD1 is occupied for decoding accordingly, such device range
should not be used for another control.
2. Turning ON the bit out of word devices according to the contents of bit devices
The value expressed by X000 to X002 is decoded to D0 (X000 and X001 are ON, and X002 is OFF in this
example.).
S D n
M8000
FNC 41 X000 D0 K3 X2 X1 X0
DECO
0 1 1 S
2n
1
4
2
K3 K2 K1 n
Turns ON when all
bits of S are OFF.
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 D =D0
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
When the values expressed by X000 to X002 are "3 (= 1 + 2 + 0)", b3 (which is the 4th from b0) becomes
1 (turns ON).
When all of X000 to X002 are "0" (OFF), b0 becomes "1" (turns ON).
306
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.3 FNC 42 ENCO / Encode
11
12.3 FNC 42 ENCO / Encode
Shift
Rotation and
FNC30-FNC39
Outline
This instruction obtains positions in which bits are ON in data.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 42 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
SS1 Data to be encoded or word device number storing data 16-bit binary
Instruction
Handy
FMC60-FNC69
n 16-bit binary
(When "n" is "0", no processing is executed.)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Unit
Index
Con- Real Charac-
stant Number ter String
Pointer 15
Type
Device
External FX I/O
FNC70-FNC79
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3
n 3 3
16
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (ENCO and ENCOP)
The 2n bit of DS1 is encoded, and the result value is stored to DD1 .
This instruction converts data into binary data according to a bit position in the ON status.
17
1) When DS1 is a bit device (1 n 8)
Transfer 2
Data
FNC100-FNC109
ON bit positions among "2n" bits (1 n 8) from DS1 are encoded to DD1 .
- When "n" is "8", 28 = 256 bits (which is the maximum value) are occupied.
- The encoding result of DD1 is "0" (OFF) from the most significant bit to the low-order bit "n".
When it is Y, M or S 18
Floating Point
FNC110-FNC139
Command
input FNC 42 S D n
ENCO
(1 n 8)
M17 M16 M15 M14 M13 M12 M11 M10 When "n" is 3
19
0 0 0 0 1 0 0 0
Operation 2
Data
FNC140-FNC149
S = M10
7 6 5 4 (3) 2 1 0
b0
All of them are "0".
307
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.3 FNC 42 ENCO / Encode
When it is T, C, D, R, U\G, V or Z
Command
input
FNC 42 S D n
ENCO
(1 n 4)
D0
2n = 8 (When "n" is 3)
b15 b0
0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 0 S
6 5 4 (3) 2 1 0
7
Ignored
D2
Cautions
308
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.4 FNC 43 SUM / Sum of Active Bits
11
12.4 FNC 43 SUM / Sum of Active Bits
Shift
Rotation and
FNC30-FNC39
Outline
This instruction counts the number of "1" (ON) bits in the data of a specified device.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 43 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D SUM P 5 steps SUM Continuous
9 steps DSUM
Continuous
Operation Operation
SUMP Pulse (Single) DSUMP Pulse (Single)
Operation Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
SS1 Word device number storing the source data 16- or 32-bit binary
D Word device number storing the result data 16- or 32-bit binary 14
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 15
SS1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Device
External FX I/O
FNC70-FNC79
SD2 3 3 3 3 3 3 3 3 3 3 3
Device
External FX
FNC80-FNC89
The number of bits in the ON status in DS1 is counted, and stored to DD1 .
When all bits are OFF in DS1 , the zero flag M8020 turns ON.
Command
input FNC 43 Number of bits in the
SUM
S D ON status in S D 17
Transfer 2
Data
FNC100-FNC109
Word data
16-bit data
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
K21847
Before S 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
execution 9 8 7 6 5 4 3 2 1 (Number of "1" (ON))
D
K0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18
Floating Point
FNC110-FNC139
20
Control
Positioning
FNC150-FNC159
309
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.4 FNC 43 SUM / Sum of Active Bits
3. Operation result DD1 according to the DS1 value (in 16-bit operation)
S M8020
Bit device Word device D (zero
flag)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 Decimal Hexadecimal
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000 0 ON
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0001 1 OFF
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0002 1 OFF
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 0003 2 OFF
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 4 0004 1 OFF
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 5 0005 2 OFF
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 6 0006 2 OFF
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 7 0007 3 OFF
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 8 0008 1 OFF
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 9 0009 2 OFF
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 10 000A 2 OFF
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 11 000B 3 OFF
OFF
1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 5 FFFB 15 OFF
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 4 FFFC 14 OFF
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 3 FFFD 15 OFF
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 2 FFFE 15 OFF
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FFFF 16 OFF
310
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.4 FNC 43 SUM / Sum of Active Bits
11
Caution
Shift
Rotation and
FNC30-FNC39
While the command input is OFF, the instruction is not executed.
The output of the number of bits in the ON status is latched in the previous status.
Program example
When X000 is ON, the number of bits in the ON status in D0 is counted, and stored to D2. 12
Data Operation
FNC40-FNC49
S D
X000
FNC 43 D 0 D 2 The number of "1" in D0 is stored to D2.
SUM
D 0 = K0 D 2 = K0 13
Processing
High Speed
FNC50-FNC59
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
M8020=ON Zero flag
D 0 = K21847 D 2 = K9
32 16 8 4 2 1
14
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
Instruction
Handy
FMC60-FNC69
M8020=OFF Zero flag
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
311
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.5 FNC 44 BON / Check Specified Bit Status
Outline
This instruction checks whether a specified bit position in a specified device is ON or OFF.
1. Instruction format
FNC 44 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BON P 7 steps BON Continuous
13 steps DBON
Continuous
Operation Operation
BONP Pulse (Single) DBONP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
SS1 Word device number storing the source data 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 S 3
n 3 3 3 3
312
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.5 FNC 44 BON / Check Specified Bit Status
11
2. 32-bit operation (DBON and DBONP)
Shift
Rotation and
FNC30-FNC39
The status (ON or OFF) of the bit "n" in [ DS1 +1, DS1 ] is output to DD1 .
[When the bit "n" is ON, DD1 is set to ON. When the bit "n" is OFF, DD1 is set to OFF.]
When a constant (K) is specified as the transfer source [ DS1 +1, DS1 ], it is automatically converted into
the binary format. 12
Command
Data Operation
FNC40-FNC49
input FNC 44 S D n [ S +1, S ] D = ON/OFF status of bit "n"
DBON
(n = K0 to K31)
S +1, S
13
Processing
High Speed
FNC50-FNC59
b31 b30 b29 b17 b16 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1 0 1 1 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 1 1
K31 K30 K29 K17 K16 K15 K14 K13 K12 K11 K10 K9 K8 K7 K6 K5 K4 K3 K2 K1 K0 n
D bit device
n = 29
n=5
0 (OFF) 14
1 (ON)
Instruction
Handy
FMC60-FNC69
Program example
When the bit 9 (n = 9) in D10 is "1" (ON), M0 is set to "1" (ON).
X000
S D n 15
FNC 44
Device
External FX I/O
FNC70-FNC79
D 10 M 0 K9
BON
D 10
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 M 0 = ON
b15 b8 b7
n=9
b0 16
Device
External FX
FNC80-FNC89
0 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 M 0 = OFF
b15 b0
n=9
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
313
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.6 FNC 45 MEAN / Mean
Outline
This instruction obtains the mean value of data.
1. Instruction format
FNC 45 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D MEAN P 7 steps MEAN Continuous
13 steps DMEAN
Continuous
Operation Operation
MEANP Pulse (Single) DMEANP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
SS1 Head word device number storing data to be averaged 16- or 32-bit binary
D Word device number storing the mean value result 16- or 32-bit binary
n Number of data to be averaged (1 n 64) 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3 3 3 3
n 3 3 3 3
[ S + 1, S ] + [ S + 3, S + 2] + + [{ S + n 2 1}, { S + n 2 2}]
[ D + 1, D ]
n
314
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.6 FNC 45 MEAN / Mean
11
Caution
Shift
Rotation and
FNC30-FNC39
When a device number is exceeded, "n" is handled as a smaller value in the possible range.
Error
When "n" is any value outside the range from "1" to "64", an operation error (M8067) is caused.
12
Data Operation
FNC40-FNC49
Program example
The data of D0, D1 and D2 are summed, divided by "3", and then stored to D10.
S D n
X000 (D 0) + (D 1) + (D 2)
FNC 45
MEAN
D 0 D 10 K 3
3
(D 10) 13
Processing
High Speed
FNC50-FNC59
14
Instruction
Handy
FMC60-FNC69
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
315
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.7 FNC 46 ANS / Timed Annunciator Set
Outline
This instruction sets a state relay as an annunciator (S900 to S999).
1. Instruction format
FNC 46 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
SS1 Timer number for evaluation time 16-bit binary
m Evaluation time data [m = 1 to 32767 (unit: 100 ms)] 16-bit binary
D Annunciator device to be set 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 S1 3
m 3 3 3 3
2
D S 3
S1 : T0 to T199
S2 : S900 to S999
Related devices
Device Name Description
M8049 Enable annunciator When M8049 is set to ON, M8048 and D8049 are valid.
M8048 Annunciator ON When M8049 is ON and one of the state relays S900 to S999 is ON, M8048 turns ON.
Smallest state relay
D8049 Among S900 to S999, the smallest state relay number in the ON status is stored.
number in ON status
316
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.7 FNC 46 ANS / Timed Annunciator Set
11
Program example
Shift
Rotation and
FNC30-FNC39
1. Displaying a fault number using an annunciator
When the program for external fault diagnosis shown below is created and the content of D8049 (smallest
state relay number in the ON status) is monitored, the smallest state relay number in the ON status from S900
to S999 is displayed.
If two or more faults are present at the same time, the next smallest fault number is displayed after the fault of
12
Data Operation
FNC40-FNC49
the smallest fault number is cleared.
M8000
0 M8049 When M8049 turns ON, monitoring becomes valid.
RUN monitor
Y005 X000 If the forward end detection input X000 does not turn
13
3 FNC 46 T 0 K 10 S900 ON within 1 second after the forward movement output
Processing
High Speed
FNC50-FNC59
Forward Forward
ANS Y005 is driven, S900 turns ON.
movement end
X001 X002 If both the upper limit input X001 and the lower limit
12 FNC 46 T 1 K 20 S901 input X002 are OFF for 2 seconds or more due to a dog
ANS error, S901 turns ON.
Upper Lower
limit limit 14
X003 X004 The switch X004 is set to ON in one operation cycle of
Instruction
Handy
FMC60-FNC69
21 FNC 46 T 2 K100 S902 the machine. If the switch X004 is not set to ON while
ANS the continuous operation mode input X003 is ON in the
Continuous Cycle machine whose tact time is less than 10 seconds, S902
turns ON.
X005
30 Y005
Forward 15
movement
Device
External FX I/O
FNC70-FNC79
M8048
32 When one among S900 to S999 turns ON, M8048 turns
Y006 ON and the fault display output Y006 turns ON.
Annunciator ON Fault display
X007
34 FNC 47
ANRP
A state relay which was set to ON by the external fault
diagnosis program is set to OFF by the reset button 16
Reset X007. Every time X007 is set to ON, an operation state
Device
External FX
FNC80-FNC89
relay in the ON status with the smallest device number
36 END is reset (set to OFF) in turn.
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
317
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.8 FNC 47 ANR / Annunciator Reset
Outline
This instruction resets an annuciator (S900 to S999) in the ON status with the smallest number.
1. Instruction format
FNC 47 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
ANR P Continuous
1 step ANR Operation
ANRP Pulse (Single)
Operation
2. Set data
Operand type Description Data type
There is no set data.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
There are no applicable devices.
Related devices
Device Name Description
M8049 Enable annunciator When M8049 is set to ON, M8048 and D8049 are valid.
When M8049 is ON and either one among the state relays S900 to S999 is ON, M8048
M8048 Annunciator ON
turns ON.
Minimum state relay
D8049 Among S900 to S999, the minimum number in the ON status is stored.
number in ON status
Caution
1. Execution in each operation cycle
When ANR instruction is used, annunciators in the ON status are reset in turn in each operation cycle.
When ANRP instruction is used, an annunciator in the ON status is reset only in one operation cycle (only
once).
Program example
Refer to ANS (FNC 46) instruction.
For a program example, refer to Section 12.7.
318
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.9 FNC 48 SQR / Square Root
11
12.9 FNC 48 SQR / Square Root
Shift
Rotation and
FNC30-FNC39
Outline
This instruction obtains the square root.
The ESQR (FNC127) instruction obtains the square root in floating point operation.
12
For ESQR (FNC127) instruction, refer to Section 18.15.
Data Operation
FNC40-FNC49
1. Instruction format
FNC 48 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D SQR P 5 steps SQR Continuous
Operation 9 steps DSQR
Continuous
Operation 13
SQRP Pulse (Single) DSQRP Pulse (Single)
Processing
High Speed
FNC50-FNC59
Operation Operation
2. Set data
Operand type Description Data type
SS1 Word device number storing data whose square root is obtained 16- or 32-bit binary 14
Instruction
Handy
FMC60-FNC69
D Data register number storing the square root operation result 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others 15
Oper-
Device
External FX I/O
FNC70-FNC79
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3
D 3 3 3 3
16
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (SQR and SQRP)
The square root of the data stored in DS1 is calculated, and stored to DD1 .
Command
input
17
FNC 48 S D D
Transfer 2
Data
FNC100-FNC109
SQR S
DSQR S + 1, S D + 1, D
Caution
1. Operation result 19
Operation 2
Data
FNC140-FNC149
1) The obtained square root is an integer because the decimal point is ignored.
When the calculated value is ignored, M8021 (borrow flag) turns ON.
2) When the calculated value is true "0", M8020 (zero flag) turns ON.
20
Control
Positioning
FNC150-FNC159
319
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.9 FNC 48 SQR / Square Root
Program example
The square root of D10 is stored to D12.
The value of D10 is "100".
S D
X000
FNC 48 D 10 D 12 D 10 D 12
SQR
= 100 10
320
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.10 FNC 49 FLT / Conversion to Floating Point
11
12.10 FNC 49 FLT / Conversion to Floating Point
Shift
Rotation and
FNC30-FNC39
Outline
This instruction converts a binary integer into a binary floating point (real number).
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 49 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D FLT P 5 steps FLT Continuous
9 steps DFLT
Continuous
Operation Operation
FLTP Pulse (Single) DFLTP Pulse (Single)
Operation Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
SS1 Data register number storing binary integer 16- or 32-bit binary
D Data register number storing binary floating point (real number) 16- or 32-bit binary 14
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 15
SS1 3 3 3 3
Device
External FX I/O
FNC70-FNC79
D 3 3 3 3
Device
External FX
FNC80-FNC89
The binary integer data of DS1 is converted into binary floating point (real number), and stored to [ DD1 +1,
DD1 ].
Command
input FNC 49 S ( D + 1, D )
S D
FLT Binary
integer
Binary floating point
(real number)
17
Transfer 2
Data
FNC100-FNC109
2. 32-bit operation (DFLT and DFLTP)
The binary integer data of [ DS1 +1, DS1 ] is converted into binary floating point (real number), and stored to
[ DD1 +1, DD1 ].
Command
input ( S + 1, S ) ( D +1, D )
18
FNC 49 S D
Floating Point
FNC110-FNC139
Related instruction
Instruction Description 19
INT(FNC129) It is inverse of FLT instruction, and converts binary floating point into binary integer.
Operation 2
Data
FNC140-FNC149
Caution
1. It is not necessary to convert a constant (K or H) into floating point value.
The value of a K or H specified in each instruction for binary floating point (real number) operation is 20
automatically converted into binary floating point (real number). It is not necessary to convert such a constant
Control
Positioning
FNC150-FNC159
321
FX3U/FX3UC Series Programmable Controllers 12 Data Operation FNC 40 to FNC 49
Programming Manual - Basic & Applied Instruction Edition 12.10 FNC 49 FLT / Conversion to Floating Point
Related devices
For the method of the zero and borrow flags, refer to Subsection 6.5.2.
Device Name Description
M8020 Zero flag Turns ON when the value is true "0".
M8021 Borrow flag Turns ON when the floating point is rounded down.
Program example
1. Arithmetic operations by binary floating point operations
The sequence program shown below is constructed as follows:
1) Calculation example
(D 25, D 24)
Binary floating
point operation
(D 29, D 28)
Binary floating
point operation
2) Sequence program
M8000 (1)
FNC 49 (D 0) (D21, D20)
D 0 D 20 BIN Binary floating point operation
FLT
322
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition
11
Shift
Rotation and
FNC30-FNC39
13. High Speed Processing FNC 50 to FNC 59
FNC 50 to FNC 59 provide interrupt processing type high speed instructions that execute sequence control 12
using the latest I/O information and utilize the high speed processing performance of the PLC.
Data Operation
FNC40-FNC49
FNC No. Mnemonic Symbol Function Reference
Section
50 REF REF D n Refresh
13.1
Section
13
51 REFF REFF n Refresh and filter adjust
Processing
High Speed
FNC50-FNC59
13.2
Section
52 MTR MTR S D1 D2 n Input Matrix
13.3
Instruction
Handy
FMC60-FNC69
Section
54 HSCR HSCR S1 S2 D High speed counter reset
13.5
Section
55 HSZ HSZ S1 S2 S D High speed counter zone compare
13.6
15
Section
Device
External FX I/O
FNC70-FNC79
56 SPD SPD S1 S2 D Speed Detection
13.7
Section
57 PLSY PLSY S1 S2 D Pulse Y Output
13.8
Device
External FX
FNC80-FNC89
Section
59 PLSR PLSR S1 S2 S3 D Acceleration/deceleration setup
13.10
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
323
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.1 FNC 50 REF / Refresh
Outline
This instruction immediately outputs the latest input (X) information or the current output (Y) operation result
in the middle of a sequence program.
1. Instruction format
FNC 50 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand Type Description Data Type
D Head bit device (X or Y) number to be refreshed Bit
n Number of bit devices to be refreshed (multiple of 8 in the range from 8 to 256) 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
System Special Real Charac-
and System User Digit Specification Index Constant Pointer
User Unit Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
D S 1 S2
n S 3 S3
S1: X000, X010 or X020: Up to the final input number (whose least significant digit number is "0")
S2: Y000, Y010 or Y020: Up to the final output number (whose least significant digit number is "0")
S3: K8 (H8) or K16 (H10): Up to K256 (H100) (which is a multiple of 8)
324
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.1 FNC 50 REF / Refresh
11
Explanation of function and operation
Shift
Rotation and
FNC30-FNC39
1. 16-bit operation (REF and REFP)
1) When refreshing outputs (Y)
"n" points are refreshed from the specified output device D . ("n" must be a multiple of 8.)
Command
12
input
Data Operation
FNC40-FNC49
FNC 50 D n
REF
Head Number
device of points
number
K8 (H8) or K16 (H10): Up to K256 (H100) (which is a multiple of 8)
Y000, Y010 or Y020: Up to the final output number
13
Processing
High Speed
FNC50-FNC59
(whose least significant digit number is "0")
- When this instruction is executed, the output latch memory is refreshed to the output status in the
specified range.
Instruction
Handy
FMC60-FNC69
REF instruction (executed)
END instruction
processing (output)
Output refresh
REF instruction + END processing
ON 15
Device
External FX I/O
FNC70-FNC79
Only END processing ON ON
Device
External FX
FNC80-FNC89
"n" points are refreshed from the specified input device D . ("n" must be a multiple of 8.)
Command
input
FNC 50 D n
REF
Head Number
device of points
17
number
Transfer 2
Data
FNC100-FNC109
K8 (H8) or K16 (H10): Up to K256 (H100) (which is a multiple of 8)
X000, X010 or X020: Up to the final input number
(whose least significant digit number is "0")
- If the input information is turned ON approximately 10 ms (response delay time of the input filter) before
the instruction is executed, the input image memory turns ON when the instruction is executed. 18
Floating Point
FNC110-FNC139
- In X000 to X017*1, the response delay time of the input filter can be changed.
*1 X000 to X007 in the FX3U-16M, FX3UC-16M.
For details, refer to "13.1.1 What should be understood before using the REF instruction".
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
325
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.1 FNC 50 REF / Refresh
Input refresh ON
REF instruction + END processing
Improved response
delay time
Cautions
1. Setting the number of refreshed points "n"
Set a multiple of 8 such as "K8 (H8), K16 (H10) K256 (H100)". Any other numeric value causes an error.
Program examples
1. When refreshing inputs
Only X010 to X017 (8 points in total) are refreshed.
D n
X000
FNC 50 X010 K 8
REF
326
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.1 FNC 50 REF / Refresh
11
13.1.1 What should be understood before using the REF instruction
Shift
Rotation and
FNC30-FNC39
1. Changing the input filter
The input filter value is determined by the contents of D8020 (initial value: 10 ms).
Use the MOV instruction, etc. to adjust the value in D8020, which represents the input filter value.
12
Target range: X000 to X017 (In inputs X020 and later, the input filter value is fixed at 10 ms and cannot
Data Operation
FNC40-FNC49
be changed.)
(The target range is X000 to X007 in the FX3U-16M, FX3UC-16M.)
Processing
High Speed
FNC50-FNC59
For details, refer to the respective PLC Hardware Edition manual.
Instruction
Handy
FMC60-FNC69
2) Transistor output type
- Y000, Y001, Y002 and Y003: 5 s or less (load current = 10 mA or more, 5 to 24V DC)
- Y004 and higher: 0.2 ms or less (load current = 100 mA, 24V DC)
3. When using the REF instruction between FOR and NEXT instructions or between a pointer
(with a lower step number) and CJ instruction (with a higher step number) 15
Inputs and outputs can be refreshed even when the input information or immediate output is required in the
Device
External FX I/O
FNC70-FNC79
middle of a routine program during control.
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
327
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.2 FNC 51 REFF / Refresh and Filter Adjust
Outline
The digital input filter time of the inputs X000 to X017*1 can be changed using this instruction or D8020.
Using this instruction, the status of inputs X000 to X017*1 can be refreshed at an arbitrary step in the program
for the specified input filter time, and then transferred to the image memory.
1. Instruction format
FNC 51 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand Type Description Data Type
n Digital input filter time [K0 to K60 (H0 to H3C) 1 ms] 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
n 3 3 S S
When the input turns ON "n 1 ms" before the instruction is executed, the image memory is set to ON.
When the input turns OFF "n 1 ms" before the instruction is executed, the image memory is set to OFF.
When the command input is ON, the REFF instruction is executed in each operation cycle.
When the command input is OFF, the REFF instruction is not executed, and the input filter of X000 to
X017*1 uses the set value of D8020 (which is the value used during input processing).
*1. X000 to X007 in the FX3U-16M, FX3UC-16M.
328
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.2 FNC 51 REFF / Refresh and Filter Adjust
11
Cautions
Shift
Rotation and
FNC30-FNC39
1. Setting the filter time "n"
Set "n" within the range from K0 (H0) to K60 (H3C) [0 to 60 ms].
Data Operation
FNC40-FNC49
range from 0 to 60 ms using applied instructions. When the filter time is set to "0", the input filter value is as
follows.
Input number Input filter value when set to "0"
X000 to X005 5 s*2
X006, X007 50 s 13
*3 *3
200 s
Processing
High Speed
FNC50-FNC59
X010 to X017
Instruction
Handy
FMC60-FNC69
including the input current of the main unit.
*3. The filter time is fixed to 10 ms in X010 to X017 when the FX3U-16M, FX3UC-16M is used.
Program example
15
1. Relationship between the program and the filter time
Device
External FX I/O
FNC70-FNC79
n When X010 is ON
X010
FNC 51 The image memory of X000 to Input
K 1 processing
REFF X017*4 is refreshed with an input
filter of 1 ms. Set value of D8020
X000
Sequence (Initial value: 10 ms) 16
program
Device
External FX
FNC80-FNC89
X001 REFF instruction
1 ms
M8000 *4
FNC 51 The image memory of X000 to X017 is REFF instruction
K 20
refreshed with an input filter of 20 ms.
X000
REFF
20ms
17
Transfer 2
Data
FNC100-FNC109
END
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
329
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.2 FNC 51 REFF / Refresh and Filter Adjust
REFF D8020
instruction
When the When the END
command is ON instruction is
executed
Input terminal *2
X000 to X017 Digital filter
Initial value: 10 ms
Input image
Input terminal memory
X020 and C-R filter
later Fixed to 10 ms
330
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.3 FNC 52 MTR / Input Matrix
11
13.3 FNC 52 MTR / Input Matrix
Shift
Rotation and
FNC30-FNC39
Outline
This instruction reads matrix input as 8-point input "n"-point output (transistor) in the time division method.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 52 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
MTR Continuous
9 steps MTR Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
Input device (X) number of matrix signal input
S X000, X010, X020 final input device number Bit
(Only "0" is allowed in the least significant digit of device numbers.) 14
Head device (Y) number of matrix signal output
Instruction
Handy
FMC60-FNC69
D1 Y000, Y010, Y020 final output device number Bit
(Only "0" is allowed in the least significant digit of device numbers.)
Head bit device (Y, M or S) number of ON output destination
Y000, Y010, Y020 final Y number, M000, M010, M020 final M number or
D2 Bit
S000, S010, S020 final S number
(Only "0" is allowed in the least significant digit of device numbers.)
15
Device
External FX I/O
FNC70-FNC79
n Number of columns in matrix input (K2 to K8 or H2 to H8) 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification
System
User
Special
Unit
Index Constant
Real Charac-
Number ter String
Pointer 16
Type
Device
External FX
FNC80-FNC89
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3
D1 3
3 3 3
D2
n 3 3
17
Transfer 2
Data
FNC100-FNC109
Explanation of function and operation
1. 16-bit operation (MTR)
An input signal of 8 points "n" columns is controlled in the time division method using 8 inputs S and "n" 18
transistor outputs D1 . Each column is read in turn, and then output to D2 .
Floating Point
FNC110-FNC139
ON Number
Command Input Output output of
input number number destination columns
(normally ON)
FNC 52 S D1 D2 n
MTR
19
Operation 2
Data
FNC140-FNC149
For each output, the I/O processing is executed immediately in turn in interrupt at every 20 ms under
consideration of the input filter response delay of 10 ms.
20
Control
Positioning
FNC150-FNC159
331
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.3 FNC 52 MTR / Input Matrix
The figure below shows an example of the FX3U series main unit (sink input/sink output). For the wiring, refer
to the following manual of the used PLC.
FX3U Hardware Edition
Diode Command
D2 +10
D2 +11
D2 +12
D2 +13
D2 +14
D2 +15
D2 +16
D2 +17
0.1A(50V) contact
2nd
column 1st column input is received.
D2 +1
D1 [1] [3] [5]
D2 +2
D2 +3
D2 +4
D2 +5
D2 +6
D2 +7
1st 2nd column input is received.
D2
column
D1 +1 [2] [4] [6]
20ms
24V 0V S/S S S +1 S +2 S +3 S +4 S +5 S +6 S +7 M8029 (execution
Input (X) [sink] complete)
PLC Output (Y) [sink]
COM D1 D1 +1 D1 +2 D1 +3 D1 +4 D1 +5 D1 +6 D1 +7
"n" points
are
occupied.
Related device
Device Name Description
M8029 Instruction execution complete Turns ON after the first cycle operation.
Cautions
1. Number of occupied devices
1) Eight input points are occupied from the input device number specified in S .
2) "n" output points are occupied from the output device number specified in D1 .
When specifying the output in D2 , make sure that "n" output numbers specified in D1 does not
overlap the output specified in D2 .
2. Wiring
One diode of 0.1 A/50 V is required for each switch.
3. Output format
Use the transistor output format.
332
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.3 FNC 52 MTR / Input Matrix
11
Program example
Shift
Rotation and
FNC30-FNC39
n=Three outputs (Y020, Y021 and Y022) are set to ON in turn repeatedly.
Every time an output is set to ON, eight inputs in the 1st, 2nd and 3rd columns are received in turn repeatedly,
and stored to M30 to M37, M40 to M47 and M50 to M57 respectively.
In this program example, the FX3U series main unit (sink input/sink output) is used. For the wiring, refer to the
following manual of the used PLC. 12
FX3U Hardware Edition
Data Operation
FNC40-FNC49
S D1 D2 n
M0
FNC 52 X020 Y020 M 30 K 3
MTR
Input Output ON Number
number number output of
destination columns
13
Processing
High Speed
FNC50-FNC59
Diode M0
M 50
M 51
M 52
M 53
M 54
M 55
M 56
M 57
0.1A(50V)
1st column input is received.
3rd
column
Y020 [1] [4]
X021 X022 X023 X024 X025 X026 X027
2nd column input is received. 14
Diode
Instruction
Handy
FMC60-FNC69
0.1A(50V)
M 40
M 41
M 42
M 43
M 44
M 45
M 46
M 47
X021 X022 X023 X024 X025 X026 X027 Y022 [3] [6]
Diode
0.1A(50V)
20ms 15
M 30
M 31
M 32
M 33
M 34
M 35
M 36
M 37
M8029 (execution
Device
External FX I/O
FNC70-FNC79
1st complete)
column
Device
External FX
FNC80-FNC89
COM
Y020Y021Y022Y023Y024Y025Y026Y027
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
333
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.3 FNC 52 MTR / Input Matrix
1. Command input
1) Setting the command input to normally ON
For the MTR instruction, set the command input to normally ON.
M{{
(normally ON)
FNC 52 X020 Y040 M 0 K 8
MTR
The figure below shows an example of the FX3U Series main unit (sink input/sink output).
Matrix
circuit
Refer to the
24V S/S 0V X000 X001 X002 X003 X004 X005 X006 X007 previous page.
FX3U-64MT-ES
Transistor output
COM5 Y020 Y021 Y022 Y023 Y024 Y025 Y026 Y027
3.3k/0.5W
Pull-up resistor
334
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.4 FNC 53 HSCS / High Speed Counter Set
11
13.4 FNC 53 HSCS / High Speed Counter Set
Shift
Rotation and
FNC30-FNC39
Outline
This instruction compares a value counted by a high speed counter with a specified value, and immediately
sets an external output (Y) if the two values are equivalent each other.
12
For the counter interrupt using HSCS instruction, refer to Section 35.6.
Data Operation
FNC40-FNC49
1. Instruction format
FNC 53 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D HSCS
13 steps DHSCS
Continuous
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
Data to be compared with the current data value of a high-speed counter or word
32-bit binary
14
S1
device number.
Instruction
Handy
FMC60-FNC69
S2 Device number of a high speed counter [C235 to C255] 32-bit binary
Bit device number to be set to ON when the compared two values are equivalent
D Bit
to each other
3. Applicable devices 15
Device
External FX I/O
FNC70-FNC79
Bit Devices Word Devices Others
Oper-
System Special Real Charac-
and System User Digit Specification Index Constant Pointer
User Unit Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3
16
S2 3 3
Device
External FX
FNC80-FNC89
D 3 3 3 S1 3 S2
Transfer 2
Data
FNC100-FNC109
Explanation of function and operation
1. 32-bit operation (DHSCS)
When the current value of a high speed counter (C235 to C255) specified in S2 becomes the comparison
value [ S1 +1, S1 ] (for example, when the current value changes from "199" to "200" or from "201" to 18
"200" if the comparison value is K200), the bit device D is set to ON without regard to the operation cycle.
Floating Point
FNC110-FNC139
This instruction is executed after the counting processing in the high speed counter.
Command
input
S2 K2,147,483,647
Comparison Comparison Output
value source destination
Set to ON.
19
FNC 53
Operation 2
Data
FNC140-FNC149
S1 S2 D S1 = S2 D
DHSCS
20
Control
Positioning
FNC150-FNC159
335
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.4 FNC 53 HSCS / High Speed Counter Set
Operation
When the current value of the high speed counter C255 changes from "99" to "100" or from "101" to "100",
Y010 is set to ON (output refresh).
M8000
C255 K2,147,483,647
RUN monitor Comparison Comparison Output
value source destination
Set to ON.
FNC 53 K100 C255 Y010 K100 = C255 Y010
DHSCS
Related instructions
The following instructions can be combined with high speed counters:
Instruction FNC No. Instruction name
DHSCS FNC 53 High speed counter set
DHSCR FNC 54 High speed counter reset
DHSZ FNC 55 High speed counter zone compare
DHCMOV FNC189 High speed counter move
DHSCT FNC280 High speed counter compare with data table
Cautions
1. Selection of the count comparison method
When the DHSCS instruction is used with a hardware counter (C235, C236, C237, C238, C239, C240, C244
(OP), C245 (OP), C246, C248 (OP), C251, C253), the hardware counter is automatically switched to a
software counter, and the maximum frequency and total frequency are affected.
Refer to the counting operation described below, and select according to the contents of control whether to
use HSCS instruction or general-purpose comparison instruction.
1) Case to select DHSCS instruction
- When the output should be given when the counting result becomes equivalent to the comparison value
without regard to the scan time of the PLC
2) Cases to select a general-purpose comparison instruction
- When the required frequency is beyond the counting performance of the software counters
- When counting is regarded as important, but the effect of the scan time can be ignored in operations
according to the counting result
- When the number of an instruction is more than 32
M8000
FNC189
DHCMOV C251 D100 K0
FNC229
LDD<= K100 D100 SET Y010
FNC 50
REF Y010 K8
4. Priority order in operation among HSCS (FNC 53), HSCR (FNC 54), and HSZ (FNC 55)
instructions for a same high speed counter
For details, refer to "6. Priority order in operations among HSCS (FNC 53), HSCR (FNC 54), and HSZ
(FNC 55) instructions for the same high speed counter" in Subsection 13.4.1.
336
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.4 FNC 53 HSCS / High Speed Counter Set
11
5. Reset operation by an external terminal
Shift
Rotation and
FNC30-FNC39
For details, refer to "5. Reset operation by an external terminal" in Subsection 13.4.1.
6. For other cautions on using HSCS instruction, refer to the description later.
For details, refer to the next page.
12
Program example
Data Operation
FNC40-FNC49
With regard to the current value of a counter, different outputs (Y) are arbitrary set to ON by two values.
Set the maximum counting value of
M8000 high speed counter.
C255 K2,147,483,647
RUN monitor S1 S2 D 13
FNC 53 C255 = K100 Y010 = ON
Processing
High Speed
FNC50-FNC59
K100 C255 Y010
DHSCS
S1 S2 D
FNC 53 K150 C255 Y011 C255 = K150 Y011 = ON
DHSCS
Comparison Comparison Output
14
value source destination
Instruction
Handy
FMC60-FNC69
151
150
149
101
C255
99
100
15
0
Device
External FX I/O
FNC70-FNC79
Y010
Y011
16
13.4.1 Common cautions on using instructions for high speed counter
Device
External FX
FNC80-FNC89
DHSCS (FNC 53), DHSCR (FNC 54), DHSZ (FNC 55) and DHSCT (FNC280) instructions are provided for
high speed counters.
This section explains common cautions for these instructions.
Transfer 2
Data
FNC100-FNC109
general instructions. However, the number of simultaneously driven instructions is limited. The DHSCT
instruction can be used only once in any program.
Instruction Limitation in number of instructions driven at same time
DHSCS
DHSCR 32 instructions including DHSCT instruction
18
Floating Point
FNC110-FNC139
DHSZ*1
DHSCT*1 Only 1 (This instruction can be used only once.)
*1. When DHSZ or DHSCT instruction is used, the maximum response frequency of every software
counter and the total frequency are limited.
19
2. Response frequency of high speed counters
Operation 2
Data
FNC140-FNC149
When DHSZ or DHSCT instruction is used, the maximum response frequency of every software counter and
the total frequency are limited.
For the maximum response frequency of each software counter and the total frequency,
refer to Subsection 4.7.10.
20
Control
Positioning
FNC150-FNC159
337
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.4 FNC 53 HSCS / High Speed Counter Set
When C255 reaches K100, the output Y000 is driven by interrupt. Y010 is driven when END processing
is executed.
If interrupt drive is required, use an output number in the range from Y001 to Y007 whose high-order two
digits are equivalent.
*1. M8025 is cleared when the PLC mode is changed from RUN to STOP.
2) Operation
When the external reset input X001 turns ON while the current value of C241 is "100", for example, the
current value of C241 is reset to "0". And Y000 is reset at this time even if a counting input is not given.
338
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.4 FNC 53 HSCS / High Speed Counter Set
11
6. Priority order in operations among HSCS (FNC 53), HSCR (FNC 54), and HSZ (FNC 55)
Shift
Rotation and
FNC30-FNC39
instructions for the same high speed counter
When the same comparison value is used for the same high speed counter in HSCS (FNC 53), HSCR (FNC
54), and HSZ (FNC 55) instructions, high speed counter reset (self-reset) by HSCR (FNC 54) instruction is
executed with the highest priority (as shown in the table below).
In this case, the comparison results do not change in HSCS, HSCR, and HSZ instructions whose comparison 12
value is programmed to be the same as the comparison value for self-reset by HSCR (FNC 54) instruction.
Data Operation
FNC40-FNC49
To change the comparison results, set the comparison value to "K0".
M8000 Processing sequence
C235 K10000 Program
sequence FX3U/ FX2N/ FX1N/FX1S/
FX3UC FX2NC FX1NC
FNC 53
K500 C235 Y000 (1) DHSCS (1)
DHSCR (6)
DHSCS (1) DHSCS (1)
13
DHSCS (self-reset)
Processing
High Speed
FNC50-FNC59
DHSCS (2) DHSZ (4) DHSCS (2) DHSCS (2)
FNC 53
K500 C235 Y001 (2) DHSCR (3) DHSCS (1) DHSCR (3) DHSCR (3)
DHSCS
DHSZ (4) DHSCS (2) DHSZ (4) DHSZ (4)
FNC 54
DHSCR
K500 C235 Y002 (3)
DHSCR (5)
DHSCR (6)
DHSCR (3) DHSCR (5) DHSCR (5)
DHSCR (6) DHSCR (6)
14
DHSCR (5)
Instruction
Handy
FMC60-FNC69
(self-reset) (self-reset) (self-reset)
M8000
FNC 55
K250 K500 C235 Y003 (4)
DHSZ
FNC 11
DZCPP
K250 K500 C235 Y003
15
Device
External FX I/O
FNC70-FNC79
M8000
FNC 54
K500 C235 Y006 (5)
DHSCR
FNC 54
K500 C235 C235 (6)
DHSCR
Self-reset program
16
Device
External FX
FNC80-FNC89
Operation of FX3U/FX3UC PLC Operation of FX2N/FX2NC/FX1N/FX1NC/FX1S PLC
[reference]
Present value
500 Present value
17
500
Transfer 2
Data
FNC100-FNC109
250
250
0
0
Y000 to Y002 and Y006 do not change.*1
Y003 ON ON
Y000,Y001 ON 18
Y004 OFF
Floating Point
FNC110-FNC139
339
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.5 FNC 54 HSCR / High Speed Counter Reset
Outline
This instruction compares the value counted by a high speed counter with a specified value at each count,
and immediately resets an external output (Y) when both values become equivalent to each other.
1. Instruction format
FNC 54 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D HSCR Continuous
13 steps DHSCR Operation
2. Set data
Operand Type Description Data Type
Data to be compared with the current value of a high speed counter or word
S1 32-bit binary
device number storing the data to be compared
S2 Device number of a high speed counter [C235 to C255] 32-bit binary
Bit device number to be reset (set to OFF) when both values become equivalent
D Bit
each other.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
System Special Real Charac-
and System User Digit Specification Index Constant Pointer
User Unit Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3
D 3 3 3 S1 S2 3
340
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.5 FNC 54 HSCR / High Speed Counter Reset
11
Operation
Shift
Rotation and
FNC30-FNC39
When the present value of the high speed counter C255 changes (counts) from "99" to "100" or from "101" to
"100", Y010 is reset (output refresh).
M8000 K2,147,483,647
C255
RUN
monitor
Comparison Comparison
value source
Output
destination
Reset.
12
Data Operation
FNC40-FNC49
FNC 54 K100 C255 Y010 K100 = C255 Y010
DHSCR
Related instructions
The following instructions can be combined with high speed counters: 13
Instruction FNC No. Instruction name
Processing
High Speed
FNC50-FNC59
DHSCS FNC 53 High speed counter set
DHSCR FNC 54 High speed counter reset
DHSZ FNC 55 High speed counter zone compare
DHCMOV
DHSCT
FNC189
FNC280
High speed counter move
High speed counter compare with data table
14
Instruction
Handy
FMC60-FNC69
Cautions
1. Selection of the count comparison method
When the DHSCR instruction is used with a hardware counter (C235, C236, C237, C238, C239, C240, C244
(OP), C245 (OP), C246, C248 (OP), C251, C253), the hardware counter is automatically switched to a
15
Device
External FX I/O
FNC70-FNC79
software counter, and the maximum frequency and total frequency are affected.
Refer to the counting operation described below, and select according to the contents of control whether to
use HSCR instruction or general-purpose comparison instruction.
1) Case to select DHSCR instruction
- When the output should be given when the counting result becomes equivalent to the comparison value
regardless of the scan time of the PLC
16
Device
External FX
FNC80-FNC89
2) Cases to select a general-purpose comparison instruction
- When the required frequency is beyond the counting performance of software counters
- When counting is important, but the effect of the scan time can be ignored in operations depending on
the counting result
- When the number in an instruction is more than 32 bits 17
Transfer 2
Data
FNC100-FNC109
M8000
FNC189
DHCMOV C251 D100 K0
FNC229
LDD<= K10000 D100 RST Y010
M8000
18
FNC 50
Floating Point
FNC110-FNC139
REF Y010 K8
341
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.5 FNC 54 HSCR / High Speed Counter Reset
Program example
1. Example of self-reset circuit
When the current value of C255 becomes "400", C255 is immediately reset. Its current value becomes "0",
and the output contact is set to OFF.
Output contact
of C255
342
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
11
13.6 FNC 55 HSZ / High Speed Counter Zone Compare
Shift
Rotation and
FNC30-FNC39
Outline
This instruction compares the current value of a high speed counter with two values (one zone), and outputs
the comparison result to three bit devices (refresh).
12
For the table high speed comparison mode, refer to Subsection 13.6.2.
Data Operation
FNC40-FNC49
For the frequency control mode, refer to Subsection 13.6.3.
1. Instruction format
FNC 55 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
13
D HSZ Continuous
17 steps DHSZ
Processing
High Speed
FNC50-FNC59
Operation
2. Set data
Operand Type Description
Data to be compared with the current value of a high speed counter or word
Data Type
14
S1 32-bit binary
Instruction
Handy
FMC60-FNC69
device number storing data to be compared (comparison value 1)
Data to be compared with the current value of a high speed counter or word
S2 32-bit binary
device number storing data to be compared (comparison value 2)
S Device number of a high speed counter [C235 to C255] 32-bit binary
D
Head bit device number to which the comparison result is output based on upper
and lower comparison values
Bit 15
Device
External FX I/O
FNC70-FNC79
3. Applicable devices
Bit Devices Word Devices Others
Oper-
System Special Real Charac-
and System User Digit Specification Index Constant Pointer
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify
User Unit
K H
Number ter String
E "" P
16
Device
External FX
FNC80-FNC89
S1 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3
S 3 3
D 3 3 3 S 3 17
Transfer 2
Data
FNC100-FNC109
S: "D.b" cannot be indexed with index registers (V and Z).
comparison points (comparison value 1 and comparison value 2). Based on the comparison result, "smaller
than the lower comparison value", "inside the comparison zone" or "larger than the upper comparison value",
one among D , D +1 and D +2 is set to ON regardless of the operation cycle.
In this instruction, the comparison processing is executed after the count processing in the high speed
counter.
19
Command
Operation 2
Data
FNC140-FNC149
input
K2,147,483,647
S
Comparison Comparison Comparison Output
value 1 value 2 source destination
Set to ON.
FNC 55 S1 > S D
S1 S2 S D
DHSZ
S1 S S2 D +1 20
Control
Positioning
FNC150-FNC159
S > S2 D +2
343
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
Comparison points
Make sure that the comparison value 1 and the comparison value 2 have the following relationship:
[ S1 +1, S1 ] [ S2 +1, S2 ]
Comparison point Contents (32 bits)
Comparison value 1 S1 +1, S1
Comparison value 2 S2 +1, S2
Operation
When the current value of the high speed counter C251 changes (counts) as shown below, the comparison
result is output to one of the outputs Y000, Y001 or Y002.
M8000 K2,147,483,647
C251
RUN monitor Comparison Comparison Comparison Output
value 1 value 2 source destination
ON
FNC 55 K1000 K2000 C251 Y000 K1000 > C251 Y000
DHSZ
K1000 C251 K2000 Y001
C251 > K2000 Y002
Related instructions
The following instructions can be combined with high speed counters:
Instruction FNC No. Instruction name
DHSCS FNC 53 High speed counter set
DHSCR FNC 54 High speed counter reset
DHSZ FNC 55 High speed counter zone compare
DHCMOV FNC189 High speed counter move
DHSCT FNC280 High speed counter compare with data table
Cautions
1. Selection of the count comparison method
When the DHSZ instruction is used with a hardware counter (C235, C236, C237, C238, C239, C240, C244
(OP), C245 (OP), C246, C248 (OP), C251, C253), the hardware counter is automatically switched to a
software counter, and the maximum frequency and total frequency are affected.
Refer to the counting operation described below, and select according to the contents of control whether to
use DHSZ instruction or general-purpose comparison instruction.
1) Case to select DHSZ instruction
- When the output should be given when the counting result becomes equivalent to the comparison value
regardless of the scan time of the PLC
344
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
11
2) Cases to select a general-purpose comparison instruction
Shift
Rotation and
FNC30-FNC39
- When the required frequency is beyond the counting performance of software counters
- When counting is important, but the effect of the scan time can be ignored in operations depending on
the counting result
- When the number in an instruction is more than 32 bits
M8000
12
Data Operation
FNC40-FNC49
DHCMOV C251 D100 K0
FNC225
LDD > K10000 D100 Y010
FNC229
LDD <= K10000 D100
FNC238
ANDD >= K20000 D100 Y011 13
Processing
High Speed
FNC50-FNC59
FNC226
LDD < K20000 D100 Y012
M8000
FNC 50
Y010 K8
REF
14
Instruction
Handy
FMC60-FNC69
2. Device specification range
Only high speed counters (C235 to C255) can be specified as S .
Device
External FX I/O
FNC70-FNC79
4. Caution on values set in the comparison value 1 S1 and comparison value 2 S2
Make sure that S1 is smaller than or equivalent to S2 .
Device
External FX
FNC80-FNC89
(When S1 is "1000" and S2 is "1999", the output D is set to ON as soon as the current value of
C235 changes from "999" to "1000" or from "1999" to "2000".)
2) Because the comparison result cannot be obtained when restoring the power or when the PLC mode
switches from STOP to RUN, the result is not output even if the comparison condition is provided.
For details, refer to "13.6.1 Program in which comparison result is set to ON when power is turned
ON [ZCP (FNC 11) instruction]".
17
Transfer 2
Data
FNC100-FNC109
6. Priority order in operation among HSCS (FNC 53), HSCR (FNC 54), and HSZ (FNC 55)
instructions for a same high speed counter
For details, refer to "6. Priority order in operation among HSCS (FNC 53), HSCR (FNC 54), and HSZ
(FNC 55) instructions for a same high speed counter" in Subsection 13.4.1.
18
7. Reset operation by an external terminal
Floating Point
FNC110-FNC139
For details, refer to "5. Reset operation by an external terminal [M8025*1: HSC (external reset)
mode]" in Subsection 13.4.1.
20
Control
Positioning
FNC150-FNC159
345
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
Explanation of operation
The outputs Y010 to Y012 are as shown below:
Y010 = ON Y011 = ON Y012 = ON
0 1000 1200
Current value of C235
Program example
X010
RST C235
M8000
C235 K9999 pulse input: X000
RUN monitor
Timing chart
In the part [1] in the timing chart, Y010 remains OFF if the current value of a high speed counter (C235 in the
example below) is "0" when restoring the power.
1) For initializing Y010, the current value of C235 is compared with K1000 and K1200, and Y010 is driven
using the DZCPP instruction (for general zone comparison) as pulse operation only upon startup.
2) The comparison result in Y010 is latched until an input pulse is input and the comparison output is driven
by the DHSZ instruction.
3) According to the current value of the counter, the DHSZ instruction drives the output (A), (B) or (C).
346
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
11
Shift
Rotation and
FNC30-FNC39
X000
(input pulse for
C235)
12
X010
Data Operation
FNC40-FNC49
(Start)
Y010 [1] A
(smaller than
zone)
13
Processing
High Speed
FNC50-FNC59
Y011 B
(inside zone)
Y012
(larger than zone)
C
14
Instruction
Handy
FMC60-FNC69
1200
1000
0
(present value of counter) 15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
347
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
This section explains the table high speed comparison mode (high speed pattern output) of the DHSZ
instruction.
When two or more outputs should be activated at one time, use the HSCT instruction which can change up to
16 outputs.
1. Set data
Operand Type Description Data Type
S1 Head word device number storing the data table (only data register D) 32-bit binary
Comparison table
Comparison data (32 bits) Output (Y) number SET/RST Table counter (D8130)
0
S1 + 1, S1 S1 +2 S1 +3
1
S1 + 5, S1 +4 S1 +6 S1 +7
2
S1 + 9, S1 +8 S1 + 10 S1 + 11
S2 1
S1 + 5, S1 +4 S1 +6 S1 +7
Repeated from "0".
348
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
11
4) Output (Y) number
Shift
Rotation and
FNC30-FNC39
Specify each digit of the (Y) number in hexadecimal form.
Example: When specifying Y010, specify "H10".
When specifying Y020, specify "H20".
5) Specification of set and reset
These set and reset are directly controlled as interrupt. 12
Contents of setting
Data Operation
FNC40-FNC49
Set (ON) K1/H1
Reset (OFF) K0/H0
2. Operation
M8002
13
FNC 12
Processing
High Speed
FNC50-FNC59
K123 D200 Comparison data
DMOV
FNC 12
MOV
K1 D203
Output is set or reset.
K1: Output is set.
14
Instruction
Handy
FMC60-FNC69
FNC 12 K234 D204 Comparison data
DMOV
Device
External FX I/O
FNC70-FNC79
MOV
Device
External FX
FNC80-FNC89
FNC 12 K1 D211
MOV K1: Output is set.
FNC 12
MOV
H11 D214 Output (Y) number 17
Transfer 2
Data
FNC100-FNC109
FNC 12 Output is set or reset.
K0 D215
MOV K0: Output is reset.
MOV
349
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
Comparison table
Present value
Comparison Output (Y) Table of C251
SET/RST
data number counter
D201,D200 D 202 D 203 0 A program to reset
K123 H10 K1 the counter is
required.
D205,D204 D 206 D 207 1 567
K234 H10 K0
456
D209,D208 D 210 D 211 2
K345 H11 K1 345
D213,D212 D 214 D 215 3
K456 H11 K0 234
4 123
D217,D216 D 218 D 219
K567 H11 K1 Repeated
from "0".
Y010
1) When this instruction is executed, the top
table in the data table is set as the A program to reset
Y011
comparison target data. the output is
required.
2) When the current value of the high speed
counter C251 is equivalent to the
comparison target data table, the output (Y) number specified in the table is set or reset.
This output processing is directly executed without regard to completion of output refresh by END
instruction.
3) "1" is added to the current value of the table counter D8130.
4) The comparison target data table is transferred to the next table.
5) The steps 2) and 3) are repeated until the current value of the table counter D8130 becomes "4".
When the current value becomes "4", the program execution returns to the step 1), and the table counter
D8130 is reset to "0".
At this time, the complete flag M8131 turns ON.
6) When the command contact is set to OFF, execution of the instruction is stopped and the table counter
D8130 is reset to "0".
Cautions
1. Limitation in the number of DHSZ instruction
This instruction can be programmed only once in a program.
With regard to the DHSCS, DHSCR, DHSZ and DHSCT instructions used for other purposes, up to 32
instructions including the DHSZ instruction can be driven at one time.
350
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
11
13.6.3 Frequency control mode (HSZ and PLSY instructions) (M8132)
Shift
Rotation and
FNC30-FNC39
When the special auxiliary relay M8132 for declaring the frequency control mode is specified as D in the
DHSZ instruction, the special function shown below is provided if DPLSY instruction is combined. 12
Data Operation
FNC40-FNC49
At this time, only a data register D can be specified as S1 , and a constant K or H can be specified as
S2 . The available range is limited to "1 K, H 128".
A high speed counter C235 to C255 can be specified as S .
This function is different from the zone comparison described above.
PLSY instruction is as shown on the next page, and only the pulse output can be changed by users.
13
1. Control example
Processing
High Speed
FNC50-FNC59
Example of table configuration and data setting
Comparison data Frequency Table counter D8131
D 301,D 300 D 302, D 303 0 Head device (32 bits)
K 20 K300 specified as S1 14
D 305,D 304 D 306, D 307 1
Instruction
Handy
FMC60-FNC69
K600 K500
D 309,D 308 D 310, D 311 2 Number of lines specified
K700 K200 as S2
D 313,D 312 D 314, D 315 3
K800 K100 15
D 317,D 316 D 318, D 319 4
Device
External FX I/O
FNC70-FNC79
K 0 K 0
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
351
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
Command
input
FNC 12 K20 D300 Comparison data
DMOVP
PLS M10
Pulse quantity
(K0 specifies
continuous Pulse
Frequency output.) output
M10
FNC 57 D8132 K0 Y000
DPLSY
352
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.6 FNC 55 HSZ / High Speed Counter Zone Compare
11
Output pulse characteristics
Shift
Rotation and
FNC30-FNC39
Output pulse
frequency (Hz)
500
12
Data Operation
FNC40-FNC49
300
200 13
100
Processing
High Speed
FNC50-FNC59
0
0 20 600 700 800
Current value of C251
1) Write prescribed data in advance to data registers constructing the table as shown in this program
example.
14
Instruction
Handy
FMC60-FNC69
2) The output frequency of the PLSY instruction remains in the value (D303, D302) until the current value of
a high speed counter specified in S becomes equivalent to (D301, D300). (D302 specifies low-order
16 bits. D303 specifies high-order 16 bits, but is always "0".)
3) The operation in the 2nd line is started after that, and then the operation in each line is executed in turn.
4) When the operation in the last line is completed, the complete flag M8133 turns ON. The program 15
execution returns to the 1st line, and the operation is repeated.
Device
External FX I/O
FNC70-FNC79
5) For stopping the operation in the last line, set the frequency in the last table to K0.
6) When the command input is set to OFF, the pulse output turns OFF and the table counter D8131 is reset.
7) After DHSZ instruction is first executed, creation of the table is completed at the END instruction. The
DHSZ instruction becomes valid after that. 16
8) Accordingly, the contact of PLS M10 is used so that the PLSY instruction is executed from the second
Device
External FX
FNC80-FNC89
scan after the command input has been set to ON.
Data can be written to the table in a program as shown in this example or directly using keys in peripheral
equipment.
1) M8132 17
This is the special auxiliary relay for declaring the frequency control mode
Transfer 2
Data
FNC100-FNC109
2) D8132
In the frequency control mode, the frequency set in the table is received by D8132 sequentially according
to the table counter count D8131.
3) D8134 (low-order) and D8135 (high-order)
In the frequency control mode, the comparison data in the table is received sequentially according to the 18
table counter count.
Floating Point
FNC110-FNC139
Cautions
1) DHSZ instruction can be used only once.
2) With regard to the DHSCS (FNC 53), DHSCR (FNC 54), DHSZ (FNC 55) and DHSCT (FNC280)
instructions used for other purposes, up to 32 instructions including the DHSZ instruction can be driven at
19
Operation 2
Data
FNC140-FNC149
one time.
3) Because the table is created when the END instruction is executed, it is necessary to delay execution of
the PLSY (FNC 57) instruction until creation of the table is completed.
4) Do not change the data table while the DHSZ instruction is driven.
5) In the frequency control mode, simultaneous output to Y000 to Y001 is not permitted. 20
Control
Positioning
FNC150-FNC159
353
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.7 FNC 56 SPD / Speed Detection
Outline
This instruction counts the input pulse for a specified period of time as interrupt input.
The function of this instruction varies depending on the version.
1. Instruction format
FNC 56 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand Type Description Data Type
S1 Device number of pulse input (X) Bit
S2 Time data (ms) or word device number storing the data 16- or 32-bit binary
D Head word device number storing the pulse density data 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
System Special Real Charac-
and System User Digit Specification Index Constant Pointer
User Unit Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 S 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3
354
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.7 FNC 56 SPD / Speed Detection
11
Explanation of function and operation
Shift
Rotation and
FNC30-FNC39
1. 16-bit operation (SPD)
The input pulse S1 is counted only for S2 1 ms. The measured value is stored in D , the present
value is stored in D +1, and the remaining time is stored in D +2 (ms).
By repeating this operation, the measured value D will store the pulse density (which is proportional to 12
the rotation speed).
Data Operation
FNC40-FNC49
Command
input
FNC 56
S1 S2 D
SPD
1) Timing chart
13
Processing
High Speed
FNC50-FNC59
Command
input The command contact is set to ON.
S1
D +1
14
D
Instruction
Handy
FMC60-FNC69
Current value D + 1 counts "OFF ON" operation of S1 .
Measured S2 ms later, the counting result is stored to D .
value
Accompanied by this operation, D +1 is reset, and
then counting of the "OFF ON" operation of S1 is
S2 ms S2 ms started again. 15
Counting time Counting time
Device
External FX I/O
FNC70-FNC79
S2 ms D + 2 is used to measure the remaining time.
D +2
Remaining time (ms) 16
Device
External FX
FNC80-FNC89
2) The measured value D is in proportion to the number of rotations as shown below:
17
Transfer 2
Data
FNC100-FNC109
Input X000
N(rpm)
60 D
18
3
N= 10 (r/min)
Floating Point
FNC110-FNC139
nt
t: Measurement time duration specified as S2 (ms)
Proximity switch
"n" pulses/rotation
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
355
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.7 FNC 56 SPD / Speed Detection
The input pulse S1 is counted only for [ S2 +1, S2 ] x 1 ms. The measured value is stored in
[ D +1, D ], the present value is stored in [ D +3, D +2], and the remaining time is stored in
[ D +5, D +4] (ms).
By repeating this operation, the measured value [ D +1, D ] will store the pulse density (which is
proportional to the rotation speed).
Command
input
FNC 56
S1 S2 D
DSPD
1) Timing chart
Command
input The command contact is set to ON.
S1
[ D +1, D ]
Measured value
[ D +3, D +2] [ D +3, D +2] counts "OFF ON" operation
Current value
of S1 . [ S2 +1, S2 ] ms later, the counting result is
stored to [ D +1, D ].
Accompanied by this operation, [ D +3, D +2] is
reset, and then counting of the "OFF ON" operation of
[ S2 +1, S2 ] ms [ S2 +1, S2 ] ms S1 is started again.
Counting time Counting time
[ D +5, D +4]
Remaining time (ms)
2) The measured value [ D +1, D ] is in proportion to the number of rotations as shown below:
Input X000
N(rpm)
60 [ +1, ]
N= 103 (r/min)
nt
t: Measurement time duration specified as [ +1, ] (ms)
Proximity switch
"n" pulses/rotation
356
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.7 FNC 56 SPD / Speed Detection
11
Cautions
Shift
Rotation and
FNC30-FNC39
1. Input specifications of the input S1
An input device X000 to X007 specified as S1 cannot overlap the following functions or instructions:
- High speed counter
- Input interrupt
12
Data Operation
FNC40-FNC49
- Pulse catch
- DSZR instruction
- DVIT instruction
- ZRN instruction
For one input, this instruction can be used only once. 13
Processing
High Speed
FNC50-FNC59
The maximum frequency of turning the inputs X000 to X007 ON and OFF is shown below:
Maximum input frequency
Used input number FX3U PLC
FX3UC PLC
Main unit FX3U-4HSX-ADP
X000 to X005 100 kHz*1 100 kHz*1
200 kHz
14
X006,X007 10 kHz 10 kHz
Instruction
Handy
FMC60-FNC69
*1. When receiving pulses within the response frequency range of 50 k to 100 kHz, perform the following
actions:
- Make sure that the wiring length is 5 m or less.
- Connect a bleeder resistor of 1.5 k (1 W or more) to the input terminal, and make sure that the
load current in the open collector transistor output of the external equipment is 20 mA or more.
15
Device
External FX I/O
FNC70-FNC79
2. Occupied devices
1) When using the 16-bit operation
Three devices are occupied from a device specified in D .
2) When using the 32-bit operation 16
Six devices are occupied from a device specified in D .
Device
External FX
FNC80-FNC89
3. When a word device is specified as S2 .
If the word device value is changed while the instruction is being executed, the change affects the operation
in every measurement cycle.
17
Function change depending on the version
Transfer 2
Data
FNC100-FNC109
The function of the FNC 56 instruction varies depending on the PLC version shown in the table below.
Applicable version
Item Outline of function
FX3U FX3UC
Ver.2.20 or later Ver.2.20 or later Addition of 32-bit instruction 32-bit operations (DSPD) are enabled.
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
357
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.8 FNC 57 PLSY / Pulse Y Output
Outline
This instruction generates a pulse signal.
For the frequency control mode, refer to Subsection 13.6.3.
1. Instruction format
FNC 57 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D PLSY 7 steps PLSY
Continuous
13 steps DPLSY
Continuous
Operation Operation
2. Set data
Operand Type Description Data Type
S1 Output pulse frequency 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
System Special Real Charac-
and System User Digit Specification Index Constant Pointer
User Unit Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D S 3
S: Specify a transistor output on the main unit or Y000 or Y001 on a special high speed output adapter*1.
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
358
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.8 FNC 57 PLSY / Pulse Y Output
11
2. 32-bit operation (DPLSY)
Shift
Rotation and
FNC30-FNC39
A pulse train at the frequency [ S1 +1, S1 ] is output by the quantity [ S2 +1, S2 ] from the output (Y)
D .
Data Operation
FNC40-FNC49
[ S1 + 1, S1 Frequency ]
Processing
High Speed
FNC50-FNC59
Specify the output (Y) number from which pulses are output in D .
Allowable setting range: Y000, Y001
For the method to output pulses without any limitation,
refer to the program example later.
14
Related devices
Instruction
Handy
FMC60-FNC69
1. Instruction execution complete flag
The instruction execution complete flag M8029 used for PLSY instruction can be used also for other
instructions. When using other instructions, setting the M8029 flag to ON or OFF, or using two or more PLSY
instructions, make sure to use each M8029 flag just after an instruction to be monitored. 15
For the instruction execution complete flag use method,
Device
External FX I/O
FNC70-FNC79
refer to Subsection 6.5.2.
Device Name Description
ON: Generation of specified number of pulses is completed.
Instruction execution
M8029 OFF: Generation of pulses is paused before the specified number of pulses is
complete
reached or the continuous pulse generation operation is stopped. 16
Device
External FX
FNC80-FNC89
Command Command
input 1 input 1
FNC 57 K1000 K0 Y000 FNC 57 K1000 K0 Y000
PLSY PLSY
Command
M8029 input 2
FNC 57 K1000 K0 Y001
17
DPLSY
Transfer 2
Data
FNC100-FNC109
Command
Command input 1 M8029
input 2
FNC 57
DPLSY
K1000 K0 Y000 Command Changes by DPSLY
instruction corresponding to
input 2 M8029 the command input 2.
M8029 18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
359
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.8 FNC 57 PLSY / Pulse Y Output
The contents of each data register can be cleared using the following program:
Command
input
FNC 12 Low-order device shown in
K0
DMOV table above
To restart pulse output, set the device (M8349 or M8359) corresponding to the output signal to OFF, and then
drive the pulse output instruction again.
Cautions
2. Frequency S1
When using transistor outputs in the main unit, set the output frequency S1 to "100,000 Hz" or less.
If the load is operated using pulses at a frequency higher than 100,000 Hz, the PLC may be damaged.
3. Pulse output
Only a transistor output on the main unit or Y000 or Y001 on a special high speed output adapter*1 can be
specified in D .
When using the PLSY (FNC 57) instruction with a relay output type FX3U PLC, a special high speed output
adapter is required.
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
The duration of the ON/OFF pulses is 50% (ON = 50%, OFF = 50%).
The pulse output is controlled by the dedicated hardware not affected by the sequence program (operation
cycle).
If the command input is set to OFF during continuous pulse output, the output from D turns OFF.
360
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.8 FNC 57 PLSY / Pulse Y Output
11
4. Handling of pulse output terminals in the FX3U and FX3UC series main units
Shift
Rotation and
FNC30-FNC39
The outputs Y000 and Y001 are the high
speed response type. Item Description
When using a pulse output instruction or Operating voltage range 5 to 24V DC
positioning instruction, adjust the load current
Operating current range 10 to 100 mA
of the open collector transistor output to
about 10 to 100 mA (5 to 24V DC). Output frequency 100 kHz or less
12
Data Operation
FNC40-FNC49
When the load is smaller, connect a dummy Equipment PLC
resistor in parallel to the outside of a used load Dummy (transistor output)
resistor resistor [sink output]
output terminal (Y000 or Y001) as shown in External
the circuit diagram below so that the power
specified current shown above flows in the supply
Input circuit
Y000 13
output transistor.
Processing
High Speed
FNC50-FNC59
COM1
Instruction
Handy
FMC60-FNC69
direction" (PLSxDIR) side.
If the switch is set to the "forward rotation pulse chain reverse rotation pulse chain" (FPxRP) side, normal
operations are disabled. The pulse output destination changes depending on the PLC output status as
shown in the table below.
Pulse output Output affecting
Operation
15
destination operation
Device
External FX I/O
FNC70-FNC79
While Y004 is ON, pulses are output from Y000 in the high speed output adapter.
D = Y000 Y004 While Y004 is OFF, pulses are output from Y004 in the high speed output
adapter.
While Y005 is ON, pulses are output from Y001 in the high speed output adapter.
D = Y001 Y005 While Y005 is OFF, pulses are output from Y005 in the high speed output
adapter.
16
Device
External FX
FNC80-FNC89
3) Set the pulse output type setting switch while the PLC is stopped or while the power is OFF.
Do not manipulate the pulse output form setting switch while pulses are being output.
4) When special high speed output adapters are connected, the same output numbers in the main unit are
assigned as shown in the table below.
Only wire the appropriate output terminals. 17
Outputs in special high speed output adapters and the main unit operate as shown below.
Transfer 2
Data
FNC100-FNC109
Assignment of output numbers in special high speed output adapters
Output number
Status of output form Setting name in each
Signal name 1st unit 2nd unit
setting switch positioning instruction
1st axis 2nd axis 3rd axis 4th axis 18
Forward rotation
Floating Point
FNC110-FNC139
Output operation
Output operation
While instruction is activated, relevant output is ON. (LED is also ON.)
Relay output type main unit
Use a special high speed adapter.
Operated.
20
Special high speed output adapter
Control
Positioning
FNC150-FNC159
361
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.8 FNC 57 PLSY / Pulse Y Output
6. Others
1) Types of pulse output, positioning and other relevant instructions and their target output numbers
Classification Instruction Instruction name Target output numbers
PLSY(FNC 57) Pulse Y output Y000,Y001
Pulse output
PLSR(FNC 59) Acceleration/deceleration setup Y000,Y001
DSZR(FNC150) DOG search zero return Y000,Y001,Y002,Y003
DVIT(FNC151) Interrupt positioning Y000,Y001,Y002,Y003
ZRN(FNC156) Zero return Y000,Y001,Y002,Y003
Positioning
PLSV(FNC157) Variable speed pulse output Y000,Y001,Y002,Y003
DRVI(FNC158) Drive to increment Y000,Y001,Y002,Y003
DRVA(FNC159) Drive to absolute Y000,Y001,Y002,Y003
High speed
PWM(FNC 58) Pulse width modulation Y000,Y001,Y002,Y003
processing
2) When using the same output relay (Y000 or Y001) in several instructions.
While a pulse output monitor (BUSY/READY) flag is ON a pulse output instruction and positioning
instruction for the same output relay cannot be executed.
While a pulse output monitor flag is ON even after the instruction drive contact is set to OFF, a pulse
output instruction or positioning instruction for the same output relay cannot be executed.
Before executing such an instruction, wait until the pulse output monitor flag turns OFF and one or more
operation cycles pass.
Pulse output destination device Pulse output monitor flag
Y000 M8340
Y001 M8350
3) "Frequency control mode" in which DHSZ (FNC 55) and PLSY (FNC 57) instructions are combined can
be used only once in a program.
362
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.9 FNC 58 PWM / Pulse Width Modulation
11
13.9 FNC 58 PWM / Pulse Width Modulation
Shift
Rotation and
FNC30-FNC39
Outline
This instruction outputs pulses with a specified period and ON duration.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 58 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
PWM Continuous
7 steps PWM Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S1 Output pulse width (ms) 16-bit binary
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
System Special Real Charac-
and System User Digit Specification Index Constant Pointer
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify
User Unit
K H
Number ter String
E "" P
15
Device
External FX I/O
FNC70-FNC79
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D S 3
S: Specify transistor output Y000, Y001, or Y002 on the main unit or Y000, Y001, Y002, or Y003 on a special 16
high speed output adapter*1.
Device
External FX
FNC80-FNC89
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
Transfer 2
Data
FNC100-FNC109
Command
input t
FNC 58 S1 S2 D D
PWM
Pulse width Period
t T0
T0 18
Floating Point
FNC110-FNC139
Specify the output (Y) number from which pulses are to be output in D .
Allowable setting range: Y000, Y001, Y002, Y003
20
Control
Positioning
FNC150-FNC159
363
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.9 FNC 58 PWM / Pulse Width Modulation
Cautions
1. Setting the pulse width and period
Make sure that the pulse width S1 and period S2 satisfy the relationship " S1 S2 ".
2. Pulse output
Only the following outputs can be specified in D according to the system configuration.
- When using special high speed output adapters : Y000, Y001, Y002*2, or Y003*2
*1
- When using transistor outputs on the main unit (that is, when not using special high speed output
adapters): Y000, Y001, or Y002
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
When using the PWM (FNC 58) instruction with a relay output type FX3U PLC, a special high speed
output adapter is required.
*2. When specifying Y002 or Y003 on a special high speed output adapter, a second special high speed
output adapter is required.
The pulse output is controlled by interrupt processing not affected by the sequence program (operation
cycle).
If the command input is set to OFF, the output from D turns OFF.
While a pulse output monitor (BUSY/READY) flag is ON, a pulse output or positioning instruction for the
same output relay cannot be executed.
While a pulse output monitor flag is ON even after the instruction drive contact is set to OFF, a pulse output
or positioning instruction for the same output relay cannot be executed.
Before executing a pulse output or positioning instruction, wait until the pulse output monitor flag turns OFF
and one or more operation cycles pass.
Pulse output destination device Pulse output monitor flag
Y000 M8340
Y001 M8350
Y002 M8360
Y003 M8370
3) Set the pulse output type setting switch while the PLC is stopped or while the power is OFF.
Do not adjust the pulse output type setting switch while pulses are being output.
364
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.9 FNC 58 PWM / Pulse Width Modulation
11
4) When special high speed output adapters are connected, the same output numbers in the main unit are
Shift
Rotation and
FNC30-FNC39
assigned as shown in the table below.
Only wire the appropriate output terminals.
Outputs in special high speed output adapters and the main unit operate as shown below.
Data Operation
FNC40-FNC49
Setting status of output Setting name in each
Signal name 1st unit 2nd unit
form setting switch positioning instruction
1st axis 2nd axis 3rd axis 4th axis
Forward rotation
Pulse output destination Y000 Y001 Y002 Y003
pulse chain (FP)
"FPxRP" side
Reverse rotation
Rotation direction signal Y004 Y005 Y006 Y007 13
pulse chain (RP)
Processing
High Speed
FNC50-FNC59
Pulse chain Pulse output destination Y000 Y001 Y002 Y003
"PLSxDIR" side
Direction Rotation direction signal Y004 Y005 Y006 Y007
Output operation
Output operation 14
Instruction
Handy
FMC60-FNC69
Do not use the PWM (FNC 58) instruction with relay-output type main units.
Relay output type main unit (Considerable output response delay may be generated, chattering may occur
in contacts, or the contact life may be shortened.)
Set the output frequency to "200kHz" or less.
Special high speed output adapter
Use a transistor output type main unit.
Transistor output type main unit Set the output frequency to "100kHz" or less. 15
Device
External FX I/O
FNC70-FNC79
Program example
When the contents of D10 are changed in the range from "0" to "50" in the program example shown below,
the average output from Y000 will be in the range from 0 to 100%.
In this program example the FX3U series main unit (sink output) is used. For wiring details, refer to the
following manual. 16
FX3U Hardware Edition
Device
External FX
FNC80-FNC89
X0 D10
FNC 58 D10 K50 Y000 Y000
PWM
50ms 17
Transfer 2
Data
FNC100-FNC109
Example of smoothing circuit
510 R
1k
0V 24V (1k)
PLC
1k
5V P
22 E e
+ 10V 18
V
Floating Point
FNC110-FNC139
12V C
1k 470F
1k
COM1 Y000 Y001 Y002 Y003
19
Operation 2
Data
FNC140-FNC149
R>P
= P(k) C(F) = 470ms >> T0
The time constant of the filter should be considerably larger than the pulse cycle T0.
The ripple value "e" in the mean output current "e" is approximately "e/e T0/"
20
Control
Positioning
FNC150-FNC159
365
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.10 FNC 59 PLSR / Acceleration/Deceleration Setup
Outline
This pulse output instruction has the acceleration/deceleration function.
1. Instruction format
FNC 59 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D PLSR 9 steps PLSR
Continuous
17 steps DPLSR
Continuous
Operation Operation
2. Set data
Operand Type Description Data Type
S1 Maximum frequency (Hz) 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
System Special Real Charac-
and System User Digit Specification Index Constant Pointer
User Unit Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D S 3
S: Specify a transistor output on the main unit or Y000 or Y001 on a special high speed output adapter*1.
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
366
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.10 FNC 59 PLSR / Acceleration/Deceleration Setup
11
2. 32-bit operation (DPLSR)
Shift
Rotation and
FNC30-FNC39
Pulses are output from the output (Y) D by the specified number [ S2 +1, S2 ] with acceleration/
deceleration to the maximum frequency [ S1 +1, S1 ] for the time [ S3 +1, S3 ](ms).
Command
input
FNC 59
DPLSR
S1 S2 S3 D 12
Data Operation
FNC40-FNC49
Maximum Total Acceleration/ Output
frequency number deceleration number
(HZ) of output time (Y000,
pulses (ms) Y001)
(PLS)
Processing
High Speed
FNC50-FNC59
[ S2 +1, S2 ]: Total number of output pulses (PLS)
Allowable setting range: 1 to 2,147,483,647 (PLS)
[ S3 +1, S3 ]: Acceleration/deceleration time (ms)
Allowable setting range: 50 to 5000 (ms)
D : Pulse output number 14
Allowable setting range: Y000, Y001
Instruction
Handy
FMC60-FNC69
3. Pulse output specifications
Simple positioning (with the acceleration/deceleration function)
The operation pattern is as shown below: 15
Device
External FX I/O
FNC70-FNC79
S1 Maximum frequency (Hz)
16-bit operation: 10 to 32767 Hz
Pulse frequency (Hz) 32-bit operation: 10 to 200,000 Hz
16
Device
External FX
FNC80-FNC89
S2 Total number of output pulses
(PLS)
16-bit operation: 1 to 32767 PLS
32-bit operation: 1 to 2,147,483,647 PLS
17
Transfer 2
Data
FNC100-FNC109
S3 S3
Acceleration/ Acceleration/
deceleration time deceleration time
50 to 5000ms 50 to 5000ms
Output processing
18
Floating Point
FNC110-FNC139
The pulse output is controlled by the dedicated hardware regardless of the operation cycle.
Data change while the instruction is executed
Even if operands are overwritten while the instruction is executed, such changes are not reflected
immediately. The changes become valid the next time the instruction is driven.
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
367
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.10 FNC 59 PLSR / Acceleration/Deceleration Setup
Related devices
1. Instruction execution complete flag
For the instruction execution complete flag use method,
refer to Subsection 6.5.2.
Device Name Description
OFF: The input command is OFF, or pulses are being output. (This flag does not turn
Instruction execution ON if the pulse output is interrupted in the middle of output.)
M8029
complete
ON: Output of the number of pulses set in S2 is completed.
The contents of each data register can be cleared using the following program:
Command
input
FNC 12 Low-order device shown in
K0
DMOV above table
To restart pulse output pulses again, set the device (M8349 or M8359) corresponding to the output signal to
OFF, and then drive the pulse output instruction again.
Cautions
1. Frequency S1
When using transistor outputs on the main unit, set the output frequency S1 to "100,000 Hz" or less.
If the load is operated using pulses at a frequency higher than 100,000 Hz from transistor outputs in the main
unit, the PLC may be damaged.
2. Pulse output
Only a transistor output on the main unit or Y000 or Y001 on a special high speed output adapter*1 can be
specified in D .
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
When using the PLSR (FNC 59) instruction with a relay output type FX3U PLC, a special high speed
output adapter is required.
The duration of the ON/OFF pulses is 50% (ON = 50%, OFF = 50%).
The pulse output is controlled by the dedicated hardware not affected by the sequence program (operation
cycle).
If the command input is set to OFF during continuous pulse output, the output from D turns OFF.
368
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.10 FNC 59 PLSR / Acceleration/Deceleration Setup
11
3. Handling of pulse output terminals in the FX3U and FX3UC series main units
Shift
Rotation and
FNC30-FNC39
The outputs Y000 and Y001 are the high speed response type.
When using a pulse output instruction or positioning instruction, adjust the load current of the open collector
transistor output to about 10 to 100 mA (5 to 24V DC).
Item Description
Operating voltage range 5 to 24V DC 12
Data Operation
FNC40-FNC49
Operating current range 10 to 100 mA
Output frequency 100 kHz or less
When the load is smaller, connect a dummy resistor in parallel to the outside of a used output terminal (Y000
or Y001) as shown in the circuit diagram below so that the specified current shown above flows in the output
transistor. 13
Processing
High Speed
FNC50-FNC59
Equipment PLC
load Dummy (transistor output)
resistor resistor [sink output]
External
power
supply Y000
Input circuit 14
COM1
Instruction
Handy
FMC60-FNC69
4. Cautions on special high speed output adapters
1) Outputs of special high speed output adapters work as differential line drivers.
15
2) Set the pulse output type setting switch in a special high speed output adapter to the "pulse chain +
Device
External FX I/O
FNC70-FNC79
direction" (PLSxDIR) side.
If the switch is set to the "forward rotation pulse chain reverse rotation pulse chain" (FPxRP) side, normal
operations are disabled. The pulse output destination changes depending on the PLC output status as
shown in the table below.
Pulse output
destination
Output affecting
operation
Operation 16
Device
External FX
FNC80-FNC89
While Y004 is ON, pulses are output from Y000 in the high speed output
adapter.
D = Y000 Y004
While Y004 is OFF, pulses are output from Y004 in the high speed output
adapter.
While Y005 is ON, pulses are output from Y001 in the high speed output
D = Y001 Y005
adapter. 17
While Y005 is OFF, pulses are output from Y005 in the high speed output
Transfer 2
Data
FNC100-FNC109
adapter.
3) Set the pulse output type setting switch while the PLC is stopped or while the power is OFF.
Do not manipulate the pulse output type setting switch while pulses are being output.
4) When special high speed output adapters are connected, the same output numbers in the main unit are
assigned as shown in the table below. 18
Only wire the appropriate output terminals.
Floating Point
FNC110-FNC139
Outputs in special high speed output adapters and the main unit operate as shown below.
369
FX3U/FX3UC Series Programmable Controllers 13 High Speed Processing FNC 50 to FNC 59
Programming Manual - Basic & Applied Instruction Edition 13.10 FNC 59 PLSR / Acceleration/Deceleration Setup
Output operation
Output operation
While instruction is active, associated output is ON. (LED is also ON.)
Relay output type main unit
Use a special high speed adapter.
Special high speed output adapter Set the output frequency to "200kHz" or less.
Transistor output type main unit Set the output frequency to "100kHz" or less.
5. Others
1) Types of pulse output, positioning and other relevant instructions and their target output numbers
Classification Instruction Instruction name Target output numbers
PLSY(FNC 57) Pulse Y output Y000,Y001
Pulse output
PLSR(FNC 59) Acceleration/deceleration setup Y000,Y001
DSZR(FNC150) DOG search zero return Y000,Y001,Y002,Y003
DVIT(FNC151) Interrupt positioning Y000,Y001,Y002,Y003
ZRN(FNC156) Zero return Y000,Y001,Y002,Y003
Positioning
PLSV(FNC157) Variable speed pulse output Y000,Y001,Y002,Y003
DRVI(FNC158) Drive to increment Y000,Y001,Y002,Y003
DRVA(FNC159) Drive to absolute Y000,Y001,Y002,Y003
High speed
PWM(FNC 58) Pulse width modulation Y000,Y001,Y002,Y003
processing
2) When using the same output relay (Y000 or Y001) in several instructions.
While a pulse output monitor (BUSY/READY) flag is ON, a pulse output or positioning instruction for the
same output relay cannot be executed.
While a pulse output monitor flag is ON, even after the instruction drive contact is set to OFF, a pulse
output or positioning instruction for the same output relay cannot be executed.
Before executing a pulse output or positioning instruction, wait until the pulse output monitor flag turns
OFF and one or more operation cycles pass.
Pulse output destination device Pulse output monitor flag
Y000 M8340
Y001 M8350
370
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition
11
Shift
Rotation and
FNC30-FNC39
14. Handy Instruction FNC 60 to FNC 69
FNC 60 to FNC 69 provide handy instructions which achieve complicated control in a minimum sequence 12
program.
Data Operation
FNC40-FNC49
FNC No. Mnemonic Symbol Function Reference
Section
60 IST IST S D1 D2 Initial State
14.1
13
Section
Processing
High Speed
FNC50-FNC59
61 SER SER S1 S2 D n Search a Data Stack
14.2
Section
62 ABSD ABSD S1 S2 D n Absolute drum sequencer
14.3
Instruction
Handy
FMC60-FNC69
Section
64 TTMR TTMR D n Teaching Timer
14.5
Section
65 STMR Special Timer
STMR S m D 14.6 15
Device
External FX I/O
FNC70-FNC79
Section
66 ALT ALT D Alternate State
14.7
Section
67 RAMP RAMP S1 S2 D n Ramp Variable Value
14.8
Device
External FX
FNC80-FNC89
Section
69 SORT SORT S m1 m2 D n SORT Tabulated Data
14.10
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
371
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
Outline
This instruction automatically controls the initial state and special auxiliary relays in a step ladder program.
For SFC programs and step ladder, refer to Chapter 34.
1. Instruction format
FNC 60 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
SS1 Head bit device number of the selector switch in the operation mode Bit
Smallest state relay number of practical state relays in the automatic mode
D1 Bit
( D1 < D2 )
Largest state relay number of practical state relays in the automatic mode
D2 Bit
( D1 < D2 )
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 S1 3
S
D21 S2 3
D2 S2 3
Specify the smallest device number of practical state relays in D1 (for the automatic mode).
Specify the largest device number of practical state relays in D2 (for the automatic mode).
372
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
11
1. Control of devices by switch operations (occupied devices)
Shift
Rotation and
FNC30-FNC39
While the command input is ON, the following devices are automatically switched and controlled. While
the command input is OFF, the devices are not switched.
Device number Operation function Device number Operation function
M8040 STL transfer disable S0 Individual operation initial state
M8041*1 Transfer start S1 Zero return initial state
12
Data Operation
FNC40-FNC49
M8042 Start pulse S2 Automatic operation initial state
*1 Zero return complete
M8043
M8045 All output reset disable
*2 Enable STL monitoring
M8047
Processing
High Speed
FNC50-FNC59
*2.Set to ON when END instruction is executed.
Instruction
Handy
FMC60-FNC69
S3 to S9 can be used arbitrarily.
S10 to S19 Occupied for zero return
If the devices are switched among individual operation (X020), zero return (X021) and automatic
operation (X022, X023 and X024) while the zero return complete device (M8043) is OFF, all outputs are
set to OFF. 15
Automatic operation can be started again after zero return is completed.
Device
External FX I/O
FNC70-FNC79
For introducing IST instruction, refer to "14.1.2 Example of IST instruction introduction
(example of workpiece transfer mechanism)".
Cautions
16
1. Device specified as DS1 and switches to be used
Device
External FX
FNC80-FNC89
It is not necessary to use all switches for mode selection.
When some switches are not used, leave the corresponding numbers in the unused status. Such numbers
cannot be used for any other purpose.
Transfer 2
Data
FNC100-FNC109
3. State relays used for the zero return operation
Use the state relays S10 to S19 for the zero return operation.
In the final state in the zero return operation, set M8043 to ON, and then let it be reset to OFF by itself.
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
373
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
1. Equivalent circuit
Continuous
operation Stepping
X024 M8041 X027 X022 operation
M8041 is set to ON when the start button
M8041 is pressed in the automatic mode.
Stop Cycle
X026 Automatic start X023 operation Transfer Especially in the continuous mode,
start M8041 holds its status by itself, and is
Continuous reset when the stop button is pressed.
X024 operation
X026 Automatic start X020 *1
PLS M8042
X025 Zero return start Individual
operation Start pulse
M8040 Self-holding
Even if the mode is switched from automatic operation to zero return operation while S2 is ON, state relays
(except initial state relays) and outputs are not reset.
*1. All outputs: Outputs (Y) not driven by state relays DS1 and outputs (Y) driven by state relays DS1 in
OUT and SET instructions
374
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
11
14.1.2 Example of IST instruction introduction (example of workpiece transfer mechanism)
Shift
Rotation and
FNC30-FNC39
1. Operation mode
Mechanism for transferring a workpiece from the
12
Stepping
operation X022 point A to the point B using the robot hand
Zero return Zero return Cycle
operation mode operation mode Y003
Data Operation
FNC40-FNC49
PB
X021 X023 Rightward Right limit X003
X025 Y004
Left limit X004 Leftward
Individual Continuous Power supply
operation mode operation mode Upper
X020 X024 PB
Leftward limit X002 Moving down
Moving up travel Unclamping
13
PB PB PB PB
Y002 Y000
X005 X006 X007 Start X026
Rightward Emergency stop
Moving down travel Clamping
Moving Lower
Processing
High Speed
FNC50-FNC59
PB PB PB PB PB
up limit X001
X010 X011 X012 Stop X027
Clamping Y001
Pushbutton switches for individual operations Unclamping Y001
of the robot hand shown in the figure on the right Workpiece
Pushbutton switches for the external circuit to
Point A Point B
14
turn ON and OFF the load power supply
Instruction
Handy
FMC60-FNC69
Operation mode Contents of operation
Individual
Manual
operation
mode
Each load is turned ON and OFF by an individual pushbutton switch.
15
Device
External FX I/O
FNC70-FNC79
mode Zero return
When the pushbutton switch for zero return is pressed, the machine automatically returns to the
operation
zero point.
mode
Stepping
operation Every time the start button is pressed, the machine performs one process.
mode 16
When the start button is pressed while the machine is located at the zero point, the machine
Device
External FX
FNC80-FNC89
Cycle performs one cycle of automatic operation and stops at the zero point.
Automatic operation If the stop button is pressed in the middle of one cycle, the machine stops immediately. When
mode mode the start button is pressed after that, the machine performs the continuous operation from the
last position, and automatically stops at the zero point.
Continuous
When the start button is pressed while the machine is located at the zero point, the machine
starts continuous operation. 17
operation
When the stop button is pressed, the machine finishes the current cycle until the zero point, and
Transfer 2
Data
FNC100-FNC109
mode
then stops at the zero point.
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
375
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
2. Transfer mechanism
Start Left limit X004
X026
Upper
Right limit limit
(1) Moving X003 X002
down Upper limit X002
Y000 (1) Moving down
Y000 (7) Moving up
Lower (3) Moving up Y002
limit Y002
X001 Lower
limit
What is the zero point condition? X001
Clamping Upper limit X002 is ON, left limit Unclamping
X004 is ON and unclamping Y001
(2) Clamping is OFF. (6) Unclamping
Y001 ON Y001 OFF
The upper left position is regarded as the zero point. The machine transfers a workpiece from the left to the
right in the order "moving down clamping moving up rightward travel moving down unclamping
moving up leftward travel."
Double-solenoid type solenoid valves (with two inputs for driving and non-driving) are adopted for moving
down, moving up, leftward travel and rightward travel. Single type solenoid valves (which operate only while
the power is ON) are adopted for clamping.
376
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
11
3. Assignment of mode selection inputs
Shift
Rotation and
FNC30-FNC39
For using IST instruction, it is necessary to assign inputs having consecutive device numbers as shown below
for mode inputs.
When using non-consecutive inputs or omitting some modes, change the layout by using an auxiliary relay as
the head input for mode specification as shown in the figure below.
- X020: Individual operation mode 12
- X021: Zero return operation mode
Data Operation
FNC40-FNC49
- X022: Stepping operation mode
- X023: Cycle operation mode
- X024: Continuous operation
- X025: Zero return start
- X026: Automatic mode start 13
Processing
High Speed
FNC50-FNC59
- X027: Stop
Instruction
Handy
FMC60-FNC69
X033:Stepping operation mode X032:Automatic mode start zero X032:Automatic mode start
X040:Cycle operation mode return start X033:Stop
X032:Continuous operation mode X033:Stop
X034:Zero return start
X026:Automatic mode start
X041:Stop
15
Device
External FX I/O
FNC70-FNC79
X030 M8000 X030
M 0 Individual
operation mode
M 0
RUN monitor
Does not
operate
M 0 Individual
operation mode 16
X035 X030 M8000
Device
External FX
FNC80-FNC89
Zero return Zero return
M 1 M 1 operation mode M 1
operation mode
X033 M8000
Stepping Does not
M 2 M 2 operate M 2
operation mode
X040
M 3
Cycle operation
M 3
Does not
M 3
17
mode operate
Transfer 2
Data
FNC100-FNC109
X032 X031 X031
Continuous Continuous Continuous
M 4 operation M 4 M 4
operation operation
X034 X032 M8000
M 5 Zero return M 5 Zero return M 5
X026
start start
X032
18
Automatic Automatic Automatic
Floating Point
FNC110-FNC139
M 6 M 6 M 6
mode start mode start mode start
X041 X033 X033
M 7 Stop M 7 Stop M 7 Stop
M8000
FNC 60 M 0 S 20 S 29
IST
RUN
monitor
20
Control
Positioning
FNC150-FNC159
377
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
378
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
11
5. Program example
Shift
Rotation and
FNC30-FNC39
1) Circuit diagram
In the sequence circuit shown below, all areas except shaded areas are standard.
Program the shaded areas according to the contents of control.
a) Initial circuit
While the machine is operating, the operation mode can be switched arbitrarily (among stepping 12
operation, cycle operation and continuous operation) in the automatic mode.
Data Operation
FNC40-FNC49
When the operation mode is switched between the individual operation mode, zero return operation
mode and automatic mode while the machine is operating, all outputs are reset once to assure safety,
after which the following mode becomes valid.
(While M8045 (All output reset disable) is ON, outputs are not reset at all.)
Ladder block Detects that the machine is located at the zero point, and 13
regards it as the condition to start the automatic mode.
Processing
High Speed
FNC50-FNC59
X004 X002 Y001
M8044 Zero point condition
Upper
Left limit limit Unclamping
M8000
FNC 60
X020 S 20 S 27 Initial state
14
RUN IST
Instruction
Handy
FMC60-FNC69
monitor
Device
External FX I/O
FNC70-FNC79
Clamping
X012 Clamping command
0 SET Y001
Unclamping
X007 command
Initial state RST Y001
for individual
operation Moving-up
16
X005 command Y000
Device
External FX
FNC80-FNC89
Moving
Y002 up
Moving-down
X010 command Y002
Y000 Moving
down
Leftward travel
X006 command X002 Y003
Y004 Leftward
travel
17
Rightward travel
Transfer 2
Data
FNC100-FNC109
X011 command X002 Y004
Y003 Rightward
Upper limit travel
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
379
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
Y002 Moving up
X002
TRAN
Upper limit
11 RST Y003 Rightward
travel reset
Y004 Leftward travel
X004
TRAN
Left limit
380
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
11
d) Automatic mode (stepping operation mode, cycle operation mode or continuous operation mode)
Shift
Rotation and
FNC30-FNC39
SFC block
State number
Data Operation
FNC40-FNC49
TRAN
Transfer Zero point
start condition
Processing
High Speed
FNC50-FNC59
21 SET Y001 Clamping
T 0 K 10
T0
TRAN 14
Instruction
Handy
FMC60-FNC69
22 Y002 Moving up
X002
TRAN
Upper limit
23 Y003
Rightward
travel 15
Device
External FX I/O
FNC70-FNC79
X003
TRAN
Right limit
24 Y000 Moving down
X001
Down limit
TRAN 16
Device
External FX
FNC80-FNC89
25 RST Y001 Unclamping
T 1 K 10
T1
TRAN
17
26
Transfer 2
Data
FNC100-FNC109
Y002 Moving up
X002
TRAN
Upper limit
27 Y004 Leftward travel
X004
18
TRAN
Floating Point
FNC110-FNC139
Left limit
S2 RET END
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
381
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.1 FNC 60 IST / Initial State
6. List program
The list program for the circuit diagram shown on the previous page is as shown below:
0 LD X 004 32 STL S 1 70 LD T 0
1 AND X 002 33 LD X 025 71 SET S 22
2 ANI Y 001 34 SET S 10 73 STL S 22
3 OUT M8044 36 STL S 10 74 OUT Y 002
Initial circuit
Automatic mode
13 STL S 0 43 STL S 11 81 SET S 24
14 LD X 012 44 RST Y 003 83 STL S 24
15 SET Y 001 45 OUT Y 004 84 OUT Y 000
16 LD X 007 46 LD X 004 85 LD X 001
17 RST Y 001 47 SET S 12 86 SET S 25
18 LD X 005 49 STL S 12 88 STL S 25
19 ANI Y 000 50 SET M8043 89 RST Y 001
20 OUT Y 002 52 LD M8043 90 OUT T 1
21 LD X 010 53 RST S 12 (SP) K 10
Individual
operation
382
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.2 FNC 61 SER / Search a Data Stack
11
14.2 FNC 61 SER / Search a Data Stack
Shift
Rotation and
FNC30-FNC39
Outline
This instruction searches for the same data, maximum value and minimum value in a data table.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 61 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D SER P 9 steps SER Continuous
17 steps DSER
Continuous
Operation Operation
SERP Pulse (Single) DSERP Pulse (Single)
Operation Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
Head device number in which same data, maximum value and minimum value
S
S1 16- or 32-bit binary
are searched
S2 Data to be searched for or device number storing data 16- or 32-bit binary
14
Instruction
Handy
FMC60-FNC69
Head device number storing number of same data, maximum value and minimum
D 16- or 32-bit binary
value detected by search
Number of data in which same data, maximum value and minimum value are
n searched 16- or 32-bit binary
[16-bit instruction: 1 to 256, 32-bit instruction: 1 to 128]
15
3. Applicable devices
Device
External FX I/O
FNC70-FNC79
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S
S1 3 3 3 3 3 3 3 3 3 3 16
Device
External FX
FNC80-FNC89
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3 3
n 3 3 3 3
Transfer 2
Data
FNC100-FNC109
1. 16-bit operation (SER and SERP)
In "n" data starting from S1 , same data as S2 is searched, and the search result is stored to D to
D +4.
Command
input FNC 61 S1 S2 D n
18
SER
Floating Point
FNC110-FNC139
Five devices starting from D store the number of same data, first position, last position, maximum
value position and minimum value position.
In this case, however, "0" is stored in three devices starting from D (which store the number of
same data, first position and last position).
20
Control
Positioning
FNC150-FNC159
383
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.2 FNC 61 SER / Search a Data Stack
2) Operation example
a) Example of search result table configuration and data
Comparison Search result
Searched data
Searched device data Data Maximum Minimum value
S1 value Same
S1 S2 value position value D D
(example) D
(example) +4 +3
3 (first
S1 K100 0
position)
S1 +1 K111 1
S1 +2 K100 2 3
S1 +3 K 98 3
S1 +4 K123 4
K100
S1 +5 K 66 5 3
3 (last
S1 +6 K100 6
position)
S1 +7 K 95 7
S1 +8 K210 8 3
S1 +9 K 88 9
S1 +1, S1 D +1, D
S2 +1, S2
384
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.2 FNC 61 SER / Search a Data Stack
11
2) Operation example
Shift
Rotation and
FNC30-FNC39
a) Example of search result table configuration and data
Search result
Searched data Comparison
Searched device Data Maximum Minimum
S1 value data Same
S1 +1 position
(example) S2 value D
+4
D
value D
+3 12
Data Operation
FNC40-FNC49
3 (first
[ S1 + 1, S1 ] K100000 0
position)
[ S1 + 3, S1 + 2] K110100 1
[ S1 + 5, S1 + 4] K100000 2 3
[ S1 + 7, S1 + 6] K 98000 3 13
Processing
High Speed
FNC50-FNC59
[ S1 + 9, S1 + 8] K123000 4
K100000
[ S1 + 11, S1 + 10] K 66000 5 3
3 (last
[ S1 + 13, S1 + 12] K100000 6
position)
[ S1 + 15, S1 + 14] K 95000 7 14
Instruction
Handy
FMC60-FNC69
[ S1 + 17, S1 + 16] K910000 8 3
Device
External FX I/O
FNC70-FNC79
[ D + 3, D + 2] 0 Same data position (first position)
Device
External FX
FNC80-FNC89
Cautions
1. Comparison of values
It is executed algebraically.
(example: 10 < 2) 17
Transfer 2
Data
FNC100-FNC109
2. When there are two or more maximum or minimum values
When there are two or more maximum or minimum values in the searched data, the last position of the max/
min is stored respectively.
DD1 .
Make sure that such devices are not used in other controls for the machine.
1) In the case of 16-bit operation
Five devices, DD1 , DD1 +1, DD1 +2, DD1 +3 and DD1 +4, are occupied.
2) In the case of 32-bit operation 19
Ten devices, [ DD1 +1, DD1 ], [ DD1 +3, DD1 +2], [ DD1 +5, DD1 +4], [ DD1 +7, DD1 +6] and
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
385
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.3 FNC 62 ABSD / Absolute Drum Sequencer
Outline
This instruction creates many output patterns corresponding to the current value of a counter.
1. Instruction format
FNC 62 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
S
S1 Head device number storing the data table (with rising and faling point data) 16- or 32-bit binary
S2 Counter number for monitoring the current value compared with the data table 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S
S1 3 3 3 3 3 3 3 3 3 3
S2 3 3
SD2 3 3 3 S 3
n 3 3
S2 X001
RST S2
X001
S2 K360
386
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.3 FNC 62 ABSD / Absolute Drum Sequencer
11
1) Write the following data to S
D1 to S
D1 +2n+1 in advance by a transfer instruction:
Shift
Rotation and
FNC30-FNC39
Rising point Falling point
Target output
Data value (example) Data value (example)
S1 40 S1 +1 140 D
S1 +2 100 S1 +3 200 D +1 12
Data Operation
FNC40-FNC49
S1 +4 160 S1 +5 60 D +2
S1 +6 240 S1 +7 280 D +3
S1 + 2n S1 + 2n + 1 D +n1
13
For example, store the 16-bit rising point data to an even device number devices, and store the 16-bit
Processing
High Speed
FNC50-FNC59
falling data to an odd device number devices.
2) Output pattern
When the command input is set to ON, "n" points starting from DD1 change as shown below.
Each rising point/falling point can be changed respectively by overwriting the data in D D1 +n
S1 to S
2. 14
Instruction
Handy
FMC60-FNC69
40 140
D
100 200
D +1
60 160
15
D +2
Device
External FX I/O
FNC70-FNC79
240 280
D +3
z
0 180 360 16
Device
External FX
FNC80-FNC89
2. 32-bit operation (DABSD)
In this example, outputs are controlled to ON or OFF by one rotation (0 to 360 using the rotation angle signal
of 1/pulse).
The present value D21
S of the counter is compared with the data table having "n" lines starting from 17
Transfer 2
Data
FNC100-FNC109
[ S
D1 +1, S D1 ] (which occupies "n" lines 4 devices), and consecutive "n" outputs starting from DD1 are
controlled to ON or OFF during one rotation.
Command
input FNC 62 S1 S2 D n
DABSD
S2 X001
18
Floating Point
FNC110-FNC139
RST S2
X001
S2 K360
20
Control
Positioning
FNC150-FNC159
387
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.3 FNC 62 ABSD / Absolute Drum Sequencer
[ S1 + 5, S1 + 4] 100 [ S1 + 7, S1 + 6] 200 D +1
[ S1 + 4n + 1, S1 + 4n] [ S1 + 4n + 3, S1 + 4n + 2] D +n1
For example, store the 32-bit rising point data to devices having an even device number, and store the
32-bit falling data to devices having an odd device number.
When the command input is set to ON, "n" points starting from DD1 change as shown below.
Each rising point/falling point can be changed respectively by overwriting the data in [ S
D1 +1, S
D1 ] to
[ S
D1 +(n2)+3, S
D1 +(n2)+2].
40 140
D
100 200
D +1
60 160
D +2
240 280
D +3
z
0 180 360
Cautions
1. Specifying a high speed counter (C235 to C255)
In DABSD instruction, a high seed counter can be specified as S D21 .
In this case, however, the output pattern contains response delay caused by the scan cycle with regard to the
current value of a counter.
When high responsibility is required, use the table high speed comparison function offered by HSZ
instruction, or use HSCT instruction.
3. Other cautions
The value "n" determines the number of target outputs (1 n 64).
Even if the command input is set to OFF, the ON/OFF status of outputs does not change.
388
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.4 FNC 63 INCD / Incremental Drum Sequencer
11
14.4 FNC 63 INCD / Incremental Drum Sequencer
Shift
Rotation and
FNC30-FNC39
Outline
This instruction creates many output patterns using a pair of counters.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 63 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
S
S1 Head word device number storing the set value 16-bit binary
Instruction
Handy
FMC60-FNC69
n Number of output bit devices [1 n 64] 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac- 15
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Device
External FX I/O
FNC70-FNC79
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S
S1 3 3 3 3 3 3 3 3 3 3
S2 3 3
SD2 3 3 3 S 3 16
n 3 3
Device
External FX
FNC80-FNC89
S: "D.b" cannot be indexed with index registers (V and Z).
Transfer 2
Data
FNC100-FNC109
The current value S
D21 of a counter is compared with the data table having "n" lines starting from S
D1
(which occupies "n" lines x 1 device). When S D21 is equivalent to the table data, the current output is reset,
and the next output is set to ON. In this way, the ON/OFF status of specified outputs is controlled in turn.
Command
input FNC 63
INCD
S1 S2 D n 18
Floating Point
FNC110-FNC139
Count signal
K9999
S2
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
389
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.4 FNC 63 INCD / Incremental Drum Sequencer
Operation
S1 S2 D n
X000
FNC 63 D300 C0 M0 K4
INCD
M8013
K9999
C0
1 sec clock
1) Timing chart
Suppose that the following data is written in advance by a transfer instruction:
Device storing data Output
Data value (example) Example
S1 D300 = 20 D M0
S1 +1 D301 = 30 D +1 M1
S1 +2 D302 = 10 D +2 M2
S1 +3 D303 = 40 D +3 M3
S1 +n1 D +n1
X000
30 40
20 20 20
Current 10
value of
C0
Current 3
2
value of 1 1 1
C1 0 0 0
M 0
M 1
M 2
M 3
2) When the command contact turns ON, the output M0 turns ON.
3) When the current value of C0 reaches the comparison value D300, the output M0 is reset. "1" is added to
the count value of the process counter C1, and the current value of the counter C0 is reset.
4) The next output M1 turns ON.
5) When the current value of C0 reaches the comparison value D301, the output M1 is reset. "1" is added
to the count value of the process counter C1, and the current value of the counter C0 is reset.
6) The current value is compared for up to "n (K4)" outputs in the same way (1 n 64).
7) When the final process specified by "n" is finished, the execution complete flag M8029 turns ON and
remains ON for one operation cycle.
M8029 is used for many instructions as the instruction execution complete flag. Use M8029 as a contact
just after a corresponding instruction.
8) The program execution returns to the beginning, and outputs are repeated.
Caution
1. When specifying digits of a bit device as S
D11
As a device number, specify a multiple of 16 (0, 16, 32, 64 ...).
390
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.5 FNC 64 TTMR / Teaching Timer
11
14.5 FNC 64 TTMR / Teaching Timer
Shift
Rotation and
FNC30-FNC39
Outline
This instruction measures the period of time in which TTMR instruction is ON.
Use this instruction to adjust the set value of a timer by a pushbutton switch.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 64 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
D
n
Device number storing the teaching data
Magnification by which the teaching data is multiplied [K0 to K2/H0 to H2]
16-bit binary
16-bit binary
14
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V
Unit
Z Modify K H
stant Number ter String
E "" P
15
Device
External FX I/O
FNC70-FNC79
SD2 3 3 3
n 3 3 3 3
Device
External FX
FNC80-FNC89
The period of time to press and hold the command input (pushbutton switch) is measured in 1-second units,
multiplied by the magnification (10n), and then transferred to DD1 .
Command Command
input
FNC 64 contact
D n
TTMR 17
D +1
Transfer 2
Data
FNC100-FNC109
D +1
D
D
0 0 18
Pressing and holding time Pressing and holding time
Floating Point
FNC110-FNC139
The table below shows the actual value indicated by DD1 depending on the magnification n and the
pressing and holding time t0 (unit: 1 sec).
n Magnification D
K0 0 D 1 19
K1 100
Operation 2
Data
FNC140-FNC149
D 10
K2 1000 D 100
Related instruction
There is a handy instruction as follows: 20
Instruction Description
Control
Positioning
FNC150-FNC159
Measures the input contact ON time in 1-hour units, and outputs alarm when the
HOUR(FNC169)
measurement result reaches a specified value.
391
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.5 FNC 64 TTMR / Teaching Timer
Cautions
1. When the command contact turns OFF
The current value [ DD1 +1] of the pressing and holding time is reset, and the teaching time DD1 will not
change any more.
Program example
1. Writing the teaching time to 10 types of data registers
Suppose that the set value is written to D400 to D409 in advance.
T 0 D 400
T 9 D 409
392
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.6 FNC 65 STMR / Special Timer
11
14.6 FNC 65 STMR / Special Timer
Shift
Rotation and
FNC30-FNC39
Outline
This instruction can easily make off-delay timers, one-shot timers and flicker timers.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 65 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
SS1 Used timer number [T0 to T199 (100 ms timer)] 16-bit binary
m Set value of the timer [1 to 32,767] 16-bit binary
14
D Head bit number to which the set value is output (Four devices are occupied.) Bit
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
SS1 3 3
m 3 3 3 3
SD2 3 3 3 S 3
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (STMR)
The value specified in "m" is handled as the set value of a timer specified in DS1 , and output to four devices
starting from DD1 . 17
Create a proper program according to the purpose while referring to the example shown below.
Transfer 2
Data
FNC100-FNC109
Command
input FNC 65 S m D
STMR
M0 [ DD1 ] : Off-delay timer which turns OFF with delay of the timer set value after the command 19
contact turned OFF
Operation 2
Data
FNC140-FNC149
M1 [ DD1 +1] : One-shot timer which turns ON after the command contact turned OFF from ON, and
turns OFF after the timer set value
M2 [ DD1 +2] : Occupied, and can be used for flicker.
M3 [ DD1 +3] : Occupied.
20
Control
Positioning
FNC150-FNC159
393
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.6 FNC 65 STMR / Special Timer
Command
input
M0 D 10s 10s
M1 D +1 10s 10s
M2 D +2 10s
M3 D +3
Flicker
In the program shown below which turns OFF STMR instruction at the NC contact of DD1 +3, flicker is output
to DD1 +1 and DD1 +2.
DD1 and DD1 +3 are occupied.
S m D
Command
input M3
FNC 65 T10 K100 M0
STMR
M0 [ DD1 ] : Occupied (, and can be used for off-delay timer). (Refer to the previous page.)
M1 [ DD1 +1] : Flicker (NO contact) which turns ON and OFF repeatedly at the interval of timer set value
M2 [ DD1 +2] : Flicker (NC contact) which turns ON and OFF repeatedly at the interval of timer set value
M3 [ DD1 +3] : Occupied.
Command
input
M1 D +1 10s 10s
Cautions
1. Handling of a specified timer
The timer number specified in this instruction cannot be used in other general circuits (such as OUT
instruction).
If the timer number is used in other general circuits, the timer malfunctions.
394
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.7 FNC 66 ALT / Alternate State
11
14.7 FNC 66 ALT / Alternate State
Shift
Rotation and
FNC30-FNC39
Outline
This instruction alternates a bit device (from ON to OFF or from OFF to ON) when the input turns ON.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 66 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
D Bit device number whose output is alternated Bit
14
3. Applicable devices
Instruction
Handy
FMC60-FNC69
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V
3 3 3 S
Z Modify K H
3
E "" P
15
SD2
Device
External FX I/O
FNC70-FNC79
S: "D.b" cannot be indexed with index registers (V and Z).
Device
External FX
FNC80-FNC89
Alternating output (1-step)
Every time the command input turns ON from OFF, a bit device specified in DD1 is alternated (from ON to
OFF or from OFF to ON).
Command
input FNC 66 D
Command input ON ON ON 17
ALTP
Transfer 2
Data
FNC100-FNC109
D ON ON
Command
ON ON ON ON
D input
Command
input FNC 66 M0 M0 D ON ON
ALTP
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
395
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.7 FNC 66 ALT / Alternate State
Caution
1. When using (continuous operation type) ALT instruction
When ALT instruction is used, a specified bit device is alternated in every operation cycle.
To alternate a specified device by turning the command ON or OFF, use the (pulse operation type) ALTP
instruction, or use a pulse operation type command contact such as LDP.
Program examples
1. Start and stop by one input
1) When the pushbutton switch X000 is pressed, the start output Y001 is set to ON.
2) When the pushbutton switch X000 is pressed again, the stop output Y000 is set to ON.
X000
FNC 66 M0
ALTP
M0
Y000 Stop
M0
Y001 Start
2. Flicker operation
1) When the input X006 is set to ON, the contact of the timer T2 turns ON instantaneously every 5 seconds.
2) Every time the contact of T2 turns ON, the output Y007 is set to ON or OFF alternately.
X006 T2 X006 ON
T2 K50
5s 5s 5s 5s 5s 5s 5s
X006 T2
FNC 66 Y007 T2
ALT
Y007 ON ON ON
3. Alternating output operation using auxiliary relays (M) (operation equivalent to ALT
instruction)
The circuit below is provided as an example of alternating operation using basic instructions and auxiliary
relays (M) which is equivalent to ALT instruction.
1) When X000 is set to ON, M0 turns ON and remains ON for only one operation cycle.
2) When M0 turns ON for the first time, Y000 is latched. When M0 turns ON the second time, Y000
becomes unlatched.
X000 M1
M0
X000
M1
M0 Y000
Y000
M0 Y000
396
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.8 FNC 67 RAMP / Ramp Variable Value
11
14.8 FNC 67 RAMP / Ramp Variable Value
Shift
Rotation and
FNC30-FNC39
Outline
This instruction obtains the data which changes between the start value (initial value) and the end value
(target value) over the specified "n" times.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 67 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
S Device number storing the initial value of ramp 16-bit binary
S1
Instruction
Handy
FMC60-FNC69
D Device number storing the current value of ramp 16-bit binary
n Ramp transfer time (scan) 16-bit binary
3. Applicable devices
Oper-
Bit Devices Word Devices Others 15
Special Con- Real Charac-
Device
External FX I/O
FNC70-FNC79
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S
S1 3 3 3
3 3 3
S2
3 3 3
16
SD2
Device
External FX
FNC80-FNC89
n 3 3 3 3
Transfer 2
Data
FNC100-FNC109
ON, the value obtained by adding a value divided equally by "n" times to S
D1 in every operation cycle is
stored to DD1 .
By combining this instruction and an analog output, the cushion start/stop command can be output.
Command
input FNC 67 S1 S2 D n
18
RAMP
Floating Point
FNC110-FNC139
1) In the case of " S1 < S2 " 2) In the case of " S1 > S2 "
S2 S1 D
S2
19
Operation 2
Data
FNC140-FNC149
S1 D
The time from start to the end value is the operation cycle multiplied by "n" times.
397
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.8 FNC 67 RAMP / Ramp Variable Value
If the command input is set to OFF in the middle of operation, execution is paused. (The present data
value stored in DD1 is held, and the number of scans stored in DD1 +1 is cleared.) When the command
input is set to ON again, DD1 is cleared, and the operation is started from S
D1 .
After transfer is completed, the instruction execution complete flag M8029 turns ON, and the DD1 value is
returned to the S
D1 value.
Command
S2
S1
D
(M8029)
When acquiring the operation result at a constant time interval (constant scan mode)
Write a prescribed scan time (which is longer than the actual scan time) to D8039 and set M8039 to ON to
select the constant scan mode in the PLC.
For example, when "20 ms" is written to D8039 and "n" is set to 100, the DD1 value will change from
D1
S to S
D21 in 20 seconds.
Command Command
S2 S2
D
S1 S1
D
(M8029) (M8029)
Related devices
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Device Name Description
Instruction
M8029 Turns ON when D becomes equivalent to S2 after "n" operation cycles.
execution complete
M8026*1 RAMP mode Refer to the operation of the mode flag M8026 described above.
*1. Cleared when the RAMP mode is changed from RUN to STOP.
Caution
398
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.9 FNC 68 ROTC / Rotary Table Control
11
14.9 FNC 68 ROTC / Rotary Table Control
Shift
Rotation and
FNC30-FNC39
Outline
This instruction is suitable for efficient control of the rotary table for putting/taking a product into/out of the
rotary table.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 68 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
Data register for counting 16-bit binary
S
m1 Number of divisions 16-bit binary
14
Instruction
Handy
FMC60-FNC69
m2 Number of low-speed sections 16-bit binary
D Head bit device number to be driven 16-bit binary
3. Applicable devices
Oper-
Bit Devices Word Devices Others 15
Special Con- Real Charac-
Device
External FX I/O
FNC70-FNC79
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3
m1 3 3
m2 3 3 16
Device
External FX
FNC80-FNC89
SD2 3 3 3 S 3
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
399
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.9 FNC 68 ROTC / Rotary Table Control
S +1 Sets the port No. to be called. Set them in advance using a transfer instruction.
D +1 B phase signal
D +3 Forward rotation at high speed Construct an internal contact circuit in advance which is
Forward rotation at low speed driven by the input signal (X)
D +4
D +5 Stop
400
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.9 FNC 68 ROTC / Rotary Table Control
11
Operation conditions
Shift
Rotation and
FNC30-FNC39
The conditions required to use this instruction are as shown in the example below.
1) Rotation detection signal: X DD1
- Provide a 2-phase switch (X000 and X001) for detecting the rotation direction (forward or backward) of
the table and the switch X002 which turns ON when the product No. 0 reaches the port No. 0. 12
- Create the sequence program shown below.
Data Operation
FNC40-FNC49
2-phase switch
D
X000 A
M0 phase
D +1 Up-counting signal during forward rotation
X001
M1
B
phase
13
Processing
High Speed
FNC50-FNC59
D +2
X002
M2 Zero point detection switch
Instruction
Handy
FMC60-FNC69
2) Specification of a register for counting: DS1
The counter DS1 detects which number of product is located at the port No. 0.
3) Registers specifying the calling condition: DS1 +1 and DS1 +2
a) Set the port No. to be called in DS1 +1. 15
Device
External FX I/O
FNC70-FNC79
b) Set the product No. to be called in DS1 +2.
4) Number of divisions m1 and number of low-speed sections m2
Specify the number of divisions m1 of the table, and number of low-speed sections m2.
When the above conditions are specified, forward/backward rotation and high speed/low speed/stop are 16
output to DD1 +3 to DD1 +7 specified by the head device DD1 .
Device
External FX
FNC80-FNC89
Cautions
1. Operations caused by the command input ON/OFF status
When the command input is set to ON and this instruction is executed, the result will be automatically 17
output to DD1 +3 to DD1 +7.
Transfer 2
Data
FNC100-FNC109
When the command input is set to OFF, DD1 +3 to DD1 +7 are set to OFF accordingly.
2. Multiple activation of the rotation detection signal ( DD1 to DD1 +2) in one division
For example, when the rotation detection signal ( DD1 to DD1 +2) is activated 10 times in one division, set a 18
value multiplied by "10" to each division, port No. to be called and product No. to be called.
Floating Point
FNC110-FNC139
As a result, an intermediate value of the division number can be set to a low-speed section.
20
Control
Positioning
FNC150-FNC159
401
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.10 FNC 69 SORT / SORT Tabulated Data
Outline
This instruction sorts a data table consisting of data (lines) and group data (columns) based on a specified
group data (column) sorted by line in ascending order. This instruction stores the group data (columns) in
serial devices.
On the other hand, SORT2 (FNC149) instruction stores the data (lines) in serial devices facilitating the
addition of data (lines), and sorts a table in either ascending or descending order.
For SORT2 (FNC149) instruction, refer to Section 19.7.
1. Instruction format
FNC 69 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
SS1 Head device number storing the data table [which occupies m1 m2 points]
m1 Number of data (lines) [1 to 32]
m2 Number of group data (columns) [1 to 6] 16-bit binary
D Head device number storing the operation result [which occupies m1 m2 points]
n Column number of the group data (column) used as the basis of sorting [1 to m2]
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3
m1 3 3
m2 3 3
SD2 3 3
n 3 3 3 3
402
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.10 FNC 69 SORT / SORT Tabulated Data
11
The data table configuration is explained in an example in which the sorting source data table has 3 lines
Shift
Rotation and
FNC30-FNC39
and 4 columns (m1 = K3, m2 = K4). For the sorting result data table, understand DS1 as DD1 .
Number of groups (m2 = K4)
Column No.
1 2 3 4
Line No. Control number Height Weight Age
12
1 S S +3 S +6 S +9
Data Operation
FNC40-FNC49
Number of
data 2 S +1 S +4 S +7 S +10
(m1 = 3)
3 S +2 S +5 S +8 S +11
When the command input turns ON, data sorting is started. Data sorting is completed after "m1" scans,
and the instruction execution complete flag M8029 is set to ON. 13
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Processing
High Speed
FNC50-FNC59
2. Operation examples
When the instruction is executed with "n = K2 (column No. 2)" and "n = K3 (column No. 3) for the following
sorting source data, the operations shown below are acquired.
It is recommended to put a serial number such as a control number in the first column so that the original line
number can be estimated based on the contents. 14
Instruction
Handy
FMC60-FNC69
Sorting source data
Column No. Number of groups (m2 = K4)
1 2 3 4
Line No. Control number Height Weight Age
S S +5 S + 10 S + 15
15
1
Device
External FX I/O
FNC70-FNC79
1 150 45 20
S +1 S +6 S + 11 S + 16
2
2 180 50 40
Number of
S +2 S +7 S + 12 S + 17
data
(m1 = 5)
3
3 160 70 30 16
Device
External FX
FNC80-FNC89
S +3 S +8 S + 13 S + 18
4
4 100 20 8
S +4 S +9 S + 14 S + 19
5
5 150 50 45
1) Sorting result when the instruction is executed with "n = K2 (column No. 2)"
17
Transfer 2
Data
FNC100-FNC109
Column No. 1 2 3 4
Line No. Control number Height Weight Age
D D +5 D + 10 D +15
1
4 100 20 8
D +1 D +6 D + 11 D + 16
18
2
Floating Point
FNC110-FNC139
1 150 45 20
D +2 D +7 D + 12 D + 17
3
5 150 50 45
D +3 D +8 D + 13 D + 18
4
3 160 70 30 19
Operation 2
Data
FNC140-FNC149
D +4 D +9 D + 14 D + 19
5
2 180 50 40
20
Control
Positioning
FNC150-FNC159
403
FX3U/FX3UC Series Programmable Controllers 14 Handy Instruction FNC 60 to FNC 69
Programming Manual - Basic & Applied Instruction Edition 14.10 FNC 69 SORT / SORT Tabulated Data
2) Sorting result when the instruction is executed with "n = K3 (column No. 3)"
Column No. 1 2 3 4
Line No. Control number Height Weight Age
D D +5 D + 10 D + 15
1
4 100 20 8
D +1 D +6 D + 11 D + 16
2
1 150 45 20
D +2 D +7 D + 12 D + 17
3
2 180 50 40
D +3 D +8 D + 13 D + 18
4
5 150 50 45
D +4 D +9 D + 14 D + 19
5
3 160 70 30
Related device
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Device Name Description
Instruction
M8029 Turns ON when sorting is completed.
execution complete
Cautions
Do not change the contents of operands and data while the instruction is executed.
Before executing the instruction again, set the command input to OFF.
Limitation in the number of instructions
Only one instruction can be used in a program.
When the same device is specified in DS1 and DD1
The source data is overwritten by the data acquired by sorting.
Take special care so that the contents of DS1 are not changed until execution is completed.
404
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition
11
Shift
Rotation and
FNC30-FNC39
15. External FX I/O Device FNC 70 to FNC 79
FNC 70 to FNC 79 provide instructions to receive data from and send data to external devices mainly using 12
inputs and outputs in PLCs.
Data Operation
FNC40-FNC49
Because these instructions easily achieve complicated controls with a minimum required sequence program
and external wiring, they are similar to handy instructions described in the preceding chapter.
FROM and TO instructions essential for controlling special units and special blocks are included in this group.
(In FX3U and FX3UC PLCs, transfer can be executed also by MOV instruction.)
13
Processing
High Speed
FNC50-FNC59
FNC No. Mnemonic Symbol Function Reference
Section
70 TKY TKY S D1 D2 Ten Key Input
15.1
Section
71 HKY HKY S D1 D2 D3 Hexadecimal Input
15.2 14
Instruction
Handy
FMC60-FNC69
Section
72 DSW DSW S D1 D2 n Digital switch (thumbwheel input)
15.3
Section
73 SEGD SEGD S D Seven Segment Decoder
15.4
Section
15
74 SEGL SEGL S D n Seven Segment With Latch
Device
External FX I/O
FNC70-FNC79
15.5
Section
75 ARWS ARWS S D1 D2 n Arrow Switch
15.6
Device
External FX
FNC80-FNC89
Section
77 PR PR S D Print (ASCII Code)
15.8
Section
78 FROM FROM m1 m2 D n Read From A Special Function Block
15.9
17
Section
Transfer 2
Data
FNC100-FNC109
79 TO TO m1 m2 S n Write To A Special Function Block
15.10
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
405
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.1 FNC 70 TKY / Ten Key Input
Outline
This instruction sets data to timers and counters through inputs of the ten keys from "0" to "9".
1. Instruction format
FNC 70 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D TKY 7 steps TKY Continuous
13 steps DTKY Continuous
Operation Operation
2. Set data
Operand Type Description Data Type
Head bit device number from which one of the ten keys is input [10 devices are
S Bit
occupied]
D1 Word device number storing the data 16- or 32-bit binary
Head bit device number storing the key pressing information [11 devices are
D2 Bit
occupied]
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 S 3
D1 3 3 3 3 3 3 3 3 3 3 3
D2 3 3 3 S 3
406
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.1 FNC 70 TKY / Ten Key Input
11
2) Key pressing information [ D2 to D2 +10]
Shift
Rotation and
FNC30-FNC39
- For the key pressing information, D2 to D2 +9 turn ON or OFF according to the pressed keys.
- For the key sensing output, D2 +10 turns ON when any key is pressed.
Command
input S [4]
FNC 70
TKY
S D1 D2 12
Data Operation
FNC40-FNC49
[2]
The figure below shows an example of FX3U PLC (sink
input). S +2 [1]
For wiring details, refer to the following manual.
FX3U Hardware Edition S +3 [3]
Ten keys 0 1 2 3 4 5 6 7 8 9
13
Processing
High Speed
FNC50-FNC59
S +9
D2
24V 0V S/S S S S S S S S S S S
pressing information
D2 +1
Instruction
Handy
FMC60-FNC69
PLC D2 +2
D2 +3
D2 +9
15
Device
External FX I/O
FNC70-FNC79
D2 +10 [1] [2] [3] [4]
Key sensing output
"2130" is stored in D1 . 16
2. 32-bit operation (DTKY)
Device
External FX
FNC80-FNC89
[ D1 +1, D1 ] store a numeric value input from S to S +9 connected to the ten keys. Output
informations for key pressing and key sensing are output to D2 to D2 +10.
1) Input numeric value [ D1 ]
- When an input value is larger than "99,999,999", it overflows from the most significant digit.
- An input numeric value is stored in the binary format.
17
Transfer 2
Data
FNC100-FNC109
2) Key pressing information [ D2 to D2 +10]
- For the key pressing information, D2 to D2 +9 turn ON or OFF according to the pressed keys.
- For the key sensing output, D2 +10 turns ON when any key is pressed.
Command
input FNC 70
18
S D1 D2
Floating Point
FNC110-FNC139
DTKY
For the ten-key connection example and key pressing information, refer to the 16-bit operation (TKY) shown
above.
Cautions 19
Operation 2
Data
FNC140-FNC149
407
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.1 FNC 70 TKY / Ten Key Input
Program example
In the program example shown below, the input X000 is set as the head bit device, and the ten keys "0" to "9"
are connected.
1. Program
S D1 D2
X030
FNC 70 X000 D0 M10
TKY
2. Connection diagram
This connection diagram shows an example of FX3U PLC (sink input).
For wiring details, refer to the following manual.
FX3U Hardware Edition
Ten keys 0 1 2 3 4 5 6 7 8 9
24V 0V S/S X000 X001 X002 X003 X004 X005 X006 X007 X010 X011
PLC
408
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.1 FNC 70 TKY / Ten Key Input
11
3. Timing chart
Shift
Rotation and
FNC30-FNC39
X000 [4]
1) When the ten keys are pressed in the order "[1] [2]
[3] [4]" shown in the figure, "2130" is stored in (D0).
X001 [2]
When an input value is larger than "9999", it overflows
from the most significant digit.
(An input numeric value is stored in the binary format in X002 [1] 12
D0).
Data Operation
FNC40-FNC49
X003 [3]
2) When X002 is pressed, M12 turns ON and remains ON
until another key is pressed. Other keys work in the
same way. X011
In this way, M10 to M19 turn ON and OFF according to
the inputs X000 to X011. M 10 13
3) When pressing a key, the key sensing output M20 is ON
Processing
High Speed
FNC50-FNC59
only while it is pressed. M 11
M 12
M 13 14
Instruction
Handy
FMC60-FNC69
M 19
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
409
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.2 FNC 71 HKY / Hexadecimal Input
Outline
This instruction multiplexes four X-devices and four Y-devices to allow for 16 key (0 to F) 4-digit (byte) input.
Keys 0 to 9 stores numerical values, and keys A to F represent function keys.
When the extension function is set to ON, hexadecimal keys 0 to F all store their corresponding numerical
values.
1. Instruction format
FNC 71 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D HKY 9 steps HKY Continuous
17 steps DHKY Continuous
Operation Operation
2. Set data
Operand Type Description Data Type
S Head X device number to be used (Four devices occupied.) Bit
D2 Device number storing the numerical input from the 16 keys 16- or 32-bit binary
Head bit device number storing the key pressing information
D3 Bit
(Eight devices are occupied.)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3
D1 3 3
D2 3 3 3 3 3 3 3 3
D3 3 3 3 S 3
410
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.2 FNC 71 HKY / Hexadecimal Input
11
1) Input of a numeric value through keys 0 to 9:
Shift
Rotation and
FNC30-FNC39
- When an input value is larger than "9999", it overflows from the most significant digit.
- The numeric value input is stored to D2 in binary.
- The key sensing output D3 +7 turns ON when any key 0 to 9 is pressed.
2) Key pressing information for the keys A to F: 12
- Six devices starting from D3 corresponding to keys A to F turn ON.
Data Operation
FNC40-FNC49
- The key sensing output D3 +6 turns ON when any key A to F is pressed.
Key Key pressing information Key Key pressing information
A D3 D D3 +3
B D3 +1 E D3 +4 13
Processing
High Speed
FNC50-FNC59
C D3 +2 F D3 +5
Instruction
Handy
FMC60-FNC69
When a key A to F is pressed, the corresponding key press information bit [ D3 to D3 +5] turns ON. and
D3 +6 turns ON.
Command
input FNC 71 S D1 D2 D3
DHKY 15
Device
External FX I/O
FNC70-FNC79
1) Input of a numeric value through keys 0 to 9:
- When an input value is larger than "99,999,999", it overflows from the most significant digit.
- The numeric value input is stored to [ D2 +1, D2 ] in binary.
- The key sensing output D3 +7 turns ON when any key 0 to 9 is pressed.
2) Key pressing information for the keys A to F: 16
Device
External FX
FNC80-FNC89
Six devices starting from D3 corresponding to keys A to F turn ON.
The key sensing output D3 +6 turns ON when any key A to F is pressed.
Extension function
When M8167 is set to ON making the extension function valid, the numerical values for keys 0 to F are stored 17
in binary.
Transfer 2
Data
FNC100-FNC109
When the extension function is valid, the function and opearation are the same except for the following.
- Example:
When "1 2 3 B F" is input, numerical value "23BF" is stored in D2 in binary.
"1" overflows when "F" is input.
Command
input
M8167
19
Operation 2
Data
FNC140-FNC149
FNC 71 S D1 D2 D3
HKY
20
Control
Positioning
FNC150-FNC159
411
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.2 FNC 71 HKY / Hexadecimal Input
FNC 71 S D1 D2 D3
DHKY
Related devices
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Device Name Description
Turns ON/OFF the hexadecimal data handling function of HKY (FNC 71) instruction.
M8167 Extension function flag OFF: Ten-keys and function keys
ON: Hexadecimal keys
Cautions
1. Limitation in the number of instructions
HKY or DHKY instruction can be used only once in a program.
When TKY and/or DTKY instruction should be used two or more times, use the indexing (V, Z) function.
6. Output format
Use a transistor output type PLC.
412
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.2 FNC 71 HKY / Hexadecimal Input
11
Program example
Shift
Rotation and
FNC30-FNC39
S D1 D2 D3
X004
FNC 71 X000 Y000 D 0 M 0
HKY
The figure below shows an example of the FX3U series main unit (sink input/sink output). 12
For wiring details, refer to the following manual.
Data Operation
FNC40-FNC49
FX3U Hardware Edition
External
wiring C D E F
13
8 9 A B
Processing
High Speed
FNC50-FNC59
4 5 6 7
0 1 2 3 14
Instruction
Handy
FMC60-FNC69
24V 0V S/S X000 X001 X002 X003
PLC
Transistor output 15
COM1 Y000 Y001 Y002 Y003
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
413
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.3 FNC 72 DSW / Digital Switch (Thumbwheel Input)
Outline
This instruction reads the set value of digital switches.
This instruction can read a set of 4 digits (n = K1) or two sets of 4 digits (n = K2).
1. Instruction format
FNC 72 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
DSW Continuous
9 steps DSW Operation
2. Set data
Operand Type Description Data Type
Head device (X) number connected to a digital switch
S Bit
(Four devices are occupied.)
Head device (Y) number to which the strobe signal is output
D1 Bit
(Four devices are occupied.)
Device number storing the numeric value of a digital switch
D2 16-bit binary
("n" devices are occupied.)
n Total number of 4-digit switch sets (4 digits/set) (n = 1 or 2) 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3
D1 3 3
D2 3 3 3 3 3 3 3 3
n 3 3
1) Data D1
- A numeric value from 0 to 9999 (up to 4 digits) can be read.
- A numeric value is stored in the binary format.
- The first set is stored to D2 , and the second set is stored to D2 +1.
414
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.3 FNC 72 DSW / Digital Switch (Thumbwheel Input)
11
2) Specification of the number of sets ("n")
Shift
Rotation and
FNC30-FNC39
- When using one set of 4 digits [n = k1]
A 4-digit BCD digital switch connected to S to S +3 is read in turn by the strobe signal D1 to
D1 +3, and stored in the binary format to D2 .
- When using two sets of 4 digits [n = k2]
A 4-digit BCD digital switch connected to S to S +3 is read in turn by the strobe signal D1 to
12
Data Operation
FNC40-FNC49
D1 +3, and stored in the binary format to D2 .
A 4-digit BCD digital switch connected to S +4 to S +7 is read in turn by the strobe signal D1
to D1 +3, and stored in the binary format to D2 +1.
Related devices 13
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Processing
High Speed
FNC50-FNC59
Device Name Description
OFF: Data is being output to D1 to D1 +3 or the instruction is not executed yet.
Instruction execution
M8029 ON: A cycle operation of outputting data to D1 to D1 +3 (scan of the 1st to 4th
complete flag
digits) is completed.
14
Instruction
Handy
FMC60-FNC69
Cautions
1. When the command contact turns OFF
Though the contents of D2 do not change, all of D1 to D1 +3 turn OFF.
Device
External FX I/O
FNC70-FNC79
1) When two sets of 4 digits (n = K2) are used, two devices are occupied starting from D2 .
2) When one set of 4 digits is used, four devices are occupied starting from S . When two sets of 4 digits
is used, eight devices are occupied starting from S .
Device
External FX
FNC80-FNC89
unused digits are occupied also by this instruction, however, they cannot be used for any other purpose.
Make sure to leave unused outputs vacant.
Transfer 2
Data
FNC100-FNC109
5. Digital switches
Use BCD output type digital switches.
Program example
In the program example shown below, digital switches are connected to inputs starting from X010 and outputs
18
Floating Point
FNC110-FNC139
from Y010.
1. Program
S D1 D2 n
X000
FNC 72
DSW
X010 Y010 D 0 K 1 19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
415
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.3 FNC 72 DSW / Digital Switch (Thumbwheel Input)
2. Connection diagram
The figure below shows an example of the FX3U series main unit (sink input/sink output).
For wiring details, refer to the following manual.
FX3U Hardware Edition
100 To
101 second
102 set
103
BCD type 100 101 102 103
digital
switch BCD type
digital
Diode of switch
0.1 A, 50 V
is required.
1 To
2 second
3 set
1 2 4 8 1 2 4 8 4
24V 0V S/S X010 X011 X012 X013 X014 X015 X016 X017
Inputs of first set Inputs of second set
PLC
COM3 Y010 Y011 Y012 Y013
100 101 102 103
3. Timing chart
X000
Repeated
Y010 0.1 sec operation 0.1 sec 0.1 sec
X000
SET M 0
M 0
FNC 72 X010 Y010 D 0 K 1
DSW
M8029
RST M 0
1) While M0 (digital switch read input) is ON, DSW (FNC 72) is driven.
2) DSW (FNC 72) completes one cycle of operation, and remains driven until the execution complete flag
(M8029) turns ON.
416
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.4 FNC 73 SEGD / Seven Segment Decoder
11
15.4 FNC 73 SEGD / Seven Segment Decoder
Shift
Rotation and
FNC30-FNC39
Outline
This instruction decodes data, and turns the seven-segment display unit (1 digit) ON.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 73 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
SEGD P 5 steps SEGD Continuous
Operation
SEGDP Pulse (Single)
Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S Head word device to be decoded 16-bit binary
Word device number storing the data to be displayed in the seven-segment
D
display unit
16-bit binary 14
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 15
Device
External FX I/O
FNC70-FNC79
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
Device
External FX
FNC80-FNC89
"0" to "F" (hexadecimal numbers) in low-order 4 bits (1 digit) of S are decoded to data for the seven-
segment display unit, and stored the low-order 8 bits of D .
Command
input FNC 73
SEGD
S D
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
417
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.4 FNC 73 SEGD / Seven Segment Decoder
0 0 0 0 0 0 0 1 1 1 1 1 1
1 0 0 0 1 0 0 0 0 0 1 1 0
2 0 0 1 0 0 1 0 1 1 0 1 1
3 0 0 1 1 0 1 0 0 1 1 1 1
4 0 1 0 0 0 1 1 0 0 1 1 0
5 0 1 0 1 0 1 1 0 1 1 0 1
6 0 1 1 0 0 1 1 1 1 1 0 1
7 0 1 1 1 0 0 1 0 0 1 1 1
8 1 0 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 0 1 1 0 1 1 1 1
A 1 0 1 0 0 1 1 1 0 1 1 1
B 1 0 1 1 0 1 1 1 1 1 0 0
C 1 1 0 0 0 0 1 1 1 0 0 1
D 1 1 0 1 0 1 0 1 1 1 1 0
E 1 1 1 0 0 1 1 1 1 0 0 1
F 1 1 1 1 0 1 1 1 0 0 0 1
Caution
1. Number of occupied devices
Low-order 8 bits of D are occupied, and high-order 8 bits do not change.
418
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.5 FNC 74 SEGL / Seven Segment With Latch
11
15.5 FNC 74 SEGL / Seven Segment With Latch
Shift
Rotation and
FNC30-FNC39
Outline
This instruction controls one or two sets of 4-digit seven-segment display units having the latch function.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 74 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
SEGL Continuous
7 steps SEGL Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S Head word device converted into the BCD format 16-bit binary
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
15
Device
External FX I/O
FNC70-FNC79
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3
n 3 3
Device
External FX
FNC80-FNC89
1. 16-bit operation (SEGL)
The 4-digit numeric value stored in S is converted into BCD data, and each digit is output to the seven-
segment display unit with the BCD decoder in the time division method.
Command
input FNC 74 S D n
17
SEGL
Transfer 2
Data
FNC100-FNC109
When using one set of 4 digits (n = K0 to K3)
For selection of "n", refer to Subsection 15.5.2.
1) Data and strobe signal 18
A 4-digit numeric value stored in S is converted from binary into BCD, and each digit is output in turn
Floating Point
FNC110-FNC139
20
Control
Positioning
FNC150-FNC159
419
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.5 FNC 74 SEGL / Seven Segment With Latch
PLC
(transistor output type)
COM D D +1 D +2 D +3 D +4 D +5 D +6 D +7 COM D +10 D +11 D +12 D +13
1 2 4 8 100 101 102 103 1 2 4 8
420
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.5 FNC 74 SEGL / Seven Segment With Latch
11
Related devices
Shift
Rotation and
FNC30-FNC39
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Device Name Description
Instruction execution
M8029 Turns ON when output of 4 digits is finished.
complete flag
12
Data Operation
FNC40-FNC49
Cautions
1. Time to update the 4-digit seven-segment display
The scan time (operation cycle) multiplied by 12 is required to update (one or two sets of) the 4-digit display.
Processing
High Speed
FNC50-FNC59
When the command contact is set to OFF in the middle of an operation, the operation is paused. When the
command contact is set to ON again, the operation is started from the beginning.
Instruction
Handy
FMC60-FNC69
the number of digits is smaller than 4, unused devices cannot be used
for any other purpose.
When two sets of 4 digits are used: 2 devices are occupied from the head device specified in S .
Twelve devices are occupied from the head device specified in D .
Even if the number of digits is smaller than 4, unused devices cannot be 15
used for any other purpose.
Device
External FX I/O
FNC70-FNC79
4. Scan time (operation cycle) and the display timing
SEGL instruction is executed in synchronization with the scan time (operation cycle) of the PLC.
For achieving a series of display, the scan time of the PLC should be 10 ms or more.
If the scan time is less than 10 ms, use the constant scan mode so that the scan time exceeds 10 ms.
16
5. Output type of the PLC
Device
External FX
FNC80-FNC89
Use a transistor output type PLC.
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
421
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.5 FNC 74 SEGL / Seven Segment With Latch
Pull-up V+
+V0
resistor ON
Logic 1 HIGH
Output circuit Y000 Logic 1
Y000
ON
LOW Pull-
down
COM1 resistor
PLC PLC
Because transistor output (sink) is provided, the Because transistor output (source) is provided, the
output becomes low level (0 V) when the internal output becomes high level (V+) when the internal
Description
logic is "1 (ON output)". This is called "negative logic is "1 (ON output)". This is called "positive
logic." logic."
Check
422
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.5 FNC 74 SEGL / Seven Segment With Latch
11
3. Confirming the logic of the seven-segment display unit
Shift
Rotation and
FNC30-FNC39
1) Data input
Logic Negative logic Positive logic
D H H D H L H L
1 1
D +1 2
H D +1 2
H L 12
H
Timing chart D +2 4 D +2 4
Data Operation
FNC40-FNC49
D +3 8 D +3 8 H
Seven-segment Seven-segment
display display
Description BCD data at low level BCD data at high level
Check 13
Processing
High Speed
FNC50-FNC59
2) Strobe signal
Logic Negative logic Positive logic
D 1 H D 1 H
14
...
...
...
...
D +3 8 D +3 8
Instruction
Handy
FMC60-FNC69
Timing chart
D +4 to D +7 H H D +4 to D +7 L H L H
Change in Change in
strobe display Nothing Nothing strobe display Nothing Nothing
Latch Latch
Description Data latched at low level is held. Data latched at high level is held. 15
Check
Device
External FX I/O
FNC70-FNC79
4. Setting the parameter "n"
Set a proper value according to the logic (positive or negative) of the PLC and the logic (positive or negative)
of the seven-segment display unit as shown in the table below:
Device
External FX
FNC80-FNC89
Negative logic (match) 0 4
Negative logic (match)
Positive logic (mismatch) 1 5
Negative logic
Positive logic (match) 2 6
Positive logic (mismatch)
Negative logic (mismatch) 3 7
Positive logic (match) 0 4
17
Positive logic (match)
Transfer 2
Data
FNC100-FNC109
Negative logic (mismatch) 1 5
Positive logic
Positive logic (mismatch) 2 6
Negative logic (mismatch)
Negative logic (match) 3 7
connected (4 digits 1 set) or "5" when two display units are connected (4 digits 2 sets).
1) Transistor output of PLC
- Sink output = Negative logic
- Source output = Positive logic
2) Seven-segment display unit 19
- Data input = Negative logic
Operation 2
Data
FNC140-FNC149
Negative logic
Positive logic (match) 2 6
Positive logic (mismatch)
Negative logic (mismatch) 3 7
423
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.6 FNC 75 ARWS / Arrow Switch
Outline
This instruction inputs data through arrow switches used for shifting the digit and incrementing/decrementing
the numeric value in each digit.
1. Instruction format
FNC 75 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
ARWS Continuous
9 steps ARWS Operation
2. Set data
Operand Type Description Data Type
S Head bit device number to be input 16- or 32-bit binary
D1 Word device number storing data converted into BCD 16- or 32-bit binary
D2 Head bit device (Y) number connected to seven-segment display unit 16- or 32-bit binary
n Number of digits of seven-segment display unit [setting range: K0 to K3] 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 S 3
D1 3 3 3 3 3 3 3 3
D2 3 3
n 3 3
424
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.6 FNC 75 ARWS / Arrow Switch
11
Explanation of function and operation
Shift
Rotation and
FNC30-FNC39
Four arrow switches are connected to the inputs S to S +3, a seven-segment display unit having the
BCD decoder is connected to the outputs D2 to D2 +7, and a numeric value is input to D1 .
Data Operation
FNC40-FNC49
When the command input is set to ON, ARWS instruction executes the following operation.
Command
input
FNC 75 S D1 D2 n
ARWS
13
Contents of the display and operation part
Processing
High Speed
FNC50-FNC59
Display/operation panel
103
D2 +7
Strobe output
102
101
D2 +6
To outputs in 14
D2 +5 PLC
Instruction
Handy
FMC60-FNC69
100
D2 +4
Display for
selected digit
Device
External FX I/O
FNC70-FNC79
8
Numeric value
D2 +3
4
output
Increment D2 +2 To outputs in
2
D2 +1 PLC 16
S +1 1
Device
External FX
FNC80-FNC89
D2
Higher Lower S +3
digit digit
Switches
S +3 S +2 S +2 To inputs in
S PLC
S +1
Decrement S
17
Transfer 2
Data
FNC100-FNC109
Arrow switches
Provided to select a digit and increment or
decrement the numeric value in the selected digit.
1) Specifying the number of digits of the seven-segment display unit having the BCD decoder n
In the explanation below, "n" is set to "4" (up to the 103 digit). 18
Floating Point
FNC110-FNC139
20
Control
Positioning
FNC150-FNC159
425
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.6 FNC 75 ARWS / Arrow Switch
4) Operation of the switches for changing data in each digit ( S and S +1)
In a digit specified by a digit selection switch described above, data is changed as follows:
- When the increment input turns ON
Every time the increment switch is pressed, the contents of D1 change in the way "0 1 2 ...
8 9 0 1".
- When the decrement input turns ON
Every time the decrement switch is pressed, the contents of D1 change in the way "0 9 8 7
... 1 0 9".
The contents can be displayed in the seven-segment display unit.
As described above, a target numeric value can be written to D1 using a series of operation while
looking at the seven-segment display unit.
Cautions
1. Setting of the parameter "n"
Refer to the explanation of parameter setting in SEGL (FNC 74) instruction. The setting range is from 0 to 3
for ARWS instruction.
For the parameter setting, refer to Subsection 15.5.2.
426
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.6 FNC 75 ARWS / Arrow Switch
11
Program example
Shift
Rotation and
FNC30-FNC39
1. When changing the timer number and displaying the current value
1) Specifying the timer number using a 3-digit digital switch
X010
X011
12
Data Operation
FNC40-FNC49
X012
X013
8 4 2 1 8 4 2 1 8 4 2 1 13
Processing
High Speed
FNC50-FNC59
102 101 100
Y012 Y011 Y010
2) Setting the constant of the timer using the arrow switches
Y007 Y006 Y005 Y004
14
Read 1
Instruction
Handy
FMC60-FNC69
Y000
Y014 2
Y001
4
Y015 Y002
8
Write Y003
Read
15
Set
Device
External FX I/O
FNC70-FNC79
Write
X004 X003 X002 X000 X001
Explanation of operation
Every time the read/write key is pressed, the read/write LED lights alternately.
In reading 16
Device
External FX
FNC80-FNC89
Set the timer number using the digital switch, and then press the set switch (X003).
In writing
Set a numeric value using the arrow switches while looking at the seven-segment display unit, and then
press the switch X003.
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
427
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.6 FNC 75 ARWS / Arrow Switch
Program
T0 D300
T1 D301 Practical
timer circuit
T99 D399
X000
M0 Decrement
X001
M1 Increment
X002
M2 Higher digit
M8000
M3 Lower digit
RUN monitor
X004
FNC 66 M100
Read/write ALTP
M100
Y014 Read indication
M100
Y015 Write indication
Y014 X003
FNC 72 X010 Y010 Z K1
Read Set DSW
Digital switch Z 4 digits 1 set
Y014
FNC 74 T0Z Y000 K 1 4 digits 1 set
Read SEGL Negative logic
T0Z Seven-segment display unit
Y015
FNC 12 D300Z D511
Write MOVP
FNC 75 M0 D511 Y000 K1
ARWS
(M 0 to M 3) (D511) (Y000 to Y007)
Seven-segment display unit
4 digits 1 set
Y015 X003
FNC 12 D511 D300Z
Write Set MOVP
428
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.7 FNC 76 ASC / ASCII Code Data Input
11
15.7 FNC 76 ASC / ASCII Code Data Input
Shift
Rotation and
FNC30-FNC39
Outline
This instruction converts a half-width alphanumeric character string into ASCII codes.
Use this instruction for selecting one among two or more messages and displaying it on an external display
12
Data Operation
FNC40-FNC49
unit.
1. Instruction format
FNC 76 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
ASC 11 steps ASC Continuous
Operation 13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
Instruction
Handy
FMC60-FNC69
D Head word device number storing ASCII data 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Index
Con- Real Charac-
Pointer 15
Unit stant Number ter String
Type
Device
External FX I/O
FNC70-FNC79
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
*1
S 3
D 3 3 3 3 3 3
*1. It is not necessary to attach quotes (" ") to the character string specified in S . 16
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (ASC)
The half-width alphanumeric characters specified in S are converted into ASCII codes, and each ASCII
code is transferred in turn to D . 17
Transfer 2
Data
FNC100-FNC109
S can handle half-width characters A to Z, 0 to 9 and symbols (, but cannot handle regular-width
characters).
A character string is entered when a program is created with a programming tool.
D stores converted ASCII codes in the order of low-order 8 bits and high-order 8 bits by 2 characters/
byte at one time. 18
Floating Point
FNC110-FNC139
D +2 46 (F) 45 (E)
19
Operation 2
Data
FNC140-FNC149
D +3 48 (H) 47 (G)
20
Control
Positioning
FNC150-FNC159
429
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.7 FNC 76 ASC / ASCII Code Data Input
Extension function
When M8161 is set to ON for making the extension function valid, a half-width alphanumeric character string
specified in S is converted into ASCII codes, and transferred in turn only to low-order 8 bits (1 byte) of
D .
Command
input
M8161
FNC 76 S D
ASC
D +1 00 42 B
D +2 00 43 C
D +3 00 44 D
D +4 00 45 E
D +5 00 46 F
D +6 00 47 G
D +7 00 48 H
Related devices
Device Name Description
8-bit processing mode for ASC (FNC 76), RS (FNC 80), ASCI (FNC 82), HEX (FNC
83) and CCD (FNC 84) instructions
M8161 Extension function flag OFF: Two characters are stored to low-order 8 bits and high-order 8 bits in this order
at one time (2 characters/word).
ON: One character is stored to low-order 8 bits at one time (1 character/word).
Caution
1. Number of occupied devices
1) While the extension function is OFF
- D occupies as many devices as the number of characters divided by "2". (The decimal point is
rounded up.)
2) While the extension function is ON
- D occupies as many devices as the number of characters in the character string.
2. When using RS (FNC 80), ASCI (FNC 82), HEX (FNC 83) and/or CCD (FNC 84) instructions
The extension function flag M8161 is also used for other instructions.
When using an instruction described above and the ASC instruction in the same program, make sure to set
M8161 to ON or OFF just before the ASC instruction so that M8161 does not apply to another instruction.
430
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.8 FNC 77 PR / Print (ASCII Code)
11
15.8 FNC 77 PR / Print (ASCII Code)
Shift
Rotation and
FNC30-FNC39
Outline
This instruction outputs ASCII code data to outputs (Y) in parallel.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 77 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
PR Continuous
5 steps PR Operation
13
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
Character string
S Head device number storing ASCII code data
(only ASCII codes)
D Head output (Y) number to which ASCII code data is output Bit 14
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 15
3 3 3 3 3
Device
External FX I/O
FNC70-FNC79
S
D 3 3
Device
External FX
FNC80-FNC89
ASCII codes stored in low-order 8 bits (1 byte) of S to S +7 are output to D to D +7 in turn by
one character at a time in the time division method.
Command
input FNC 77 S D
PR
17
The timing chart below shows a case in which the following ASCII codes are stored in S to S +7.
Transfer 2
Data
FNC100-FNC109
Eight bytes are sent from S = "A" at first to " S +7 = "H" at the end.
S S +1 S +2 S +3 S +4 S +5 S +6 S +7
A (H41) B (H42) C (H43) D (H44) E (H45) F (H46) G (H47) H (H48)
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
431
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.8 FNC 77 PR / Print (ASCII Code)
2. Timing chart
Command input
S1 S1 +1 S1 +2 S1 +3 S1 +7
D to D +7 Data A B C D H
T0 T0
T0: Scan time (ms)
T0
D +8 Strobe
D +9 Execution flag
Extension function
1. 16-byte serial output
Depending on the ON/OFF status of the special auxiliary relay M8027, the number of characters output by
one-time execution of the instruction varies.
While M8027 is OFF, 8-byte serial output (fixed to 8 characters) is executed. While M8027 is ON, 16-byte
serial output (1 to 16 characters) is executed.
In the example shown below, up to 16 characters (1 character/byte) are output to the display unit (external
display unit A6FD, for example).
It is supposed that data to be displayed is stored in hexadecimal codes in D300 to D307.
1) Connection example of the external display unit A6FD*1
The PLC shown in the example below is the FX2N-16EYT (sink input/sink output) connected to the
FX3U-32M.
PLC
COM1 Y020 Y021 Y022 Y023 Y024 Y025 Y026 Y027 COM2 Y030 Y031 Y032 Y033
NC
12V
24V AC100/200V
COM D 0 D 1 D 2 D 3 D 4 D 5 D 6 D 7 STR AC AC
*1. A6FD was distributed only inside Japan, however, production of the external display unit A6FD was
terminated in November 2002.
432
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.8 FNC 77 PR / Print (ASCII Code)
11
2) Timing chart (while M8027 is ON)
Shift
Rotation and
FNC30-FNC39
Operation is started when X000 turns ON from OFF.
Drive input X000
Data Operation
FNC40-FNC49
T: Operation cycle
or interrupt time
Strobe Y010
Processing
High Speed
FNC50-FNC59
Execution complete flag M8029
* If "H00 (NUL code)" is contained in the data (16 characters), the character just before "H00 (NUL code)"
is handled as the last character.
Related devices 14
Instruction
Handy
FMC60-FNC69
Device Name Description
OFF: 8-byte serial output (fixed to 8 characters)
M8027*1 PR mode
ON: 16-byte serial output (1 to 16 characters)
Device
External FX I/O
FNC70-FNC79
1. Command input and instruction operation
While the command input is ON: Even if the command input is continuously ON or if the pulse operation type
instruction is used, execution is completed after a series of outputs. M8029
turns ON only while M8027 is ON.
While the command input is OFF: All outputs are OFF. 16
Device
External FX
FNC80-FNC89
2. Relationship with the scan time (operation cycle)
This instruction is executed in synchronization with the scan time.
If the scan time is short, the constant scan mode can be used. If the scan mode is too long, the timer interrupt
function can be used.
Transfer 2
Data
FNC100-FNC109
Use a transistor output type PLC.
4. When "00H (NUL code)" is contained in the data (while M8027 is ON)
The instruction is executed completely, and the data after "00H" is not output.
M8029 remains ON during one operation cycle.
18
5. This instruction can only be executed twice in a program.
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
433
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.9 FNC 78 FROM / Read From A Special Function Block
Outline
This instruction reads the contents of buffer memories (BMF) in a special extension unit/block attached to a
PLC.
When a large capacity of buffer memory (BFM) data is read by this instruction, a watchdog timer error may
occur. When bad effect is not given to the control even if data to be read is divided, use RBFM (FNC278)
instruction.
For RBFM (FNC278) instruction, refer to Section 31.1.
1. Instruction format
FNC 78 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D FROM P 9 steps FROM Continuous
17 steps DFROM
Continuous
Operation Operation
FROMP Pulse (Single) DFROMP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type
Unit number of a special extension unit/block
m1 16- or 32-bit binary
(K0 to K7 from the right side of the main unit)
m2 Transfer source buffer memory (BFM) number 16- or 32-bit binary
D Transfer destination device number 16- or 32-bit binary
n Number of transfer points 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
m1 3 3 3 3
m2 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3
n 3 3 3 3
434
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.9 FNC 78 FROM / Read From A Special Function Block
11
2. 32-bit operation (DFROM and DFROMP)
Shift
Rotation and
FNC30-FNC39
Special extension unit/block (BFM) PLC (word device)
"n" 32-bit data starting from the buffer memory (BFM) # [m2+1, m2] inside a special extension unit/block No.
m1 are transferred (read) to "n" devices starting from [ D +1, D ] inside a PLC.
Command
input
12
FNC 78 m1 m2 D n
Data Operation
FNC40-FNC49
DFROM
Number of transfer points
n = 1 to 16383
Transfer destination (PLC)
Transfer source BFM #
(Special extension unit/block)
m2 = 0 to 32765
13
Processing
High Speed
FNC50-FNC59
Unit No.
m1 = 0 to 7
Related devices
Device Name Description 14
Instruction
Handy
FMC60-FNC69
Disables or enables interrupts while FROM/TO instruction is executed.
For details, refer to "Acceptance of interrupts while FROM/TO instruction is
executed (M8028)" on the next page.
M8028 Enable interrupt flag
OFF: Disables interrupts.
(Interrupts are executed after FROM/TO instruction is executed.)
ON: Enables interrupts.
15
Device
External FX I/O
FNC70-FNC79
Cautions
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
435
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.9 FNC 78 FROM / Read From A Special Function Block
Program examples
In programs, the contents of buffer memories (BFMs) in special extension unit/blocks are read (transferred) to
data registers (D), extension registers (R) or auxiliary relays (M) with digit specification using an applied
instruction such as FROM, MOV and BMOV.
Example: When the BFM #4 (abnormal station information) in the CC-Link/LT master unit (whose unit number
is fixed to "0") built in the FX3UC-32MT-LT is read to D0
- In case of FROM instruction
M8000 FNC 78 K0 K4 D0 K1
FROM
Unit BFM #4 Transfer Number of
No. 0 destination transfer
points
436
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.9 FNC 78 FROM / Read From A Special Function Block
11
15.9.1 Common items between FROM instruction and TO instruction (details)
Shift
Rotation and
FNC30-FNC39
Contents specified by operands
1. Unit number "m1" of a special extension unit/block
Use the unit number to specify which equipment FROM/TO instruction works for.
12
Data Operation
FNC40-FNC49
Setting range: K0 to K7
Unit
No. 0
Built-in Unit Unit Unit
CC-Link/LT No.1 No.2 No.3
FX3UC-
13
I/O Special Special I/O Special
32MT-
Processing
High Speed
FNC50-FNC59
extension extension extension extension extension
LT main
block block block block block
unit
A unit number is automatically assigned to each special extension unit/block connected to a PLC.
The unit number is assigned in the way "No. 0 No. 1 No. 2 ..." starting from the equipment nearest to the
main unit.
14
Instruction
Handy
FMC60-FNC69
2. Buffer memory (BFM) number "m2"
Up to 32767 16-bit RAM memories are built into a special extension unit/block, and they are called buffer
memories.
Buffer memory numbers range from "0" to "32766" and their contents vary depending on the function of the
extension equipment. 15
Setting range: K0 to K32766
Device
External FX I/O
FNC70-FNC79
When BFMs are handled in a 32-bit instruction, a specified BFM stores low-order 16 bits, and a
consecutive BFM stores high-order 16-bits.
High-order Low-order
16 bits 16 bits
BFM #10 BFM #9 Specified BFM number 16
Device
External FX
FNC80-FNC89
3. Number of transfer points "n"
Setting range: K1 to K32767
Transfer 2
Data
FNC100-FNC109
D100 BFM #5
D100 BFM #5
D101 #6
D101 #6
D102 #7
#7
D103
D104
#8
#9
D102
D103 #8 18
Floating Point
FNC110-FNC139
In the case of "n = 5" in a 16-bit In the case of "n = 2" in a 32-bit
instruction instruction
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
437
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.9 FNC 78 FROM / Read From A Special Function Block
2. While M8028 is ON
When an interrupt is generated during the execution of a FROM/TO instruction, the FROM/TO operation is
momentarily paused while the interrupt program executes. FROM/TO instructions cannot be used in interrupt
programs.
2. Countermeasures
1) Using RBFM (FNC278) or WBFM (FNC279) instruction [Ver.2.20 or later]
For divided BFM read [RBFM (FNC278) instruction], refer to Section 31.1.
For divided BFM write [WBFM (FNC279) instruction], refer to Section 31.2.
2) Changing the watchdog timer time
By overwriting the contents of D8000 (watchdog timer time), the watchdog timer detection time can be
changed.
When the program shown below is input, the sequence program after the input will be monitored with the
new watchdog timer time.
M8002
FNC 12 K300 D8000 Watchdog timer time: 300 ms
0
MOV
Initial pulse
Watchdog timer refresh
FNC 07 If WDT (FNC 07) instruction is not programmed, the value of
WDT D8000 is valid during END processing.
438
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.10 FNC 79 TO / Write To A Special Function Block
11
15.10 FNC 79 TO / Write To A Special Function Block
Shift
Rotation and
FNC30-FNC39
Outline
This instruction writes data from a PLC to buffer memories (BFM) in a special extension unit/block.
When a large capacity of data is written to buffer memories (BFM) by this instruction, a watchdog timer error
12
Data Operation
FNC40-FNC49
may occur. When splitting the data to be written does not affect the control, use WBFM (FNC279) instruction.
For WBFM (FNC279) instruction, refer to Section 31.2.
1. Instruction format
FNC 79 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
13
D TO P 9 steps TO Continuous
17 steps DTO
Continuous
Processing
High Speed
FNC50-FNC59
Operation Operation
TOP Pulse (Single) DTOP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type 14
Unit number of a special extension unit/block
Instruction
Handy
FMC60-FNC69
m1 16- or 32-bit binary
(K0 to K7 from the right side of the main unit)
m2 Transfer destination buffer memory (BFM) number 16- or 32-bit binary
S Device number storing the transfer source data 16- or 32-bit binary
n Number of transfer points 16- or 32-bit binary
15
3. Applicable devices
Device
External FX I/O
FNC70-FNC79
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
m1 3 3 3 3 16
Device
External FX
FNC80-FNC89
m2 3 3 3 3
S 3 3 3 3 3 3 3 3 3 3
n 3 3 3 3
Transfer 2
Data
FNC100-FNC109
1. 16-bit operation (TO and TOP)
For the common items between FROM instruction and TO instruction,
refer to Subsection 15.9.1.
Command
input FNC 79 m1 m2 S n
TO
Number of transfer points
n = 1 to 32767 19
Transfer source (PLC)
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
439
FX3U/FX3UC Series Programmable Controllers 15 External FX I/O Device FNC 70 to FNC 79
Programming Manual - Basic & Applied Instruction Edition 15.10 FNC 79 TO / Write To A Special Function Block
Related devices
Device Name Description
Disables or enables interrupts while FROM/TO instruction is executed.
For details, refer to "Acceptance of interrupt while FROM/TO instruction is
executed (M8028)" in Subsection 15.9.1.
M8028 Enable interrupt flag
OFF: Disables interrupts.
(Interrupts are executed after FROM/TO instruction is executed.)
ON: Enables interrupts.
Cautions
Program examples
In programs, the contents of data registers (D), extension registers (R), auxiliary relays (M) with digit
specification, or constants (K, H) are written (transferred) to buffer memories in a special extension unit/block
using an applied instruction such as TO, MOV and BMOV.
Example: When writing "H0" to the BFM #27 (command) in the CC-Link/LT master unit (whose unit number is
fixed to "0") built in the FX3UC-32MT-LT
- In case of TO instruction
M1 FNC 79 K0 K27 H0 K1
TOP
Unit BFM #27 Transfer Number of
No. 0 source Transfer
data points
M1 FNC 12 H0 U0\G27
MOVP
Transfer Unit No. 0
source BFM #27
data
440
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition
11
Shift
Rotation and
FNC30-FNC39
16. External FX Device FNC 80 to FNC 89
FNC 80 to FNC 89 provide control instructions for special adapters mainly connected to serial ports. 12
PID control loop instruction is included in this group.
Data Operation
FNC40-FNC49
FNC No. Mnemonic Format Function Reference
Section
80 RS RS S m D n Serial Communication
16.1
13
Section
Processing
High Speed
FNC50-FNC59
81 PRUN PRUN S D Parallel Run (Octal Mode)
16.2
Section
82 ASCI ASCI S D n Hexadecimal to ASCII Conversion
16.3
Instruction
Handy
FMC60-FNC69
Section
84 CCD CCD S D n Check Code
16.5
85
15
Device
External FX I/O
FNC70-FNC79
86
Section
87 RS2 RS2 S m D n n1 Serial Communication 2
16.6
Device
External FX
FNC80-FNC89
89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
441
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.1 FNC 80 RS / Serial Communication
Outline
This instruction sends and receives data in no-protocol communication by way of a serial port (only the ch1) in
accordance with RS-232C or RS-485 provided in the main unit.
1. Instruction format
FNC 80 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
RS 9 steps RS Continuous
Operation
2. Set data
Operand type Description Data type
16-bit binary or
SS1 Head device of data registers storing data to be sent
character string
m Number of bytes of data to be sent [setting range: 0 to 4096]*1 16-bit binary
16-bit binary or
D Head device of data registers storing received data when receiving is completed
character string
n Number of bytes to be received [setting range: 0 to 4096]*1 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3
m 3 3 3 3
SD2 3 3 3
n 3 3 3 3
442
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.1 FNC 80 RS / Serial Communication
11
Related devices
Shift
Rotation and
FNC30-FNC39
For detailed explanation, refer to the Data Communication Edition manual.
Device Name Device Name
M8063 Serial communication error 1 D8120*2 Communication format setting
Data Operation
FNC40-FNC49
M8122 D8123
M8123*1 Receiving complete flag D8124 Header
M8124 Carrier detection flag D8125 Terminator
M8129 Time-out check flag *2 Time-out time setting
D8129
M8161 *3 8-bit processing mode D8063 Error code number of serial communication error 1 13
D8405 Communication parameter display
Processing
High Speed
FNC50-FNC59
D8419 Operation mode display
Instruction
Handy
FMC60-FNC69
*3. Cleared when the PLC mode is changed from RUN to STOP.
System configuration
To use this instruction, it is necessary to attach one of the products shown in the table below to the main unit.
For the system configuration, refer to the respective PLC Hardware Edition manual. 15
For detailed explanation, refer to the Data Communication Edition manual.
Device
External FX I/O
FNC70-FNC79
Communication type Option
RS-232C communication FX3U-232-BD or FX3U-232ADP(-MB) (with FX3U-CNV-BD)
RS-485 communication FX3U-485-BD or FX3U-485ADP(-MB) (with FX3U-CNV-BD)
16
Differences between RS (FNC 80) instruction and RS2 (FNC 87) instruction
Device
External FX
FNC80-FNC89
Item RS2 instruction RS instruction Remarks
Up to 1 character
Header size 1 to 4 characters (bytes) For the RS2 instruction, up to 4 characters
(byte)
(bytes) can be specified as a header or
Up to 1 character
Terminator size 1 to 4 characters (bytes)
(byte)
terminator.
17
Transfer 2
Data
FNC100-FNC109
For the RS2 instruction, the check sum can
be automatically attached to the sent and
The check sum should
Attachment of check The check sum can be received data.
be attached by a user
sum automatically attached. In this case, however, make sure to use a
program.
terminator with the communication frame to
be sent and received.
18
Floating Point
FNC110-FNC139
Cautions
For other cautions, refer to the Data Communication Edition manual.
RS (FNC 80) instruction can be used for ch1 only (cannot be used for ch2).
Do not drive two or more RS (FNC 80) and/or RS2 (FNC 87) instructions for the same port at the same
time. 19
Operation 2
Data
FNC140-FNC149
It is not permitted to use an RS (FNC 80)/RS2 (FNC 87) instruction and an IVCK (FNC270)/IVDR
(FNC271)/IVRD (FNC272)/IVWR (FNC273)/IVBWR (FNC274) instruction for the same port.
20
Control
Positioning
FNC150-FNC159
443
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.2 FNC 81 PRUN / Parallel Run (Octal Mode)
Outline
This instruction handles the device number of S with digit specification and the device number of D
as octal numbers, and transfers data.
1. Instruction format
FNC 81 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D PRUN P 5 steps PRUN Continuous
9 steps DPRUN
Continuous
Operation Operation
PRUNP Pulse (Single) DPRUNP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
*1 16- or 32-bit binary
SS1 Digit specification
*1 16- or 32-bit binary
D Device number of transfer destination
*1. Make sure that the least significant digit of a specified device number is "0".
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3
SD2 3 3 3
444
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.2 FNC 81 PRUN / Parallel Run (Octal Mode)
11
Decimal bit device Octal bit device
Shift
Rotation and
FNC30-FNC39
S D
Command
input FNC 81 K4M0 K4Y000 M0 to M7, M10 to M17 Y0 to Y17
PRUN
Data Operation
FNC40-FNC49
M17 M16 M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
Processing
High Speed
FNC50-FNC59
2. 32-bit operation (DPRUN and DPRUNP)
Octal bit device Decimal bit device
S D
Command
input FNC 81
14
K6X000 K6M0 X000 to X027 M0 to M7, M10 to M17, M20 to M27
Instruction
Handy
FMC60-FNC69
DPRUN
Device
External FX I/O
FNC70-FNC79
M27 M20 M19 M18 M17 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
Device
External FX
FNC80-FNC89
S D
Command
input FNC 81 K6M0 K6Y000 M0 to M7, M10 to M17, M20 to M27 Y000 to Y027
DPRUN
Transfer 2
Data
FNC100-FNC109
M27 M20 M19 M18 M17 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
445
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.3 FNC 82 ASCI / Hexadecimal to ASCII Conversion
Outline
This instruction converts hexadecimal code into ASCII code.
On the other hand, BINDA (FNC261) instruction converts binary data into ASCII code, and ESTR (FNC116)
instruction converts binary floating point data into ASCII code.
For BINDA (FNC261) instruction, refer to Section 29.6.
For ESTR (FNC116) instruction, refer to Section 18.4.
1. Instruction format
FNC 82 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
SS1 Head device number storing hexadecimal code to be converted 16-bit binary
Character string
D Head device number storing converted ASCII code
(only ASCII code)
Number of characters (digits) of hexadecimal code to be converted [setting
n 16-bit binary
range: 1 to 256]
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3 3
n 3 3 3 3
446
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.3 FNC 82 ASCI / Hexadecimal to ASCII Conversion
11
2. 16-bit conversion mode (while M8161 is OFF) (M8161 is also used for the RS, HEX, CCD and
Shift
Rotation and
FNC30-FNC39
CRC instructions.)
Each digit of hexadecimal data stored in S and later is converted into ASCII code, and transferred to the
high-order 8 bits and low-order 8 bits of each device D and later. The number of digits (characters) to be
converted is specified by "n".
Each ASCII code is stored in either the high-order 8 bits or low-order 8 bits of each device D and later. 12
M8161 is used also for RS, HEX, CCD and CRC instructions. When using the 16-bit mode, set M8161 to
Data Operation
FNC40-FNC49
normally OFF. M8161 is cleared when the PLC mode is changed from RUN to STOP.
M8000
M8161 16-bit mode
Command
input FNC 82 S D n
13
ASCI
Processing
High Speed
FNC50-FNC59
Operation
In the following program, conversion is executed as follows:
M8000
M8161 16-bit mode
14
Instruction
Handy
FMC60-FNC69
X010
FNC 82 D100 D200 K4
ASCI
Devices after S 15
D100 = 0ABCH
Device
External FX I/O
FNC70-FNC79
D101 = 1234H
D102 = 5678H
Device
External FX
FNC80-FNC89
Low-order 8 bits of D200 [C] [B] [A] [0] [4] [3] [2] [1] [8]
High-order 8 bits of D200 [C] [B] [A] [0] [4] [3] [2] [1]
Low-order 8 bits of D201 [C] [B] [A] [0] [4] [3] [2]
High-order 8 bits of D201 [C] [B] [A] [0] [4] [3]
Low-order 8 bits of D202 [C] [B] [A] [0] [4] 17
Transfer 2
Data
FNC100-FNC109
High-order 8 bits of D202 [C] [B] [A] [0]
Low-order 8 bits of D203 Does not change [C] [B] [A]
High-order 8 bits of D203 [C] [B]
Low-order 8 bits of D204 [C]
D 100 = 0ABCH
0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0 ASCII code
0 A B C [0] = 30H [1] = 31H [5] = 35H
D 200 [A] = 41H [2] = 32H [6] = 36H
[B] = 42H [3] = 33H [7] = 37H
0 1 0 0
[A] 41H
0 0 0 1 0 0 1 1
[0] 30H
0 0 0 0
[C] = 43H [4] = 34H [8] = 38H 19
Operation 2
Data
FNC140-FNC149
D 201
0 1 0 0 0 0 1 1 0 1 0 0 0 0 1 0
[C] 43H [B] 42H
When outputting data in the BCD format for a printer, for example, it is necessary to convert binary data
into BCD data before executing this instruction. 20
Control
Positioning
FNC150-FNC159
447
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.3 FNC 82 ASCI / Hexadecimal to ASCII Conversion
Operation
In the following program, conversion is executed as follows:
M8000
M8161 8-bit mode
X010
FNC 82 D100 D200 K4
ASCI
Devices after S
D100 = 0ABCH
D101 = 1234H
D102 = 5678H
When outputting data in the BCD format for a printer, for example, it is necessary to convert binary data
into BCD data before executing this instruction.
448
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.4 FNC 83 HEX / ASCII to Hexadecimal Conversion
11
16.4 FNC 83 HEX / ASCII to Hexadecimal Conversion
Shift
Rotation and
FNC30-FNC39
Outline
This instruction converts ASCII codes into hexadecimal codes.
On the other hand, DABIN (FNC260) instruction converts ASCII codes into binary data, and EVAL (FNC117)
12
Data Operation
FNC40-FNC49
instruction converts ASCII codes into binary floating point data.
For DABIN (FNC260) instruction, refer to Section 29.5.
For EVAL (FNC117) instruction, refer to Section 18.5.
1. Instruction format
13
FNC 83 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
HEX P HEX Continuous
7 steps Operation
HEXP Pulse (Single)
Operation
2. Set data 14
Operand type Description Data type
Instruction
Handy
FMC60-FNC69
Character string
SS1 Head device number storing ASCII code to be converted
(only ASCII code)*1
D Head device number storing converted hexadecimal code 16- or 32-bit binary
n Number of ASCII codes (bytes) to be converted [setting range: 1 to 256] 16-bit binary
15
*1. Make sure to use only ASCII codes "0" to "9" and "A" to "F".
Device
External FX I/O
FNC70-FNC79
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Type
Unit stant Number ter String 16
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX
FNC80-FNC89
SS1 3 3 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3 3 3 3
n 3 3 3 3
Transfer 2
Data
FNC100-FNC109
1. 16-bit operation (HEX and HEXP)
Among the ASCII codes stored in S and later, "n" characters are converted into hexadecimal codes, and
then stored to the devices D and later.
The 16-bit mode and 8-bit mode are available for this instruction. For operation in each mode, refer to the
proceeding pages.
18
Floating Point
FNC110-FNC139
Command
input FNC 83 S D n
HEX
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
449
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.4 FNC 83 HEX / ASCII to Hexadecimal Conversion
Operation
In the following program, conversion is executed as follows:
M8000
M8161 16-bit mode
X010
FNC 83 D200 D100 K4
HEX
When the input data is in BCD format, it is necessary to convert BCD data into binary data after executing
this instruction.
If ASCII code is not stored in S in the HEX instruction, an operation error occurs and conversion into
hexadecimal code is disabled. Especially, note that ASCII code should be stored in high-order 8 bits of
S also when M8161 is OFF.
450
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.4 FNC 83 HEX / ASCII to Hexadecimal Conversion
11
3. 8-bit conversion mode (while M8161 is ON)
Shift
Rotation and
FNC30-FNC39
(M8161 is used also for the RS, ASCI, CCD and CRC instructions.)
Each ASCII code stored in the low-order 8 bits of each device S and later is converted into a
hexadecimal code, and transferred to device D and later in 4-digits units. The number of characters to be
converted is specified by "n".
M8161 is also used for the RS, ASCI, CCD and CRC instructions. When using the 8-bit mode, set M8161 to 12
normally ON. M8161 is cleared when the PLC mode is changed from RUN to STOP.
Data Operation
FNC40-FNC49
M8000
M8161 8-bit mode 16 bits
Command Ignored Low-order 8 bits
input FNC 83
HEX
S D n Source data 13
Processing
High Speed
FNC50-FNC59
Operation
In the following program, conversion is executed as follows:
M8000
M8161 8-bit mode
14
X010
FNC 83
Instruction
Handy
FMC60-FNC69
D200 D100 K4
HEX
Device
External FX I/O
FNC70-FNC79
D 201 41H A
D 202 42H B
D 203 43H C
D 204 31H 1
D 205 32H 2 16
D 206 33H 3
Device
External FX
FNC80-FNC89
D 207 34H 4
D 208 35H 5
Transfer 2
Data
FNC100-FNC109
D
D 102 D 101 D 100
n D 200 0 0 1 1 0 0 0 0
1 0H 30H [0]
2 0AH
Does not change
3 0ABH
D 201 0 1 0 0 0 0 0 1
18
4 0ABCH 41H [A]
Floating Point
FNC110-FNC139
5 0H ABC1H D 100 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
6 0AH BC12H 0 A
7 0ABH C123H
8 0ABCH 1234H
9 0H ABC1H 2345H
19
Operation 2
Data
FNC140-FNC149
When the input data is in BCD format, it is necessary to convert BCD data into binary data after executing
this instruction.
20
Control
Positioning
FNC150-FNC159
451
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.5 FNC 84 CCD / Check Code
Outline
This instruction calculates the horizontal parity value and sum check value in the error check methods used in
communication. There is another check method, CRC (cyclic redundancy check) also. For obtaining CRC
value, use CRC instruction.
For CRC instruction, refer to Section 24.4.
For complement [NEG (FNC 29) instruction], refer to Section 10.10.
1. Instruction format
FNC 84 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
16-bit binary or
SS1 Head device number of applicable device
character string
16-bit binary or
D Head device number storing the calculated data
character string
n Number of data [setting range: 1 to 256] 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3
n 3 3 3 3
452
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.5 FNC 84 CCD / Check Code
11
2. 16-bit conversion mode (while M8161 is OFF)
Shift
Rotation and
FNC30-FNC39
(M8161 is also used for the RS, ASCI, HEX and CRC instructions.)
With regard to "n" data starting from S , the addition data and horizontal parity data of high-order 8 bits
and low-order 8 bits are stored to D and D +1 respectively.
M8161 is used also for the RS, ASCI, HEX and CRC instructions. When using the 16-bit mode, set M8161 to
normally OFF. M8161 is cleared when the PLC mode is changed from RUN to STOP. 12
Data Operation
FNC40-FNC49
M8000
M8161 16-bit mode
Command
input FNC 84 S D n
CCD
13
Processing
High Speed
FNC50-FNC59
Example of 16-bit conversion
In the following program, conversion is executed as follows:
M8000
M8161 16-bit mode
X010 14
FNC 84 D100 D0 K10
Instruction
Handy
FMC60-FNC69
CCD
Device
External FX I/O
FNC70-FNC79
High-order 8 bits of D101 K 98 = 01100010
Low-order 8 bits of D102 K123 = 0111101 (1)
High-order 8 bits of D102 K 66 = 01000010
Low-order 8 bits of D103 K100 = 01100100
High-order 8 bits of D103 K 95 = 0101111 (1)
16
Device
External FX
FNC80-FNC89
Low-order 8 bits of D104 K210 = 11010010
High-order 8 bits of D104 K 88 = 01011000
Total K1091
Horizontal parity 1000010 (1) When the number of "1" is odd, the horizontal parity is
"1".
When the number of "1" is even, the horizontal parity is
17
"0".
Transfer 2
Data
D0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 "1091" in BCD FNC100-FNC109
D1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 Horizontal parity
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
453
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.5 FNC 84 CCD / Check Code
D0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 "1091" in BCD
D1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 Horizontal parity
454
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.6 FNC 87 RS2 / Serial Communication 2
11
16.6 FNC 87 RS2 / Serial Communication 2
Shift
Rotation and
FNC30-FNC39
Outline
This instruction sends and receives data in no-protocol communication by way of serial ports in accordance
with RS-232C or RS-485 provided in the main unit.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 87 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
16-bit binary or
SS1 Head device of data registers storing data to be sent
character string 14
Instruction
Handy
FMC60-FNC69
m Number of bytes of data to be sent [setting range: 0 to 4,096] 16-bit binary
16-bit binary or
D Head device of data registers storing received data when receiving is completed
character string
n Number of bytes to be received [setting range: 0 to 4,096] 16-bit binary
n1 Used channel number [contents of setting: K1 = ch 1, K2 = ch 2] 16-bit binary
15
3. Applicable devices
Device
External FX I/O
FNC70-FNC79
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3
16
Device
External FX
FNC80-FNC89
m 3 3 3 3
SD2 3 3 3
n 3 3 3 3
n1 3 3
17
Explanation of function and operation
Transfer 2
Data
FNC100-FNC109
1. 16-bit operation (RS2)
This instruction sends and receives data in no-protocol communication by way of serial ports in accordance
with RS-232C or RS-485 provided in the main unit.
For detailed explanation, refer to the Data Communication Edition. 18
Command
Floating Point
FNC110-FNC139
input FNC 87 S m D n n1
RS2
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
455
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.6 FNC 87 RS2 / Serial Communication 2
Related devices
For detailed explanation, refer to the Data Communication Edition.
Device Device
Name Name
ch1 ch2 ch1 ch2
M8401 M8421 Sending wait flag*1 D8400 D8420 Communication format setting
M8402 M8422 Sending request*1
M8403 M8423 Receiving complete flag*1 D8402 D8422 Remaining number of data to be sent*1
M8404 M8424 Carrier detection flag D8403 D8423 Monitor for number of received data*1
M8405 M8425 Data Set Ready (DSR) Flag *2 D8405 D8425 Communication parameter display
D8409 D8429 Time-out time setting
M8409 M8429 Time-out check flag D8410 D8430 Header 1, 2
D8411 D8431 Header 3, 4
D8412 D8432 Terminator 1, 2
D8413 D8433 Terminator 3, 4
D8414 D8434 Receiving sum (received data)
D8415 D8435 Receiving sum (calculation result)
D8416 D8436 Sending sum
D8419 D8439 Operation mode display
M8063 M8438 Serial communication error D8063 D8438 Error code number of serial communication error
*1. Cleared when the PLC mode is changed from RUN to STOP. *2 Available in Ver. 2.30 or later.
System configuration
For using this instruction, it is necessary to attach one of the products shown in the table below to the main
unit.
For the system configuration, refer to the respective PLC Hardware Edition manual.
For detailed explanation, refer to the Data Communication Edition manual.
Communication type Option
RS-232C communication FX3U-232-BD or FX3U-232ADP(-MB)
RS-485 communication FX3U-485-BD or FX3U-485ADP(-MB)
Differences between RS (FNC 80) instruction and RS2 (FNC 87) instruction
Item RS2 instruction RS instruction Remarks
Header size 1 to 4 characters (bytes) Up to 1 character (byte) For the RS2 instruction, up to 4 characters (bytes)
Terminator size 1 to 4 characters (bytes) Up to 1 character (byte) can be specified as a header or terminator.
For the RS2 instruction, the check sum can be
The check sum should
Attachment of The check sum can be automatically attached to the sent and received data.
be attached by a user
check sum automatically attached. In this case, however, make sure to use a terminator
program.
in the communication frame to be sent and received.
Cautions
For other cautions, refer to the Data Communication Edition.
Do not drive two or more RS (FNC 80) and/or RS2 (FNC 87) instructions for the same port at the same time.
It is not permitted to use an RS (FNC 80)/RS2 (FNC 87) instruction and an IVCK (FNC270)/IVDR
(FNC271)/IVRD (FNC272)/IVWR (FNC273)/IVBWR (FNC274) instruction for the same port.
When using a header and terminator, set the data in the header and terminator to corresponding devices
(D) before executing the RS2 instruction. Do not change the values of the header and terminator while the
RS2 instruction is being executed.
456
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.7 FNC 88 PID / PID Control Loop
11
16.7 FNC 88 PID / PID Control Loop
Shift
Rotation and
FNC30-FNC39
Outline
This instruction executes PID control which changes the output value according to the input variation.
For details, refer to the Analog Control Edition.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 88 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
SS11 Data register number storing the target value (SV)
Data register number storing the measured value (PV)
16-bit binary
16-bit binary
14
SS12
Instruction
Handy
FMC60-FNC69
S3 Data register number storing a parameter 16-bit binary
SD
1 Data register number storing the output value (MV) 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others 15
Oper-
Device
External FX I/O
FNC70-FNC79
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS11 3 3 3
SS12 3 3 3
16
SS23 3 3
Device
External FX
FNC80-FNC89
SD1 3 3 3
Transfer 2
Data
FNC100-FNC109
When the target value S1 , measured value S2 , and parameters S3 to S3 +6 are set and a
program is executed, the operation result (MV) is stored to the output value D at every sampling time
S3 .
Command
input FNC 88 S1 S2 S3 D 18
PID
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
457
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.7 FNC 88 PID / PID Control Loop
2. Set items
Number of
Set item Description occupied
points
Set the target value (SV).
PID instruction does not change the contents of setting.
Target value Caution on using the auto tuning (limit cycle method)
S1 1
(SV) If the target value for auto tuning is different from the target value for PID control,
it is necessary to set a value including the bias value first, and then store the
actual target value when the auto tuning flag turns OFF.
Measured
S2 This is the input value in PID control loop. 1
value (PV)
1) Auto tuning: In the case of limit cycle method
Twenty-nine devices are occupied from the head device specified in S3 . 29
2) Auto tuning: In the case of step response method
S3 Parameter*1 a) Operation setting (ACT): When bits 1, 2 and 5 are not all "0"
Twenty-five devices are occupied from the head device specified in S3 .
25
b) Operation setting (ACT): When bits 1, 2 and 5 are all "0"
Twenty devices are occupied from the head device specified in S3 . 20
1) In case of PID control (normal processing)
Before driving PID instruction, the user should set the initial output value.
After that, the operation result is stored.
2) Auto tuning: In the case of limit cycle method
Output value
D During auto tuning, the ULV or LLV value is output automatically. 1
(MV)
When auto tuning is finished, the specified MV value is set.
3) Auto tuning: In the case of step response method
Before driving PID instruction, the user should set the initial output value.
During auto tuning, PID instruction does not change the MV output.
*1. When auto tuning is not used, the number of points is the same as the number in the step
response method are occupied.
458
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.7 FNC 88 PID / PID Control Loop
11
Set item Setting Value Remarks
Shift
Rotation and
FNC30-FNC39
S3 +7
: These devices are occupied for internal processing in PID control loop. Do not change the data.
S3 +19
Input variation
S3 +20*1 (incremental) alarm set 0 to 32767 It is valid when bit 1 is set to "1" in S3 +1 12
value for the operation setting (ACT).
Data Operation
FNC40-FNC49
Input variation
It is valid when bit 1 is set to "1" in S3 +1
S3 +21*1 (decremental) alarm set 0 to 32767
value for the operation setting (ACT).
Processing
High Speed
FNC50-FNC59
S3 +22*1
It is valid when bit 2 is set to "0" and bit 5 is
Output upper limit set value 32768 to 32767 set to "1" in S3 +1 for the operation
setting (ACT).
Output variation It is valid when bit 2 is set to "1" and bit 5 is
(decremental) alarm set
value
0 to 32767 set to "0" in S3 +1 for the operation 14
setting (ACT).
Instruction
Handy
FMC60-FNC69
S3 +23*1
It is valid when bit 2 is set to "0" and bit 5 is
Output lower limit set value 32768 to 32767 set to "1" in S3 +1 for the operation
setting (ACT).
0: Input variation (incremental) is It is valid when bit 1 is set to "1" or bit 2 is set
bit0
not exceeded.
1: Input variation (incremental) is to "1" in S3 +1 for the operation setting 15
(ACT).
Device
External FX I/O
FNC70-FNC79
exceeded.
0: Input variation (decremental) is
not exceeded.
bit1
1: Input variation (decremental) is
exceeded.
S3 +24*1 Alarm output
0: Output variation (incremental) is 16
not exceeded.
bit2
Device
External FX
FNC80-FNC89
1: Output variation (incremental) is
exceeded.
0: Output variation (decremental) is
not exceeded.
bit3
1: Output variation (decremental) is
exceeded. 17
The setting below is required when the limit cycle method is used (when bit 6 is set to "ON" in the operation setting (ACT)).
Transfer 2
Data
FNC100-FNC109
PV value threshold Set it according to the fluctuation of
S3 +25
(hysteresis) width (SHPV) the measured value (MV).
Output value upper limit Set the maximum value (ULV) of
S3 +26
(ULV) the output value (MV). They are occupied when bit 6 is set to "ON
S3 +27
Output value lower limit Set the minimum value (LLV) of the (limit cycle method)" in the operation setting
(ACT).
18
(LLV) output value (MV).
Floating Point
FNC110-FNC139
*1. S3 +20 to S3 +24 are occupied when any bit 1, 2 or 5 is set to "1" in S3 +1 for operation
setting (ACT). 19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
459
FX3U/FX3UC Series Programmable Controllers 16 External FX Device FNC 80 to FNC 89
Programming Manual - Basic & Applied Instruction Edition 16.7 FNC 88 PID / PID Control Loop
Cautions
1. When using two or more PID instructions
Two or more PID instructions can be executed at the same time. (There is no limitation in the number of
loops.) However, make sure that S3 , D and other operands specified in each instruction are different
to each other.
Error
When an operation error occurs, the special auxiliary relay M8067 turns ON, and the error code is stored in
the special data register D8067.
For the error code, refer to Section 37.4.
460
FX3U/FX3UC Series Programmable Controllers 17 Data Transfer 2 FNC100 to FNC109
Programming Manual - Basic & Applied Instruction Edition
11
Shift
Rotation and
FNC30-FNC39
17. Data Transfer 2 FNC100 to FNC109
FNC100 to FNC109 provide an instruction for executing complicated processing for fundamental applied 12
instructions and for executing special processing.
Data Operation
FNC40-FNC49
FNC No. Mnemonic Symbol Function Reference
100 13
Processing
High Speed
FNC50-FNC59
101
Section
102 ZPUSH ZPUSH D Batch Store of Index Register
17.1 14
Instruction
Handy
FMC60-FNC69
Section
103 ZPOP ZPOP D Batch POP of Index Register
17.2
104
15
Device
External FX I/O
FNC70-FNC79
105
160
16
Device
External FX
FNC80-FNC89
107
108
17
Transfer 2
Data
FNC100-FNC109
109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
461
FX3U/FX3UC Series Programmable Controllers 17 Data Transfer 2 FNC100 to FNC109
Programming Manual - Basic & Applied Instruction Edition 17.1 FNC102 ZPUSH/Batch Store of Index Register
Outline
This instruction temporarily batch-stores the present value of the index registers V0 to V7 and Z0 to Z7.
For restoring the present value of temporarily batch-stored index registers, use ZPOP (FNC103) instruction.
For ZPOP (FNC103) instruction, refer to Section 17.2.
1. Instruction format
FNC 102 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
ZPUSH P 3 steps ZPUSH
Continuous
Operation
ZPUSHP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number batch-storing the present value of the index registers V0 to
V7 and Z0 to Z7
D D : Number of times of batch-storage 16-bit binary
D +1 to D +16 Number of times of batch-storage: Batch-stored data
storage destination
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
D 3 3
1) The contents of the index registers V0 to V7 and Z0 to Z7 are batch-stored temporarily to D and later.
When the contents of index registers are batch-stored, the number of times of batch-storage D is
incremented by "1".
2) For restoring the batch-stored data, use ZPOP (FNC103) instruction.
Use ZPUSH (FNC102) and ZPOP (FNC103) instruction as a pair.
3) By specifying a same device to D , ZPUSH (FNC102) and ZPOP (FNC103) instructions can be used
in the nest structure.
In this case, the occupied points are added by "16" after D every time ZPUSH (FNC102) instruction is
executed. Secure in advance sufficient area for the number of the next structure.
462
FX3U/FX3UC Series Programmable Controllers 17 Data Transfer 2 FNC100 to FNC109
Programming Manual - Basic & Applied Instruction Edition 17.1 FNC102 ZPUSH/Batch Store of Index Register
11
4) The figure below shows the data structure batch-stored in D and later.
Shift
Rotation and
FNC30-FNC39
When the nest structure is not used Batch- When the nest structure is used Batch-
Index register stored data Index register stored data
[1] ZPUSH *1 *1
Z0 D +0 Z0 [1] ZPUSH D +0
instruction
V0 Number of times +1 Z0 V0 instruction +1 Z0
Z1 of batch-storage
D is
+2 V0 Z1
Number of times
of batch-storage 1st nesting +2 V0 12
V1 +3 Z1 V1 D :01 Number of +3 Z1
incremented by "1". 16 points
Data Operation
FNC40-FNC49
times of
Z2 +4 V1 Z2 batch- +4 V1
[4] ZPOP for 1
V2 +5 Z2 storage +5 Z2
...
instruction nesting
[2] ZPOP Number of times D =1
+6 V2 Z7
...
...
...
instruction of batch-storage
Z7 Number of times of V7 D :0 +15 Z7
...
...
V7 batch-storage +15 Z7 +16 V7
D is
decremented by
+16 V7
[2] ZPUSH instruction
Number of times
of batch-storage 2nd nesting
+17 Z0 13
D :12 +18 V0
Processing
High Speed
FNC50-FNC59
"1". Number of
times of +19 Z1
batch-
[3] ZPOP instruction storage +20 V1
Number of times of D =2
*1 Number of times of batch-storage
...
...
batch-storage
D :21
14
Related instruction
Instruction
Handy
FMC60-FNC69
Instruction Description
Restores the index registers V0 to V7 and Z0 to Z7 which were batch-stored temporarily by the
ZPOP(FNC103)
ZPUSH (FNC102) instruction.
15
Cautions
Device
External FX I/O
FNC70-FNC79
When not using the nest structure, clear the number of batch-storage times D before executing
ZPUSH (FNC102) instruction.
When using the nest structure, clear the number of batch-storage times D before executing ZPUSH
(FNC102) instruction the first time.
16
Device
External FX
FNC80-FNC89
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the range of points used after D in ZPUSH (FNC102) instruction exceeds the corresponding
device range (error code: K6706) 17
Transfer 2
Data
FNC100-FNC109
When the number of batch-storage times D stores a negative value while the ZPUSH (FNC102)
instruction is executed (error code: K6706)
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
463
FX3U/FX3UC Series Programmable Controllers 17 Data Transfer 2 FNC100 to FNC109
Programming Manual - Basic & Applied Instruction Edition 17.1 FNC102 ZPUSH/Batch Store of Index Register
Program example
In the program shown below, the contents of the index registers Z0 to Z7 and V0 to V7 before execution of
subroutine program are batch-stored in D0 and later when index registers are used in the subroutine after the
pointer P0.
M8002
RST D0
X005 FNC 12
K5 V0
MOVP
X005 FNC 12
K10 V0
MOVP
X000 V0
Y000
X000 FNC 01 P0
CALL
FNC 06
FEND
Label
P0 M8000 FNC102 D0
RUN monitor ZPUSH
X006 FNC 12
K5 V0
MOVP
X006 FNC 12 Program using index
K10 V0
MOVP registers
X030
T0
D100V0
M8000
FNC103
V0
ZPOP
FNC 02
SRET
END
464
FX3U/FX3UC Series Programmable Controllers 17 Data Transfer 2 FNC100 to FNC109
Programming Manual - Basic & Applied Instruction Edition 17.2 FNC103 ZPOP/Batch POP of Index Register
11
17.2 FNC103 ZPOP/Batch POP of Index Register
Shift
Rotation and
FNC30-FNC39
Outline
This instruction restores the contents of the index registers V0 to V7 and Z0 to Z8 which were batch-stored
temporarily by ZPUSH (FNC102) instruction.
12
For ZPUSH (FNC102) instruction, refer to Section 17.1
Data Operation
FNC40-FNC49
1. Instruction format
FNC 103 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
ZPOP P 3 steps ZPOP
Continuous
Operation 13
ZPOPP Pulse (Single)
Processing
High Speed
FNC50-FNC59
Operation
2. Set data
Operand Type Description Data Type
Head device number temporarily batch-storing the contents of the index registers
V0 to V7 and Z0 to Z7
14
Instruction
Handy
FMC60-FNC69
D D : Number of times of batch-storage 16-bit binary
D +1 to D +16 Number of times of batch-storage: Batch-stored data
storage destination
3. Applicable devices
Bit Devices Word Devices Others
15
Device
External FX I/O
FNC70-FNC79
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
D 3 3
16
Explanation of function and operation
Device
External FX
FNC80-FNC89
1. 16-bit operation (ZPOP/ZPOPP)
For the function and operation, refer also to Section 17.1.
Command
input FNC103
ZPOP
D 17
Transfer 2
Data
FNC100-FNC109
1) The contents of the index registers V0 to V7 and Z0 to Z7 which were batch-stored temporarily to D
and later are restored to the original index registers. When the contents of the index registers are
restored, the number of times of batch-storage D is decremented by "1".
2) For temporarily batch-storing the data, use ZPUSH (FNC102) instruction. 18
Use ZPUSH (FNC102) and ZPOP (FNC103) instruction as a pair.
Floating Point
FNC110-FNC139
Related instruction
Instruction Description
ZPUSH(FNC102) Temporarily batch-stores the present value of the index registers V0 to V7 and Z0 to Z7.
19
Operation 2
Data
FNC140-FNC149
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the number of times of batch-storage (D) stores "0" or a negative value while ZPOP (FNC103)
instruction is executed (error code: K6706) 20
Control
Positioning
FNC150-FNC159
Program example
For a program example, refer to Section 17.1.
465
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition
Section
110 ECMP ECMP S1 S2 D Floating Point Compare
18.1
Section
111 EZCP EZCP S1 S2 S D Floating Point Zone Compare
18.2
Section
112 EMOV EMOV S D Floating Point Move
18.3
113
114
115
Section
120 EADD EADD S1 S2 D Floating Point Addition
18.8
Section
121 ESUB ESUB S1 S2 D Floating Point Subtraction
18.9
Section
122 EMUL EMUL S1 S2 D Floating Point Multiplication
18.10
Section
123 EDIV EDIV S1 S2 D Floating Point Division
18.11
Section
124 EXP EXP S D Floating Point Exponent
18.12
Section
125 LOGE LOGE S D Floating Point Natural Logarithm
18.13
Section
126 LOG10 LOG10 S D Floating Point Common Logarithm
18.14
Section
127 ESQR ESQR S D Floating Point Square Root
18.15
Section
128 ENEG ENEG D Floating Point Negation
18.16
466
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition
11
FNC No. Mnemonic Symbol Function Reference
Shift
Rotation and
FNC30-FNC39
Section
129 INT INT S D Floating Point to Integer Conversion
18.17
Section
130 SIN SIN S D Floating Point Sine
18.18 12
Data Operation
FNC40-FNC49
Section
131 COS COS S D Floating Point Cosine
18.19
Section
132 TAN TAN S D Floating Point Tangent
18.20
Section 13
133 ASIN ASIN S D Floating Point Arc Sine
18.21
Processing
High Speed
FNC50-FNC59
Section
134 ACOS ACOS S D Floating Point Arc Cosine
18.22
Section
135 ATAN ATAN S D Floating Point Arc Tangent
18.23 14
Instruction
Handy
FMC60-FNC69
Floating Point Degrees to Radians Section
136 RAD RAD S D Conversion 18.24
Device
External FX I/O
FNC70-FNC79
139
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
467
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.1 FNC110 ECMP / Floating Point Compare
Outline
This instruction compares two data (binary floating point), and outputs the result (larger, same or smaller) to
three single bit devices.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 110 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ECMP P Continuous
13 steps DECMP Operation
DECMPP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S1 Device number storing binary floating point data to be compared Real number
S2 Device number storing binary floating point data to be compared (binary)*1
Head bit device number to which the comparison result is output (Three devices
D Bit
are occupied.)
*1. When a constant (K or H) is specified, it is automatically converted from binary into binary floating
point (real number) when the instruction is executed.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3
D 3 3 3 S 3
468
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.1 FNC110 ECMP / Floating Point Compare
11
When a constant (K or H) is specified as [ S1 +1, S1 ] or [ S2 +1, S2 ], it is automatically
Shift
Rotation and
FNC30-FNC39
converted from binary into binary floating point (real number) when the instruction is executed.
Command
input FNC110
S1 S2 D
DECMP
Data Operation
FNC40-FNC49
D +1 Turns ON in the case of
" [ S1 +1, S1 ] = [ S2 +1, S2 ] ".
Processing
High Speed
FNC50-FNC59
Even if the command input turns OFF and DECMP instruction is not executed, D to D +2 hold the status
before the please rewrite this command input turned OFF.
Caution 14
Instruction
Handy
FMC60-FNC69
1. Number of occupied devices
Three devices are occupied from D ( D , D +1 and D +2).
Make sure that these devices are not used for any other purpose.
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
469
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.2 FNC111 EZCP / Floating Point Zone Compare
Outline
This instruction compares data (binary floating point) with two values (one zone), and outputs the comparison
result to three single bit devices.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 111 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D EZCP P Continuous
17 steps DEZCP Operation
DEZCPP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S1 Data register number storing binary floating point data to be compared
Real number
S2 Data register number storing binary floating point data to be compared
(binary)*1
S Data register number storing binary floating point data to be compared
Head bit device number to which the comparison result is output (Three devices
D Bit
are occupied.)
*1. When a constant (K or H) is specified, it is automatically converted from binary into binary floating
point (real number) when the instruction is executed.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3
S 3 3 3 3 3 3 3
D 3 3 3 S 3
470
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.2 FNC111 EZCP / Floating Point Zone Compare
11
Explanation of function and operation
Shift
Rotation and
FNC30-FNC39
1. 32-bit operation (DEZCP and DEZCPP)
The comparison values [ S1 +1, S1 ], [ S2 +1, S2 ] are compared with the comparison source
[ S +1, S ] as floating point data, and either bit among D , D +1, and D +2 turns ON
according to the result (smaller, same or larger). 12
Data Operation
FNC40-FNC49
When a constant (K or H) is specified as [ S1 +1, S1 ], [ S2 +1, S2 ], or [ S +1, S ], it is
automatically converted into binary floating point when the instruction is executed.
Command
input FNC 111 S1 S2 S D
EDZCP
D Turns ON in the case of
13
Processing
High Speed
FNC50-FNC59
" [ S1 +1, S1 ] > [ S +1, S ] ".
Instruction
Handy
FMC60-FNC69
Even if the command input turns OFF and DEZCP instruction is not executed, D to D +2 hold the status
before the command input turned OFF.
15
Cautions
Device
External FX I/O
FNC70-FNC79
1. Number of occupied devices
Three devices are occupied from D ( D , D +1 and D +2).
Make sure that these devices are not used for any other purpose.
16
2. Comparison values [ S1 +1, S1 ] and [ S2 +1, S2 ]
Device
External FX
FNC80-FNC89
Make sure that two comparison values have the following relationship:
[( S1 +1, S1 ] [ S2 +1, S2 ]
In the case of "[ S1 +1, S1 ] > [ S2 +1, S2 ]", the value [ S2 +1, S2 ] is regarded as [ S1 +1,
S1 ] value during comparison.
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
471
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.3 FNC112 EMOV / Floating Point Move
Outline
This instruction transfers binary floating point data.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 112 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D EMOV P 9 steps DEMOV
Continuous
Operation
DEMOVP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Binary floating point data (transfer source) or device number storing data
Real number (binary)
D Device number receiving floating point data
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
Program examples
1. In the program example shown below, a real number stored in D11 and D10 is transferred to
D1 and D0 when X007 turns ON
X007
FNC112 D10 D0
DEMOVP D11 D10 D1 D0
36.475 36.475
END
2. In the program shown below, a real number "-1.23" is transferred to D11 and D10 when X007
turns ON
X007
FNC112 E1.23 D10
DEMOVP D11 D10
1.23 1.23
END
472
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.4 FNC116 ESTR / Floating Point to Character String Conversion
11
18.4 FNC116 ESTR / Floating Point to Character String Conversion
Shift
Rotation and
FNC30-FNC39
Outline
This instruction converts binary floating point data into a character string (ASCII codes) having a specified
number of digits.
12
Data Operation
FNC40-FNC49
On the other hand, STR (FNC200) instruction converts binary data into a character string (ASCII codes).
For a character string, refer to Section 5.3.
For handling of floating point, refer to Subsection 5.1.3.
For STR (FNC200) instruction, refer to Section 26.1.
1. Instruction format 13
Processing
High Speed
FNC50-FNC59
FNC 116 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ESTR P Continuous
13 steps DESTR Operation
DESTRP Pulse (Single)
Operation
2. Set data
14
Instruction
Handy
FMC60-FNC69
Operand Type Description Data Type
S1 Binary floating point data to be converted or device storing data Real number (binary)
Head device number storing the display specification of a numeric value to be
S2 16-bit binary
converted
D Head device number storing converted character string Character string
15
Device
External FX I/O
FNC70-FNC79
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V
Unit
Z Modify K H
stant Number ter String
E "" P
16
Device
External FX
FNC80-FNC89
S1 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
17
Explanation of function and operation
Transfer 2
Data
FNC100-FNC109
1. 32-bit operation (DESTR and DESTRP)
The contents (binary floating point data) of [ S1 +1, S1 ] are converted into a character string according
to the contents specified by S2 , S2 +1 and S2 +2, and then stored to devices D and later. A real
number can be directly specified as S1 . 18
Command
Floating Point
FNC110-FNC139
input FNC116 S1 S2 D
DESTR
The data after conversion varies depending on the display specification stored in S2 .
0: Decimal point
format
The data after conversion varies 19
S2 1: Exponent depending on the display
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
473
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.4 FNC116 ESTR / Floating Point to Character String Conversion
D +4 0000H
The total number of digits which can be specified by S2 +1 is as follows (24 digits maximum):
When the number of digits of the decimal part is "0", Total number of digits 2
When the number of digits of the decimal part is any value other than "0", Total number of digits (Number
of digits of decimal part + 3)
The number of digits of the decimal part which can be specified by S2 +2 is from 0 to 7.
However, the following must be satisfied, "Number of digits of decimal part (Total number of digits - 3)"
For example, when the total number of digits is "8", the number of digits of the decimal part is "3", and
"-1.23456" is specified, data is stored in D and later as shown below:
Total
S2 0 number
of digits Number of
S2 +1 8 digits of
decimal part
b15 b8 b7 b0
S2 +2 3
D 20H(space) 2DH(-)
D +1 31H(1) 20H(space)
1 2 3 5
D +2 32H(2) 2EH(.)
S1 +1 S1 D +4 0000H
1.23456
0000H is automatically stored at the end of the
Binary floating point character string.
(real number)
The character string data after conversion is stored in the devices D and later as shown below:
- For the sign, "20H (space)" is stored when the binary floating point data is positive, and "2DH (-)" is
stored when the data is negative.
- If the decimal part of the binary floating point data cannot be accommodated in the number of digits of
the decimal part, low-order digits of the decimal part are rounded.
0: Decimal point
S2 format Total
8 (Total number of
number of
S2 +1 digits) digits
2 (Number of digits
S2 +2 of decimal part) 1 2 3 4 5 6
Low-order
S1 +1 S1 digits of Rounded.
decimal part
1.23456
474
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.4 FNC116 ESTR / Floating Point to Character String Conversion
11
- When the number of digits of the decimal part is set to any value other than "0", "2EH (.)" is
Shift
Rotation and
FNC30-FNC39
automatically stored in "specified number of digits of decimal part + 1"th digit.
When the number of digits of the decimal part is "0", "2EH (.)" is not stored.
0: Decimal point
S2 format Total
number of
S2 +1
8 (Total number of
digits) digits 12
2 (Number of digits
Data Operation
FNC40-FNC49
S2 +2 of decimal part) 1 2 3
- When the total number of digits subtracted by the digits for sign, decimal point and decimal part is larger 13
than the integer part of the binary floating point data, "20H (space)" is stored between the sign and the
Processing
High Speed
FNC50-FNC59
integer part.
S2 0 Total
number of
S2 +1 8 digits
S2 +2 2
14
1 2 3
Instruction
Handy
FMC60-FNC69
Low-order digits of decimal
S1 +1 S1 part
"20H (space)" is stored.
1.23456
- "00H" or "0000H" is automatically stored at the end of the converted character string.
15
3. In the case of exponent format
Device
External FX I/O
FNC70-FNC79
b15 b8 b7 b0
ASCII code in "(specified
D total number of digits - 1)"th ASCII code for sign
S2 Exponent format
digit
S2 +1
Total number of
digits
D +1
ASCII code for decimal point
(.) (2EH)
ASCII code in "(specified
total number of digits - 2)"th
16
Number of digits digit
S2 +2
Device
External FX
FNC80-FNC89
of decimal part
ASCII code in "(specified ASCII code in "(specified
D +2 total number of digits - 5)"th total number of digits - 4)"th
digit (decimal part) digit (decimal part)
E ASCII code in "(specified ASCII code in "(specified
D +3 total number of digits - 7)"th total number of digits - 6)"th
Sign (integer part) Sign (exponent part)
digit (decimal part) digit (decimal part)
17
ASCII code of sign
D +4 45H(E)
Transfer 2
Data
FNC100-FNC109
(exponent part)
S1 +1 S1 Automatically
added.
ASCII code in "(specified ASCII code in "(specified
D +5 total number of digits - total number of digits -
11)"th digit (exponent part) 10)"th digit (exponent part)
Binary floating point
(real number) D +6 0000H
18
Floating Point
FNC110-FNC139
The total number of digits which can be specified by S2 +1 is as follows (24 digits maximum):
When the number of digits of the decimal part is "0" Total number of digits 6
When the number of digits of the decimal part is any value other than "0" Total number of digits (Number 19
of digits of decimal part + 7)
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
475
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.4 FNC116 ESTR / Floating Point to Character String Conversion
The number of digits of the decimal part which can be specified by S2 +2 is from 0 to 7.
However, the following must be satisfied, "Number of digits of decimal part (Total number of digits - 7)"
For example, when the total number of digits is "12", the number of digits of the decimal part is "4", and
"-12.34567" is specified, data is stored in D and later as shown below:
S2 1 Total number
of digits b15 b8 b7 b0
S2 +1 12
Number of D 20H space 2DH(-)
digits of
S2 +2 4 decimal
part D +1 2EH(.) 31H(1)
D +2 33H(3) 32H(2)
1 2 3 4 6E+ 0 1 D +3 36H(6) 34H(4)
Fixed to 2 digits
D +4 2BH(+) 45H(E)
Sign (integer part) Sign (exponent part)
D +5 31H(1) 30H(0)
S1 +1 S1
D +6 0000H
12.34567
The character string data after conversion is stored in the devices D and later as shown below:
- For the sign of the integer part, "20H (space)" is stored when the binary floating point data is positive,
and "2DH (-)" is stored when the data is negative.
- The integer part is fixed to 1 digit.
"20H (space)" is stored between the integer part and the sign.
S2 +1 12 Fixed to 1 digit
S2 +2 4 1 2 3 4 6E+ 0 1
- If the decimal part of the binary floating point data cannot be accommodated in the number of digits of
the decimal part, low-order digits of the decimal part are rounded.
S2 1
S2 +2 4 1 2 3 4 6 6 7E+ 0 1
- When the number of digits of the decimal part is set to any value other than "0", "2EH (.)" is
automatically stored in "specified number of digits of decimal part + 1"th digit.
When the number of digits of the decimal part is "0", "2EH (.)" is not stored.
S2 1
S2 +2 4 1 2 3 4 6E+ 0 1
Number of digits of
S1 +1 S1 decimal part (4)
12.34567 Automatically added.
- For the sign of the exponent part, "2BH (+)" is stored when the exponent is positive, and "2DH (-)" is
stored when the exponent is negative.
476
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.4 FNC116 ESTR / Floating Point to Character String Conversion
11
- The exponent part is fixed to 2 digits.
Shift
Rotation and
FNC30-FNC39
When the exponent part is 1 digit, "30H (0)" is stored after the sign of the exponent part.
S2 +1 12 Fixed to 2 digits.
S2 +2 4 1 2 3 4 6E+ 0 1
12
Data Operation
FNC40-FNC49
S1 +1 S1 "30H (0)" is stored.
12.34567
- "00H" or "0000H" is automatically stored at the end of the converted character string.
13
Related instructions
Processing
High Speed
FNC50-FNC59
Instruction Description
EVAL (FNC117) Converts a character string (ASCII codes) into binary floating point data.
STR (FNC200) Converts binary data into a character string (ASCII codes).
VAL (FNC201) Converts a character string (ASCII codes) into binary data. 14
Instruction
Handy
FMC60-FNC69
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When S1 is not located within the following range (error code: K6706) 15
0, 2126 S1 < 2128
Device
External FX I/O
FNC70-FNC79
When the format specified by S2 is any value other than "0" or "1" (error code: K6706)
When the total number of digits specified by S2 +1 is not located within the following range (error code:
K6706)
In the case of decimal point format:
When the number of digits of the decimal part is "0", Total number of digits 2
16
Device
External FX
FNC80-FNC89
When the number of digits of the decimal part is any value other than "0", Total number of digits
(Number of digits of decimal part + 3)
In the case of exponent format:
When the number of digits of the decimal part is "0", Total number of digits 6
When the number of digits of the decimal part is any value other than "0", Total number of digits
(Number of digits of decimal part + 7) 17
Transfer 2
Data
FNC100-FNC109
When the number of digits of the decimal part specified by S2 +2 is not located within the following
range (error code: K6706)
In the case of decimal point format: Number of digits of decimal part (Total number of digits - 3)
In the case of exponent format: Number of digits of decimal part (Total number of digits - 7)
When the devices storing a character string specified by
code: K6706)
D exceeds the allowable device range (error
18
Floating Point
FNC110-FNC139
When the conversion result exceeds the specified total number of digits (error code: K6706)
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
477
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.4 FNC116 ESTR / Floating Point to Character String Conversion
Program examples
1) In the program example shown below, the contents (binary floating point data) of R0 and R1 are
converted according to the contents specified by R10 to R12, and then stored to D0 and later when X000
turns ON
X000
FNC116 R0 R10 D0
DESTRP
END
Conversion b15 b8 b7 b0
R10 0 format
Total number Total number D0 20H(space) 20H(space)
R11 7 of digits of digits
Number of digits D1 2EH(.) 30H(0)
R12 3 of decimal part 0 0 3 3
D2 33H(3) 30H(0)
Space Number of
R1 R0 digits of D3 00H 33H(3)
decimal part
0.0327457
00H is automatically stored at
the end of the character string.
2) In the program shown below, the contents (binary floating point data) of R0 and R1 are converted
according to the contents specified by R10 to R12, and then stored to D10 and later when X000 turns ON
X000
FNC116 R0 R10 D10
DESTRP
END
1 (exponent Conversion
R10 format) format
Total number Total number
R11 12 of digits of digits
Number of digits
R12 4 of decimal part 3 2 7 4 6E 0 2
D16 0000H
478
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.5 FNC117 EVAL / Character String to Floating Point Conversion
11
18.5 FNC117 EVAL / Character String to Floating Point Conversion
Shift
Rotation and
FNC30-FNC39
Outline
This instruction converts a character string (ASCII codes) into binary floating point data.
On the other hand, the VAL (FNC201) instruction converts a character string (ASCII codes) into binary data.
12
For a character string, refer to Section 5.3.
Data Operation
FNC40-FNC49
For handling of floating point, refer to Subsection 5.1.3.
For VAL (FNC201) instruction, refer to Subsection 26.2.
1. Instruction format
13
FNC 117 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
D EVAL P Continuous
9 steps DEVAL Operation
DEVALP Pulse (Single)
Operation
2. Set data 14
Operand Type Description Data Type
Instruction
Handy
FMC60-FNC69
Head device number storing character string data to be converted into binary
S Character string
floating point data
D Head device number storing converted binary floating point data Real number (binary)
3. Applicable devices 15
Device
External FX I/O
FNC70-FNC79
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3
16
D 3 3 3 3
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 32-bit operation (EVAL and EVALP)
A character string stored in S and later is converted into binary floating point, and stored to [ D +1, 17
D ].
Transfer 2
Data
FNC100-FNC109
Command
input FNC117
S D
DEVAL
A specified character string may be in the decimal point format or exponent format. A character string in
either format can be converted into binary floating point data.
18
Floating Point
FNC110-FNC139
b15 b8 b7 b0
S ASCII code for 1st character ASCII code for sign
D +1 D
S +1 ASCII code for 3rd character ASCII code for 2nd character
S +2 ASCII code for 5th character ASCII code for 4th character 19
Binary floating point
Operation 2
Data
FNC140-FNC149
S +3 ASCII code for 7th character ASCII code for 6th character
(real number)
S +4 00H
479
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.5 FNC117 EVAL / Character String to Floating Point Conversion
1 0 7 8 1 2
S +1 2EH(.) 31H(1)
D +1 D
S +2 32H(2) 33H(3)
1.3201E+10
S +3 31H(1) 30H(0)
2BH(+) 45H(E) Binary floating point
S +4 (real number)
S +5 30H(0) 31H(1)
S +6 00H
1 3 2 0 1E+ 1 0
When a character string to be converted into binary floating point specified by S has 7 digits or more
excluding the sign, decimal point and exponent part, the conversion result may contain rounding error.
a) In the case of decimal point format
b15 b8 b7 b0
S 20H(space) 2DH(-)
S +1 31H(1) 20H(space)
S +2 33H(3) 2EH(.) D +1 D
S +3 31H(1) 30H(0) 1.30156
S +4 36H(6) 35H(5) Up to 6 digits are securely
equivalent.
S +5 31H(1) 38H(8)
Binary floating point
S +6 00H 32H(2) (real number)
1 3 0 1 5 6 8 1 2
Rounded.
480
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.5 FNC117 EVAL / Character String to Floating Point Conversion
11
b) In the case of exponent format
Shift
Rotation and
FNC30-FNC39
b15 b8 b7 b0
S 20H(.) 2DH(-)
S +1 2EH(.) 31H(1)
S +2 35H(5) 33H(3) 12
D +1 D
Data Operation
FNC40-FNC49
S +3 33H(3) 30H(0) 1.35034E2
S +4 31H(1) 34H(4) Up to 6 digits are
securely equivalent.
S +5 45H(E) 32H(2)
Binary floating point
S +6 30H(0) 2DH(-) (real number)
13
00H 32H(2)
Processing
High Speed
FNC50-FNC59
1 3 5 0 3 4 1 2E 0 2
Rounded.
14
When "20H (space)" or "30H (0)" exists between numbers except the first "0" in a character string specified
Instruction
Handy
FMC60-FNC69
by S , "20H" or "30H" is ignored during conversion.
b15 b8 b7 b0
S 20H(space) 2DH(-)
S +1 31H(1) 30H(0) D +1 D 15
Device
External FX I/O
FNC70-FNC79
S +2 32H(2) 2EH(.) 1.231
S +3 31H(1) 33H(3)
Binary floating point
(real number)
S +4 00H
0 1 2 3 1 16
Device
External FX
FNC80-FNC89
Ignored.
When "30H (0)" exists between a number and "E" in a character string in the exponent format, "30H" is
ignored during conversion.
b15 b8 b7 b0 17
20H(space) 2DH(-)
Transfer 2
Data
FNC100-FNC109
2EH(.) 31H(1)
34H(4) 30H(0) D +1 D
33H(3) 35H(5) 1.0453E+3
2BH(+) 45H(E)
18
Floating Point
FNC110-FNC139
33H(3) 30H(0)
00H
1 0 4 5 3E+ 0 3
19
Operation 2
Data
FNC140-FNC149
Ignored.
20
Control
Positioning
FNC150-FNC159
481
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.5 FNC117 EVAL / Character String to Floating Point Conversion
Related devices
For the use methods of the zero, borrow and carry flags, refer to Subsection 6.5.2.
Description
Device Name
Condition Operation
The conversion result is true "0".
M8020 Zero flag The zero flag M8020 turns ON.
(The mantissa part is "0".)
The absolute value of the conversion The value of D is the minimum value (2126) of 32-
M8021 Borrow flag
result is less than "2126". bit real numbers and the borrow flag M8021 turns ON.
The absolute value of the conversion The value of D is the maximum value (2128) of 32-
M8022 Carry flag 128
result is not less than "2 ". bit real numbers and the carry flag M8022 turns ON.
Related instructions
Instruction Description
ESTR (FNC116) Converts binary floating point data into a character string (ASCII codes).
STR (FNC200) Converts binary data into a character string (ASCII codes).
VAL (FNC201) Converts a character string (ASCII codes) into binary data.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When any character other than "30H (0)" to "39H (9)" exists in the integer part or decimal part (error code:
K6706)
When "2EH (.)" exists in two or more positions in a character string specified by S (error code: K6706)
When any character other than "45H (E)", "2BH (+)" or "2DH (-)" exists in the exponent part, or when two or
more exponent parts exist (error code: K6706)
When "00H" does not exist in the corresponding device range starting from S (error code: K6706)
When the number of characters after S is "0" or more than "24" (error code: K6706)
Program examples
1) In the program example shown below, a character string stored in R0 and later is converted into binary
floating point, and stored to D0 and D1 when X000 turns ON
X000
FNC117 R0 D0
DEVALP
END
b15 b8 b7 b0
R0 20H(space) 2DH(-)
R1 31H(1) 30H(0)
R2 32H(2) 2EH(.) D1 D0
1.23452
R3 34H(4) 33H(3)
R4 32H(2) 35H(5)
R5 00H 31H(1)
0 1 2 3 4 5 2 1
Ignored. Rounded.
482
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.5 FNC117 EVAL / Character String to Floating Point Conversion
11
2) In the program shown below, a character string stored in D10 and later is converted into binary floating
Shift
Rotation and
FNC30-FNC39
point, and stored to D100 and D101 when X000 turns ON
X000
FNC117 D10 D100
DEVALP
END 12
Data Operation
FNC40-FNC49
b15 b8 b7 b0
D10 20H(space) 20H(space)
Processing
High Speed
FNC50-FNC59
D13 35H(5) 34H(4) 1.2345E2
D14 2DH(-) 45H(E)
D16 00H 14
Instruction
Handy
FMC60-FNC69
1 2 3 4 5E 0 2
Ignored. Rounded.
Device
External FX I/O
FNC70-FNC79
The absolute value of the
conversion result is less than The value of D is the minimum value (2126) of 32-bit real numbers and the borrow
126 flag M8021 turns ON.
"2 ".
The absolute value of the
The value of D is the maximum value (2128) of 32-bit real numbers and the carry
conversion result is not less than
"2 128
".
flag M8022 turns ON. 16
Device
External FX
FNC80-FNC89
The conversion result is true "0".
The zero flag M8020 turns ON.
(The mantissa part is "0".)
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
483
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.6 FNC118 EBCD / Floating Point to Scientific Notation Conversion
Outline
This instruction converts binary floating point into scientific notation.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 118 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D EBCD P Continuous
9 steps DEBCD Operation
DEBCDP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Data register number storing binary floating point Real number (binary)
Real number
D Data register number storing converted scientific notation
(decimal)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3
D 3 3 3 3
S +1 S
After execution
D +1 D
D +1
D
10
484
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.6 FNC118 EBCD / Floating Point to Scientific Notation Conversion
11
Caution
Shift
Rotation and
FNC30-FNC39
1. Handling of floating point
In floating point operations, all data is handled in binary floating point.
Because binary floating point is difficult to understand (requiring a dedicated monitoring method), it is
converted into scientific notation so that monitoring can be easily executed by peripheral equipment.
GX Developer and GOT have the function to directly monitor and display binary floating point.
12
Data Operation
FNC40-FNC49
13
Processing
High Speed
FNC50-FNC59
14
Instruction
Handy
FMC60-FNC69
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
485
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.7 FNC119 EBIN / Scientific Notation to Floating Point Conversion
Outline
This instruction converts scientific notation stored in devices into binary floating point.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 119 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D EBIN P 9 steps DEBIN
Continuous
Operation
DEBINP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Real number
S Data register number storing scientific notation data
(decimal)
D Data register number storing converted binary floating point. Real number (binary)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3
D 3 3 3 3
S +1 S
S +1
S
10
After execution
D +1 D
486
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.7 FNC119 EBIN / Scientific Notation to Floating Point Conversion
11
Program example
Shift
Rotation and
FNC30-FNC39
By DEBIN instruction, a numeric value containing the decimal point can be directly converted into binary
floating point.
Data Operation
FNC40-FNC49
X002
FNC 12 K314 D0 K314 D0 [D1]
MOVP
314 102
FNC 12 [D0]
K -2 D1 K -2 D1
MOVP
(D1,D0) (D11,D10)
13
FNC119 D0 D 10
Processing
High Speed
FNC50-FNC59
DEBIN 314 102 Binary floating point
14
Instruction
Handy
FMC60-FNC69
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
487
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.8 FNC120 EADD / Floating Point Addition
Outline
This instruction executes addition of two binary floating point data.
For program examples of floating point operations, refer to Section 12.10.
For handling of floating point, refer to Subsection 5.1.3.
For flag operations, refer to Subsection 6.5.2.
1. Instruction format
FNC 120 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D EADD P Continuous
13 steps DEADD Operation
DEADDP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S1 Word device number storing binary floating point data used in addition
Real number
S2 Word device number storing binary floating point data used in addition
(binary)*1
D Data register number storing the addition result
*1. When a constant (K or H) is specified, it is automatically converted into binary floating point (real
number) when the instruction is executed.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3
D 3 3 3 3
Caution
1. When a same device is specified
The same device number can be specified in [ S1 +1, S1 ],[ S2 +1, S2 ] and [ D +1, D ].
In this case, note that the addition result changes in every operation cycle when the continuous operation
type instruction (DEADD) is used.
488
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.9 FNC121 ESUB / Floating Point Subtraction
11
18.9 FNC121 ESUB / Floating Point Subtraction
Shift
Rotation and
FNC30-FNC39
Outline
This instruction executes subtraction of two binary floating point data.
For program examples of floating point operations, refer to Section 12.10.
12
For handling of floating point, refer to Subsection 5.1.3.
Data Operation
FNC40-FNC49
For flag operations, refer to Subsection 6.5.2.
1. Instruction format
FNC 121 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
13
D ESUB P Continuous
13 steps DESUB
Processing
High Speed
FNC50-FNC59
Operation
DESUBP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type 14
Instruction
Handy
FMC60-FNC69
S1 Word device number storing binary floating point data used in subtraction
Real number
S2 Word device number storing binary floating point data used in subtraction
(binary)*1
D Data register number storing the subtraction result
*1. When a constant (K or H) is specified, it is automatically converted into binary floating point (real
number) when the instruction is executed.
15
Device
External FX I/O
FNC70-FNC79
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
16
Device
External FX
FNC80-FNC89
S1 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3
D 3 3 3 3
Transfer 2
Data
FNC100-FNC109
1. 32-bit operation (DESUB and DESUBP)
Binary floating point data [ S2 +1, S2 ] is subtracted from binary floating point data [ S1 +1, S1 ], and
the subtraction result in the binary floating point format is transferred to [ D +1, D ].
Command
input FNC121
18
S1 S2 D [ S1 +1, S1 ] [ S2 +1, S2 ] [ D +1, D ]
Floating Point
FNC110-FNC139
DESUB
Binary floating point Binary floating point Binary floating point
Caution
1. When a same device is specified 20
Control
Positioning
FNC150-FNC159
A same device number can be specified in [ S1 +1, S1 ],[ S2 +1, S2 ] and [ D +1, D ].
In this case, note that the subtraction result changes in every operation cycle when the continuous operation
type instruction (DESUB) is used.
489
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.10 FNC122 EMUL / Floating Point Multiplication
Outline
This instruction executes multiplication of two binary floating point data.
For program examples of floating point operations, refer to Section 12.10.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 122 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D EMUL P Continuous
13 steps DEMUL Operation
DEMULP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S1 Word device number storing binary floating point data used in multiplication
Real number
S2 Word device number storing binary floating point data used in multiplication
(binary)*1
D Data register number storing the multiplication result
*1. When a constant (K or H) is specified, it is automatically converted into binary floating point (real
number) when the instruction is executed.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3
D 3 3 3 3
490
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.11 FNC123 EDIV / Floating Point Division
11
18.11 FNC123 EDIV / Floating Point Division
Shift
Rotation and
FNC30-FNC39
Outline
This instruction executes division of two binary floating point.
For program examples of floating point operations, refer to Section 12.10.
12
For handling of floating point, refer to Subsection 5.1.3.
Data Operation
FNC40-FNC49
For flag operations, refer to Subsection 6.5.2.
1. Instruction format
FNC 123 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
13
D EDIV P Continuous
13 steps DEDIV
Processing
High Speed
FNC50-FNC59
Operation
DEDIVP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type 14
Instruction
Handy
FMC60-FNC69
S1 Word device number storing binary floating point data used in division
Real number
S2 Word device number storing binary floating point data used in division
(binary)*1
D Data register number storing the division result
*1. When a constant (K or H) is specified, it is automatically converted into binary floating point (real
number) when the instruction is executed.
15
Device
External FX I/O
FNC70-FNC79
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
16
Device
External FX
FNC80-FNC89
S1 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3
D 3 3 3 3
Transfer 2
Data
FNC100-FNC109
1. 32-bit operation (DEDIV and DESDIVP)
Binary floating point data [ S1 +1, S1 ] is divided by binary floating point data [ S2 +1, S2 ], and the
division result in the binary floating point format is transferred to [ D +1, D ].
Command
input
Dividend Divisor 18
FNC123 [ S1 +1, S1 ] [ S2 +1, S2 ] [ D +1, D ]
S1 S2 D
Floating Point
FNC110-FNC139
DEDIV Binary floating point Binary floating point Binary floating point
20
Control
Positioning
FNC150-FNC159
491
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.12 FNC124 EXP / Floating Point Exponent
Outline
This instruction executes exponential operation whose base is "e (2.71828)".
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 124 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D EXP P 9 steps DEXP
Continuous
Operation
DEXPP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number storing binary floating point data used in exponential
S
operation. Real number (binary)
D Head device number storing the operation result.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
S +1 S D +1 D
Error
An operation error occurs in the following case; The error flag M8067 turns ON, and the error code is stored in
D8067.
When the operation result is outside the following range (error code: K6706)
2126 | Operation result | < 2128
492
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.12 FNC124 EXP / Floating Point Exponent
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program example shown below, the exponential operation is executed for a value set in the 2-digit BCD
format in X020 to X027, and the operation result is stored in the binary floating point format to D0 and D1
when X000 turns ON.
X000
FNC 19 K2X20 D20 Data used in the exponential operation is input ([1]). 12
BIN
Data Operation
FNC40-FNC49
FNC224 The range of the value to be operated is checked.
D20 K88 M0
LD > (Refer to 1) in "Points" below.)
M0
FNC 49 The input data is converted into binary floating point
D20 D10
FLT (real number) ([2]).
13
FNC124 D10 D0 The exponential operation is executed ([3]).
Processing
High Speed
FNC50-FNC59
DEXP
END
Instruction
Handy
FMC60-FNC69
[1] D20 [2] Conversion into [3]
Conversion binary floating point Exponential
X027 X020 into binary b15 b0 (real number) D11 D10 operation D1 D0
1 3 13 13 442413.4
BCD value BIN FLT Binary floating point EXP Binary floating point
Binary value (real number) value (real number) value
15
Device
External FX I/O
FNC70-FNC79
Points
1) The operation result becomes less than "2128" when the BCD value set in X020 to X027 is "88" or less
because of "loge2128 = 88.7".
If a value "89" or more is set, an operation error occurs. To prevent this operation error, when a value
more than "89" is set, M0 is set to ON so that the exponential operation is not executed. 16
Device
External FX
FNC80-FNC89
2) Conversion from natural logarithm into common logarithm
In the CPU, operations are executed in natural logarithm.
For obtaining a value in common logarithm, specify a common logarithm value divided by "0.4342945" in
[ S +1, S ].
X 17
10X= e 0.4342945
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
493
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.13 FNC125 LOGE / Floating Point Natural Logarithm
Outline
This instruction executes the natural logarithm operation.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 125 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D LOGE P 9 steps DLOGE
Continuous
Operation
DLOGEP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number storing binary floating point data used in the natural
S
logarithm operation Real number (binary)
D Head device number storing the operation result
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
Only a positive value can be set in [ S +1, S ]. (The natural logarithm operation cannot be executed
for a negative value.)
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When a negative value is specified in S (error code: K6706)
When "0" is specified in S (error code: K6706)
494
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.13 FNC125 LOGE / Floating Point Natural Logarithm
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program example shown below, natural logarithm of "10" set in D50 is calculated, and stored to D30
and D31 when X000 turns ON.
X000
FNC 12 Data used in the natural logarithm operation is set
K10 D50
MOV ([1]). 12
The data to be used is converted into binary floating
Data Operation
FNC40-FNC49
FNC 49 D50 D40
FLT point (real number) ([2]).
END 13
Processing
High Speed
FNC50-FNC59
D50 [2] Conversion into
binary floating point [3] Logarithm
[1] b15 b0 (real number) D41 D40 operation D31 D30
10 10 10 2.302585
MOV Binary value FLT Binary floating point
(real number) value
LOGE Binary floating point
(real number) value 14
Instruction
Handy
FMC60-FNC69
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
495
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.14 FNC126 LOG10 / Floating Point Common Logarithm
Outline
This instruction executes the common logarithm operation.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 126 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D LOG10 P 9 steps DLOG10
Continuous
Operation
DLOG10P Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number storing binary floating point data used in the common
S
logarithm operation Real number (binary)
D Head device number storing the operation result
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
Only a positive value can be set in [ S +1, S ]. (The common logarithm operation cannot be
executed for a negative value.)
Errors
An operation error occurs in the following cases; The error flag M8067 turns ON, and the error code is stored
in D8067.
When a negative value is specified in S (error code: K6706)
When "0" is specified in S (error code: K6706)
496
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.14 FNC126 LOG10 / Floating Point Common Logarithm
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program example shown below, common logarithm of "15" set in D50 is calculated, and stored to D30
and D31 when X000 turns ON.
X000
FNC 12 Data used in the common logarithm operation is set
K15 D50
MOV ([1]). 12
The data to be used is converted into binary floating
Data Operation
FNC40-FNC49
FNC 49 D50 D40
FLT point (real number) ([2]).
END 13
Processing
High Speed
FNC50-FNC59
D50 [2] Conversion into
binary floating point [3] Logarithm
[1] b15 b0 (real number) D41 D40 operation D31 D30
10 15 15 1.176091
MOV Binary value FLT Binary floating point
(real number) value
DLOG10 Binary floating point
(real number) value 14
Instruction
Handy
FMC60-FNC69
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
497
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.15 FNC127 ESQR / Floating Point Square Root
Outline
This instruction obtains the square root of binary floating point.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 127 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ESQR P 9 steps DESQR
Continuous
Operation
DESQRP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Word device number storing binary floating point data whose square root is
S Real number
calculated
(binary)*1
D Data register number storing the square root of binary floating point data
*1. When a constant (K or H) is specified, it is automatically converted into binary floating point (real
number) when the instruction is executed.
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3
D 3 3 3 3
Related device
For the zero flag use method, refer to Subsection 6.5.2.
Device Name Description
M8020 Zero flag Turns ON when the operation result is true "0".
Error
The contents of [ S1 +1, S1 ] are valid only when a positive value is set. When a negative value is set,
the operation error flag M8067 turns ON, and the instruction is not executed.
498
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.16 FNC128 ENEG / Floating Point Negation
11
18.16 FNC128 ENEG / Floating Point Negation
Shift
Rotation and
FNC30-FNC39
Outline
This instruction inverts the sign of binary floating point (real number) data.
For handling of floating point, refer to Subsection 5.1.3.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 128 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ENEG P 5 steps DENEG
Continuous
13
Operation
DENEGP Pulse (Single)
Operation
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
D Head device number storing binary floating data whose sign is to be inverted Real number (binary)
14
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
15
D 3 3 3 3
Device
External FX I/O
FNC70-FNC79
Explanation of function and operation
1. 32-bit operation (DENEG and DENEGP)
The sign of binary floating point stored in [ D +1, D ] is inverted, and the negation result is stored to 16
[ D +1, D ].
Device
External FX
FNC80-FNC89
Command
input FNC128
D
DENEG
Program example
17
Transfer 2
Data
FNC100-FNC109
In the program example shown below, the sign of floating point data stored in D100 and D101 is inverted, and
the negation result is stored to D100 and D101 when X000 turns ON.
X000
FNC128 D100
DENEGP
18
END
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
499
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.17 FNC129 INT / Floating Point to Integer Conversion
Outline
This instruction converts binary floating point data into a binary integer which is a normal data format inside
PLCs (binary floating point binary integer).
For program examples of floating point operations, refer to Section 12.10.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 129 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D INT P 5 steps INT Continuous
9 steps DINT
Continuous
Operation Operation
INTP Pulse (Single) DINTP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type
Data register number storing binary floating point data to be converted into a
S Real number (binary)
binary integer
D Data register number storing a converted binary integer 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3
D 3 3 3 3
500
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.17 FNC129 INT / Floating Point to Integer Conversion
11
Related devices
Shift
Rotation and
FNC30-FNC39
For the methods of zero, borrow and carry flags, refer to Subsection 6.5.2.
Device Name Description
M8020 Zero flag Turns ON when the operation result is 0
M8021 Borrow flag Turns ON when the conversion result is cut in the decimal part.
12
Turns ON when the operation result is outside the range from 32768 to 32767
Data Operation
FNC40-FNC49
M8022 Carry flag (in 16-bit operation) or from 2,147,483,648 to 2,147,483,647 (in 32-bit operation) and
overflow occurs. (The operation result is not reflected.)
Caution
1. Caution in the operation 13
Processing
High Speed
FNC50-FNC59
Values after the decimal point are rounded.
14
Instruction
Handy
FMC60-FNC69
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
501
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.18 FNC130 SIN / Floating Point Sine
Outline
This instruction obtains the sine value of an angle (in radians).
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 130 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D SIN P 9 steps DSIN
Continuous
Operation
DSINP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Device number storing an angle (in radians) in binary floating point
Real number (binary)
D Device number storing the sine value in binary floating point
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
D D +1 D Sine value
Binary floating point
502
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.18 FNC130 SIN / Floating Point Sine
11
Program example
Shift
Rotation and
FNC30-FNC39
X001
FNC 12 K 45 D 0 (K45) (D 0)
MOVP An angle is selected by the inputs
X002 X001 and X002.
FNC 12
MOVP
K 90 D 0 (K90) (D 0) 12
Data Operation
FNC40-FNC49
M8000 (D 0) (D5, D4) Binary floating point
FNC 49 D0 D 4
RUN FLTP value
monitor (/180) (D21, D20)
FNC123 K31415926 K1800000000 D 20
DEDIV Binary floating point
Processing
High Speed
FNC50-FNC59
DEMUL
S D
FNC130 (D31, D30) RAD (D101, D100) SIN
D 30 D100 Binary floating point
DSIN
14
Instruction
Handy
FMC60-FNC69
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
503
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.19 FNC131 COS / Floating Point Cosine
Outline
This instruction obtains the cosine value of an angle (in radians).
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 131 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D COS P 9 steps DCOS
Continuous
Operation
DCOSP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Device number storing an angle (in radians) in binary floating point
Real number (binary)
D Device number storing the cosine value in binary floating point
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
D D +1 D Cosine value
Binary floating point
504
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.20 FNC132 TAN / Floating Point Tangent
11
18.20 FNC132 TAN / Floating Point Tangent
Shift
Rotation and
FNC30-FNC39
Outline
This instruction obtains the tangent value of an angle (in radians).
For handling of floating point, refer to Subsection 5.1.3.
12
Data Operation
FNC40-FNC49
1. Instruction format
FNC 132 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D TAN P 9 steps DTAN
Continuous
13
Operation
DTANP Pulse (Single)
Operation
Processing
High Speed
FNC50-FNC59
2. Set data
Operand Type Description Data Type
S Device number storing an angle (in radians) in binary floating point
Real number (binary) 14
D Device number storing the tangent value in binary floating point
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
S 3 3 3 3 3
D 3 3 3 3
Device
External FX
FNC80-FNC89
1. 32-bit operation (DTAN and DTANP)
A value of angle (binary floating point) specified in [ S +1, S ] is converted into the tangent value, and
transferred to [ D +1, D ].
Command
input FNC132
S D
[ S +1, S ] RAD [ D +1, D ] TAN
Binary floating point Binary floating point
17
DTAN
Transfer 2
Data
FNC100-FNC109
Value in radians (Value in degrees /180)
S S +1 S Binary floating point
Tangent value
18
D D +1 D
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
505
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.21 FNC133 ASIN / Floating Point Arc Sine
Outline
This instruction executes the SIN1 (arc sine) operation.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 133 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ASIN P 9 steps DASIN
Continuous
Operation
DASINP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Head device number storing a sine value used in the SIN1 (arc sine) operation.
Real number (binary)
D Head device number storing the operation result
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
S +1 S D +1 D
SIN1
The sine value stored in [ S +1, S ] can be set within the range from 1.0 to +1.0.
The angle (operation result) stored in [ D +1, D ] is expressed in radians (from /2 to /2).
For conversion between radians and degrees, refer to RAD (FNC136) and DEG (FNC137) instructions.
For RAD (FNC136) instruction, refer to Section 18.24.
For DEG (FNC137) instruction, refer to Section 18.25.
Error
An operation error is caused in the following case; The error flag M8067 turns ON, and the error code is
stored in D8067.
When a value specified in S is outside the range from 1.0 to +1.0 (error code: K6706)
506
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.21 FNC133 ASIN / Floating Point Arc Sine
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program example shown below, the SIN1 value of data (binary floating point) stored in D0 and D1 is
calculated, and the angle is output in 4-digit BCD to Y040 to Y057 when X000 turns ON.
X000
FNC133 The angle (in radians) is calculated by the SIN1
DASIN
D0 D10
operation ([1]). 12
Data Operation
FNC40-FNC49
FNC137 The value in radians is converted into the value in
D10 D20
DDEG degrees ([2]).
Processing
High Speed
FNC50-FNC59
END
Instruction
Handy
FMC60-FNC69
Conversion
by SIN1
D1 D0 operation D11 D10
0.5 0.5235988
Binary floating point DASIN Binary floating point
(real number) value (real number) value
[2] Conversion into degrees 15
DDEG
Device
External FX I/O
FNC70-FNC79
[3]
Conversion D30 [4] BCD
D21 D20 into binary b15 b0 operation Y057 Y040
30 30 0 0 3 0
Binary floating point
(real number) value
INT Binary
value
BCD BCD
value 16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
507
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.22 FNC134 ACOS / Floating Point Arc Cosine
Outline
This instruction executes the COS1 (arc cosine) operation.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 134 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ACOS P 9 steps DACOS
Continuous
Operation
DACOSP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number storing a cosine value used in the COS1 (arc cosine)
S
operation Real number (binary)
D Head device number storing the operation result
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
S +1 S D +1 D
1
COS
The cosine value stored in [ S +1, S ] can be set within the range from 1.0 to +1.0.
The angle (operation result) stored in [ D +1, D ] is expressed in radians (from 0 to ).
For conversion between radians and degrees, refer to RAD (FNC136) and DEG (FNC137) instructions.
For RAD (FNC136) instruction, refer to Section 18.24.
For DEG (FNC137) instruction, refer to Section 18.25.
Error
An operation error is caused in the following case; The error flag M8067 turns ON, and the error code is
stored in D8067.
When a value specified in S is outside the range from 1.0 to +1.0 (error code: K6706)
508
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.22 FNC134 ACOS / Floating Point Arc Cosine
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program example shown below, the COS1 value of data (binary floating point) stored in D0 and D1 is
calculated, and the angle is output in 4-digit BCD to Y040 to Y057 when X000 turns ON.
X000
FNC134 The angle (in radians) is calculated by the COS1
DACOS
D0 D10
operation ([1]). 12
Data Operation
FNC40-FNC49
FNC137 The value in radians is converted into the value in
D10 D20
DDEG degrees ([2]).
Processing
High Speed
FNC50-FNC59
END
Instruction
Handy
FMC60-FNC69
Conversion
by COS1
D1 D0 operation D11 D10
0.5 1.047198
Binary floating point DACOS Binary floating point
(real number) value (real number) value
[2] Conversion into degrees 15
DDEG
Device
External FX I/O
FNC70-FNC79
[3]
Conversion D30 [4] BCD
D21 D20 into binary b15 b0 operation Y057 Y040
60 60 0 0 6 0
Binary floating point
(real number) value
INT Binary
value
BCD BCD
value 16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
509
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.23 FNC135 ATAN / Floating Point Arc Tangent
Outline
This instruction executes the TAN1 (arc tangent) operation.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 135 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ATAN P 9 steps DATAN
Continuous
Operation
DATANP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number storing a tangent value used in the TAN1 (arc tangent)
S
operation Real number (binary)
D Head device number storing the operation result
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
S +1 S D +1 D
1
TAN
The angle (operation result) stored in [ D +1, D ] is expressed in radians (from /2 to +/2).
For conversion between radians and degrees, refer to RAD (FNC136) and DEG (FNC137) instructions.
For RAD (FNC136) instruction, refer to Section 18.24.
For DEG (FNC137) instruction, refer to Section 18.25.
510
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.23 FNC135 ATAN / Floating Point Arc Tangent
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program example shown below, the TAN1 value of data (binary floating point) stored in D0 and D1 is
calculated, and the angle is output in 4-digit BCD to Y040 to Y057 when X000 turns ON.
X000
FNC135 The angle (in radians) is calculated by the TAN1
DATAN
D0 D10
operation ([1]). 12
Data Operation
FNC40-FNC49
FNC137 The value in radians is converted into the value in
D10 D20
DDEG degrees ([2]).
Processing
High Speed
FNC50-FNC59
END
Instruction
Handy
FMC60-FNC69
Conversion
by TAN1
D1 D0 operation D11 D10
1 0.785398
Binary floating point DATAN Binary floating point
(real number) value (real number) value
[2] Conversion into degrees 15
DDEG
Device
External FX I/O
FNC70-FNC79
[3]
Conversion D30 [4] BCD
D21 D20 into binary b15 b0 operation Y057 Y040
45 45 0 0 4 5
Binary floating point
(real number) value
INT Binary
value
BCD BCD
value 16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
511
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.24 FNC136 RAD / Floating Point Degrees to Radians Conversion
Outline
This instruction converts a value in degrees into a value in radians.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 136 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D RAD P 9 steps DRAD
Continuous
Operation
DRADP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number storing a value in degrees to be converted into a value in
S
radians Real number (binary)
D Head device number storing a value in radians acquired by conversion
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
S +1 S D +1 D
rad
512
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.24 FNC136 RAD / Floating Point Degrees to Radians Conversion
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program example shown below, a 4-digit BCD value set in degrees in X020 to X037 is converted into a
binary floating point value in radians, and stored to D20 and D21 when X000 turns ON.
X000
FNC 19 K4X20 D0 Angle to be converted into radians is input ([1]).
BIN 12
The input angle is converted into binary floating
Data Operation
FNC40-FNC49
FNC 49 D0 D10
FLT point (real number) ([2]).
END 13
Processing
High Speed
FNC50-FNC59
Operation when "120" is specified in X020 to X037
Instruction
Handy
FMC60-FNC69
0 1 2 0 120 120 2.094395 ...
BCD BIN Binary FLT DRAD
value value
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
513
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.25 FNC137 DEG / Floating Point Radians to Degrees Conversion
Outline
This instruction converts a value in radians into a value in degrees.
For handling of floating point, refer to Subsection 5.1.3.
1. Instruction format
FNC 137 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D DEG P 9 steps DDEG
Continuous
Operation
DDEGP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number storing a value in radians to be converted into a value in
S
degrees Real number (binary)
D Head device number storing a value in degrees acquired by conversion
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3
514
FX3U/FX3UC Series Programmable Controllers 18 Floating Point FNC110 to FNC139
Programming Manual - Basic & Applied Instruction Edition 18.25 FNC137 DEG / Floating Point Radians to Degrees Conversion
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program example shown below, a binary floating point value set in radians in D20 and D21 is converted
into a BCD value in degrees, and stored to Y040 and Y057 when X000 turns ON.
X000
FNC137 A value in radians is converted into a value in
D20 D10
DDEG degrees ([1]). 12
The angle in binary floating point (real number) is
Data Operation
FNC40-FNC49
FNC129 D10 D0
INT converted into an integer ([2]).
END 13
Processing
High Speed
FNC50-FNC59
Operation when "1.435792" is specified in D20 and D21
[2]
[1] Conversion [3]
D21 D20
Conversion
into degrees D11 D10
into binary
value b15
D0 Conversion
b0 into BCD Y057 Y040 14
Instruction
Handy
FMC60-FNC69
1.435792 82.26482 82 0 0 8 2
Binary floating point DDEG Binary floating point INT Binary BCD BCD
value (real number) value (real number) value value
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
515
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition
Section
140 WSUM WSUM S D n Sum of Word Data
19.1
Section
141 WTOB WTOB S D n WORD to BYTE
19.2
Section
142 BTOW BTOW S D n BYTE to WORD
19.3
Section
143 UNI UNI S D n 4-bit Linking of Word Data
19.4
Section
144 DIS DIS S D n 4-bit Grouping of Word Data
19.5
145
146
Section
147 SWAP SWAP S Byte Swap
19.6
148
Section
149 SORT2 SORT2 S m1 m2 D n Sort Tabulated Data 2
19.7
516
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.1 FNC140 WSUM / Sum of Word Data
11
19.1 FNC140 WSUM / Sum of Word Data
Shift
Rotation and
FNC30-FNC39
Outline
This instruction calculates the sum of consecutive 16-bit or 32-bit data.
When calculating the addition data (sum value) in units of byte (8 bits), use the CCD (FNC 84) instruction.
12
For CCD (FNC 84) instruction, refer to Section 16.5.
Data Operation
FNC40-FNC49
1. Instruction format
FNC 140 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D WSUM P 7 steps WSUM Continuous
Operation 13 steps DWSUM
Continuous
Operation 13
WSUMP Pulse (Single) DWSUMP Pulse (Single)
Processing
High Speed
FNC50-FNC59
Operation Operation
2. Set data
Operand type Description Data type
S Head device number storing data whose sum is calculated 16- or 32-bit binary
14
Instruction
Handy
FMC60-FNC69
D Head device number storing sum 32- or 64-bit binary
n Number of data (0 < n) 16- or 32-bit binary
3. Applicable devices
Oper-
Bit Devices Word Devices Others 15
Special Con- Real Charac-
Device
External FX I/O
FNC70-FNC79
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3
D
n
3 3 3 3
3 3
3 3
3 3
16
Device
External FX
FNC80-FNC89
Explanation of function and operation
1. 16-bit operation (WSUM and WSUMP)
The sum of "n" 16-bit data starting from S is stored as 32-bit data in [ D +1, D ]. 17
Command
Transfer 2
Data
FNC100-FNC109
input
FNC140 S D n
WSUM
S +0 K4444
K3333
+1
+2 K1234 "n"
Sum of
"n" data [ +1, D ]
D
18
+3 K-5426 points
Floating Point
FNC110-FNC139
(n = 6) K13911
+4 K326
+5 K10000
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
517
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.1 FNC140 WSUM / Sum of Word Data
[ S +1, S ] K32767000
[ S +3, S +2] K6000 Sum of
"n"
[ S +5, S +4] K35392000 "n" data [ D +3, D +2, D +1, D ]
points
[ S +7, S +6] K-11870000 (n = 5) K68640000
[ S +9, S +8] K12345000
Related instruction
Instruction Description
Check code
CCD (FNC 84)
Calculates the sum of 16-bit data in units of byte (8 bits) and the horizontal parity.
Caution
In the 32-bit operation, the acquired sum is 64-bit data. FX3U and FX3UC PLCs cannot handle 64-bit data.
When the sum is within the numeric range of 32-bit data (K-2,147,483,648 to K2,147,483,647), however,
FX3U and FX3UC PLCs can handle the low-order 32 bits of 32-bit data as the sum while ignoring the high-
order 32 bits.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When "n" points starting from S are outside the specified device range (error code: K6706)
When "n" is smaller than or equivalent to "0" (error code: K6706)
When D are outside the specified device range. (error code: K6706)
Program example
In the program shown below, the sum of 16-bit data stored in D10 to D14 is stored in [D101, D100].
X010 D10 K4500
FNC140 D10 D100 K5
WSUMP D11 K2500 WSUMP
D12 K-3276 instruction [D101,D100]
D13 K6780 K14948
END
D14 K4444
518
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.2 FNC141 WTOB / WORD to BYTE
11
19.2 FNC141 WTOB / WORD to BYTE
Shift
Rotation and
FNC30-FNC39
Outline
This instruction separates consecutive 16-bit data in byte units (8 bits).
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 141 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
S Head device number storing data to be separated in byte units
D Head device number storing result of separation in byte units 16-bit binary 14
n Number of byte data to be separated (0 n)
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
S 3 3 3 3 3
D 3 3 3 3 3
n 3 3 3 3
16
Explanation of function and operation
Device
External FX
FNC80-FNC89
1. 16-bit operation (WTOB and WTOBP)
1) "n/2" 16-bit data stored in S and later is separated into "n" bytes, and stored in "n" devices starting
from D as shown below.
Command
17
Transfer 2
Data
FNC100-FNC109
input FNC141 S D n
WTOBP
b15 b8 b7 b0 b15 b8 b7 b0
S +0 High-order byte Low-order byte D +0 00H Low-order byte
+1 High-order byte Low-order byte +1 00H High-order byte
+2 00H Low-order byte 18
...
...
...
data.
20
Control
Positioning
FNC150-FNC159
519
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.2 FNC141 WTOB / WORD to BYTE
3) When "n" is an odd number, only the low-order byte (8 bits) of the final separation source device is
regarded as the target data as shown in the figure below.
For example, when "n" is "5", the data from S to the low-order byte (8 bits) of S +2 is stored in
D to D +4.
b15 b8 b7 b0 b15 b8 b7 b0
S +0 12H 39H D +0 00H 39H
+1 56H 78H +1 00H 12H
When "n"
+2 FEH DCH +2 00H 78H is "5"
+3 00H 56H
It is ignored when
"n" is "5". +4 00H DCH
"00H" is stored.
4) When "n" is "0", WTOB instruction is not executed.
Related instruction
Instruction Description
BTOW (FNC142) Combines the low-order 8 bits (low-order byte) of consecutive 16-bit data.
Caution
Devices storing the separation source data can overlap devices storing the separated data.
When "n" is an odd number, however, the high-order byte (8 bits) of the final separation source device is
overwritten and erased.
b15 b8 b7 b0 b15 b8 b7 b0
S =D12 32H 31H D =D12 00H 31H
D13 34H 33H D13 00H 32H
When "n"
D14 36H 35H D14 00H 33H is "5"
"36H" is ignored when "n" is "5". D15 00H 34H
Because D14 is also used in the D16 00H 35H
separation result destination devices D
and later, "36H" is erased and
overwritten. "00H" is stored.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the separation source devices S to S +n/2 are outside the specified device range (error
code: K6706)
When "n" is an odd number, the number of a rounded up value decides the number of devices. (error
code: K6706)
When the separated data destination devices D to D +n-1 are outside the specified device range
(error code: K6706)
Program example
In the program shown below, the data stored in D10 to D12 is separated in byte units, and stored in D20 to
D25.
X000
FNC141 D10 D20 K6
WTOBP
END
b15 b8 b7 b0 b15 b8 b7 b0
D10 FDH 58H D20 00H 58H
D11 57H E2H D21 00H FDH
D12 34H 44H D22 00H E2H 6 bytes
D23 00H 57H
D24 00H 44H
D25 00H 34H
"00H" is stored.
520
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.3 FNC142 BTOW / BYTE to WORD
11
19.3 FNC142 BTOW / BYTE to WORD
Shift
Rotation and
FNC30-FNC39
Outline
This instruction combines the low-order 8 bits (low-order byte) of consecutive 16-bit data.
12
1. Instruction format
Data Operation
FNC40-FNC49
FNC 142 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Processing
High Speed
FNC50-FNC59
2. Set data
Operand type Description Data type
S Head device number storing data to be combined in byte units
D Head device number storing data acquired by combination in byte units 16-bit binary 14
n Number of byte data to be combined (0 n)
Instruction
Handy
FMC60-FNC69
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
15
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Device
External FX I/O
FNC70-FNC79
S 3 3 3 3 3
D 3 3 3 3 3
n 3 3 3 3
16
Explanation of function and operation
Device
External FX
FNC80-FNC89
1. 16-bit operation (BTOW and BTOWP)
1) The low-order byte (8 bits) of "n" 16-bit data starting from S is combined, and stored in "n/2" devices
starting from D as shown below.
Command
17
Transfer 2
Data
FNC100-FNC109
input FNC142 S D n
BTOWP
b15 b8 b7 b0 b15 b8 b7 b0
S +0 1st byte data D +0 2nd byte 1st byte
+1 2nd byte data +1 4th byte 3rd byte
"n" +2 3rd byte data 18
...
...
bytes +n/2 *
"n"th byte "n-1"th byte
...
...
Floating Point
FNC110-FNC139
2) The high-order byte (8 bits) of each combination source 16-bit data ( S and later) is ignored.
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
521
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.3 FNC142 BTOW / BYTE to WORD
3) When "n" is an odd number, "00H" is stored in the high-order byte (8 bits) of the final one among the
combination result destination devices as shown below.
For example, when "n" is "5", the low-order byte (8 bits) of S to S +4 is stored in D to
D +2, and "00H" is stored in the high-order byte (8 bits) of D +2.
b15 b8 b7 b0 b15 b8 b7 b0
S +0 ABH 12H D +0 34H 12H
+1 CDH 34H +1 78H 56H
When
"n" is +2 EFH 56H +2 00H 9AH
"5" +3 ABH 78H
When "n" is "5",
+4 CDH 9AH "00H" is stored.
The high-order bytes is ignored.
Related instruction
Instruction Description
WTOB (FNC141) Separates consecutive 16-bit data in byte units (8 bits).
Caution
Devices storing the combination source data may be equivalent to devices storing the combined data.
After combination, however, the high-order byte (8 bits) of the combination source data stored in the devices
used for the combination destination data is erased and overwritten with the data acquired by combining the
high-order byte (8 bits).
b15 b8 b7 b0 b15 b8 b7 b0
S =D11 ABH 12H D =D10 34H 12H
D12 CDH 34H D11 78H 56H
When D13 EFH 56H D12 BCH 9AH
"n" is D14 ABH 78H D13 EFH 56H
"6" D15 CDH 9AH D14 ABH 78H
D16 EFH BCH D15 CDH 9AH
D16 EFH BCH
The high-order bytes is ignored.
It is not changed.
Because these combination source devices are
also used for the combination destination, "ABH"
and "CDH" are erased and overwritten.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the combination source devices S to S +n-1 are outside the specified device range (error
code: K6706)
When the combined data destination devices D to D +n/2 are outside the specified device range
(error code: K6706)
When "n" is an odd number, the number of a rounded up value decides the numer of devices. (error code:
K6706)
522
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.3 FNC142 BTOW / BYTE to WORD
11
Program example
Shift
Rotation and
FNC30-FNC39
In the program shown below, the low-order byte (8 bits) data stored in D20 to D25 is combined, and stored in
D10 to D12.
X000
FNC142 D20 D10 K6
BTOWP 12
Data Operation
FNC40-FNC49
END
b15 b8 b7 b0 b15 b8 b7 b0
D20 00H 78H D10 12H 78H
D21
6 bytes D22
31H
36H
12H
49H
D11
D12
55H
31H
49H
67H
13
Processing
High Speed
FNC50-FNC59
D23 44H 55H
D24 48H 67H
D25 49H 31H
Instruction
Handy
FMC60-FNC69
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
523
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.4 FNC143 UNI / 4-bit Linking of Word Data
Outline
This instruction combines the low-order 4 bits of consecutive 16-bit data.
1. Instruction format
FNC 143 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
S Head device number storing data to be combined
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3 3
n 3 3 3 3
b15 b4 b3 b0
S +0 Low-order 4 bits
"n" 1 Low-order 4 bits
points 2 Low-order 4 bits b15 b12b11 b8 b7 b4 b3 b0
3 Low-order 4 bits D
524
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.4 FNC143 UNI / 4-bit Linking of Word Data
11
3) In the case of "1 n 3", the high-order {4 (4-n)} bits of D are set to "0".
Shift
Rotation and
FNC30-FNC39
For example, when "n" is "3", the low-order 4 bits of S to S +2 are stored in b0 to b11 of D ,
and the high-order 4 bits of D are set to "0".
S +0
b15 b4 b3 b0
Low-order 4 bits 12
+1 Low-order 4 bits b15 b12b11 b8 b7 b4 b3 b0
Data Operation
FNC40-FNC49
+2 Low-order 4 bits D 0 0 0 0
Processing
High Speed
FNC50-FNC59
Instruction Description
DIS (FNC144) Separates 16-bit data in 4-bit units.
Errors 14
An operation error occurs in the following cases; The error flag M8067 turns ON, and the error code is stored
Instruction
Handy
FMC60-FNC69
in D8067.
When S to S +n are outside the specified device range (error code: K6706)
When "n" is outside the range from "0 to 4" (error code: K6706)
15
Program example
Device
External FX I/O
FNC70-FNC79
In the program below, the low-order 4 bits of D0 to D2 are combined and stored in D10 when X000 turns ON.
X000
FNC143 D0 D10 K3
UNIP
END
16
Device
External FX
FNC80-FNC89
b15 b4 b3 b0 b15 b12b11 b4 b3 b0
D0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 D10 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1
D1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
D2 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 17
Transfer 2
Data
FNC100-FNC109
Combined data Because "n" is "K3",
they are set to "0".
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
525
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.5 FNC144 DIS / 4-bit Grouping of Word Data
Outline
This instruction separates 16-bit data into 4 bit units.
1. Instruction format
FNC 144 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
S Device number storing data to be separated
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3 3
n 3 3 3 3
Related instruction
Instruction Description
UNI (FNC143) Combines low-order 4 bits of 16-bit data.
526
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.5 FNC144 DIS / 4-bit Grouping of Word Data
11
Errors
Shift
Rotation and
FNC30-FNC39
An operation error occurs in the following cases; The error flag M8067 turns ON, and the error code is stored
in D8067.
When D to D +n are outside the specified device range (error code: K6706)
When "n" is outside the range from "0 to 4" (error code: K6706) 12
Data Operation
FNC40-FNC49
Program example
In the program below, D0 is separated into 4 bit units and stored in D10 to D13 when X000 turns ON.
X000
FNC144 D0 D10 K4
DISP 13
Processing
High Speed
FNC50-FNC59
END
Instruction
Handy
FMC60-FNC69
D12 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
D13 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
527
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.6 FNC147 SWAP / Byte Swap
Outline
This instruction swaps the high-order 8 bits and low-order 8 bits of a word device.
1. Instruction format
FNC 147 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D SWAP P 3 steps SWAP Continuous
5 steps DSWAP
Continuous
Operation Operation
SWAPP Pulse (Single) DSWAPP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
Word device whose high-order 8 bits and low-order 8 bits are swapped for each
SS1 16- or 32-bit binary
other
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3 3
Caution
When the continuous operation type instruction is used, swapping is executed in each operation cycle.
This instruction works in the same way as the extension function of the XCH (FNC 17) instruction.
528
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.7 FNC149 SORT2 / Sort Tabulated Data 2
11
19.7 FNC149 SORT2 / Sort Tabulated Data 2
Shift
Rotation and
FNC30-FNC39
Outline
This instruction sorts a data table consisting of data (lines) and group data (columns) based on a specified
group data (column) sorted by line in either ascending or descending order. This instruction stores the data
12
Data Operation
FNC40-FNC49
(lines) in serial devices facilitating the addition of data (lines).
On the other hand, the SORT (FNC 69) instruction stores the group data (columns) in serial devices, and
sorts a table in ascending order only.
For SORT (FNC 69) instruction, refer to Section 14.10.
1. Instruction format 13
Processing
High Speed
FNC50-FNC59
FNC 149 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
14
Instruction
Handy
FMC60-FNC69
Operand type Description Data type
S Head device number storing the data table [which occupies m1 m2 points]
m1 Number of data (lines) [1 to 32]
m2 Number of group data (columns) [1 to 6]
Head device number storing the operation result [which occupies m1 m2 points]
16- or 32-bit binary
15
D
Device
External FX I/O
FNC70-FNC79
n Column number of group data (column) used as the basis of sorting [1 to m2]
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Index
Con- Real Charac-
Pointer
16
Unit stant Number ter String
Device
External FX
FNC80-FNC89
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3
m1 3 3 3 3
m2
D 3 3
3 3
17
Transfer 2
Data
FNC100-FNC109
n 3 3 3 3
or descending order based on the group data in column No. "n", and the result is stored in the data table
(occupying m1 x m2 points) from D .
For operation examples, refer to Page 523.
Command
input FNC149 S m1 m2 D n
19
SORT2
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
529
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.7 FNC149 SORT2 / Sort Tabulated Data 2
The data table configuration is explained in an example in which the sorting source data table has 3 lines and
4 columns (m1 = K3, m2 = K4). For the sorting result data table, understand S as D .
Number of groups (m2 = K4)
Column No. 1 2 3 4
Line No. Control number Height Weight Age
1 S S +1 S +2 S +3
Number
of data 2 S +4 S +5 S +6 S +7
(m1 = 3)
3 S +8 S +9 S +10 S +11
When the command input turns ON, data sorting is started. Data sorting is completed after "m1" scans,
and the instruction execution complete flag M8029 is set to ON.
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
The data table configuration is explained in an example in which the sorting source data table has 3 lines and
4 columns (m1 = K3, m2 = K4). For the sorting result data table, understand S as D .
Number of groups (m2 = K4)
Column No. 1 2 3 4
Line No. Control number Height Weight Age
1 [ S +1, S ] [ S +3, S +2] [ S +5, S +4] [ S +7, S +6]
Number
of data 2 [ S +9, S +8] [ S +11, S +10] [ S +13, S +12] [ S +15, S +14]
(m1 = 3)
3 [ S +17, S +16] [ S +19, S +18] [ S +21, S +20] [ S +23, S +22]
When a data register D or extension register (R) is used for "m1", the data length is 32 bits.
For example, when "m1" is specified in D0, "m1" is 32-bit data stored in [D1, D0].
When the command input turns ON, data sorting is started. Data sorting is completed after "m1" scans,
and the instruction execution complete flag M8029 is set to ON.
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
530
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.7 FNC149 SORT2 / Sort Tabulated Data 2
11
3. Operation examples
Shift
Rotation and
FNC30-FNC39
When the instruction is executed with "n = K2 (column No. 2)" and "n = K3 (column No. 3)" for the following
sorting source data, the operations shown below result.
The operation examples below indicate 16-bit operations. In the case of 32-bit operation, construct the data
table with 32-bit binary data.
It is recommended to put a serial number such as a control number in the first column so that the original line
number can be estimated based on the contents.
12
Data Operation
FNC40-FNC49
Sorting source data
Number of groups (m2 = K4)
Column No. 1 2 3 4
Line No. Control number Height Weight Age
13
S S +1 S +2 S +3
Processing
High Speed
FNC50-FNC59
1
1 150 45 20
S +4 S +5 S +6 S +7
2
2 180 50 40
Number
of data 3
S
3
+8 S
160
+9 S
70
+10 S
30
+11
14
(m1 = 5)
Instruction
Handy
FMC60-FNC69
S +12 S +13 S +14 S +15
4
4 100 20 8
S +16 S +17 S +18 S +19
5
5 150 50 45
15
1) Sorting result when the instruction is executed with "n = K2 (column No. 2)"
Device
External FX I/O
FNC70-FNC79
(in the case of ascending order)
Column No. 1 2 3 4
Line No. Control number Height Weight Age
D D +1 D +2 D +3
1
4 100 20 8
16
Device
External FX
FNC80-FNC89
D +4 D +5 D +6 D +7
2
1 150 45 20
D +8 D +9 D +10 D +11
3
5 150 50 45
D +12 D +13 D +14 D +15
17
4
Transfer 2
Data
FNC100-FNC109
3 160 70 30
D +16 D +17 D +18 D +19
5
2 180 50 40
2) Sorting result when the instruction is executed with "n = K3 (column No. 3)"
(in the case of descending order) 18
Floating Point
FNC110-FNC139
Column No. 1 2 3 4
Line No. Control number Height Weight Age
D D +1 D +2 D +3
1
3 160 70 30
2
D +4 D +5 D +6 D +7 19
2 180 50 40
Operation 2
Data
FNC140-FNC149
D +8 D +9 D +10 D +11
3
5 150 50 45
D +12 D +13 D +14 D +15
4
1 150 45 20 20
D +16 D +17 D +18 D +19
Control
Positioning
FNC150-FNC159
5
4 100 20 8
531
FX3U/FX3UC Series Programmable Controllers 19 Data Operation 2 FNC140 to FNC149
Programming Manual - Basic & Applied Instruction Edition 19.7 FNC149 SORT2 / Sort Tabulated Data 2
Related devices
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Device Name Description
M8029 Instruction execution complete Turns ON when data sorting is completed.
Sorts data in the descending order when set to ON.
M8165 Descending order
Sorts data in the ascending order when set to OFF.
Related instruction
Instruction Description
Sort tabulated data
This instruction sorts a data table consisting of data (lines) and group data (columns) based on
SORT (FNC 69)
a specified group data (column) sorted by line in ascending order. This instruction stores the
group data (columns) in serial devices.
Cautions
Do not change the contents of operands and data during operation.
To execute SORT2 instruction again, set the command input to OFF once, then ON again.
Limitation in number of SORT2 instructions
Up to two SORT2 instructions can be simultaneously driven in a program.
Writing during RUN is disabled for a circuit block including SORT2 instruction.
When the same device is specified in S and D
The source data is overwritten with the data acquired by sorting.
Pay close attention not to change the contents of S until execution of SORT2 instruction is completed.
Ensure that the sorted data does not overlap with the source data.
D50 D70
Source Data
D20 D40
Sorted Data
532
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition
11
Shift
Rotation and
FNC30-FNC39
20. Positioning Control FNC150 to FNC159
FNC150 to FNC159 provide positioning instructions using the built-in pulse output function of the PLC. 12
For details, refer to the Positioning Control Edition manual.
Data Operation
FNC40-FNC49
FNC No. Mnemonic Symbol Function Reference
Section
150 DSZR DSZR S1 S2 D1 D2 DOG Search Zero Return
20.1
Section
13
151 DVIT DVIT S1 S2 D1 D2 Interrupt Positioning
Processing
High Speed
FNC50-FNC59
20.2
Section
152 TBL TBL D n Batch Data Positioning Mode
20.3
153 14
Instruction
Handy
FMC60-FNC69
154
Section
155 ABS ABS S D1 D2 Absolute Current Value Read
20.4
15
Section
Device
External FX I/O
FNC70-FNC79
156 ZRN ZRN S1 S2 S3 D Zero Return
20.5
Section
157 PLSV PLSV S D1 D2 Variable Speed Pulse Output
20.6
Device
External FX
FNC80-FNC89
Section
159 DRVA DRVA S1 S2 D1 D2 Drive to Absolute
20.8
Transfer 2
Data
FNC100-FNC109
If program write is executed during RUN to a circuit block including a target instruction below while pulses are
being output, the PLC executes the operation shown below.
PLC operation when writing excuted during RUN while instruction is
Target instruction
executed
DSZR (FNC150) 18
Decelerates and stops pulse output.
Floating Point
FNC110-FNC139
DVIT (FNC151)
TBL (FNC152) Disables writing during RUN.
ZRN (FNC156) Decelerates and stops pulse output.
During operation with
Decelerates and stops pulse output.
PLSV (FNC157)
acceleration/deceleration*1
19
During operation without
Immediately stops pulse output.
Operation 2
Data
FNC140-FNC149
acceleration/deceleration
DRVI (FNC158)
Decelerates and stops pulse output.
DRVA (FNC159)
533
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.1 FNC150 DSZR / Dog Search Zero Return
Outline
This instruction executes a zero return, and aligns the mechanical position with a present value register inside
the PLC.
In addition, this instruction enables the following functions not supported by the ZRN (FNC156) instruction:
DOG search function
Zero return by the near-point (dog) signal and zero-phase signal
It is not possible, however, to count the zero-phase signal and then determine the zero point.
For explanation of the instruction, refer to the Positioning Control Edition manual.
For cautions on using special high speed output adapters,
refer to the Positioning Control Edition manual.
1. Instruction format
FNC 150 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
S1 Device number for near-point signal (dog)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 S1 3
S
S2 3
2
S
D1 3
3
S
D2 3 3 S1 3
4
534
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.1 FNC150 DSZR / Dog Search Zero Return
11
S4 : When using a special high speed output adapter for the pulse output destination in an FX3U PLC, the
Shift
Rotation and
FNC30-FNC39
rotation direction signal must be used by the following table output.
When using a built-in transistor output for the pulse output destination in an FX3U/FX3UC PLC, the
rotation direction signal must use transistor output.
Special high speed output adapter No. Pulse output Rotation direction output
Data Operation
FNC40-FNC49
D1 =Y001 D2 =Y005
D1 =Y002 D2 =Y006
No. 2 (2nd unit)
D1 =Y003 D2 =Y007
Processing
High Speed
FNC50-FNC59
Command
input FNC150 S1 S2 D1 D2
DSZR
Instruction
Handy
FMC60-FNC69
During RUN, avoid writing while the DSZR (FNC150) instruction is executed (that is, while a pulse is output).
Note that if writing is executed during RUN to a circuit block including the FNC150 instruction while pulses are
output, the PLC decelerates and stops pulse output.
Device
External FX I/O
FNC70-FNC79
For explanation of the instruction and the contents of function change,
refer to the Positioning Control Edition.
Applicable version
Item Outline of function
FX3U FX3UC
Ver.2.20 or Ver.2.20 or
Clear signal output When a special auxiliary relay corresponding to D1 is set to ON, 16
destination the clear signal output destination is changed to an output number
Device
External FX
FNC80-FNC89
later later
specification function specified by a special data register corresponding to D .
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
535
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.2 FNC151 DVIT / Interrupt Positioning
Outline
This instruction executes one-speed interrupt constant quantity feed.
For explanation of the instruction, refer to the Positioning Control Edition manual.
For cautions on using special high speed output adapters,
refer to the Positioning Control Edition manual.
1. Instruction format
FNC 151 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D DVIT 9 steps DVIT Continuous
17 steps DDVIT Continuous
Operation Operation
2. Set data
Operand type Description Data type
*1
S1 Number of output pulses (incremental address) after interrupt
16- or 32-bit binary
S2 Output pulse frequency*2
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3
S
D1 3
1
S
D2 3 3 S3 3
2
S1 : Specify a transistor output Y000, Y001, or Y002 on the main unit or Y000, Y001, Y002*2, or Y003*2 on
a special high speed output adapter*1.
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
*2. When specifying Y002 or Y003 on a special high speed output adapter, a second special high
speed output adapter is required.
Points
When using a relay output type FX3U PLC, a special high speed output adapter is required.
Outputs of special high speed output adapters work as differential line drivers.
536
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.2 FNC151 DVIT / Interrupt Positioning
11
S2 : When using a special high speed output adapter for the pulse output destination in an FX3U PLC, the
Shift
Rotation and
FNC30-FNC39
rotation direction signal must be used by the following table output.
When using a built-in transistor output for the pulse output destination in an FX3U/FX3UC PLC, the
rotation direction signal must use transistor output.
Special high speed output adapter No. Pulse output Rotation direction output
Data Operation
FNC40-FNC49
D1 =Y001 D2 =Y005
D1 =Y002 D2 =Y006
No. 2 (2nd unit)
D1 =Y003 D2 =Y007
Processing
High Speed
FNC50-FNC59
Explanation of function and operation
Command
input FNC151 S1 S2 D1 D2
DVIT
14
Instruction
Handy
FMC60-FNC69
Caution on writing during RUN
During RUN, avoid writing while the DVIT (FNC151) instruction is executed (that is, while a pulse is output).
Note that if writing is executed during RUN to a circuit block including the FNC151 instruction while pulses are
output, the PLC decelerates and stops pulse output.
15
Function change depending on the version
Device
External FX I/O
FNC70-FNC79
The functions of FNC151 instruction are changed depending on the version as shown in the table below.
For explanation of the instruction and the contents of function change,
refer to the Positioning Control Edition.
Applicable version
FX3U FX3UC
Item Outline of function
16
When M8336 is set to ON, the interrupt input signal corresponding to
Device
External FX
FNC80-FNC89
Y000 to Y003 is changed to an input number (X000 to X007)
Ver.2.20 or Ver.1.30 or Interrupt input signal
specified by D8336.
later later specification function
When using a transistor output in the main unit, Y003 cannot be
specified.
When "8" is specified by D8336 to the interrupt input signal
corresponding to Y000 to Y003 and M8336 is set to ON, the interrupt
17
input signal is changed to a special auxiliary relay. When this
Transfer 2
Data
FNC100-FNC109
changed special auxiliary relay is set to ON from OFF in an input
Ver.2.20 or Ver.2.20 or
User interrupt mode interrupt program, the PLC starts the interrupt operation. When this
later later
function is used, however, the logic of the interrupt input cannot be
inverted.
In addition, when using a transistor output in the main unit, Y003
cannot be specified. 18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
537
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.3 FNC152 TBL / Batch Data Positioning Mode
Outline
This instruction executes one specified table operation from the data table set in GX Developer (Ver.8.23Z or
later).
For explanation of the instruction, refer to the Positioning Control Edition manual.
For cautions on using special high speed output adapters,
refer to the Positioning Control Edition manual.
Instruction Description
DVIT (FNC151) Interrupt positioning
PLSV (FNC157) Variable speed pulse output
DRVI (FNC158) Drive to increment
DRVA (FNC159) Drive to absolute
1. Instruction format
FNC 152 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D TBL 17 steps DTBL Continuous
Operation
2. Set data
Operand type Description Data type
D Device number (Y) from which pulses are to be output Bit
n Table entry number [1 to 100] to be executed 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S
D
1
n 3 3
S1 : Specify a transistor output Y000, Y001, or Y002 on the main unit or Y000, Y001, Y002*2, or Y003*2 on
a special high speed output adapter*1.
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
*2. When specifying Y002 or Y003 on a special high speed output adapter, a second special high
speed output adapter is required.
Points
When using a relay output type FX3U PLC, a special high speed output adapter is required.
Outputs of special high speed output adapters work as differential line drivers.
538
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.4 FNC155 ABS / Absolute Current Value Read
11
20.4 FNC155 ABS / Absolute Current Value Read
Shift
Rotation and
FNC30-FNC39
Outline
This instruction reads the absolute position (ABS) data when the Mitsubishi servo amplifier (equipped with the
absolute position detection function) MR-H, MR-J2(S), or MR-J3 is connected. The data is converted into a
12
Data Operation
FNC40-FNC49
pulse when being read.
For explanation of the instruction, refer to the Positioning Control Edition.
1. Instruction format
FNC 155 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
13
D ABS 13 steps DABS Continuous
Processing
High Speed
FNC50-FNC59
Operation
2. Set data
Operand type Description Data type 14
Head device number inputting absolute (ABS) data output signal sent from servo
Instruction
Handy
FMC60-FNC69
S amplifier
Three points are occupied from S .
Bit
Head device number outputting absolute (ABS) data control signal to servo
D1 amplifier
Three points are occupied from D1 . 15
Device
External FX I/O
FNC70-FNC79
D2 Device number storing absolute (ABS) data (32-bit value) 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Unit
Index
Con- Real Charac-
stant Number ter String
Pointer 16
Type
Device
External FX
FNC80-FNC89
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 S2 3
S
D1 3 3 S2 3
1
D2 3 3 3 3 3 3 3 3 3 3 3 17
Transfer 2
Data
FNC100-FNC109
S1: Specify a transistor output.
S2: "D.b" cannot be indexed with index registers (V and Z).
DABS
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
539
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.5 FNC156 ZRN / Zero Return
Outline
This instruction executes a zero return, and aligns the mechanical position with a present value register inside
the PLC.
When the dog search function is required, use DSZR (FNC150) instruction.
For explanation of the instruction, refer to the Positioning Control Edition manual.
For cautions on using special high speed output adapters,
refer to the Positioning Control Edition manual.
1. Instruction format
FNC 156 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D ZRN 9 steps ZRN Continuous
17 steps DZRN Continuous
Operation Operation
2. Set data
Operand type Description Data type
S1 Initial zero return speed*1
16- or 32-bit binary
S2 Creep speed [10 to 32767 Hz]
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S3 3 3 3 3 S1 3
S
D 3
2
540
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.5 FNC156 ZRN / Zero Return
11
Explanation of function and operation
Shift
Rotation and
FNC30-FNC39
Command
input FNC156 S1 S2 S3 D
ZRN
12
Caution on writing during RUN
Data Operation
FNC40-FNC49
During RUN, avoid writing while the ZRN (FNC156) instruction is executed (that is, while pulses are output).
Note that if writing is executed during RUN to a circuit block including the FNC156 instruction while pulses are
output, the PLC decelerates and stops pulse output.
Processing
High Speed
FNC50-FNC59
For explanation of the instruction and the contents of function change,
refer to the Positioning Control Edition.
Applicable version
Item Outline of function
FX3U FX3UC
Clear signal output When a special auxiliary relay corresponding to D is set to ON,
14
Ver.2.20 or Ver.2.20 or
Instruction
Handy
FMC60-FNC69
destination the clear signal output destination is changed to an output number
later later
specification function specified by a special data register corresponding to D .
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
541
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.6 FNC157 PLSV / Variable Speed Pulse Output
Outline
This instruction outputs variable speed pulses with an assigned rotation direction.
For explanation of the instruction, refer to the Positioning Control Edition manual.
For cautions on using special high speed output adapters,
refer to the Positioning Control Edition manual.
1. Instruction format
FNC 157 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D PLSV 9 steps PLSV Continuous
17 steps DPLSV Continuous
Operation Operation
2. Set data
Operand type Description Data type
*1 16- or 32-bit binary
S1 Device number for output pulse frequency
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S
D1 3
1
S
D2 3 3 S3 3
2
S1 : Specify a transistor output Y000, Y001, or Y002 on the main unit or Y000, Y001, Y002*2, or Y003*2 on
a special high speed output adapter*1.
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
*2. When specifying Y002 or Y003 on a special high speed output adapter, a second special high
speed output adapter is required.
Points
When using a relay output type FX3U PLC, a special high speed output adapter is required.
Outputs of special high speed output adapters work as differential line drivers.
542
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.6 FNC157 PLSV / Variable Speed Pulse Output
11
S2 : When using a special high speed output adapter for the pulse output destination in an FX3U PLC, the
Shift
Rotation and
FNC30-FNC39
rotation direction signal must be used by the following table output.
When using a built-in transistor output for the pulse output destination in an FX3U/FX3UC PLC, the
rotation direction signal must use transistor output.
Special high speed output adapter No. Pulse output Rotation direction output 12
D1 =Y000 D2 =Y004
Data Operation
FNC40-FNC49
No. 1 (1st unit)
D1 =Y001 D2 =Y005
D1 =Y002 D2 =Y006
No. 2 (2nd unit)
D1 =Y003 D2 =Y007
Processing
High Speed
FNC50-FNC59
Explanation of function and operation
Command
input FNC157 S1 D1 D2
PLSV 14
Instruction
Handy
FMC60-FNC69
Caution on writing during RUN
During RUN, avoid writing while PLSV (FNC157) instruction is executed (that is, while pulses are output).
Note that if writing is executed during RUN to a circuit block including FNC157 instruction while pulses are
output, the PLC executes the operation shown below.
15
PLC operation when writing is excuted during RUN while
Device
External FX I/O
FNC70-FNC79
instruction is executed
During operation with acceleration/deceleration*1 Decelerates and stops pulse output.
During operation without acceleration/deceleration Immediately stops pulse output.
Device
External FX
FNC80-FNC89
Function change depending on the version
The function of the FNC157 instruction is changed depending on the version as shown in the table below.
For explanation of the instruction and the contents of function change,
refer to the Positioning Control Edition.
Applicable version
Item Outline of function
17
FX3U FX3UC
Transfer 2
Data
FNC100-FNC109
Acceleration/ When M8338 is set to ON, the PLC accelerates or decelerates up to
Ver.2.20 or Ver.2.20 or
deceleration S1 in the acceleration or deceleration time corresponding to
later later
operation function D1 if S1 changes.
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
543
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.7 FNC158 DRVI / Drive to Increment
Outline
This instruction executes one-speed positioning by incremental drive. The movement distance from the
present position can be specified with a positive or negative sign.
For explanation of the instruction, refer to the Positioning Control Edition manual.
For cautions on using special high speed output adapters,
refer to the Positioning Control Edition manual.
1. Instruction format
FNC 158 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D DRVI 9 steps DRVI Continuous
17 steps DDRVI Continuous
Operation Operation
2. Set data
Operand type Description Data type
S1 Number of output pulses (relative address)*1
16- or 32-bit binary
S2 Output pulse frequency*2
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S
D1 3
1
S
D2 3 3 S3 3
2
S1 : Specify a transistor output Y000, Y001, or Y002 on the main unit or Y000, Y001, Y002*2, or Y003*2 on
a special high speed output adapter*1.
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
*2. When specifying Y002 or Y003 in a special high speed output adapter, the second special high
speed output adapter is required.
Points
When using a relay output type FX3U PLC, a special high speed output adapter is required.
Outputs of special high speed output adapters work as differential line drivers.
544
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.7 FNC158 DRVI / Drive to Increment
11
S2 :When using a special high speed output adapter for the pulse output destination in an FX3U PLC, the
Shift
Rotation and
FNC30-FNC39
rotation direction signal must be used by the following table output.
When using a built-in transistor output for the pulse output destination in an FX3U/FX3UC PLC, the
rotation direction signal must use transistor output.
Special high speed output adapter No. Pulse output Rotation direction output 12
D1 =Y000 D2 =Y004
Data Operation
FNC40-FNC49
No. 1 (1st unit)
D1 =Y001 D2 =Y005
D1 =Y002 D2 =Y006
No. 2 (2nd unit)
D1 =Y003 D2 =Y007
Processing
High Speed
FNC50-FNC59
Explanation of function and operation
Command
input FNC158 S1 S2 D1 D2
DRVI 14
Instruction
Handy
FMC60-FNC69
Caution on writing during RUN
During RUN, avoid writing while DRVI (FNC158) instruction is executed (that is, while pulses are output).
Note that if writing is executed during RUN to a circuit block including FNC158 instruction while pulses are
output, the PLC decelerates and stops pulse output.
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
545
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.8 FNC159 DRVA / Drive to Absolute
Outline
This instruction executes one-speed positioning by absolute drive. The movement distance from the zero
point can be specified.
For explanation of the instruction, refer to the Positioning Control Edition manual.
For cautions on using special high speed output adapters,
refer to the Positioning Control Edition manual.
1. Instruction format
FNC 159 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D DRVA 9 steps DRVA Continuous
17 steps DDRVA Continuous
Operation Operation
2. Set data
Operand type Description Data type
S1 Number of output pulses (absolute address)*1
16- or 32-bit binary
S2 Output pulse frequency*2
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S
D1 3
1
S
D2 3 3 S3 3
2
S1 : Specify a transistor output Y000, Y001, or Y002 on the main unit or Y000, Y001, Y002*2, or Y003*2 on
a special high speed output adapter*1.
*1. Special high speed output adapters cannot be connected to the FX3UC PLC.
*2. When specifying Y002 or Y003 on a special high speed output adapter, a second special high
speed output adapter is required.
Points
When using a relay output type FX3U PLC, a special high speed output adapter is required.
Outputs of special high speed output adapters work as differential line drivers.
546
FX3U/FX3UC Series Programmable Controllers 20 Positioning Control FNC150 to FNC159
Programming Manual - Basic & Applied Instruction Edition 20.8 FNC159 DRVA / Drive to Absolute
11
S2 : When using a special high speed output adapter for the pulse output destination in an FX3U PLC, the
Shift
Rotation and
FNC30-FNC39
rotation direction signal must be used by the following table output.
When using a built-in transistor output for the pulse output destination in an FX3U/FX3UC PLC, the
rotation direction signal must use transistor output.
Special high speed output adapter No. Pulse output Rotation direction output 12
D1 =Y000 D2 =Y004
Data Operation
FNC40-FNC49
No. 1 (1st unit)
D1 =Y001 D2 =Y005
D1 =Y002 D2 =Y006
No. 2 (2nd unit)
D1 =Y003 D2 =Y007
Processing
High Speed
FNC50-FNC59
Explanation of function and operation
Command
input FNC159 S1 S2 D1 D2
DRVA 14
Instruction
Handy
FMC60-FNC69
Caution on writing during RUN
During RUN, avoid writing while DRVA (FNC159) instruction is executed (that is, while pulses are output).
Note that if writing is executed during RUN to a circuit block including FNC159 instruction while pulses are
output, the PLC decelerates and stops pulse output.
15
Device
External FX I/O
FNC70-FNC79
16
Device
External FX
FNC80-FNC89
17
Transfer 2
Data
FNC100-FNC109
18
Floating Point
FNC110-FNC139
19
Operation 2
Data
FNC140-FNC149
20
Control
Positioning
FNC150-FNC159
547
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition
Section
160 TCMP TCMP S1 S2 S3 S D RTC data compare
21.1
Section
161 TZCP TZCP S1 S2 S D RTC data zone compare
21.2
Section
162 TADD TADD S1 S2 D RTC data addition
21.3
Section
163 TSUB TSUB S1 S2 D RTC data subtraction
21.4
Section
164 HTOS HTOS S D Hour to second conversion
21.5
Section
165 STOH STOH S D Second to hour conversion
21.6
Section
166 TRD TRD D Read RTC data
21.7
Section
167 TWR TWR S Set RTC data
21.8
168
Section
169 HOUR HOUR S D1 D2 Hour Meter
21.9
548
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.1 FNC160 TCMP / RTC Data Compare
21
21.1 FNC160 TCMP / RTC Data Compare
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction compares the comparison time with the time data, and turns ON or OFF bit devices according
to the comparison result.
22
External Device
FNC170-FNC179
1. Instruction format
FNC 160 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Instructions
Alternate
FNC180
2. Set data
Operand type Description Data type
S
S1 Specifies "hour" of the comparison time [setting range: 0 to 23].
Specifies "minute" of the comparison time [setting range: 0 to 59].
16-bit binary
16-bit binary
24
S2
Others
FNC181-FNC189
S3 Specifies "second" of the comparison time [setting range: 0 to 59]. 16-bit binary
Specifies "hour" of the time data (hour, minute, and second).
S 16-bit binary
(Three devices are occupied.)
Turns ON or OFF according to the comparison result.
D (Three devices are occupied.)
Bit
25
Operation
Block Data
FNC190-FNC199
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 26
S
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S 3 3 3 3 3 3
SD2 3 3 3 S 3 27
Operation 3
Data
FNC210-FNC219
S: "D.b" cannot be indexed with index registers (V and Z).
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
549
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.1 FNC160 TCMP / RTC Data Compare
D S1 (hour) S (hour)
Turns ON in the case of " S2 (minute) > S +1(minute) "
S3 (second) S +2(second)
S1 (hour) S (hour)
D +1
Turns ON in the case of " S2 (minute) = S +1(minute) "
S3 (second) S +2(second)
D +2 S1 (hour) S (hour)
Turns ON in the case of " S2 (minute) < S +1(minute) "
S3 (second) S +2(second)
Even if the command contact turns OFF from ON and TCMP instruction is not
executed, D , D +1 and D +2 hold the status before the command
contact turned OFF.
Cautions
1) Number of occupied devices
Three devices are occupied respectively by S and D .
Make sure that these devices are not used in other controls for the machine.
2) When utilizing the time (hour, minute, and second) of the real time clock built in a PLC
Read the values of special data registers by TRD (FNC166) instruction, and then specify those word
devices as the operands.
Program example
S1 S2 S3 S D
X000
FNC160 K10 K30 K50 D0 M0
TCMP
10:30:50
D0 (hour)
M0
Turns ON in the case of "10:30:50 > D1 (minute) "
S1 : Specifies "hour" of the comparison
D2 (second)
time.
S2 : Specifies "minute" of the
M1 D0 (hour)
comparison time.
Turns ON in the case of "10:30:50 = D1 (minute) " : Specifies "second" of the comparison
S3
D2 (second) time.
S : Specifies "hour" of the time data.
M2 D0 (hour)
S +1 : Specifies "minute" of the time data.
Turns ON in the case of "10:30:50 < D1 (minute) "
S +2 : Specifies "second" of the time data.
D2 (second)
D , D +1, D +2
: Three bit devices turn ON or OFF
Even if X000 is OFF and TCMP instruction is not executed, M0 to
according to the comparison result.
M2 hold the status before X000 turned OFF.
550
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.2 FNC161 TZCP / RTC Data Zone Compare
21
21.2 FNC161 TZCP / RTC Data Zone Compare
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction compares two comparison time (comparison time zone) with the time data, and turns ON or
OFF the specified bit devices according to the comparison results.
22
External Device
FNC170-FNC179
1. Instruction format
FNC 161 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Instructions
Alternate
FNC180
2. Set data
Operand type Description Data type
Specifies "hour" of the lower limit comparison time (hour, minute, and second).
S
S1 (Three devices are occupied.)
16-bit binary 24
Others
FNC181-FNC189
Specifies "hour" of the upper limit comparison time (hour, minute, and second).
S2 16-bit binary
(Three devices are occupied.)
Specifies "hour" of the time data (hour, minute, and second).
S 16-bit binary
(Three devices are occupied.)
Turns ON or OFF according to the comparison result.
D (Three devices are occupied.)
Bit
25
Operation
Block Data
FNC190-FNC199
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 26
S
S1 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
S2 3 3 3 3 3 3
S 3 3 3 3 3 3
SD2 3 3 3 S 3
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
551
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.2 FNC161 TZCP / RTC Data Zone Compare
D S1 (hour) S (hour)
Turns ON in the case of " S1 +1(minute) > S +1(minute) ".
S1 +2(second) S +2(second)
D +2 S (hour) S2 (hour)
Turns ON in the case of " S +1(minute) > S2 +1(minute) ".
S +2(second) S2 +2(second)
Even if the command contact turns OFF from ON and TZCP instruction is not executed, D ,
D +1 and D +2 hold the status before the command contact turned OFF.
Cautions
1) Number of occupied devices
Three devices are occupied respectively by S1 , S2 , S3 , and D .
Make sure that these devices are not used in other controls for the machine.
2) When utilizing the time (hour, minute, and second) of the real time clock built in a PLC
Read the values of special data registers by TRD (FNC166) instruction, and then specify those word
devices as the operands.
552
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.2 FNC161 TZCP / RTC Data Zone Compare
21
Program example
Control
Real Time Clock
FNC160-FNC169
S1 S2 S D
X000
FNC161 D 20 D 30 D0 M3
TZCP
22
External Device
FNC170-FNC179
D20 (hour) D0 (hour)
M3
Turns ON in the case of " D21 (minute) > D1 (minute) ".
D22 (second) D2 (second)
Instructions
Alternate
FNC180
D22 (second) D2 (second) D 32 (second)
M5 D0 (hour) D 30 (hour)
Turns ON in the case of " D1 (minute) > D 31 (minute) ".
D2 (second) D 32 (second) 24
Others
FNC181-FNC189
Even if X000 is OFF and TZCP instruction is not executed, M0
to M2 hold the status before X000 turned OFF.
S1 , S1 +1 and S1 +2 : Specify the lower limit of the comparison time zone in "hour", "minute" and "second. 25
Operation
Block Data
FNC190-FNC199
S2 , S2 +1 and S2 +2 : Specify the upper limit of the comparison time zone in "hour", "minute" and "second.
Control
Character String
FNC200-FNC209
The setting range of "minute" is from 0 to 59.
The setting range of "second" is from 0 to 59.
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
553
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.3 FNC162 TADD / RTC Data Addition
Outline
This instruction executes addition of two time data, and stores the addition result to word devices.
1. Instruction format
FNC 162 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
Specifies "hour" of the time data (hour, minute, and second) used in addition.
S
S1 16-bit binary
(Three devices are occupied.)
Specifies "hour" of the time data (hour, minute, and second) used in addition.
S2 16-bit binary
(Three devices are occupied.)
Stores the addition result (hour, minute, and second) of two time data. (Three
D 16-bit binary
devices are occupied.)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S
S1 3 3 3 3 3 3
S2 3 3 3 3 3 3
SD2 3 3 3 3 3 3
When the operation result exceeds 24 hours, the carry flag turns ON, and the value simply acquired by
addition subtracted by 24 hours is stored as the operation result.
When the operation result becomes "0" (0:0:0), the zero flag turns ON.
554
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.3 FNC162 TADD / RTC Data Addition
21
Cautions
Control
Real Time Clock
FNC160-FNC169
1) Number of occupied devices
Three devices are occupied by S1 , S2 and D respectively.
Make sure that these devices are not used in other controls for the machine.
2) When utilizing the time (hour, minute, and second) of the real time clock built in a PLC
Read the values of special data registers using the TRD (FNC166) instruction, and then specify those
22
External Device
FNC170-FNC179
word devices as the operands.
Program example
S1 S2 D
X000
FNC162 ( D10 ,D11 ,D12)+(D20 ,D21 ,D22) 23
D 10 D 20 D 30
TADD ( D30 ,D31,D32)
Instructions
Alternate
FNC180
S1 10 (hour) S2 3 (hour) D 13 (hour)
S1 +1 30 (minute) + S2 +1 10 (minute) D +1 40 (minute)
S1 +2 10 (second) S2 +2 5 (second) D +2 15 (second) 24
Others
FNC181-FNC189
10:30:10 3:10:5 13:40:15
Operation
Block Data
FNC190-FNC199
30 (second) 5 (second) 35 (second)
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
555
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.4 FNC163 TSUB / RTC Data Subtraction
Outline
This instruction executes subtraction of two time data, and stores the subtraction result to word devices.
1. Instruction format
FNC 163 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
Specifies "hour" of the time data (hour, minute, and second) used in subtraction.
S
S1 16-bit binary
(Three devices are occupied.)
Specifies "hour" of the time data (hour, minute, and second) used in subtraction.
S2 16-bit binary
(Three devices are occupied.)
Stores the subtraction result (hour, minute, and second) of two time data. (Three
D 16-bit binary
devices are occupied.)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S
S1 3 3 3 3 3 3
S2 3 3 3 3 3 3
SD2 3 3 3 3 3 3
Command
input ( S1 , S1 +1, S1 +2)( S2 , S2 +1, S2 +2)
FNC163 S1 S2 D
TSUB ( D , D +1, D +2)
When the operation result is smaller than 0 hour, the borrow flag turns ON, and the value simply acquired by
subtraction added by 24 hours is stored as the operation result.
When the operation result becomes "0" (0:0:0), the zero flag turns ON.
556
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.4 FNC163 TSUB / RTC Data Subtraction
21
Cautions
Control
Real Time Clock
FNC160-FNC169
1) Number of occupied devices
Three devices are occupied by S1 , S2 and D respectively.
Make sure that these devices are not used in other controls for the machine.
2) When utilizing the time (hour, minute, and second) of the real time clock built in a PLC
Read the values of special data registers using TRD (FNC166) instruction, and then specify those word
22
External Device
FNC170-FNC179
devices as the operands.
Program example
S1 S2 D
X000
FNC163 D 10 D 20 D 30 ( D10, D11, D12) (D20, D21, D22)
23
TSUB ( D30, D31, D32)
Instructions
Alternate
FNC180
D 10 10 (hour) D 20 3 (hour) D 30 7 (hour)
D 11 30 (minute) D 21 10 (minute) D 31 20 (minute)
24
D 12 10 (second) D 22 5 (second) D 32 5 (second)
Others
FNC181-FNC189
10:30:10 3:10:5 7:20:5
Operation
Block Data
FNC190-FNC199
20 (minute) 10 (minute) 10 (minute)
40 (second) 5 (second) 35 (second)
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
557
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.5 FNC164 HTOS / Hour to Second Conversion
Outline
This instruction converts the time data in units of "hour, minute, and second" into data in units of "second".
1. Instruction format
FNC 164 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D HTOS P 5 steps HTOS Continuous
9 steps DHTOS
Continuous
Operation Operation
HTOSP Pulse (Single) DHTOSP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
Head device number storing the time data (hour, minute and second) before
SS1 16-bit binary
conversion
D Device number storing the time data (second) after conversion 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3 3
D
S hour (0 to 9)
S +1 minute (0 to 59) second
S +2 second (0 to 59)
For example, when "4 hours 29 minutes 31 seconds" is specified, the operation is as follows:
D
S 4
S +1 29 16171
S +2 31
558
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.5 FNC164 HTOS / Hour to Second Conversion
21
2. 32-bit operation (DHTOS and DHTOSP)
Control
Real Time Clock
FNC160-FNC169
The time data (hour, minute, and second) stored in S , S +1, and S +2 is converted into data in
units of "second", and stored to D +1, D .
Command
input FNC164
DHTOS
S D
22
External Device
FNC170-FNC179
D +1 D
S hour (0 to 32767)
S +1 minute (0 to 59) second
S +2 second (0 to 59) 23
Instructions
Alternate
FNC180
For example, when "35 hours 10 minutes 58 seconds" is specified, the operation is as follows:
D +1 D
S 35
S +1 10 126658
S +2 58
24
Others
FNC181-FNC189
Error
An operation error is caused in the following case; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the data of S , S + 1 or S + 2 is outside the allowable range (error code: K6706)
25
Operation
Block Data
FNC190-FNC199
Program example
In the program shown below, the time data read from the real time clock built in a PLC is converted into data
in units of "second", and stored to D100 and D101 when X020 turns ON.
X020 26
FNC166 D10
Control
Character String
FNC200-FNC209
TRD
END
27
Operation 3
Data
FNC210-FNC219
Operation
Clock data reading operation by TRD (FNC166) instruction
Real time
clock
D10 2004 Year
28
D11 1 Month
Comparison
Data
FNC220-FNC249
D12 31 Day
D13 20 Hour Clock data
D14 21 Minute Time data
D15 23 Second
29
Operation
Data Table
FNC250-FNC269
D13 20 D101,D100
30
D14 21 73283
Inverter Comms
Ex-Device
FNC270-FNC274
D15 23
559
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.6 FNC165 STOH / Second to Hour Conversion
Outline
This instruction converts the time data in units of "second" into data in units of "hour, minute, and second".
1. Instruction format
FNC 165 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D STOH P 5 steps STOH Continuous
9 steps DSTOH
Continuous
Operation Operation
STOHP Pulse (Single) DSTOHP Pulse (Single)
Operation Operation
2. Set data
Operand type Description Data type
SS1 Device number storing the time data (second) before conversion 16- or 32-bit binary
Head device number storing the time data (hour, minute and second) after
D 16-bit binary
conversion
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3
SD2 3 3 3 3 3 3 3 3 3
S
D Hour (0 to 9)
Second (0 to 32767) D +1 Minute (0 to 59)
D +2 Second (0 to 59)
560
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.6 FNC165 STOH / Second to Hour Conversion
21
2. 32-bit operation (DSTOH and DSTOHP)
Control
Real Time Clock
FNC160-FNC169
The time data in units of "second" stored in S +1 and S is converted into data in units of "hour,
minute, and second", and stored to three devices D , D +1, and D +2 (hour, minute, and second).
Command
input FNC165
DSTOH
S D
22
External Device
FNC170-FNC179
S +1 S
D Hour (0 to 32767)
Second (0 to 117964799) D +1 Minute (0 to 59)
D +2 Second (0 to 59)
23
For example, when "45,325 seconds" is specified, the operation is as follows:
Instructions
Alternate
FNC180
S +1 S
D 12
45325 D +1 35
D +2 25
24
Others
FNC181-FNC189
Error
An operation error is caused in the following case; The error flag M8067 turns ON, and the error code is store
in D8067.
When the data of S is outside the allowable range (error code: K6706)
25
Operation
Block Data
FNC190-FNC199
Program example
In the program shown below, the time data in units of "second" stored in D0 and D1 is converted into data in
units of "hour, minute, and second", and stored to D100, D101, and D102 when X020 turns ON.
X020
FNC165
DSTOH
D0 D100 26
Control
Character String
FNC200-FNC209
END
Operation
Converting the data in second into the data in hour, minute and second using STOHP instruction
27
Operation 3
Data
FNC210-FNC219
(when "40,000 seconds" is specified by D1 and D0)
D100 11
D1,D0 40000 D101 6
D102 40 28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
561
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.7 FNC166 TRD / Read RTC data
Outline
This instruction reads the clock data of the real time clock built in a PLC.
1. Instruction format
FNC 166 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
Specifies the head device number storing the clock data.
D 16-bit binary
(Seven devices are occupied.)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SD2 3 3 3 3 3 3
D8018 Year
0 to 99
(lower two digits) D0 Year
Special data register
Caution
1. Number of occupied devices
Seven devices are occupied by D .
Make sure that these devices are not used in other controls for the machine.
562
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.8 FNC167 TWR / Set RTC data
21
21.8 FNC167 TWR / Set RTC data
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction writes the clock data to the real time clock built in a PLC.
22
1. Instruction format
External Device
FNC170-FNC179
FNC 167 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Instructions
Alternate
FNC180
2. Set data
Operand type Description Data type
Specifies the head device number to which the clock data is written.
D 16-bit binary
(Seven devices are occupied.)
24
3. Applicable devices
Others
FNC181-FNC189
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SD2 3 3 3 3 3 3
25
Operation
Block Data
FNC190-FNC199
Explanation of function and operation
The clock data stored in S to S +6 is written to D8013 to D8019 for the real time clock built in a PLC.
Command
input FNC167 S 26
TWRP
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
563
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.8 FNC167 TWR / Set RTC data
- D8018 (year data) can be converted into the 4-digit mode. (Refer to the program example shown later.)
Device Item Clock data Device Item
D 10 Year
0 to 99
(lower two digits) D8018 Year
D 16 Day of week
0 (Sunday) to
6 (Saturday) D8019 Day of week
- When TWR (FNC167) instruction is executed, the clock data of the real time clock is immediately
changed. Accordingly, transfer the clock data several minutes ahead to S to S +6 in advance,
and then execute FNC167 instruction when the accurate time has come.
- When setting the clock data (time) using this instruction, it is not necessary to control the special
auxiliary relay M8015 (time stop and time setting).
- If a numeric value indicating impossible date/time is set, the clock data is not changed.
Set the correct clock data, and then write it.
Caution
1. Number of occupied devices
Seven devices are occupied by S .
Make sure that these devices are not used in other controls for the machine.
564
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.8 FNC167 TWR / Set RTC data
21
Program example
Control
Real Time Clock
FNC160-FNC169
1. Example of setting the clock data (time)
In the program example shown below, the real time clock is set (to 15:20:30 on Tuesday, April 25, 2001).
X000
FNC 12 K1 D0 Year (lower two digits) 22
MOV
External Device
FNC170-FNC179
FNC 12 K4 D1 Month
MOV
Instructions
Alternate
FNC180
MOV
FNC 12
MOV
K30 D5 Second
24
Others
FNC181-FNC189
FNC 12 K2 D6 Day of week
MOV
Operation
Block Data
FNC190-FNC199
The shaded area indicates the set value of each item.
When setting the time, it is recommended to set the time to several minutes ahead in advance, and then
set X000 to ON when the accurate time is reached. The set time is then immediately written to the real 26
time clock, and the clock data is updated.
Control
Character String
FNC200-FNC209
Every time X001 is set to ON, the current time can be corrected by 30 seconds.
When handling the year in the 4-digit mode, add the following program.
D8018 will specify the 4-digit year mode in the second scan and later after the PLC mode is changed to
RUN.
27
M8002
Operation 3
Data
FNC210-FNC219
FNC 12 K2000 D8018
Initial pulse MOV
- A PLC is normally operating in the 2-digit year mode. When the above instruction is executed and
"K2000 (fixed value)" is transferred to D8018 (year) in only one operation cycle after the PLC mode was
changed to RUN, the year mode is switched to the 4-digit mode. 28
- Execute this program every time the PLC mode is changed to RUN. Even if "K2000" is transferred, only
Comparison
Data
FNC220-FNC249
the display format is changed to the 4-digit year mode. The current date and time are not affected.
- In the 4-digit year mode, the set values "80 to 99" correspond to "1980 to 1999", and "00 to 79"
correspond to "2000 to 2079".
Examples:
"80" indicates 1980. "99" indicates 1999. "00" indicates 2000. "79" indicates 2079.
29
When the data access unit FX-10DU-E/20DU-E/25DU-E is connected, select the 2-digit year mode. If the
Operation
Data Table
FNC250-FNC269
4-digit year mode is selected, the year is not correctly displayed in the current version of the FX-10DU-E/
20DU-E/25DU-E.
Note that the clock is changed to the 2-digit year mode when the clock is set from the FX-10DU-E/20DU-E/
25DU-E while the PLC is operating in the 4-digit year mode.
30
Inverter Comms
Ex-Device
FNC270-FNC274
565
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.9 FNC169 HOUR / Hour Meter
Outline
This instruction measures the ON time of the input contact in units of hour.
1. Instruction format
FNC 169 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand type Description Data type
SS1 Time after which D2 is set to ON (unit: hour) 16- or 32-bit binary
Current value (unit: hour) (latched (battery backed) type data register latched
S
D11 16- or 32-bit binary
(battery backed))
D2 Head device number to which alarm is output 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
SS1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S
D11 3 3 3
S
D22 3 3 3 S 3
Specify a latched (battery backed) type data register as D1 so that the current value data can be
continuously used even after the PLC turns OFF.
If a general type data register is used, the current value data is cleared when the power of the PLC is
turned OFF or when the PLC mode switches from STOP to RUN.
Even after the alarm output D2 turns ON, the measurement is continued.
When the current value D1 reaches the maximum value of 16-bit data, the measurement is stopped.
For continuing the measurement, clear the current value stored in D1 and D1 +1.
566
FX3U/FX3UC Series Programmable Controllers 21 Real Time Clock Control FNC160 to FNC169
Programming Manual - Basic & Applied Instruction Edition 21.9 FNC169 HOUR / Hour Meter
21
2. 32-bit operation
Control
Real Time Clock
FNC160-FNC169
Command
input FNC169 S D1 D2
DHOUR
External Device
FNC170-FNC179
[ D1 +1, D1 ] : Current value in units of hour
The high-order side is stored in D1 +1, and the low-order side is stored in D1 .
D1 +2 : Current value less than one hour (unit: second)
D2 : Alarm output destination
It turns ON when the current value [ D1 +1, D1 ] exceeds the time specified in S . 23
Instructions
Alternate
FNC180
Specify a latched (battery backed) type data register as D1 so that the current value data can be
continuously used even after the PLC turns OFF.
If a general data type register is used, the current value data is cleared when the power of the PLC is
turned OFF or when the PLC mode switches from STOP to RUN.
Even after the alarm output D2 turns ON, the measurement is continued. 24
When the current value [ D1 +1, D1 ] reaches the maximum value of 32-bit data, the measurement is
Others
FNC181-FNC189
stopped.
For continuing the measurement, clear the current value stored in D1 to D1 +2.
Caution
25
Number of occupied devices
Operation
Block Data
FNC190-FNC199
Two (16-bit operation) or three (32-bit operation) devices are occupied by D1 .
Make sure that these devices are not used in other controls for the machine.
Program example
In the program example shown below, when the accumulated X000 ON time exceeds 300 hours, Y005 turns 26
ON.
Control
Character String
FNC200-FNC209
The current value less than one hour is stored in D201 in units of second.
S D1 D2
X000
FNC169 K300 D 200 Y005
HOUR
27
Operation 3
Data
FNC210-FNC219
S : Time after which D2 is set to ON
Specify a value in units of hour.
D1 : Current value in units of hour
D1 +1 : Current value less than one hour (unit: second)
D2 : Alarm output destination 28
It turns ON when the current value D1 exceeds the time specified in S .
Comparison
Data
FNC220-FNC249
(In this example, it turns ON when the current value becomes 300 hours 1 second.)
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
567
FX3U/FX3UC Series Programmable Controllers 22 External Device FNC170 to FNC179
Programming Manual - Basic & Applied Instruction Edition
Section
170 GRY GRY S D Decimal to Gray Code Conversion
22.1
Section
171 GBIN GBIN S D Gray Code to Decimal Conversion
22.2
172
173
174
175
Section
176 RD3A RD3A m1 m2 D Read form Dedicated Analog Block
22.3
Section
177 WR3A WR3A m1 m2 S Write to Dedicated Analog Block
22.4
178
179
568
FX3U/FX3UC Series Programmable Controllers 22 External Device FNC170 to FNC179
Programming Manual - Basic & Applied Instruction Edition 22.1 FNC170 GRY / Decimal to Gray Code Conversion
21
22.1 FNC170 GRY / Decimal to Gray Code Conversion
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction converts a binary value into a gray code, and transfers it.
22
1. Instruction format
External Device
FNC170-FNC179
FNC 170 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D GRY P 5 steps
GRY Continuous
9 steps
DGRY Continuous
Operation Operation
GRYP Pulse (Single) DGRYP Pulse (Single)
Operation Operation
23
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
S Conversion source data or word device storing conversion source data 16- or 32-bit binary
Others
FNC181-FNC189
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 25
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Operation
Block Data
FNC190-FNC199
D 3 3 3 3 3 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
Command
input This instruction converts and transfers data from
FNC170 S D
GRY the source (binary) to the destination (gray code).
Operation 3
Data
FNC210-FNC219
BIN 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
Caution
The data conversion speed depends on the scan time of the PLC.
30
Inverter Comms
Ex-Device
FNC270-FNC274
569
FX3U/FX3UC Series Programmable Controllers 22 External Device FNC170 to FNC179
Programming Manual - Basic & Applied Instruction Edition 22.2 FNC171 GBIN / Gray Code to Decimal Conversion
Outline
This instruction converts a gray code into a binary value, and transfers it.
1. Instruction format
FNC 171 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D GBIN P 5 steps
GBIN Continuous
9 steps
DGBIN Continuous
Operation Operation
GBINP Pulse (Single) DGBINP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type
S Conversion source data or word device storing conversion source data 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
b15 b0
D10 BIN 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
- This instruction can be used for detecting an absolute position by a gray code type encoder.
- S can store a value from 0 to 32,767.
Caution
When an input relay (X) is specified as S , the response relay will be Scan time of PLC + Input filter
constant.
The filter constant can be changed in X000 to X017 using REFF (FNC 51) instruction or D8020 (filter
adjustment) so that the filter constant delay is eliminated.
570
FX3U/FX3UC Series Programmable Controllers 22 External Device FNC170 to FNC179
Programming Manual - Basic & Applied Instruction Edition 22.3 FNC176 RD3A / Read form Dedicated Analog Block
21
22.3 FNC176 RD3A / Read form Dedicated Analog Block
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction reads an analog input value from the analog block FX0N-3A or FX2N-2AD.
22
1. Instruction format
External Device
FNC170-FNC179
FNC 176 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
RD3A P 7 steps
RD3A Continuous
Operation
RD3AP Pulse (Single)
Operation 23
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
Special block number
m1 - FX3U/FX3UC (D, DSS) PLC: K0 to K7 16-bit binary
- FX3UC-32MT-LT : K1 to K7 24
m2 Analog input channel number 16-bit binary
Others
FNC181-FNC189
D Word device storing the read data 16-bit binary
3. Applicable devices
Oper-
Bit Devices Word Devices
Special Con- Real
Others
Charac-
25
and System User Digit Specification System User Index Pointer
Operation
Block Data
FNC190-FNC199
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
m1 3 3 3 3 3 3 3 3 3 3 3 3 3
m2 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 26
Control
Character String
FNC200-FNC209
Explanation of function and operation
1. 16-bit operation (RD3A)
Command
input
FNC176
27
m1 m2 D
Operation 3
Data
FNC210-FNC219
RD3A
30
Inverter Comms
Ex-Device
FNC270-FNC274
571
FX3U/FX3UC Series Programmable Controllers 22 External Device FNC170 to FNC179
Programming Manual - Basic & Applied Instruction Edition 22.4 FNC177 WR3A / Write to Dedicated Analog Block
Outline
This instruction writes a digital value to the analog block FX0N-3A or FX2N-2DA.
1. Instruction format
FNC 177 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
WR3A P 7 steps
WR3A Continuous
Operation
WR3AP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Special block number
m1 - FX3U/FX3UC (D, DSS) PLC: K0 to K7 16- or 32-bit binary
- FX3UC-32MT-LT : K1 to K7
m2 Analog output channel number 16- or 32-bit binary
S Data to be written or word device storing data to be written 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
m1 3 3 3 3 3 3 3 3 3 3 3 3 3
m2 3 3 3 3 3 3 3 3 3 3 3 3 3
S 3 3 3 3 3 3 3 3 3 3
572
FX3U/FX3UC Series Programmable Controllers 23 Introduction of Alternate Instructions FNC180
Programming Manual - Basic & Applied Instruction Edition 23.1 Instruction correspondence table
21
Control
Real Time Clock
FNC160-FNC169
23. Introduction of Alternate Instructions FNC180
22
23.1 Instruction correspondence table
External Device
FNC170-FNC179
Outline
EXTR instruction is provided for FX2N and FX2NC PLCs.
For FX3U and FX3UC PLCs with a built-in inverter communication function, dedicated instructions shown 23
below are provided. (EXTR instruction is not provided.)
Instructions
Alternate
FNC180
Instruction correspondence table
Others
FNC181-FNC189
EXTR K11 FNC271 IVDR Inverter drive
EXTR K12 FNC272 IVRD Inverter parameter read
EXTR K13 FNC273 IVWR Inverter parameter write
FNC274 IVBWR Inverter parameter block write
Operation
Block Data
FNC190-FNC199
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
573
FX3U/FX3UC Series Programmable Controllers 23 Introduction of Alternate Instructions FNC180
Programming Manual - Basic & Applied Instruction Edition 23.1 Instruction correspondence table
MEMO
574
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition
21
Control
Real Time Clock
FNC160-FNC169
24. Others FNC181 to FNC189
FNC181 to FNC189 provide instructions for generating random numbers, executing CRC data operations, 22
and processing data in high speed counter operations.
External Device
FNC170-FNC179
FNC No. Mnemonic Symbol Function Reference
181
Section
23
182 COMRD COMRD S D Read device comment data
Instructions
Alternate
FNC180
24.1
183
Others
FNC181-FNC189
185
Section
186 DUTY DUTY n1 n2 D Timing pulse generation
24.3
25
Operation
Block Data
FNC190-FNC199
187
Section
188 CRC CRC S D n Cyclic Redundancy Check
24.4
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
575
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.1 FNC182 COMRD / Read Device Comment Data
Outline
This instruction reads the comment data for registered devices written to the PLC by programming software
such as GX Developer.
1. Instruction format
FNC 182 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand Type Description Data Type
S Device number for which comment to be read is registered Device name
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3
...
- When M8091 is OFF, "0000H" is written to the device following the final character.
- When M8091 is ON, the device following the final character does not change.
576
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.1 FNC182 COMRD / Read Device Comment Data
21
For example, when the comment of S is "LineNo.1Start", it is stored in D and later as shown
Control
Real Time Clock
FNC160-FNC169
below.
b15 b8 b7 b0
D +0 69H(i) 4CH(L)
+1 65H(e) 6EH(n)
Comment of S
LineNo.1Start +2 6FH(o) 4EH(N) 22
+3 31H(1) 2EH(.)
External Device
FNC170-FNC179
+4 74H(t) 53H(S)
+5 72H(r) 61H(a)
+6 20H(space) 74H(t)
+7 20H(space) 20H(space)
+8 0000H 23
- When M8091 is OFF, "0000H" is written to the next device following the final character.
Instructions
Alternate
FNC180
- When M8091 is ON, the device following the final character does not change.
Others
FNC181-FNC189
Related device
Device Name Description
M8091 Output character number selector signal Refer to the above explanation.
25
Operation
Block Data
FNC190-FNC199
Caution
Specify a device number in device S for which a comment is registered in the PLC.
If a comment is not registered for the device S , "20H" (space) is stored in D and later for the
number of characters in the comment (16 half-width characters).
26
Errors
Control
Character String
FNC200-FNC209
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When a comment is not registered for the device S (error code: K6706)
When the range of points used from D for the comment exceeds the corresponding device range 27
(error code: K6706)
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
577
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.1 FNC182 COMRD / Read Device Comment Data
Program example
In the program shown below, the comment "Target Line A" registered to D100 is stored in ASCII code in D0
and later when X010 is set to ON. And since M8091 is OFF "0000H" is written to the device following the last
character.
X010
RST M8091
FNC182 D100 D0
COMRDP
END
b15 b8 b7 b0
D0 61H(a) 54H(T)
D1 67H(g) 72H(r)
Comment of D100 D2 74H(f) 65H(e)
Target Line A D3 4CH(L) 20H(space)
D4 6EH(n) 69H(i)
D5 20H(space) 65H(e)
D6 20H(space) 41H(A)
D7 20H(space) 20H(space)
D8 0000H
578
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.2 FNC184 RND / Random Number Generation
21
24.2 FNC184 RND / Random Number Generation
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction generates random numbers.
22
1. Instruction format
External Device
FNC170-FNC179
FNC 184 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
RND P RND Continuous
3 steps Operation
RNDP Pulse (Single)
Operation
23
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
D Head device number storing a random number 16-bit binary
3. Applicable devices 24
Others
FNC181-FNC189
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
D 3 3 3 3 3 3 3 3 3 25
Operation
Block Data
FNC190-FNC199
Explanation of function and operation
1. 16-bit operation (RND and RNDP)
This instruction generates a pseudo-random number within the range from 0 to 32767, and stores it as a
random number to D . 26
In the pseudo-random number sequence, the source value of a random number is calculated at every time,
Control
Character String
FNC200-FNC209
and this instruction calculates a pseudo-random number using the source value.
Command
input
FNC 184 D
RND
27
Operation 3
Data
FNC210-FNC219
Pseudo-random number calculation equation:
(D8311, D8310) = (D8311, D8310) *1 1103515245 + 12345.....(1)
D = ([D8311, D8310]>>16)&<logical product>00007FFFh
*1. To (D8311, D8310), write a non-negative value (0 to 2,147,483,647) only once when the PLC mode
switches from STOP to RUN. 28
[K1 is written to (D8311, D8310) as the initial value when the power is restored.]
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
579
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.2 FNC184 RND / Random Number Generation
Program example
In the program example shown below, a random number is stored to D100 every time X010 turns ON.
When the PLC mode switches from STOP to RUN, the time data converted into seconds and added by the
value (Year + Month) Day is written to D8311 and D8310.
M8002
FNC166 D0 The clock data is read.
TRD
FNC164 D3 D14 Data in hour, minute and second Data in second
DHTOS
FNC 20 D0 D1 D10
ADD
FNC 23 The data in second is added by the value (Year +
D10 D2 D12 Month) Day, and written to D8311 and D8310.
MUL
FNC 20 D14 D12 D8310
DADD
X010
FNC184 D100
RNDP
END
580
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.3 FNC186 DUTY / Timing Pulse Generation
21
24.3 FNC186 DUTY / Timing Pulse Generation
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction generates the timing signal whose one cycle corresponds to the specified number of
operation cycles.
22
External Device
FNC170-FNC179
1. Instruction format
FNC 186 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
n1 Number of scans (operation cycles) to remain ON [n1 > 0]
n2 Number of scans (operation cycles) to remain OFF [n2 > 0]
16-bit binary 24
Others
FNC181-FNC189
D Timing clock output destination Bit
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Index
Con- Real Charac-
Pointer 25
Unit stant Number ter String
Type
Operation
Block Data
FNC190-FNC199
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
n1 3 3 3 3 3 3
n2 3 3 3 3 3 3
D S 3
26
S: Specify either one among M8330 to M8334.
Control
Character String
FNC200-FNC209
Explanation of function and operation
1. 16-bit operation (DUTY)
1) The timing clock output destination D is set to ON and OFF with the ON duration for "n1" scans and 27
OFF duration for "n2" scans.
Operation 3
Data
FNC210-FNC219
Command
input FNC186 n1 n2 D
DUTY
2) Specify either one among M8330 to M8334 as the timing clock output destination device D .
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
581
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.3 FNC186 DUTY / Timing Pulse Generation
3) The counted number of scans is stored in either one among D8330 to D8334 in accordance with the
timing clock output destination device D .
The counted number of scans stored in either one among D8330 to D8334 is reset when the counted
value reaches "n1+n2" or when the command input (instruction) is set to ON.
Timing clock output destination device D Scan counting device
M8330 D8330
M8331 D8331
M8332 D8332
M8333 D8333
M8334 D8334
4) When the command input is set to ON, the operation is started. The timing clock output destination
device D is set to ON or OFF by END instruction.
Even if the command input is set to OFF, the operation is not stopped.
In the STOP mode, the operation is suspended. When the power of the PLC is turned OFF, the operation
is stopped.
5) When "n1" and "n2" are set to "0", the device D is set to the following status:
n1/n2 status D ON/OFF status
n1 = 0, n2 0 D Fixed to OFF
n1 > 0, n2 = 0 D Fixed to ON
Related devices
Device Name Description
M8330 Timing clock output 1
M8331 Timing clock output 2
M8332 Timing clock output 3 Timing clock output in DUTY (FNC186) instruction
M8333 Timing clock output 4
M8334 Timing clock output 5
Counted number of scans for Counted number of scans for timing clock output 1 in DUTY (FNC186)
D8330
timing clock output 1 instruction
Counted number of scans for Counted number of scans for timing clock output 2 in DUTY (FNC186)
D8331
timing clock output 2 instruction
Counted number of scans for Counted number of scans for timing clock output 3 in DUTY (FNC186)
D8332
timing clock output 3 instruction
Counted number of scans for Counted number of scans for timing clock output 4 in DUTY (FNC186)
D8333
timing clock output 4 instruction
Counted number of scans for Counted number of scans for timing clock output 5 in DUTY (FNC186)
D8334
timing clock output 5 instruction
Caution
DUTY (FNC186) instruction can be used up to 5 times (points).
It is not permitted, however, to use the same timing clock output destination device D for two or more
DUTY (FNC186) instructions.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When "n1" and/or "n2" is less than "0" (error code: K6706)
When any device other than M8330 to M834 is set to D (error code: K6705)
582
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.3 FNC186 DUTY / Timing Pulse Generation
21
Program example
Control
Real Time Clock
FNC160-FNC169
In the program shown below, when X000 is set to ON, M8330 is set to ON for 1 scan and OFF for 3 scans.
X000
FNC186 K1 K3 M8330
DUTY
22
END
External Device
FNC170-FNC179
X000 OFF ON
M8330 OFF ON 23
1 scan 3 scans
Instructions
Alternate
FNC180
3
2
D8330 1 1
current value 0 0
24
Others
FNC181-FNC189
25
Operation
Block Data
FNC190-FNC199
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
583
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.4 FNC188 CRC / Cyclic Redundancy Check
Outline
This CRC instruction calculates the CRC (cyclic redundancy check) value which is an error check method
used in communication.
In addition to CRC value, there are other error check methods such as parity check and sum check. For
obtaining the horizontal parity value and sum check value, CCD (FNC 84) instruction is available.
CRC instruction uses X16 + X15 + X2 + 1 as a polynomial for generating the CRC value (CRC-16).
For CCD instruction (check code), refer to Section 16.5.
1. Instruction format
FNC 188 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
CRC P CRC Continuous
7 steps Operation
CRCP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Head device number storing data for which the CRC value is generated
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S S S S S 3 3 3 3 3 3
D S S S 3 3 3 3 3 3
n 3 3 3 3
S: Make sure to specify four digits (K4{{{) when specifying the digits of a bit device.
584
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.4 FNC188 CRC / Cyclic Redundancy Check
21
16-bit conversion mode (while M8161 is OFF)
Control
Real Time Clock
FNC160-FNC169
In this mode, the operation is executed for high-order 8 bits (1 byte) and low-order 8 bits (1 byte) of a device
specified in S .
The operation result is stored to one 16-bit device specified in D .
M8000
M8161 16-bit conversion mode 22
External Device
FNC170-FNC179
Command
input
FNC188 S n
D
CRC
Example: S = D100 23
D = D0
Instructions
Alternate
FNC180
n= 6
Contents of target data
Device
8 bits 16 bits
Low-order byte Low-order bits of D100 01H
S
High-order byte High-order bits of D100 03H
0301H 24
Others
FNC181-FNC189
Low-order byte Low-order bits of D101 03H
S +1 0203H
Device storing data for High-order byte High-order bits of D101 02H
which the CRC value is Low-order byte Low-order bits of D102 00H
generated S +2 1400H
High-order byte High-order bits of D102 14H
25
...
...
Low-order byte
Operation
Block Data
FNC190-FNC199
S +n/2-1
High-order byte
Device storing the Low-order byte Low-order bits of D0 E4H
D 41E4H
generated CRC value High-order byte High-order bits of D0 41H
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
585
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.4 FNC188 CRC / Cyclic Redundancy Check
Example: S = D100
D = D0
n= 6
Device Contents of target data
S Low-order byte Low-order bits of D100 01H
2. Related device
Related device Description
ON CRC instruction operates in the 8-bit mode.
M8161*1
OFF CRC instruction operates in the 16-bit mode.
*1. Cleared when the PLC mode is changed from RUN to STOP.
Caution
In this instruction, X16 + X15 + X2 + 1 is used as a polynomial for generating the CRC value (CRC-16).
There are many other standard polynomials for generating the CRC value. Note that the CRC value
completely differs if an adopted polynomial is different.
586
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.4 FNC188 CRC / Cyclic Redundancy Check
21
Errors
Control
Real Time Clock
FNC160-FNC169
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When any digits other than 4 digits are specified as S or D in digit specification of bit device (error
code: K6706)
22
When n is outside the allowable range (1 to 256) (error code: K6706)
External Device
FNC170-FNC179
When a device specified by S +n-1 or D +1 is outside the allowable range (error code: K6706)
Program example
In the program example shown below, the CRC value of the ASCII code 0123456 stored in D100 to D106 is
generated and stored to D0 when M0 turns ON. 23
Instructions
Alternate
FNC180
1. In the case of 16-bit mode
M8000
M8161 16-bit conversion mode
M0
FNC188 D100 D0 K7
24
CRC
Others
FNC181-FNC189
Contents of data
Target data
D100 3130H
Low-order byte 30H
25
High-order byte 31H
Operation
Block Data
FNC190-FNC199
Low-order byte 32H
D101 3332H
Device storing data for which High-order byte 33H
CRC value is generated Low-order byte 34H
D102 3534H
High-order byte 35H
Low-order byte 36H 26
D103 3736H
Control
Character String
FNC200-FNC209
Device storing generated CRC Low-order byte CFH
D0 2ACFH
value High-order byte 2AH
Operation 3
Data
FNC210-FNC219
M8161 8-bit conversion mode
M0
FNC188 D100 D0 K7
CRC
28
Contents of target data
Comparison
Data
FNC220-FNC249
587
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.5 FNC189 HCMOV / High Speed Counter Move
Outline
This instruction updates the current value of a specified high speed counter or ring counter.
The function of this instruction varies depending on the PLC version.
1. Instruction format
FNC 189 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand Type Description Data Type
Device number of high speed counter or ring counter*1 handled as transfer
S
source 32-bit binary
D Device number handled as transfer destination
Specification to clear the current value of high speed counter or ring counter*1
n 16-bit binary
(transfer source) after transfer [clear (K1), no clear (K0)]
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S S S
D 3 3
n 3 3
S: Only high speed counters (C235 to C255) and ring counters (D8099 and D8398)*1 can be specified.
The current value of a high speed counter or ring counter specified in S is transferred to [ D +1,
D ].
After transfer, the current value of the high speed counter or ring counter is processed as shown in the
table below depending on the set value of "n":
"n" set value Operation
K0 (H0) Does not clear the current value (no processing).
K1 (H1) Clears the current value to "0".
*1. Ring counters (D8099 and D8398) cannot be specified in FX3UC PLCs before Ver.2.20.
588
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.5 FNC189 HCMOV / High Speed Counter Move
21
2. High speed counter current value update timing and the effect of DHCMOV instruction
Control
Real Time Clock
FNC160-FNC169
1) High speed counter current value update timing
When a pulse is input to an input terminal for a high speed counter (C235 to C255), the high speed
counter executes up-counting or down-counting.
If the current value of a high speed counter is handled in an applied instruction such as the normal MOV
instruction, the current value is updated at the timing shown in the table below. As a result, it is affected 22
by the program scan time.
External Device
FNC170-FNC179
Current value update timing
Hardware counter When OUT instruction for the counter is executed
Software counter Every time a pulse is input
By using DHCMOV instruction, the current value can be updated and transferred when it is executed. 23
2) Effect of DHCMOV instruction
Instructions
Alternate
FNC180
By using both input interrupt and DHCMOV instruction, the current value of a high speed counter can
be received at the rising edge or falling edge of an external input (at reception of input interrupt).
Refer to the Program example 2.
When DHCMOV instruction is used just before a comparison instruction (CMP, ZCP or comparison
contact instruction), the latest value of a high speed counter is used in comparison.The following points 24
must be kept in mind when using the DHCMOV command.
Others
FNC181-FNC189
- When the current value of a high speed counter is compared using CMP, ZCP or comparison
contact instruction (not using a designated high speed counter comparison instruction), a hardware
counter does not change into a software counter.
For the condition in which a hardware counter is handled as a software counter,
refer to Subsection 4.7.9. 25
- When the number of high speed software counter comparison instructions is reduced, the total
Operation
Block Data
FNC190-FNC199
frequency limitation is decreased.
For the limitation in software counters by the total frequency,
refer to Subsection 4.7.10.
- When it is necessary to execute comparison and change an output contact (Y) as soon as the
current value of a high speed counter changes, use a desighnated high speed counter comparison 26
instruction (HSCS, HSCR or HSZ).
Control
Character String
FNC200-FNC209
- DHCMOV instruction can be used as many times as necessary.
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
589
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.5 FNC189 HCMOV / High Speed Counter Move
Cautions
When programming DHCMOV instruction in an input interrupt program, the following points should be
observed.
For assignment of pointers for input interrupt and inputs, refer to the table shown in 5) below.
1) Program EI (FNC 04) and FEND (FNC 06) instructions in the main program. They are necessary to
execute an input interrupt program.
For EI (FNC 04) and FEND (FNC 06) instructions, refer to Section 8.5 and Section 8.6.
2) When programming DHCMOV instruction in the 1st line in an input interrupt program, make sure to use
the pattern program shown below.
Make sure to use the command contact M8394.
I M8394 Pattern program for using the
FNC189 S D n DHCMOV instruction in an interrupt
DHCMOV program
FNC 03
IRET
3) If two or more DHCMOV instructions are used in one input interrupt program, only the first instruction (just
after the interrupt pointer) is executed when the interrupt is generated.
The rest of the interrupt, including additional DHCMOV instructions, is executed according to normal
interrupt processing.
Do not use M8394 as the command contact for the DHCMOV instructions following the first.
4) It is not permitted to use DHCMOV instruction for the same counter in two or more input interrupt
programs.
I000 M8394
FNC189 C236 D0 K0
DHCMOV
FNC03
Same counter IRET
I200 M8394
FNC189 C236 D2 K1
DHCMOV
FNC03
IRET
590
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.5 FNC189 HCMOV / High Speed Counter Move
21
5) While input interrupts are disabled by the interrupt disable flags (shown in the table below), DHCMOV
Control
Real Time Clock
FNC160-FNC169
instructions are not executed when they are placed inside a corresponding interrupt.
Input number corresponding to interrupt
Interrupt disable flag Corresponding interrupt pointer
pointer
M8050*1 I000,I001 X000
M8051*1 I100,I101 X001 22
External Device
FNC170-FNC179
M8052*1 I200,I201 X002
M8053*1 I300,I301 X003
M8054*1 I400,I401 X004
M8055*1 I500,I501 X005
*1. Cleared when the PLC mode is changed from RUN to STOP. 23
Instructions
Alternate
FNC180
6) If an input interrupt is generated while input interrupts are disabled by something other than the interrupt
disable flags M8050 to M8055 (after execution of DI instruction and before execution of EI instruction),
DHCMOV instruction is immediately executed, but execution of the interrupt program is held. The
interrupt program will be executed after EI instruction is executed and interrupts are enabled.
Others
FNC181-FNC189
The function of FNC189 instruction changes depending on the version as shown in the table below.
Applicable version
Item Outline of function
FX3U FX3UC
Ver.2.20 or Ver.2.20 or
Target device
later later Ring counter (D8099 and D8398) can be specified in S .
25
Operation
Block Data
FNC190-FNC199
Error
An operation error occurs in the following case; The error flag M8067 turns ON, and the error code is stored in
D8067.
When a device specified in S or [ D +1, D ] is outside the allowable range (error code: K6705)
26
Control
Character String
FNC200-FNC209
Program examples
1. Program example 1
In the program example below, the current value of the high speed counter C235 is compared in each
operation cycle, and then the output Y000 is set to ON if the current value is "K500" or more (when the current
value of C235 is not cleared). 27
Operation 3
Data
FNC210-FNC219
The current value of C235 is
M8000
FNC189 1
transferred to D1 and D0.
C235 D0 K0* (The current value of C235 is not
DHCMOV cleared.)
FNC238 D0 K500 In the case of "(D1, D0) K500",
Y000
DAND>= Y000 is set to ON.
28
Comparison
Data
FNC220-FNC249
END
*1. K0: The current value of the high speed counter is not cleared when DHCMOV instruction is executed.
K1: The current value of the high speed counter is cleared when DHCMOV instruction is executed.
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
591
FX3U/FX3UC Series Programmable Controllers 24 Others FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition 24.5 FNC189 HCMOV / High Speed Counter Move
2. Program example 2
In the program example shown below, the current value of C235 is transferred to D201 and D200, and the
current value of C235 is cleared when X001 turns from OFF to ON.
0 EI
FEND
M8394 When X001 turns from OFF to ON, the
I101 FNC189 C235 D200 K1*1 interrupt program from I101 to IRET is
DHCMOV executed.
The current value of C235 is
transferred to D201 and D200.
(The current value of C235 is cleared
IRET to 0.)
*1. K0: The current value of the high speed counter is not cleared when DHCMOV instruction is executed.
K1: The current value of the high speed counter is cleared when DHCMOV instruction is executed.
592
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition
21
Control
Real Time Clock
FNC160-FNC169
25. Block Data Operation FNC190 to FNC199
FNC190 to FNC199 provide instructions for adding, subtracting and comparing block data. 22
External Device
FNC170-FNC179
FNC No. Mnemonic Symbol Function Reference
190
23
Instructions
Alternate
FNC180
191
Section
192 BK+ BK+ S1 S2 D n Block Data Addition
25.1
24
Others
FNC181-FNC189
Section
193 BK BK- S1 S2 D n Block Data Subtraction
25.2
Section
194 BKCMP= BKCMP= S1 S2 D n Block Data Compare S1 = S2
25.3
25
Operation
Block Data
FNC190-FNC199
Section
195 BKCMP> BKCMP> S1 S2 D n Block Data Compare S1 > S2
25.3
Section
196 BKCMP< BKCMP< S1 S2 D n Block Data Compare S1 < S2
25.3
26
Section
Control
Character String
FNC200-FNC209
197 BKCMP<> BKCMP<> S1 S2 D n Block Data Compare S1 S2
25.3
Section
198 BKCMP<= BKCMP<= S1 S2 D n Block Data Compare S1 S2
25.3
27
Section
Operation 3
Data
FNC210-FNC219
199 BKCMP>= BKCMP>= S1 S2 D n Block Data Compare S1 S2
25.3
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
593
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.1 FNC192 BK+ / Block Data Addition
Outline
This instruction adds binary block data.
1. Instruction format
FNC 192 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BK+ P 9 steps
BK+ Continuous
17 steps
DBK+ Continuous
Operation Operation
BK+P Pulse (Single) DBK+P Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type
S1 Head device number storing addition data
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3
S2 3 3 3 3 3 3 3
D 3 3 3 3 3
n 3 3 3 3
1) "n" 16-bit binary data starting from S2 are added to "n" 16-bit binary data starting from S1 , and the
operation result is stored in "n" points starting from D .
b15 b0 b15 b0 b15 b0
S1 +0 K1234 S2 +0 K4000 D +0 K5234
+1 K4567 +1 K1234 +1 K5801
+2 K-2000 "n" +2 K-1234 "n" +2 K-3234 "n"
points + points points
+(n-2) K-1234 +(n-2) K5000 +(n-2) K3766
+(n-1) K4000 +(n-1) K4321 +(n-1) K8321
594
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.1 FNC192 BK+ / Block Data Addition
21
2. 32-bit operation (DBK+ and DBK+P)
Control
Real Time Clock
FNC160-FNC169
Command
input
FNC192 S1 S2 D n
DBK+P
1) "2n" 32-bit binary data starting from [ S2 +1, S2 ] are added to "2n" 32-bit binary data starting from 22
External Device
FNC170-FNC179
[ S1 +1, S1 ], and the operation result is stored in "2n" points starting from [ D +1, D ].
b31 b0 b31 b0
[ S1 +1, S1 ] K1234 [ S2 +1, S2 ] K4000
[ S1 +3, S1 +2] K40000 [ S2 +3, S2 +2] K1234
[ S1 +5, S1 +4] K-2000 "n"
points +
[ S2 +5, S2 +4] K-1234 "n"
points 23
Instructions
Alternate
FNC180
[ S1 +2n-3, S1 +2n-4] K-1234 [ S2 +2n-3, S2 +2n-4] K5000
[ S1 +2n-1, S1 +2n-2] K4000 [ S2 +2n-1, S2 +2n-2] K4321
b31 b0
[ D +1, D ] K5234
[ D +3, D +2]
[ D +5, D +4]
K41234
K-3234 "n"
24
points
Others
FNC181-FNC189
[ D +2n-3, D +2n-4] K3766
[ D +2n-1, D +2n-2] K8321
Operation
Block Data
FNC190-FNC199
[ S1 +1, S1 ] K1234
[ S1 +3, S1 +2] K40000
[ S1 +5, S1 +4] K-2000 "n"
points + [ S2 +1, S2 ] K4321
[ S1 +2n-3, S1 +2n-4]
[ S1 +2n-1, S1 +2n-2]
K-1234
K4000
b31 b0 26
[ D +1, D ] K5555
Control
Character String
FNC200-FNC209
[ D +3, D +2] K44321
[ D +5, D +4] K2321 "n"
points
[ D +2n-3, D +2n-4] K3087
[ D +2n-1, D +2n-2] K8321
27
Operation 3
Data
FNC210-FNC219
Related instruction
Instruction Description
BK- (FNC193) Subtracts binary block data.
28
Comparison
Data
FNC220-FNC249
Caution
1) When underflow or overflow occurs in the operation result, the following processing is executed. At this
time, the carry flag does not turn ON.
- In the case of 16-bit operation
K32767(H7FFF) + K2(H0002) K-32767(H8001) 29
K-32768(H8000) + K-2(HFFFE) K32766(H7FFE)
Operation
Data Table
FNC250-FNC269
595
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.1 FNC192 BK+ / Block Data Addition
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When "n" ("2n" in 32-bit operation) devices starting from S1 , S2 , and/or D exceed the
corresponding device range (error code: K6706)
When "n" ("2n" in 32-bit operation) devices starting from S1 overlap "n" ("2n" in 32-bit operation)
devices starting from D (error code: K6706)
When "n" ("2n" in 32-bit operation) devices starting from S2 overlap "n" ("2n" in 32-bit operation)
devices starting from D (error code: K6706)
Program example
In the program shown below, the specified number of data stored in D150 to D0 are added to the specified
number of data stored in D100 to D0 when X020 is set to ON, and the operation result is stored in D200 and
later.
X020
FNC192 D100 D150 D200 D0 When D0 is "4"
BK+
END
596
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.2 NFC193 BK / Block Data Subtraction
21
25.2 NFC193 BK / Block Data Subtraction
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction subtracts binary block data.
22
1. Instruction format
External Device
FNC170-FNC179
FNC 193 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BK P 9 steps
BK Continuous
17 steps
DBK Continuous
Operation Operation
BKP Pulse (Single) DBKP Pulse (Single)
Operation Operation
23
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
S1 Head device number storing subtraction data
Others
FNC181-FNC189
n Number of data
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Index
Con- Real Charac-
Pointer
25
Unit stant Number ter String
Operation
Block Data
FNC190-FNC199
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3
S2 3 3 3 3 3 3 3
D 3 3 3 3 3 26
n 3 3 3 3
Control
Character String
FNC200-FNC209
Explanation of function and operation
1. 16-bit operation (BK- and BK-P)
Command 27
input FNC193
Operation 3
Data
FNC210-FNC219
S1 S2 D n
BK-P
1) "n" 16-bit binary data starting from S2 are subtracted from "n" 16-bit binary data starting from S1 ,
and the operation result is stored in "n" points starting from D .
b15 b0 b15 b0 b15 b0 28
S1 +0 K8765 S2 +0 K1234 D +0 K7531
Comparison
Data
FNC220-FNC249
597
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.2 NFC193 BK / Block Data Subtraction
1) "2n" 32-bit binary data starting from [ S2 +1, S2 ] are subtracted from "2n" 32-bit binary data starting
from [ S1 +1, S1 ], and the operation result is stored in "2n" points starting from [ D +1, D ].
b31 b0 b31 b0
[ S1 +1, S1 ] K8765 [ S2 +1, S2 ] K1234
[ S1 +3, S1 +2] K8888 [ S2 +3, S2 +2] K5678
[ S1 +5, S1 +4] K9325 "n" [ S2 +5, S2 +4] K9876 "n"
points points
[ S1 +2n-3, S1 +2n-4] K50000 [ S2 +2n-3, S2 +2n-4] K4321
[ S1 +2n-1, S1 +2n-2] K4352 [ S2 +2n-1, S2 +2n-2] K4000
b31 b0
[ D +1, D ] K7531
[ D +3, D +2] K3210
[ D +5, D +4] K-551 "n"
points
[ D +2n-3, D +2n-4] K45679
[ D +2n-1, D +2n-2] K352
Related instruction
Instruction Description
BK+ (FNC192) Adds binary block data.
Caution
1) When underflow or overflow occurs in the operation result, the following processing is executed. At this
time, the carry flag does not turn ON.
- In the case of 16-bit operation
K-32768(H8000) K2(H0002) K32766(H7FFE)
K32767(H7FFF) K-2(HFFFE) K-32767(H8001)
598
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.2 NFC193 BK / Block Data Subtraction
21
Errors
Control
Real Time Clock
FNC160-FNC169
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When "n" ("2n" in 32-bit operation) devices starting from S1 , S2 , and/or D exceed the
corresponding device range (error code: K6706)
22
When "n" ("2n" in 32-bit operation) devices starting from S1 overlap "n" ("2n" in 32-bit operation)
External Device
FNC170-FNC179
devices starting from D (error code: K6706)
When "n" ("2n" in 32-bit operation) devices starting from S2 overlap "n" ("2n" in 32-bit operation)
devices starting from D (error code: K6706)
Program example
23
Instructions
Alternate
FNC180
In the program shown below, the constant "8765" is subtracted from the data stored in D100 to D102 when
X010 is set to ON, and the operation result is stored in D200 and later.
X010
FNC193 D100 K8765 D200 K3
BK-P
24
Others
FNC181-FNC189
END
b15 b0 b15 b0
D100 K12345 b15 b0 D200 K3580
D101
D102
K8701
K3502
K8765 D201
D202
K-64
K-5263
25
Operation
Block Data
FNC190-FNC199
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
599
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.3 FNC194~199 BKCMP=, >, <, < >, <=, >= / Block Data Compare
25.3 FNC194~199 BKCMP=, >, <, < >, <=, >= / Block Data Compare
Outline
These instructions compare block data in the comparison condition set in each instruction.
1. Instruction format
FNC 194 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BKCMP= P 9 steps
BKCMP= Continuous
17 steps
DBKCMP= Continuous
Operation Operation
BKCMP=P Pulse (Single) DBKCMP=P Pulse (Single)
Operation Operation
FNC 195 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BKCMP> P 9 steps
BKCMP> Continuous
17 steps
DBKCMP> Continuous
Operation Operation
BKCMP>P Pulse (Single) DBKCMP>P Pulse (Single)
Operation Operation
FNC 196 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BKCMP< P 9 steps
BKCMP< Continuous
17 steps
DBKCMP< Continuous
Operation Operation
BKCMP<P Pulse (Single) DBKCMP<P Pulse (Single)
Operation Operation
FNC 197 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BKCMP<> P 9 steps
BKCMP<> Continuous
17 steps
DBKCMP<> Continuous
Operation Operation
BKCMP<>P Pulse (Single) DBKCMP<>P Pulse (Single)
Operation Operation
FNC 198 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BKCMP<= P 9 steps
BKCMP<= Continuous
17 steps
DBKCMP<= Continuous
Operation Operation
BKCMP<=P Pulse (Single) DBKCMP<=P Pulse (Single)
Operation Operation
FNC 199 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D BKCMP>= P 9 steps
BKCMP>= Continuous
17 steps
DBKCMP>= Continuous
Operation Operation
BKCMP>=P Pulse (Single) DBKCMP>=P Pulse (Single)
Operation Operation
S1 3 3 3 3 3 3 3
S2 3 3 3 3 3
D 3 3 3 S 3
n 3 3 3 3
600
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.3 FNC194~199 BKCMP=, >, <, < >, <=, >= / Block Data Compare
21
Explanation of function and operation
Control
Real Time Clock
FNC160-FNC169
1. 16-bit operation (BKCMP=, >, <, <>, <=, >= / BKCMP=P, >P, <P, <>P, <=P, and >=P)
1) "n" 16-bit binary data starting from S1 are compared with "n" 16-bit binary data starting from S2 ,
and the comparison result is stored in "n" points starting from D .
Command *1 The number out of 194 to 199 is put in "OOO".
22
input FNCOOO*1 *2 The symbol out of "=", ">", "<", "<>", "<=", or
External Device
FNC170-FNC179
S1 S2 D n ">=" corresponding to the FNC No. is put in .
BKCMP*2
Comparison result
S1 +0 K1234 S2 +0 K5321 D +0 OFF(0)
+1 K5678 +1 K3399 +1 ON(1)
+2 K5000 "n"
*3
+2 K5678 "n" +2 OFF(0) "n" 23
points > points points
Instructions
Alternate
FNC180
+n-2 K7777 +n-2 K6543 +n-2 ON(1)
+n-1 K4321 +n-1 K1200 +n-1 ON(1)
*3 An operation example of BKCMP>
(FNC195) instruction is shown here.
24
2) A constant can be directly specified in S1 .
Others
FNC181-FNC189
Comparison result
S2 +0 K32000 D +0 ON(1)
+1 K4321 +1 OFF(0)
*4
+2 K32000 "n" +2 ON(1) "n"
K32000 =
S1
*4 An operation example of BKCMP= +n-2
points points
25
K1234 +n-2 OFF(0)
Operation
Block Data
FNC190-FNC199
(FNC194) instruction is shown
+n-1 K5678 +n-1 OFF(0)
here.
Control
Character String
FNC200-FNC209
BKCMP>(FNC195) S1 > S2 S1 <= S2
BKCMP<(FNC196) S1 < S2 S1 >= S2
BKCMP<>(FNC197) S1 <> S2 S1 = S2
BKCMP<=(FNC198) S1 <= S2 S1 > S2 27
Operation 3
Data
FNC210-FNC219
BKCMP>=(FNC199) S1 >= S2 S1 < S2
4) When the comparison result is ON (1) in all of "n" points starting from D , M8090 (block comparison
signal) turns ON.
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
601
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.3 FNC194~199 BKCMP=, >, <, < >, <=, >= / Block Data Compare
2. 32-bit operation (DBKCMP=, >, <, <>, <=, >= / DBKCMP=P, >P, <P, <>P, <=P, and >=P)
1) "n" 32-bit binary data starting from [ S1 +1, S1 ] are compared with "n" 32-bit binary data starting
from [ S2 +1, S2 ], and the comparison result is stored in "n" points starting from [ D +1, D ].
Command *1 The number out of 194 to 199 is put in "OOO".
input FNCOOO*1 S1 S2 D n *2 The symbol out of "=", ">", "<", "<>", "<=", or
DBKCMP*2 ">=" corresponding to the FNC No. is put in .
[ S2 +1, S2 ] K32000
[ S2 +3, S2 +2] K4321
*4
[ S2 +5, S2 +4] K32000 "n"
[ S1 +1, S1 ] K32000 = points
*4 An operation example of DBKCMP= [ S2 +2n-3, S2 +2n-4] K1234
(FNC194) instruction is shown here. [ S2 +2n-1, S2 +2n-2] K5678
Comparison result
D +0 ON(1)
+1 OFF(0)
+2 ON(1) "n"
points
+n-2 OFF(0)
+n-1 OFF(0)
3) The table below shows the comparison result for each instruction:
Instruction Comparison result ON (1) condition Comparison result OFF (0) condition
DBKCMP=(FNC194) [ S1 +1, S1 ] = [ S2 +1, S2 ] [ S1 +1, S1 ] [ S2 +1, S2 ]
DBKCMP>(FNC195) [ S1 +1, S1 ] > [ S2 +1, S2 ] [ S1 +1, S1 ] <= [ S2 +1, S2 ]
DBKCMP<(FNC196) [ S1 +1, S1 ]< [ S2 +1, S2 ] [ S1 +1, S1 ] >= [ S2 +1, S2 ]
DBKCMP<>(FNC197) [ S1 +1, S1 ] [ S2 +1, S2 ] [ S1 +1, S1 ] = [ S2 +1, S2 ]
DBKCMP<=(FNC198) [ S1 +1, S1 ] <= [ S2 +1, S2 ] [ S1 +1, S1 ] > [ S2 +1, S2 ]
DBKCMP>=(FNC199) [ S1 +1, S1 ] >= [ S2 +1, S2 ] [ S1 +1, S1 ] < [ S2 +1, S2 ]
4) When the comparison result is ON (1) in all of "n" points starting from [ D +1, D ], the M8090 (block
comparison signal) turns ON.
Related device
For the block comparison signal use method, refer to Subsection 6.5.2.
Device Name Description
Turns ON when all comparison results are "ON (1)" in a block data instruction.
M8090 Block comparison signal DBKCMP= (FNC194), DBKCMP> (FNC195), DBKCMP< (FNC196), DBKCMP<>
(FNC197), DBKCMP<= (FNC198), and DBKCMP>= (FNC199)
602
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.3 FNC194~199 BKCMP=, >, <, < >, <=, >= / Block Data Compare
21
Caution
Control
Real Time Clock
FNC160-FNC169
When using 32-bit counters (including 32-bit high speed counters)
For comparing 32-bit counters and 32-bit high speed counters (C200 to C255), make sure to use an
instruction for 32-bit operation (DBKCMP=, DBKCMP>, DBKCMP<, DBKCMP<>, DBKCMP<=, or
DBKCMP>=).
If an instruction for 16-bit operation (BKCMP=, BKCMP>, BKCMP<, BKCMP<>, BKCMP<=, or BKCMP>=) 22
is used, an operation error is caused (error code: K6705).
External Device
FNC170-FNC179
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the range of "n" ("2n" in 32-bit operation) points starting from S1 and/or S2 exceeds the
23
Instructions
Alternate
FNC180
corresponding device range (error code: K6706)
When the range of "n" points starting from D exceeds the corresponding device range (error code:
K6706)
When data registers starting from D specified as "D.b" overlap "n" ("2n" in 32-bit operation) points
starting from S1 (error code: K6706) 24
Others
FNC181-FNC189
When data registers starting from D specified as "D.b" overlap "n" ("2n" in 32-bit operation) points
starting from S2 (error code: K6706)
When a 32-bit counter (C200 to C255) is specified in S1 and/or S2 in 16-bit operation (error code:
K6705)
For comparing 32-bit counters, make sure to use an instruction for 32-bit operation (DBKCMP=, 25
DBKCMP>, DBKCMP<, DBKCMP<>, DBKCMP<=, or DBKCMP>=).
Operation
Block Data
FNC190-FNC199
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
603
FX3U/FX3UC Series Programmable Controllers 25 Block Data Operation FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition 25.3 FNC194~199 BKCMP=, >, <, < >, <=, >= / Block Data Compare
Program example
1) In the program shown below, four 16-bit binary data starting from D100 are compared with four 16-bit
binary data starting from D200 by BKCMP= (FNC194) instruction when X020 is set to ON, and the
comparison result is stored in four points starting from M10.
When the comparison result is "ON (1)" in all of the four points starting from M10, Y000 is set to ON.
X020
FNC194 D100 D200 M10 K4
BKCMP=
M8090
Y000
Block comparison signal
END
Comparison
result
D100 K1000 D200 K1000 M10 ON
D101 K2000 D201 K2000 M11 ON
D102 K3000
= D202 K5000 M12 OFF
D103 K4000 D203 K4000 M13 ON
Y000 OFF
(When all of M10 to M13 are ON, Y000 is set to ON.)
2) In the program shown below, the constant K1000 is compared with four data starting from D10 when
X010 is set to ON, and the comparison result is stored in b4 to b7 of D0.
X010
FNC197 K1000 D10 D0.4 K4
BKCMP<>
END
b15 b7 b4 b0
D0 before
operation 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0
D10 K2000
D11 K1000
K1000 <>
D12 K1000
b15 b7 b4 b0
D13 K2222 D0 after
operation 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0
604
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition
21
Control
Real Time Clock
FNC160-FNC169
26. Character String Control FNC200 to FNC209
FNC200 to FNC209 provide instructions for controlling character strings such as linking character string data, 22
replacing some characters and extracting character string data.
External Device
FNC170-FNC179
FNC No. Mnemonic Symbol Function Reference
Section
200 STR STR S1 S2 D BIN to Character String Conversion
26.1
Section
23
201 VAL VAL S D1 D2 Character String to BIN Conversion
Instructions
Alternate
FNC180
26.2
Section
202 $+ $+ S1 S2 D Link Character Strings
26.3
Others
FNC181-FNC189
Extracting Character String Data from Section
204 RIGHT RIGHT S D n the Right 26.5
Operation
Block Data
FNC190-FNC199
206 MIDR MIDR S1 D S2 Random Selection of Character Strings
26.7
Control
Character String
FNC200-FNC209
Section
209 $MOV $MOV S D Character String Transfer
26.10
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
605
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.1 FNC200 STR / BIN to Character String Conversion
Outline
This instruction converts binary data into character strings (ASCII codes).
On the other hand, the ESTR (FNC116) instruction converts floating point data into character strings.
For character strings, refer to Section 5.3.
For ESTR (FNC116) instruction, refer to Section 18.4.
1. Instruction format
FNC 200 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D STR P 7 steps STR Continuous
13 steps DSTR
Continuous
Operation Operation
STRP Pulse (Single) DSTRP Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type
Head device number storing the number of digits of a numeric value to be
S1 16-bit binary
converted
S2 Device number storing binary data to be converted 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3
606
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.1 FNC200 STR / BIN to Character String Conversion
21
Explanation of function and operation
Control
Real Time Clock
FNC160-FNC169
1. 16-bit operation (STR and STRP)
1) All digits (specified by S1 ) of 16-bit binary data stored in S2 are converted into ASCII codes while
the decimal point is added to the position specified by the device storing the number of digits of the
decimal part ( S1 +1), and stored in D and later. 22
External Device
FNC170-FNC179
Command
input FNC200 S1 S2 D
STR
b15 b8 b7 b0
Number of all
23
ASCII code in "(Value ASCII code
S1 +0 digits D +0 specifying number of all
digits - 1)"th digit indicating sign
+1 Number of digits
Instructions
Alternate
FNC180
ASCII code in "(Value ASCII code in "(Value
of decimal part +1 specifying number of all specifying number of all For number of
digits - 3)"th digit digits - 2)"th digit all digits
ASCII code in "(Value ASCII code in "(Value
+2 specifying number of all specifying number of all For value
digits - 5)"th digit digits - 4)"th digit stored in S1
ASCII code in "(Value ASCII code in "(Value
+3
Sign specifying number of all specifying number of all
digits - 7)"th digit digits - 6)"th digit 24
+4 0000H
Others
FNC181-FNC189
16-bit binary
S2 0000H is automatically stored at
data
the end of a character string.
S1 +0 5
+1 1 b15
31H(1)
b8 b7
2DH(-)
b0
25
D +0 For number of
Operation
Block Data
FNC190-FNC199
- 1 2 3 +1 2EH(.) 32H(2) all digits
16-bit binary S1 =5
+2 00H 33H(3)
data
S2 -123 00H is automatically stored at the
end of a character string.
26
2) Set the number of all digits S1 in the range from 2 to 8.
Control
Character String
FNC200-FNC209
3) Set the number of digits of the decimal part S1 +1 in the range from 0 to 5.
Make sure to satisfy "Number of digits of decimal part <= (Number of all digits -3)".
4) 16-bit binary data to be converted stored in S2 should be within the range from -32768 to +32767.
5) Converted character string data is stored in D and later as shown below. 27
- As the sign, "space" (20H) is stored when the 16-bit binary data stored in S2 is positive, and "-"
Operation 3
Data
FNC210-FNC219
(2DH) is stored when the 16-bit binary data stored in S2 is negative.
- When the number of digits of the Number of
all digits 6
decimal part S1 +1 is set to any
value other than "0", the decimal point Number of 2
"." (2EH) is automatically added in
digits of
decimal part
1 2 3 4 28
16-bit Number of digits of
"number of digits of decimal part + 1"th
Comparison
Data
FNC220-FNC249
607
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.1 FNC200 STR / BIN to Character String Conversion
608
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.1 FNC200 STR / BIN to Character String Conversion
21
5) Converted character string data is stored in D and later as shown below.
Control
Real Time Clock
FNC160-FNC169
- For the sign, "space" (20H) is stored when the 32-bit binary data stored in S2 is positive, and "-
(2DH)" is stored when the 32-bit binary data stored in S2 is negative.
- When the number of digits of the Number of
10
decimal part S1 +1 is set to any all digits
value other than "0", the decimal Number of 3
22
digits of 1 2 3 4 5 6 7 8
External Device
FNC170-FNC179
point "." (2EH) is automatically decimal part
32-bit Number of digits of
added in "number of digits of 12345678 decimal part
binary data
decimal part + 1"th digit. It is automatically added.
When the number of digits of the
decimal part S1 +1 is set to "0",
the decimal point is not added. 23
Instructions
Alternate
FNC180
- When the number of digits of the Number of
all digits 13
decimal part S1 +1 is larger than the
number of digits of 32-bit binary data Number of 10
digits of 0 0 0 0 0 0 5 4 3 2 1
stored in [ S2 +1, S2 ], "0" (30H) is decimal part
automatically added, and the data is 16-bit 54321
shifted to the right end during
binary data
It is automatically added. 24
conversion.
Others
FNC181-FNC189
- When the number of all digits stored in
Number of
S1 excluding the sign and decimal all digits 13
point is larger than the number of digits Number of 2
digits of - 5 4 3 2 1 0
of 32-bit binary data stored in [ S2 +1, decimal part
S2 ], "space" (20H) is stored in each
32-bit -543210
"20H" (space) is stored in 25
binary data each digit.
Operation
Block Data
FNC190-FNC199
digit between the sign and the numeric
value.
When the number of all digits stored in S1 excluding the sign and decimal point is smaller than the
number of digits of 32-bit binary data stored in [ S2 +1, S2 ], an error is caused.
- "00H" indicating the end of a character string is automatically stored at the end of a converted character
string.
26
Control
Character String
FNC200-FNC209
When the number of all digits is even, "0000H" is stored in the device after the last character.
When the number of all digits is odd, "00H" is stored in the high-order byte (8 bits) of the device storing
the final character.
Related instructions
27
Instruction Description
Operation 3
Data
FNC210-FNC219
Converts binary floating point data into a character string (ASCII codes) with a specified number
ESTR(FNC116)
of digits.
EVAL(FNC117) Converts a character string (ASCII codes) into binary floating point data.
VAL(FNC201) Converts a character string (ASCII codes) into binary data.
28
Errors
Comparison
Data
FNC220-FNC249
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the number of all digits stored in S1 is outside the following range (error code: K6706)
Setting range 29
16-bit operation 2 to 8
Operation
Data Table
FNC250-FNC269
32-bit operation 2 to 13
When the number of digits of the decimal part stored in S1 +1 is outside the following range (error code:
K6706)
Setting range 30
16-bit operation 0 to 5
Inverter Comms
Ex-Device
FNC270-FNC274
32-bit operation 0 to 10
609
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.1 FNC200 STR / BIN to Character String Conversion
When the relationship between the number of all digits stored in S1 and the number of digits of the
decimal part stored in S1 +1 does not satisfy the following (error code: K6706)
(Number of all digits -3) Number of digits of decimal part
When the number of all digits stored in S1 including the digit for sign and the digit for decimal point is
smaller than the number of digits of the binary data stored in [ S2 +1, S2 ] (error code: K6706)
When the devices D and later storing a character string exceeds the corresponding device range
(error code: K6706)
Program example
In the program below, the 16-bit binary data stored in D10 is converted into a character string in accordance
with the digit specification by D0 and D1 when X000 is set to ON, and then stored in D20 to D23.
X000
FNC 12 K12672 D10 Data to be converted is set.
MOVP
END
b15 b8 b7 b0
16-bit binary data D10 12672 " 12672" D20 31H(1) 20H(space)
D21 36H(6) 32H(2)
Number of all digits D0 6 D22 32H(2) 37H(7)
Number of digits of D1 0 D23 0000H
decimal part
610
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.2 FNC201 VAL / Character String to BIN Conversion
21
26.2 FNC201 VAL / Character String to BIN Conversion
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction converts a character string (ASCII codes) into binary data.
On the other hand, EVAL (FNC117) instruction converts a character string (ASCII codes) into floating point
22
External Device
FNC170-FNC179
data.
For character strings, refer to Section 5.3.
For EVAL (FNC117) instruction, refer to Section 18.5.
1. Instruction format
23
FNC 201 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Instructions
Alternate
FNC180
D VAL P 7 steps VAL Continuous
13 steps DVAL
Continuous
Operation Operation
VALP Pulse (Single) DVALP Pulse (Single)
Operation Operation
2. Set data 24
Operand Type Description Data Type
Others
FNC181-FNC189
S Head device number storing a character string to be converted into binary data Character string
Head device number storing the number of all digits of the binary data acquired
D1 16-bit binary
by conversion
D2 Head device number storing the binary data acquired by conversion 16- or 32-bit binary
25
Operation
Block Data
FNC190-FNC199
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
26
S 3 3 3 3 3
Control
Character String
FNC200-FNC209
D1 3 3 3 3 3
D2 3 3 3 3 3 3 3 3 3
Operation 3
Data
FNC210-FNC219
1. 16-bit operation (VAL and VALP)
1) A character string stored in S and later is converted into 16-bit binary data. The number of all digits
of the binary data acquired for conversion is stored in D1 , the number of digits of the decimal part is
stored in D1 +1, and the converted binary data is stored in D2 .
In converting a character string into binary data, the data from S to a device number storing "00H" is 28
handled as a character string in byte units.
Comparison
Data
FNC220-FNC249
Command
input FNC201 S D1 D2
VAL
Number of all
b15 b8 b7 b0 D1 +0 digits
+1 Number of digits
29
S +0 ASCII code of 1st character ASCII code indicating sign
Operation
Data Table
FNC250-FNC269
of decimal part
+1 ASCII code of 3rd character ASCII code of 2nd character
Integer value in
+2 ASCII code of 5th character ASCII code of 4th character - D2 which decimal
ASCII code of 7th character ASCII code of 6th character point is ignored
+3
Sign
1st character
2nd character
7th character
00H
+4 16-bit binary data 30
Inverter Comms
Ex-Device
FNC270-FNC274
611
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.2 FNC201 VAL / Character String to BIN Conversion
For example, when a character string "-123.45" is specified in S and later, the conversion result is
stored in D1 and D2 as shown below.
b15 b8 b7 b0 D1 +0 7
S +0 31H(1) 2DH(-) +1 2
+1 33H(3) 32H(2)
+2 34H(4) 2EH( ) - 1 2 3 4 5 D2 -12345
+3 00H 35H(5)
It indicates the end of the character string.
3) D1 stores the number of all digits. The number of all digits indicates the number of all characters
(including the number, sign and decimal point).
4) D1 +1 stores the number of digits of the decimal part. The number of digits of the decimal part indicates
the number of all characters after the decimal point "." (2EH).
5) D2 stores 16-bit data (bin) converted from a character string with the decimalpoint ignored.
In the character string located in S and later, "space" (20H) and "0" (30H) characters between the
sign and the first number other than "0" are ignored in the conversion to 16-bit binary data.
Number of all Number of all
digits 8 digits 7
Number of digits 2 Number of digits 4
- 1 2 3 4 5 of decimal part 0 0 0 1 2 of decimal part
16-bit binary -12345 16-bit binary 12
Ignored data Sign Ignored data
612
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.2 FNC201 VAL / Character String to BIN Conversion
21
2. 32-bit operation (DVAL and DVALP)
Control
Real Time Clock
FNC160-FNC169
1) A character string stored in S and later is converted into 32-bit binary data. The number of all digits
of the binary data acquired for conversion is stored in D1 , the number of digits of the decimal part is
stored in D1 +1, and the binary data is stored in [ D2 +1, D2 ].
In conversion from a character string into binary data, the data from S
"00H" is handled as a character string in byte units.
to a device number storing 22
External Device
FNC170-FNC179
Command
input FNC201 S D1 D2
DVAL
Number of all
b15 b8 b7 b0 D1 +0 digits
S +0 ASCII code of 1st character ASCII code indicating sign +1 Number of digits 23
of decimal part
Instructions
Alternate
FNC180
+1 ASCII code of 3rd character ASCII code of 2nd character
D2 +1 D2
+2 ASCII code of 5th character ASCII code of 4th character - Integer value in
which decimal
+3 ASCII code of 7th character ASCII code of 6th character point is ignored
Sign
1st character
2nd character
12th character
+4 ASCII code of 9th character ASCII code of 8th character
+5 ASCII code of 11th character ASCII code of 10th character 32-bit binary
data
24
+6 00H ASCII code of 12th character
Others
FNC181-FNC189
It indicates the end of character string.
For example, when a character string "-12345.678" is specified in S and later, the conversion result
is stored in D1 and D2 as shown below. 25
Operation
Block Data
FNC190-FNC199
b15 b8 b7 b0
31H(1) 2DH(-) D1 +0 10
S +0
+1 3
+1 33H(3) 32H(2)
+2 35H(5) 34H(4)
- 1 2 3 4 5 6 7 8 -12345678
+3 36H(6) 2EH(.)
D2 +1 D2 26
+4 38H(8) 37H(7)
Control
Character String
FNC200-FNC209
+5 00H
Operation 3
Data
FNC210-FNC219
Number of all characters (digits) 2 to 13
Number of characters (digits) of decimal part 0 to 10 and smaller than "number of all digits 3"
2,147,483,648 to +2,147,483,647
Numeric range when decimal point is ignored
Example: 12345.678 "12345678"
D1
(including the number, sign and decimal point).
4) D1 +1 stores the number of digits of the decimal part. The number of digits of the decimal part
indicates the number of all characters after the decimal point "." (2EH).
30
Inverter Comms
Ex-Device
FNC270-FNC274
613
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.2 FNC201 VAL / Character String to BIN Conversion
5) [ D2 +1, D2 ] stores 16-bit data (bin) converted from a character string with the decimal point ignored.
For the character string located in S and later, the "space" (20H) and "0" (30H) characters between
the sign and the first number other than "0" are ignored in the conversion to 32-bit binary data.
Related instructions
Instruction Description
Converts binary floating point data into a character string (ASCII code) with a specified number
ESTR(FNC116)
of digits.
EVAL(FNC117) Converts a character string (ASCII code) into binary floating point data.
STR(FNC200) Converts binary data into a character string (ASCII code).
Caution
Store sign data, "space (20H)" or "- (2DH)", must be stored in the 1st byte (lower order 8 bits of the head
device set in S ).
Only the ASCII code data "0 (30H)" to "9 (39H)", "space (20H)" and "decimal point (2EH)" can be stored from
the 2nd byte to the "00H" at the end of the character string in S .
If "- (2DH)" is stored in the 2nd byte or later, an operation error (error code: K6706) occurs.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the number of characters of the character string to be converted ( S and later) is outside the
following ranges (error code: K6706)
Setting range
16-bit operation 2 to 8
32-bit operation 2 to 13
When the number of characters after the decimal point of the character string to be converted ( S and
later) is outside the following ranges (error code: K6706)
Setting range
16-bit operation 0 to 5
32-bit operation 0 to 10
When the relationship between the number of all characters in the character string to be converted ( S
and later) and the number of characters after the decimal point does not satisfy the following (error code:
K6706)
(Number of all characters -3) Number of characters after the decimal point
When the sign is set to any ASCII code other than "space" (20H) and "-" (2DH) (error code: K6706)
When a digit of a number is set to any ASCII code other than "0" (30H) to "9" (39H) or a decimal point "."
(2EH) (error code: K6706)
When the decimal point "." (2EH) is set two or more times in the character string to be converted ( S
and later) (error code: K6706)
614
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.2 FNC201 VAL / Character String to BIN Conversion
21
When the binary data acquired by conversion is outside the following range (error code: K6706)
Control
Real Time Clock
FNC160-FNC169
Setting range
16-bit operation 32768 to 32767
32-bit operation 2,147,483,648 to 2,147,483,647
When "00H" is not present in the location from S to the final device number (error code: K6706) 22
External Device
FNC170-FNC179
Program example
1) In the program below, the character string data stored in D20 to D22 is regarded as an integer value,
converted into a binary value, and stored in D0 when X000 is set to ON.
X000
FNC201 D20 D10 D0
23
VALP
Instructions
Alternate
FNC180
END
b15 b8 b7 b0
D20 31H(1) 2DH(-) D0 -1654 24
D21 2EH(.) 36H(6)
Others
FNC181-FNC189
D22 34H(4) 35H(5) D10 6 Number of all digits
D23 00H D11 2 Number of digits of decimal part
"00H" is stored here.
2) In the program below, the character string data stored in D20 to D24 is regarded as an integer value,
converted into a binary value, and stored in D0 when X000 is set to ON.
25
Operation
Block Data
FNC190-FNC199
X000
FNC201 D20 D10 D0
DVALP
END
26
b15 b8 b7 b0 D1 D0
Control
Character String
FNC200-FNC209
D20 37H(7) 20H(space) D0 7910 0611
D21 31H(1) 39H(9)
D22 30H(0) 30H(0) D10 10 Number of all digits
D23 36H(6) 2EH(.) D11 3 Number of digits of decimal part
D24
D25
31H(1) 31H(1)
00H
27
Operation 3
Data
FNC210-FNC219
"00H" is stored here.
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
615
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.3 FNC202 $+ / Link Character Strings
Outline
This instruction links a character string to another character string.
For handling of character strings, refer to Section 5.3.
1. Instruction format
FNC 202 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
$+ P $+ Continuous
7 steps Operation
$+P Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number storing the link source data (character string) or directly
S1
specified character string
Head device number storing the link data (character string) or directly specified Character string
S2
character string
D Head device number storing the linked data (character string)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
616
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.3 FNC202 $+ / Link Character Strings
21
Explanation of function and operation
Control
Real Time Clock
FNC160-FNC169
1. 16-bit operation ($+ and $+P)
The character string data stored in S2 and later is linked to the end of the character string data stored in
S1 and later, and the linked data is stored to devices starting from D .
A character string stored in S1 or S2 or later indicates the data from the specified device to the first 22
"00H" in units of byte.
External Device
FNC170-FNC179
Command
input
FNC202 S1 S2 D
$+
23
b15---b8 b7----b0 b15---b8 b7----b0 b15---b8 b7---b0
Instructions
Alternate
FNC180
S1 46H(F) 48H(H) S2 35H(5) 31H(1) D 46H(F) 48H(H) S1
S1 +1 2DH(-) 41H(A) + S2 +1 39H(9) 33H(3) D +1 2DH(-) 41H(A) S1 +1
S1 +2 00H S2 +2 00H 41H(A) D +2 35H(5) 31H(1) S2
D +3 39H(9) 33H(3) S2 +1
24
D +4 00H 41H(A) S2 +2
Others
FNC181-FNC189
00H is automatically
stored.
In linking, 00H indicating the end of a character string specified in S1 is ignored, and a character string
specified in S2 is linked to the last character specified in S1 . 25
When a character string is linked, 00H is automatically added at the end.
Operation
Block Data
FNC190-FNC199
- When the number of characters after linking is odd, 00H is stored in the high-order byte of the device
storing the last character.
- When the number of characters after linking is even, 0000H is stored in the device after the last
character.
26
Cautions
Control
Character String
FNC200-FNC209
When directly specifying a character string, up to 32 characters can be specified (input).
However, this limitation in the number of characters is not applied when a word device is specified in S1
or S2 .
When the values in both S1 and S2 start from "00H" (that is, when the number of characters is 0), 27
"0000H" is stored in D .
Operation 3
Data
FNC210-FNC219
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the number of devices after a device number specified by D is smaller than the number of
28
Comparison
Data
FNC220-FNC249
devices required to store all linked character strings (that is, when 00H cannot be stored after all
character strings and the last character) (error code: K6706)
When the same device is specified in S1 , S2 and D as a device for storing a character string
(error code: K6706)
When 00H is not set within the corresponding device range after the device specified by S1 or S2 29
(error code: K6706)
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
617
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.3 FNC202 $+ / Link Character Strings
Program example
In the program example shown below, a character string stored in D10 to D12 (abcde) is linked to the
character string ABCD, and the result is stored to D100 and later when X000 turns ON.
X000
FNC202 D10 ABCD D100
$+
END
618
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.4 FNC203 LEN / Character String Length Detection
21
26.4 FNC203 LEN / Character String Length Detection
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction detects the number of characters (bytes) of a specified character string.
For handling of character strings, refer to Section 5.3.
22
External Device
FNC170-FNC179
1. Instruction format
FNC 203 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
LEN P LEN Continuous
5 steps
23
Operation
LENP Pulse (Single)
Operation
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
S Head device number storing a character string whose length is to be detected Character string
24
D Device number storing the detected character string length (number of bytes) 16-bit binary
Others
FNC181-FNC189
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
25
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Operation
Block Data
FNC190-FNC199
S 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
1. 16-bit operation (LEN and LENP)
The length of a character string stored in S and later is detected, and stored to D . Data starting from
S until the first device storing "00H" is handled as a character string in units of byte.
Command
input
FNC203 S D
27
LEN
Operation 3
Data
FNC210-FNC219
b15----------b8 b7-------------b0
S 2nd character 1st character
S +1 4th character 3rd character b15---------------b0 28
S +2 6th character 5th character D Character string
Comparison
Data
FNC220-FNC249
length
For example, when ABCDEFGHI is stored in S and later as shown below, K9 is stored to D . 29
Operation
Data Table
FNC250-FNC269
b15----------b8 b7-------------b0
S 42H(B) 41H(A)
S +1 44H(D) 43H(C) ABCDEFGHI b15---------------b0
S +2 46H(F) 45H(E) D 9
S +3 48H(H) 47H(G) 30
Inverter Comms
Ex-Device
FNC270-FNC274
S +4 00H 49H(I)
619
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.4 FNC203 LEN / Character String Length Detection
Caution
This instruction can handle character codes other than ASCII codes, but the character string length is
handled in byte units (8 bits). Accordingly, in the case of character codes in which 2 bytes express 1
character such as shift JIS codes, the length of 1 character is detected as 2.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When 00H is not set within the corresponding device range after a device specified by S (error code:
K6706)
When the detected number of characters is 32768 or more (error code: K6706)
Program example
In the program example shown below, the length of a character string stored in D0 and later is output in 4-digit
BCD to Y040 to Y057 when X000 turns ON.
X000
FNC203 D0 D10
LEN
The length of the character
FNC 18 D10 K4Y40 string is output to the display
BCD unit.
END
b15---b8 b7----b0
D0 49H(I) 4DH(M) Conversion
D1 53H(S) 54H(T) D10 into BCD Y057 to Y040
D2 42H(B) 55H(U) 10 0 0 1 0
D3 53H(S) 49H(I) MITSUBISHI BCD BCD value
(Characters
D4 49H(I) 48H(H)
ABC.......
D5 41H(A) 00H after 00H are
ignored.)
D6 43H(C) 42H(B)
620
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.5 FNC204 RIGHT / Extracting Character String Data from the Right
21
26.5 FNC204 RIGHT / Extracting Character String Data from the Right
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction extracts a specified number of characters from the right end of a specified character string.
For handling of character strings, refer to Section 5.3.
22
External Device
FNC170-FNC179
1. Instruction format
FNC 204 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
RIGHT P 7 steps
RIGHT Continuous
23
Operation
RIGHTP Pulse (Single)
Operation
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
S Head device number storing a character string
Character string 24
D Head device number storing extracted character string
Others
FNC181-FNC189
n Number of characters to be extracted 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
and System User Digit Specification System User
Special
Index
Con- Real Charac-
Pointer
25
Unit stant Number ter String
Operation
Block Data
FNC190-FNC199
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
n 3 3 3 3
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
621
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.5 FNC204 RIGHT / Extracting Character String Data from the Right
b15----------------------b8b7-----------------------b0 b15----------------------b8b7-----------------------b0
ASCII code for 2nd ASCII code for 1st D ASCII code for (last ASCII code for (last
S
character character character -n+2)th character character -n+1)th character
ASCII code for 4th ASCII code for 3rd D +1 ASCII code for (last ASCII code for (last
S +1
character character character -n+4)th character character -n+3)th character
ASCII code for (last ASCII code for (last ASCII code for (last ASCII code for (last
character -n+2)th character character -n+1)th character character -1)th character character -2)th character
In the case of n = 5
b15----------------------b8b7-----------------------b0 b15----------------------b8b7-----------------------b0
S 42H(B) 41H(A) D 32H(2) 31H(1)
S +1 44H(D) 43H(C) D +1 34H(4) 33H(3)
S +2 46H(F) 45H(E) D +2 00H 35H(5)
S +3 32H(2) 31H(1) 12345
S +4 34H(4) 33H(3) ASCII code for 5th character
S +5 00H 35H(5)
ABCDEF12345
ASCII code for 1st character
A character string stored in S and later indicates data stored in devices from the specified device until
"00H" is first detected in byte units.
Cautions
When handling character codes other than ASCII codes, note the following contents:
The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in
which 2 bytes express 1 character such as shift JIS codes, the length of 1 character is detected as 2.
When extracting characters from a character string including character codes in which 2 bytes express 1
character such as shift JIS codes, consider the number of characters to be extracted in units of character
codes for 1 character.
Note that the expected character code is not given if only 1 byte is executed out of a 2-byte character code.
622
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.5 FNC204 RIGHT / Extracting Character String Data from the Right
21
Errors
Control
Real Time Clock
FNC160-FNC169
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When 00H is not set within the corresponding device range after a device specified by S (error code:
K6706)
22
When n exceeds the number of characters specified by S (error code: K6706)
External Device
FNC170-FNC179
When the number of devices after a device number specified by D is smaller than the number of
devices required to store extracted n characters (that is, when 00H cannot be stored after all character
strings and the last character) (error code: K6706)
When n is a negative value (error code: K6706)
23
Instructions
Alternate
FNC180
Program example
In the program example shown below, 4 characters are extracted from the right end of the character string
data stored in R0 and later, and stored to D0 and later when X000 turns ON.
X000
FNC204
RIGHTP
R0 D0 K4 24
Others
FNC181-FNC189
END
b15----------------------b8b7-----------------------b0 b15----------------------b8b7-----------------------b0
41H(A) 42H(B) 45H(E) 30H(0)
R0
R1 31H(1) 32H(2)
D0
D1 41H(A) 46H(F)
25
Operation
Block Data
FNC190-FNC199
R2 45H(E) 30H(0) D2 0000H
R3 41H(A) 46H(F) 0EFA
R4 00H
ASCII code for 4th character
BA210EFA
ASCII code for 1st character 26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
623
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.6 FNC205 LEFT / Extracting Character String Data from the Left
26.6 FNC205 LEFT / Extracting Character String Data from the Left
Outline
This instruction extracts a specified number of characters from the left end of a specified character string.
For handling of character strings, refer to Section 5.3.
1. Instruction format
FNC 205 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
LEFT P LEFT Continuous
7 steps Operation
LEFTP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Head device number storing a character string
Character string
D Head device number storing extracted character string
n Number of characters to be extracted 16-bit binary
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
n 3 3 3 3
624
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.6 FNC205 LEFT / Extracting Character String Data from the Left
21
Explanation of function and operation
Control
Real Time Clock
FNC160-FNC169
1. 16-bit operation (LEFT and LEFTP)
n characters are extracted from the left end (that is, from the head) of the character string data stored in
S and later and stored to D and later.
If the number of characters specified by n is 0, the NULL code (0000H) is stored to D . 22
When characters are extracted from a character string, "00H is automatically added at the end of the
External Device
FNC170-FNC179
extracted characters.
- When the number of extracted characters is odd, 00H is stored in the high-order byte of a device
storing the last character.
- When the number of extracted characters is even, 0000H is stored in the device after the last
character. 23
Command
Instructions
Alternate
FNC180
input
FNC205 S n
D
LEFT
b15----------------------b8b7-----------------------b0 b15----------------------b8b7-----------------------b0
S
ASCII code for 2nd
character
ASCII code for 1st
character
D ASCII code for 2nd
character
ASCII code for 1st
character 24
ASCII code for 4th ASCII code for 3rd D +1 ASCII code for 4th ASCII code for 3rd
Others
FNC181-FNC189
S +1
character character character character
ASCII code for n-1 ASCII code for n-2 ASCII code for n-1 ASCII code for n-2
character character character character
ASCII code for n+1
character
ASCII code for n
character
00H ASCII code for n
character
25
Operation
Block Data
FNC190-FNC199
00H ASCII code for last
character
Control
Character String
FNC200-FNC209
b15----------------------b8b7----------------------b0 b15----------------------b8b7-----------------------b0
S 42H(B) 41H(A) D 42H(B) 41H(A)
S +1 44H(D) 43H(C) D +1 44H(D) 43H(C)
S +2 46H(F) 45H(E) D +2 46H(F) 45H(E)
S +3 32H(2) 31H(1) D +3 00H 31H(1) 27
S +4 34H(4) 33H(3) "ABCDEF1"
Operation 3
Data
FNC210-FNC219
ASCII code for 7th character
S +5 00H 35H(5)
"ABCDEF12345"
A character string stored in S and later indicates data stored in devices from the specified device until
"00H" is first detected in byte units. 28
Comparison
Data
FNC220-FNC249
Cautions
When handling character codes other than ASCII codes, note the following contents:
The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in
which 2 bytes express 1 character such as shift JIS codes, the length of 1 character is detected as 2. 29
When extracting characters from a character string including character codes in which 2 bytes express 1
Operation
Data Table
FNC250-FNC269
character such as shift JIS codes, consider the number of characters to be extracted in units of character
codes for 1 character.
Note that the expected character code is not given if only 1 byte is executed out of a 2-byte character code.
30
Inverter Comms
Ex-Device
FNC270-FNC274
625
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.6 FNC205 LEFT / Extracting Character String Data from the Left
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When 00H is not set within the corresponding device range after a device specified by S (error code:
K6706)
When n exceeds the number of characters specified by S (error code: K6706)
When the number of devices after a device number specified by D is smaller than the number of
devices required to store extracted n characters (that is, when 00H cannot be stored after all character
strings and the last character) (error code: K6706)
When n is a negative value (error code: K6706)
Program example
In the program example shown below, the number of characters which is equivalent to the number stored in
D0 are extracted from the left end of the character string data stored in D100 and later, and stored to R10 and
later when X010 turns ON.
X010
FNC205 D100 R10 D0
LEFTP
END
626
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.7 FNC206 MIDR / Random Selection of Character Strings
21
26.7 FNC206 MIDR / Random Selection of Character Strings
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction extracts a specified number of characters from arbitrary positions of a specified character
string.
22
For handling of character strings, refer to Section 5.3.
External Device
FNC170-FNC179
1. Instruction format
FNC 206 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
MIDR P
7 steps
MIDR Continuous
Operation
23
MIDRP Pulse (Single)
Instructions
Alternate
FNC180
Operation
2. Set data
Operand Type Description Data Type
S1 Head device number storing a character string
24
Character string
Others
FNC181-FNC189
D Head device number storing extracted character string
Head device number specifying the head position and number of characters to be
extracted
S2 16-bit binary
S2 : Head character position
S2 +1 : Number of characters 25
Operation
Block Data
FNC190-FNC199
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 26
S1 3 3 3 3 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
D 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
627
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.7 FNC206 MIDR / Random Selection of Character Strings
A character string stored in S1 and later indicates data stored in devices from the specified device until
00H is first detected in units of byte.
When the number of characters to be extracted specified by S2 +1 is 0, the extraction processing is
not executed.
When the number of characters to be extracted specified by S2 +1 is -1, the entire character string
stored in S1 and later is stored to D and later.
b15-----------------b8 b7-------------------b0 b15-----------------b8b7-------------------b0
S1 42H(B) 41H(A) D 46H(F) 45H(E)
S1 +1 44H(D) 43H(C) D +1 48H(H) 47H(G)
S1 +2 46H(F) 45H(E) D +2 4AH(J) 49H(I)
S1 +3 48H(H) 47H(G) D +3 00H 4BH(K)
S1 +4 4AH(J) 49H(I) FEGHIJK
5th character S2
S1 +5 00H 4BH(K)
ABCDEFGHIJK
S2 5
S2 +1 -1
628
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.7 FNC206 MIDR / Random Selection of Character Strings
21
Cautions
Control
Real Time Clock
FNC160-FNC169
When handling character codes other than ASCII codes, note the following contents:
The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in
which 2 bytes express 1 character such as shift JIS code, the length of 1 character is regarded as 2
characters.
When extracting characters from a character string including character codes in which 2 bytes express 1
22
External Device
FNC170-FNC179
character such as shift JIS codes, consider the number of characters to be extracted in units of character
codes for 1 character.
Note that the expected character code is not given if only 1 byte is executed out of a 2-byte character code.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
23
Instructions
Alternate
FNC180
stored in D8067.
When 00H is not set within the corresponding device range after a device specified by S1 (error code:
K6706)
When the value specified by S2 +1 exceeds the number of characters specified by S1 (error code:
K6706) 24
Others
FNC181-FNC189
When the number of characters specified by S2 +1 from the position specified by D exceeds the
device range specified by D (error code: K6706)
When the number of devices after a device number specified by D is smaller than the number of
devices required to store extracted characters as many as the number specified by S2 +1 (that is, when
00H cannot be stored after all character strings and the last character) (error code: K6706) 25
Operation
Block Data
FNC190-FNC199
When S2 specifies a negative value (error code: K6706)
When S2 +1 specifies -2 or less (error code: K6706)
When S2 +1 specifies a number larger than the number of characters specified by S1
(error code: K6706)
26
Program example
Control
Character String
FNC200-FNC209
In the program example shown below, four characters are extracted from the 3rd character from the left end
of the character string data stored in D10 and later, and then stored to D0 and later when X000 turns ON.
X000
FNC206
MIDRP
D10 D0 R0
27
Operation 3
Data
FNC210-FNC219
END
3rd character
D10
b15---------------------b8 b7-----------------------b0
41H(A) 42H(B) D0
b15----------------------b8b7-----------------------b0
31H(1) 32H(2)
28
Comparison
Data
FNC220-FNC249
R0 3
R1 4
30
Inverter Comms
Ex-Device
FNC270-FNC274
629
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.8 FNC207 MIDW / Random Replacement of Character Strings
Outline
This instruction replaces the characters in arbitrary positions inside designated character string with a
specified character string.
For handling of character strings, refer to Section 5.3.
1. Instruction format
FNC 207 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
MIDW P 7 steps
MIDW Continuous
Operation
MIDWP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S1 Head device number storing a character string used in overwriting
Character string
D Head device number storing character string to be overwritten
Head device number specifying the head position and number of characters to be
overwritten
S2 16-bit binary
S2 : Head character position to be overwritten
S2 +1 : Number of characters to be overwritten
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3
630
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.8 FNC207 MIDW / Random Replacement of Character Strings
21
Explanation of function and operation
Control
Real Time Clock
FNC160-FNC169
1. 16-bit operation (MIDW and MIDWP)
S2 +1 characters are extracted from the left end (that is, the head) of the character string data stored in
S1 and later, and stored to the position specified by S2 and later of the character string data stored in
D and later. 22
External Device
FNC170-FNC179
Command
input
FNC207 S1 D S2
MIDW
Before execution
S1
b15---------------b8b7-----------------b0
31H(1) 30H(0)
1st
character D
b15---------------b8b7-----------------b0
42H(B) 41H(A)
1st
character
23
Instructions
Alternate
FNC180
3rd
S1 +1 33H(3) 32H(2) D +1 44H(D) 43H(C) character
S1 +2 35H(5) 34H(4) D +2 46H(F) 45H(E)
S1 +3 37H(7) 36H(6) D +3 48H(H) 47H(G)
S1 +4 00H 38H(8) D +4 00H 49H(I)
6th character
012345678 ABCDEFGHI 24
After execution
Others
FNC181-FNC189
Position from the left end in the
S2 3 character string stored in D and later b15---------------b8b7-----------------b0
S2 +1 6 Number of characters from the left end D 42H(B) 41H(A)
in the character string stored in S1
3rd
and later D +1 31H(1) 30H(0) character
D +2 33H(3) 32H(2)
D +3 35H(5) 34H(4)
25
Operation
Block Data
FNC190-FNC199
D +4 00H 49H(I)
AB012345I
Six characters starting from 3rd
character (overwritten character string)
The character string stored in S1 and later or D and later indicates data stored in devices from the 26
specified device until 00H is first detected in byte units.
Control
Character String
FNC200-FNC209
When the number of characters to be overwritten specified by S2 +1 is 0, the overwriting processing is
not executed.
When the number of characters to be overwritten specified by S2 +1 exceeds the last character of the
character string stored in D and later, data is stored up to the last character. 27
Before execution
Operation 3
Data
FNC210-FNC219
b15---------------b8b7-----------------b0 b15---------------b8b7-----------------b0
S1 31H(1) 30H(0) 1st D 42H(B) 41H(A)
character
S1 +1 33H(3) 32H(2) D +1 44H(D) 43H(C)
5th
S1 +2
S1 +3
35H(5)
37H(7)
34H(4)
36H(6)
D +2
D +3
46H(F)
48H(H)
45H(E)
47H(G)
character
28
Comparison
Data
FNC220-FNC249
5th
D +2 31H(1) 30H(0) character
D +3 33H(3) 32H(2)
D +4 00H 34H(4)
ABCD01234
Characters from the 5th character to the last 30
character are overwritten. Excessive
Inverter Comms
Ex-Device
FNC270-FNC274
631
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.8 FNC207 MIDW / Random Replacement of Character Strings
When S2 +1 (the number of characters to be extracted) is -1, the entire character string stored in
S1 and later is stored to D and later.
2nd
character Before execution
b15---------------b8b7-----------------b0
1st
b15---------------b8b7-----------------b0 42H(B) 41H(A) character
S1 1st
31H(1) 30H(0) character D +1 44H(D) 43H(C)
S1 +1 33H(3) 32H(2) D +2 46H(F) 45H(E)
S1 +2 35H(5) 34H(4) D +3 48H(H) 47H(G)
S1 +3 00H D +4 4AH(J) 49H(I)
012345 D +5
Last character 00H 4BH(K)
Position from the left end in the ABCDEFGHIJK
S2 2 character string stored in D and later 2nd
Number of characters from the left end character After execution
S2 +1 -1
in the character string stored in S1 b15---------------b8b7-----------------b0
and later
30H(0) 41H(A)
D +1 32H(2) 31H(1)
D +2 34H(4) 33H(3)
D +3 48H(H) 35H(5)
D +4 4AH(J) 49H(I)
D +5 00H 4BH(K)
A012345HIJK
Six characters from the 2nd
character are overwritten.
Cautions
This instruction can handle character codes other than ASCII codes, but please note the following:
The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in
which 2 bytes express 1 character such as shift JIS code, the length of 1 character is regarded as 2
characters.
When overwriting a character string including character codes in which 2 bytes express 1 character such
as shift JIS codes, consider the number of characters to be extracted in units of character codes for 1
character.
Note that the expected character code is not given if only 1 byte is overwritten out of a 2-byte character
code.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When 00H is not set within the corresponding device range after a device specified by S1 or D
(error code: K6706)
When the value specified by S2 exceeds the number of characters of the character string stored in
D and later (error code: K6706)
When the number of characters specified by S2 +1 exceeds the number of characters specified by
S1 (error code: K6706)
632
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.8 FNC207 MIDW / Random Replacement of Character Strings
21
Program example
Control
Real Time Clock
FNC160-FNC169
In the program example shown below, 4 characters are extracted from the character string data stored in D0
and later, and stored to the 3rd character (from the left end) and later for the character string data stored in
D100 and later when X010 turns ON.
X010
FNC207 D0 D100 R0 22
MIDWP
External Device
FNC170-FNC179
END
4th
character Before execution
b15---------------b8b7-----------------b0 b15---------------b8b7-----------------b0
1st
23
D0 31H(1) 32H(2) 1st D100 53H(S) 55H(U)
Instructions
Alternate
FNC180
character
character
3rd
D1 45H(E) 46H(F) D101 59H(Y) 43H(C) character
D2 33H(3) 30H(0) D102 31H(1) 5AH(Z)
D3 00H D103 42H(B) 30H(0)
21FE03 D104 0000H
USCYZ10B
24
R0 3
Others
FNC181-FNC189
R1 4
After execution
b15---------------b8b7-----------------b0
D100 53H(S) 55H(U)
D101 31H(1) 32H(2)
3rd
character
25
Operation
Block Data
FNC190-FNC199
D102 45H(E) 46H(F)
D103 42H(B) 30H(0)
D104 0000H
US21FE0B
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
633
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.9 FNC208 INSTR / Character string search
Outline
This instruction searches a specified character string within another character string.
1. Instruction format
FNC 208 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
INSTR P 9 steps
INSTR Continuous
Operation
INSTRP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S1 Head device number storing a character string Character string
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3
S2 3 3 3 3 3
D 3 3 3 3 3
n 3 3 3 3
634
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.9 FNC208 INSTR / Character string search
21
4) A character string can be directly specified in the character string S1 .
Control
Real Time Clock
FNC160-FNC169
Character string to be searched S2 Character string S1
b15 b8 b7 b0 "AB"
S2 +0 32H(2) 31H(1) Search is started from
+1 34H(4) 33H(3)
+2 42H(B) 41H(A)
the 3rd character (n = 3).
Fifth character from D100 5
22
+3 36H(6) 35H(5) the head character
External Device
FNC170-FNC179
+4 42H(B) 41H(A)
+5 00H
"1234AB56AB"
23
Errors
Instructions
Alternate
FNC180
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the search start position "n" exceeds the number of characters stored in S2 (error code: K6706)
When "00H (NULL)" is not located within the corresponding device range starting from S1
(error code: K6706)
24
Others
FNC181-FNC189
When "00H (NULL)" is not located within the corresponding device range starting from S2
(error code: K6706)
Program example
1) In the program example below, the character string "CI23" (D0 and later) is searched from the 5th
25
Operation
Block Data
FNC190-FNC199
character from the left end (head character) of the character string "CI2312CIM" (R0 and later) when
X000 is set to ON. The search result is stored in D100
X000
FNC208 D0 R0 D100 K5
INSTR
26
END
Control
Character String
FNC200-FNC209
Character string to be searched R0 Character string D0
b15 b8 b7 b0 b15 b8 b7 b0
R0 These characters are not D0
49H(I) 43H(C) searched because the 49H(I) 43H(C)
R1
R2
33H(3)
32H(2)
32H(2)
31H(1)
search start position is "5".
The search source
D1
D2
33H(3) 32H(2)
00H
27
Operation 3
Data
FNC210-FNC219
R3 49H(I) 43H(C) character string is searched
from the 5th character. "CI23"
R4 00H 4DH(M)
"CI2312CIM"
D100 0
Because the searched
character string is not
28
detected, "0" is stored.
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
635
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.10 FNC209 $MOV / Character String Transfer
Outline
This instruction transfers character string data.
For handling of character strings, refer to Section 5.3.
1. Instruction format
FNC 209 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
$MOV P 5 steps
$MOV Continuous
Operation
$MOVP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Directly specified character string (up to 32 characters) or head device number
S
storing character string which is handled as the transfer source Character string
D Head device number storing transferred character string
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
b15 b8 b7 b0 b15 b8 b7 b0
S 2nd character 1st character D 2nd character 1st character
636
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.10 FNC209 $MOV / Character String Transfer
21
Even if the device range S to S +n storing the transfer source character string data overlaps the
Control
Real Time Clock
FNC160-FNC169
device range D to D +n/2 storing the transferred character string data, transfer is executed.
For example, when a character string stored in D10 to D13 is transferred to D11 to D14, the transfer is
executed as shown below:
Command
input
FNC209
22
D10 D11
External Device
FNC170-FNC179
$MOV
b15 b8 b7 b0 b15 b8 b7 b0
... It is same as the
D10 32H(2) 31H(1) D10 32H(2) 31H(1)
character string 23
D11 34H(4) 33H(3) D11 32H(2) 31H(1) before transfer.
Instructions
Alternate
FNC180
D12 36H(6) 35H(5) D12 34H(4) 33H(3)
Others
FNC181-FNC189
Caution
When 00H is stored in the low-order byte of S +n, 00H is stored to both the high-order byte and low-
order byte of D +n.
Command
input
25
FNC209
Operation
Block Data
FNC190-FNC199
S D
$MOV
b15 b8 b7 b0 b15 b8 b7 b0
S 42H(B) 41H(A) D 42H(B) 41H(A)
26
S +1 44H(D) 43H(C) D +1 44H(D) 43H(C)
Control
Character String
FNC200-FNC209
S +2 45H(E) 00H D +2 00H 00H
Operation 3
Data
FNC210-FNC219
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When 00H does not exist in the range specified from device (error code: K6706)
S
28
When the specified character string cannot be stored in devices from the device specified by D to the
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
637
FX3U/FX3UC Series Programmable Controllers 26 Character String Control FNC200 to FNC209
Programming Manual - Basic & Applied Instruction Edition 26.10 FNC209 $MOV / Character String Transfer
Program example
In the program example shown below, character string data stored in D10 to D12 is transferred to D20
through D22.
X000
FNC209 D10 D20
$MOV
END
b15 b8 b7 b0 b15 b8 b7 b0
D10 4DH(M) 2AH(*) D20 4DH(M) 2AH(*)
638
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition
21
Control
Real Time Clock
FNC160-FNC169
27. Data Operation 3 FNC210 to FNC219
FNC210 to FNC219 provide instructions for reading last-in data and controlling leftward/rightward shift 22
instructions with carry.
External Device
FNC170-FNC179
FNC No. Mnemonic Symbol Function Reference
Section
210 FDEL FDEL S D n Deleting Data from Tables
27.1
Section
23
211 FINS FINS S D n Inserting Data to Tables
Instructions
Alternate
FNC180
27.2
Section
212 POP POP S D n Shift Last Data Read [FILO Control]
27.3
Others
FNC181-FNC189
16-bit data n Section
214 SFL SFL D n Bit Shift Left with Carry 27.5
215
25
Operation
Block Data
FNC190-FNC199
216
217
218 26
Control
Character String
FNC200-FNC209
219
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
639
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.1 FNC210 FDEL / Deleting Data from Tables
Outline
This instruction deletes an arbitrary data from a data table.
1. Instruction format
FNC 210 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FDEL P 7 steps
FDEL Continuous
Operation
FDELP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Device number storing deleted data
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3 3
n 3 3 3 3
...
...
...
0
Deleted data
S 3333
Caution
The device range used in a data table should be controlled by the user.
The data table has D data starting from the next device ( D +1) after D indicating the number of
stored data.
Refer to the program example.
640
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.1 FNC210 FDEL / Deleting Data from Tables
21
Related instruction
Control
Real Time Clock
FNC160-FNC169
Instruction Description
FINS(FNC211) Inserts data into an arbitrary position in a data table.
Errors 22
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
External Device
FNC170-FNC179
stored in D8067.
When the table position "n" of the data to be deleted exceeds the amount of data stored (error code:
K6706)
When the value "n" exceeds the device range of the data table D (error code: K6706)
When the FNC210 instruction is executed under the condition "n 0" (error code: K6706)
23
Instructions
Alternate
FNC180
When the amount of data stored specified in D is "0" (error code: K6706)
When the data table range exceeds the corresponding device range (error code: K6706)
Program example
In the program shown below, the 2nd data entry is deleted from the data table stored in D100 to D105, and
24
Others
FNC181-FNC189
the deleted data is stored in D0.
When the amount of data stored is "0", however, the FDEL (FNC210) instruction is not executed. (The device
range used in the data table is D100 to D107).
X010
FNC234 FNC237 FNC210
AND<
K0 D100
AND<=
D100 K7
FDELP
D0 D100 K2
25
Operation
Block Data
FNC190-FNC199
END
X010:ON
Amount of
D100
Data table
5
-1
D100
Data table
4
Amount of 26
data stored data stored
Control
Character String
FNC200-FNC209
D101 -123 D101 -123
Data D102 4444 D102 3210 Data table
Device range used in table D103 3210 D103 1234 range
data table range D104 1234 D104 5432
D105 5432 D105 0
D106 0 D106 0 27
D107 0 D107 0
Operation 3
Data
FNC210-FNC219
D0 4444 Deleted data
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
641
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.2 FNC211 FINS / Inserting Data to Tables
Outline
This instruction inserts data into an arbitrary position in a data table.
1. Instruction format
FNC 211 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FINS P 7 steps
FINS Continuous
Operation
FINSP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Device number storing inserted data
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3
D 3 3 3 3 3
n 3 3 3 3
...
...
...
0 0
When "n" is "2"
S 4444
Caution
The device range used in a data table should be controlled by the user.
The data table has D data starting from the next device ( D +1) after D indicating the number of
stored data.
Refer to the program example.
642
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.2 FNC211 FINS / Inserting Data to Tables
21
Related instruction
Control
Real Time Clock
FNC160-FNC169
Instruction Description
FDEL(FNC210) Deletes an arbitrary data entry from a data table.
Errors 22
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
External Device
FNC170-FNC179
stored in D8067.
When the table position "n" for data insertion exceeds the amount of stored data plus 1(error code: K6706)
When the value "n" exceeds the device range of the data table D (error code: K6706)
When FNC211 instruction is executed under the condition "n 0" (error code: K6706) 23
When the data table range exceeds the corresponding device range (error code: K6706)
Instructions
Alternate
FNC180
Program example
In the program shown below, data stored in D100 is inserted into the 3rd position of the data table stored in
D0 to D4.
When the amount of data stored exceeds "7", however, the FINS (FNC211) instruction is not executed. (The 24
device range used in the data table is D0 to D7).
Others
FNC181-FNC189
X010
FNC237 K0 D0 FNC234 D0 K7 FNC211 D100 D0 K3
AND<= AND< FINSP
END
25
Operation
Block Data
FNC190-FNC199
X010:ON
Control
Character String
FNC200-FNC209
range range
data table D4 5000 D4 -123
D5 0 D5 5000
D6 0 D6 0
D7 0 D7 0
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
643
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.3 FNC212 POP / Shift Last Data Read [FILO Control]
Outline
This instruction reads the last data written by shift write (SFWR) instruction for FILO control.
For SFWR (FNC 38) instruction, refer to Section 11.9.
1. Instruction format
FNC 212 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
POP P 7 steps
POP Continuous
Operation
POPP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Head device number storing first-in data (including pointer data)
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
n 3 3
S +1
S +2
S +3
Data area
...
Every time the instruction is executed for the word devices S to S +n-1, a device S + Pointer
data S is read to D . (The last data entry written by the shift write (SFWR) instruction for first-in
first-out control is read to D .) Specify n in the range from 2 to 512.
644
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.3 FNC212 POP / Shift Last Data Read [FILO Control]
21
Subtract 1 from the value of the pointer data S .
Control
Real Time Clock
FNC160-FNC169
Data area
Pointer
S +n-1 S +n-2 S +6 S +5 S +4 S +3 S +2 S +1 S
In the case of K4 22
External Device
FNC170-FNC179
No data area
Pointer
S +n-1 S +n-2 S +6 S +5 S +4 S +3 S +2 S +1 S D
K4K3
23
Instructions
Alternate
FNC180
Related device
For the zero flag use method, refer to Subsection 6.5.2.
Device Name Description
M8020 Zero flag Turns ON when the instruction is executed while the pointer S is 0. 24
Others
FNC181-FNC189
Related instructions
Instruction Description
SFWR(FNC 38) Shift write [for FIFO/FILO control]
SFRD(FNC 39) Shift read [for FIFO control]
25
Operation
Block Data
FNC190-FNC199
Cautions
When this instruction is programmed in the continuous operation type, the instruction is executed in every
operation cycle. As a result, an expected operation may not be achieved.
Usually, program this instruction in the pulse operation type, or let this instruction be executed by a
pulsed command contact. 26
Control
Character String
FNC200-FNC209
When the current value of the pointer S is 0, the zero flag M8020 turns ON and the instruction is not
executed.
Check in advance using a comparison instruction whether the current value of S satisfies 1 S
n-1, and then execute this instruction.
When the current value of the pointer
ON.
S is 1, 0 is written to S and the zero flag M8020 turns 27
Operation 3
Data
FNC210-FNC219
Error
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When S is larger than n-1 (error code: K6706) 28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
645
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.3 FNC212 POP / Shift Last Data Read [FILO Control]
Program example
Among values stored in D20 input first to D101 to D106, the last value input is stored to D10, and 1 is
subtracted from the number of stored data (pointer D100) every time X000 turns ON.
First-in command
FNC 38 D20 D100 K7
SFWR
Last-in read command
X000 FNC212 D100 D10 K7
POP
END
D20
D100: D100: D100:
First-in command K2K3 K1K2 K0K1
Do not change
646
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.4 FNC213 SFR / Bit Shift Right with Carry
21
27.4 FNC213 SFR / Bit Shift Right with Carry
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction shifts 16 bits stored in a word device rightward by n bits.
22
1. Instruction format
External Device
FNC170-FNC179
FNC 213 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
SFR P 5 steps
SFR Continuous
Operation
SFRP Pulse (Single)
Operation
23
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
D Device number storing data to be shifted
16-bit binary
n Number of times of shift (0 n 15) 24
Others
FNC181-FNC189
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 25
D 3 3 3 3 3 3 3 3 3 3 3
Operation
Block Data
FNC190-FNC199
n 3 3 3 3 3 3 3 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
Command
input
FNC213 D n
SFRP
Operation 3
Data
FNC210-FNC219
If 16 or larger value is specified as n, 16 bits are shifted rightward by the remainder of n/16.
For example, when n is set to 18, 16 bits are shifted rightward by 2 bits (18/16 = 1 ... 2).
2) The ON (1)/OFF (0) status of the nth bit (bit n-1) in the word device D is transferred to the carry
flag M8022.
3) 0 is set to n bits from the most significant bit. 28
Comparison
Data
FNC220-FNC249
D 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 1 1
Become 0.
30
Inverter Comms
Ex-Device
FNC270-FNC274
647
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.4 FNC213 SFR / Bit Shift Right with Carry
M11 M8 M7 M4 M3 M0
1 0 1 0 1 0 1 0 1 0 1 0
Carry flag
M11 M8 M7 M4 M3 M0 M8022
0 0 0 0 1 0 1 0 1 0 1 0 1
Become 0.
Related device
For the carry flag use method, refer to Subsection 6.5.2.
Device Name Description
M8022 Carry flag Shifts the ON/OFF status of bit n-1.
Error
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When a negative value is set to n (error code: K6706)
Program example
In the program example shown below, the contents of Y010 to Y023 are shifted rightward by the number of
bits specified by D0 when X020 turns ON.
X020
FNC213 K3Y010 D0
SFRP
END
D0 4
Carry flag
Y23 Y20 Y17 Y14 Y13 Y10 M8022
0 0 0 0 1 0 1 0 1 0 1 0 1
Become 0.
648
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.5 FNC214 SFL / Bit Shift Left with Carry
21
27.5 FNC214 SFL / Bit Shift Left with Carry
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction shifts 16 bits stored in a word device leftward by n bits.
22
1. Instruction format
External Device
FNC170-FNC179
FNC 214 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
SFL P 5 steps
SFL Continuous
Operation
SFLP Pulse (Single)
Operation
23
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
D Device number storing data to be shifted
16-bit binary
n Number of times of shift (0 n 15) 24
Others
FNC181-FNC189
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 25
D 3 3 3 3 3 3 3 3 3 3 3
Operation
Block Data
FNC190-FNC199
n 3 3 3 3 3 3 3 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
Command
input
FNC214 D n
SFLP
Operation 3
Data
FNC210-FNC219
For example, when n is set to 18, 16 bits are shifted leftward by 2 bits (18/16 = 1 ... 2).
2) The ON (1)/OFF (0) status of the n+1th bit (bit n) in the word device D is transferred to the carry
flag M8022.
3) 0 is set to n bits from the least significant bit. 28
Comparison
Data
FNC220-FNC249
1 D 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0
Become 0.
30
Inverter Comms
Ex-Device
FNC270-FNC274
649
FX3U/FX3UC Series Programmable Controllers 27 Data Operation 3 FNC210 to FNC219
Programming Manual - Basic & Applied Instruction Edition 27.5 FNC214 SFL / Bit Shift Left with Carry
Carry flag
M8022 M17 M14M13 M12 M10
1 1 0 0 1 1 0 0 0
Become 0.
Related device
For the carry flag use method, refer to Subsection 6.5.2.
Device Name Description
M8022 Carry flag Shifts the ON/OFF status of bit n.
Error
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When a negative value is set to n (error code: K6706)
Program example
In the program example shown below, the contents of Y010 to Y017 are shifted leftward by the number of bits
specified by D0 when X020 turns ON.
X020
FNC214 K2Y10 D0
SFLP
END
3 D0
Carry flag
M8022 Y17 Y14 Y13 Y12 Y10
1 1 0 0 1 1 0 0 0
Become 0.
650
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition
21
Control
Real Time Clock
FNC160-FNC169
28. Data Comparison FNC220 to FNC249
FNC220 to FNC249 provide data comparison instructions which can be handled as contact symbols in 22
programming such as LD, AND and OR.
External Device
FNC170-FNC179
FNC No. Mnemonic Symbol Function Reference
220
23
221
Instructions
Alternate
FNC180
222
223 24
Others
FNC181-FNC189
Section
224 LD= LD= S1 S2 Load Compare S1 = S2
28.1
Section
225 LD> LD> S1 S2 Load Compare S1 > S2
28.1
25
Section
Operation
Block Data
FNC190-FNC199
226 LD< LD< S1 S2 Load Compare S1 < S2
28.1
227
Control
Character String
FNC200-FNC209
Section
229 LD<= LD<= S1 S2 Load Compare S1 <= S2
28.1
Section
230 LD>= LD>= S1 S2 Load Compare S1 >= S2
28.1
27
Operation 3
Data
FNC210-FNC219
231
Section
232 AND= AND= S1 S2 AND Compare S1 = S2
28.2
Section
234 AND< AND< S1 S2 AND Compare S1 < S2
28.2
235
29
Operation
Data Table
FNC250-FNC269
Section
236 AND<> AND<> S1 S2 AND Compare S1 S2
28.2
Section
237 AND<= AND<= S1 S2 AND Compare S1 <= S2
28.2
Section 30
238 AND>= AND>= S1 S2 AND Compare S1 >= S2
28.2
Inverter Comms
Ex-Device
FNC270-FNC274
651
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition
239
Section
240 OR= OR Compare S1 = S2
28.3
OR= S1 S2
Section
241 OR> OR Compare S1 > S2
28.3
OR> S1 S2
Section
242 OR< OR Compare S1 < S2
OR< S1 S2 28.3
243
Section
244 OR<> OR Compare S1 S2
28.3
OR<> S1 S2
Section
245 OR<= OR Compare S1 <= S2
OR<= S1 S2 28.3
Section
246 OR>= OR Compare S1 >= S2
OR>= S1 S2 28.3
247
248
249
652
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.1 FNC224~230 LD =, >, <, <>, <=, >= / Data Comparison
21
28.1 FNC224~230 LD =, >, <, <>, <=, >= / Data Comparison
Control
Real Time Clock
FNC160-FNC169
Outline
These instructions compare numeric values, and set a contact to ON when the condition agrees so that an
operation is started.
22
External Device
FNC170-FNC179
1. Instruction format
FNC 224 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
23
Operation Operation
Instructions
Alternate
FNC180
FNC 225 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
24
Others
FNC181-FNC189
FNC 226 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FNC 228 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition 25
D LD<>
Operation
Block Data
FNC190-FNC199
Continuous Continuous
5 steps LD<> Operation 9 steps LDD<> Operation
FNC 229 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Control
Character String
FNC200-FNC209
FNC 230 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
27
Operation Operation
Operation 3
Data
FNC210-FNC219
2. Set data (common among FNC224 to FNC230)
Operand Type Description Data Type
S1 Device number storing comparison data 16- or 32-bit binary
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
30
Inverter Comms
Ex-Device
FNC270-FNC274
653
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.1 FNC224~230 LD =, >, <, <>, <=, >= / Data Comparison
Cautions
1. Negative value
When the most significant bit is "1" in the data stored in S1 or S2 , it is regarded as a negative value in
comparison.
In the 16-bit operation: bit 15
In the 32-bit operation: bit 31
Operating procedure
a) Display the circuit program edit window, and put the cursor in a position where a data comparison
instruction is to be used.
b) Input "Instruction" "space" "value or device" "space" "value or device".
For an input example, refer to "Instruction input window in GX Developer" shown below.
c) Click the [OK] button.
d) Input other contacts and coil drive units consecutively.
654
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.1 FNC224~230 LD =, >, <, <>, <=, >= / Data Comparison
21
Program example
Control
Real Time Clock
FNC160-FNC169
S1 S2
FNC224 When the current value of the counter C10 is "200", Y010
K200 C10 Y10
LD= is driven.
FNC225
X001
When the contents of D200 are "-29" or more and X001 is
22
D200 K-30 SET Y11
External Device
FNC170-FNC179
LD> ON, Y011 is set.
FNC225 When the contents of the counter C200 are less than
K678493 C200 M50
LDD> "K678,493" or when M3 turns ON, M50 is driven.
M3 23
Instructions
Alternate
FNC180
24
Others
FNC181-FNC189
25
Operation
Block Data
FNC190-FNC199
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
655
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.2 FNC232~238 AND=, >, <, < >, <=, >= / Data Comparison
28.2 FNC232~238 AND=, >, <, < >, <=, >= / Data Comparison
Outline
These instructions compare numeric values, and set a contact to ON when the condition agrees.
1. Instruction format
FNC 232 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FNC 233 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FNC 234 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FNC 236 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FNC 237 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FNC 238 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
S1 3 3 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
656
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.2 FNC232~238 AND=, >, <, < >, <=, >= / Data Comparison
21
Explanation of function and operation
Control
Real Time Clock
FNC160-FNC169
FNC232 to FNC237 are data comparison instructions connected to other contacts in series.
The contents of S1 are compared with the contents of S2 in binary format, and a contact becomes
conductive (ON) or non-conductive (OFF) depending on the comparison result.
External Device
FNC170-FNC179
232 AND= ANDD= S1 = S2 S1 S2
233 AND> ANDD> S1 > S2 S1 <= S2
234 AND< ANDD< S1 < S2 S1 >= S2
236 AND<> ANDD<> S1 S2 S1 = S2
23
237 AND<= ANDD<= S1 <= S2 S1 < S2
Instructions
Alternate
FNC180
238 AND>= ANDD>= S1 >= S2 S1 > S2
Cautions
1. Negative value 24
Others
FNC181-FNC189
When the most significant bit is "1" in the data stored in S1 or S2 , it is regarded as a negative value in
comparison.
In the 16-bit operation: bit 15
In the 32-bit operation: bit 31
Operation
Block Data
FNC190-FNC199
Make sure to execute the 32-bit operation (such as "ANDD=", "ANDD>" and "ANDD<") when comparing 32-
bit counters (C200 to C255).
If a 32-bit counter is specified in the 16-bit operation (such as "AND=", "AND>" and "AND<"), a program error
or operation error will occur.
Control
Character String
FNC200-FNC209
Separate "" into "<" and "=", and separate "" into ">" and "=".
The input procedure is described below:
Operating procedure
a) Display the circuit program edit window, and put the cursor in a position where a data comparison
instruction is to be used.
27
Operation 3
Data
FNC210-FNC219
b) Input "Instruction" "space" "value or device" "space" "value or device".
For an input example, refer to "Instruction input window in GX Developer" shown below.
c) Click the [OK] button.
d) Input other contacts and coil drive units consecutively.
29
<Input example for 32-bit operation>
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
657
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.2 FNC232~238 AND=, >, <, < >, <=, >= / Data Comparison
Program example
S1 S2
X000
FNC232 When X000 is ON and the current value of the counter
K200 C10 Y10
AND= C10 is "200" Y010 is driven.
X001 When X001 is OFF and the contents of the data register
FNC236 K-10 D0 Y11
SET D0 are not "-10", Y011 is set.
AND<>
X002 When X002 is ON, when the contents of the data registers
FNC233 K678493 D10 M50 D11 and D10 are less than "K678,493", or when M3 turns
ANDD> ON, M50 is driven.
M3
658
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.3 FNC240~246 OR=, >, <, < >, <=, >= / Data Comparison
21
28.3 FNC240~246 OR=, >, <, < >, <=, >= / Data Comparison
Control
Real Time Clock
FNC160-FNC169
Outline
These instructions compare numeric values, and set a contact to ON when the condition agrees.
22
1. Instruction format
External Device
FNC170-FNC179
FNC 240 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
23
Instructions
Alternate
FNC180
FNC 241 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
FNC 242 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition 24
D OR<
Others
FNC181-FNC189
Continuous Continuous
5 steps OR< Operation 9 steps ORD< Operation
FNC 244 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Operation
Block Data
FNC190-FNC199
FNC 245 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Control
Character String
FNC200-FNC209
FNC 246 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
27
Operation 3
Data
FNC210-FNC219
2. Set data (common among FNC240 to FNC246)
Operand Type Description Data Type
S1 Device number storing comparison data 16- or 32-bit binary
S2 3 3 3 3 3 3 3 3 3 3 3 3 3 3
30
Inverter Comms
Ex-Device
FNC270-FNC274
659
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.3 FNC240~246 OR=, >, <, < >, <=, >= / Data Comparison
Cautions
1. Negative value
When the most significant bit is "1" in the data stored in S1 or S2 , it is regarded as a negative value in
comparison.
In the 16-bit operation: bit 15
In the 32-bit operation: bit 31
Operating procedure
a) Display the circuit program edit window, and put the cursor in a position where a data comparison
instruction is to be used.
b) Input "Instruction" "space" "value or device" "space" "value or device".
For an input example, refer to "Instruction input window in GX Developer" shown below.
c) Click the [OK] button.
d) Input other contacts and coil drive units consecutively.
660
FX3U/FX3UC Series Programmable Controllers 28 Data Comparison FNC220 to FNC249
Programming Manual - Basic & Applied Instruction Edition 28.3 FNC240~246 OR=, >, <, < >, <=, >= / Data Comparison
21
Program example
Control
Real Time Clock
FNC160-FNC169
X001
When X001 turns ON or when the current value of the
Y000
counter C10 is "200", Y000 is driven.
S1 S2
FNC240
OR=
K200 C10 22
External Device
FNC170-FNC179
X002 M30 When X002 and M30 turn ON or when the contents of the
M60 data registers D101 and D100 are more than "K100,000"
M60 is driven.
FNC246
ORD>=
D100 K100000 23
Instructions
Alternate
FNC180
24
Others
FNC181-FNC189
25
Operation
Block Data
FNC190-FNC199
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
661
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition
250
251
252
253
254
255
Section
256 LIMIT LIMIT S1 S2 S3 D Limit Control
29.1
Section
257 BAND BAND S1 S2 S3 D Dead Band Control
29.2
Section
258 ZONE ZONE S1 S2 S3 D Zone Control
29.3
Section
259 SCL SCL S1 S2 D Scaling (Coordinate by Point Data)
29.4
Section
260 DABIN DABIN S D Decimal ASCII to BIN Conversion
29.5
Section
261 BINDA BINDA S D BIN to Decimal ASCII Conversion
29.6
262
263
264
265
266
267
268
Section
269 SCL2 SCL2 S1 S2 D Scaling 2 (Coordinate by X/Y Data)
29.7
662
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.1 FNC256 LIMIT / Limit Control
21
29.1 FNC256 LIMIT / Limit Control
External Device
FNC179
FNC170-
1. Instruction format
FNC 256 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
S1 Lower limit value (minimum output value)
24
S2 Upper limit value (maximum output value)
Others
FNC189
FNC181-
16- or 32-bit binary
S3 Input value controlled by the upper and lower limit values
Head device number storing the output value controlled by the upper and lower
D
limit values
3. Applicable devices 25
Bit Devices Word Devices Others
Block Data
FNC199
FNC190-
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
3 3 3 3 3 3 3 3 3 3 3 3
S1
3 3 3 3 3 3 3 3 3 3 3 3
26
S2
Character String
FNC209
FNC200-
S3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
27
Data
FNC219
FNC210-
28
Data
FNC249
FNC220-
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
663
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.1 FNC256 LIMIT / Limit Control
Command
input
FNC256 S1 S2 S3 D
LIMIT
In the case of S1 Lower limit value > S3 Input value .... S1 Lower limit value D Output value
In the case of S2 Upper limit value < S3 Input value .... S2 Upper limit value D Output value
In the case of S1 Lower limit value S3 Input value S2 Upper limit value .... S3 Input value D Output value
Output Output ( D )
value value S2 Specified
Input Input ( S3 )
value value
S1 Specified
When controlling the output value using only the upper limit value, set -32768 to the lower limit value
specified in S1 .
When controlling the output value using only the lower limit value, set 32767 to the upper limit value
specified in S2 .
664
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.1 FNC256 LIMIT / Limit Control
21
2. 32-bit operation (DLIMIT and DLIMITP)
External Device
FNC179
FNC170-
S1 +1, S1 S3 +1, S3 S1 +1, S1 D +1, D
In the case of Lower limit value > Input value .................................... Lower limit value Output value
Instructions
Alternate
FNC180
S1 +1, S1 S3 +1, S3 S2 +1, S2 S3 +1, S3 D +1, D
In the case of Lower limit value Input value Upper limit value .... Input value Output value
Output
value
Output
value
( D +1, D ) 24
Others
FNC189
FNC181-
S2 +1, S2
Specified
Input
Input value
value
( S3 +1, S3 )
S1 +1, S1 25
Block Data
FNC199
FNC190-
Specified
When controlling the output value using only the upper limit value, set -2,147,483,648 to the lower limit
value specified in [ S1 +1, S1 ].
When controlling the output value using only the lower limit value, set 2,147,483,647 to the upper limit
value specified in [ S2 +1, S2 ].
26
Character String
FNC209
FNC200-
Error
An operation error is caused when the instruction is executed in the setting status shown below; The error flag
M8067 turns ON, and the error code (K6706) is stored in D8067.
Relationship 27
16-bit operation
Data
FNC219
FNC210-
S1 S2
32-bit operation [ S1 +1, S1 ] [ S2 +1, S2 ]
28
Data
FNC249
FNC220-
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
665
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.1 FNC256 LIMIT / Limit Control
Program examples
1. Program example 1
In the program example shown below, the BCD data set in X020 to X037 is controlled by the limit values 500
to 5000, and the controlled value is output to D1 when X000 turns ON.
X000
FNC 19 K4X020 D0
BIN
END
Operation
In the case of D0 < 500, 500 is output to D1. Output (D1)
In the case of 500 D0 5000, the value of D0 is output to
D1. 5000
In the case of D0 > 5000, 5000 is output to D1. 500
Input (D0)
500 5000
2. Program example 2
In the program example shown below, the BCD data set in X020 to X057 is controlled by the limit values
10000 and 1,000,000, and the controlled value is output to D11 and D10 when X000 turns ON.
X000
FNC 19 K8X020 D0
DBIN
END
Operation
In the case of (D1, D0) < 10000, 10000 is output to (D11, Output (D11,D10)
D10).
In the case of 10000 (D1, D0) 1,000,000, the value of 1,000,000
(D1, D0) is output to (D11, D10). 10000
In the case of (D1, D0) > 1,000,000, 1,000,000 is output Input (D1,D0)
to (D11, D10). 10000 1,000,000
666
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.2 FNC257 BAND / Dead Band Control
21
29.2 FNC257 BAND / Dead Band Control
External Device
FNC179
FNC170-
1. Instruction format
FNC 257 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
S1 Lower limit value of the dead band (no-output band)
24
S2 Upper limit value of the dead band (no-output band)
Others
FNC189
FNC181-
16- or 32-bit binary
S3 Input value controlled by the dead band
D Device number storing the output value controlled by the dead band
3. Applicable devices
Bit Devices Word Devices Others
25
Block Data
FNC199
FNC190-
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3 26
Character String
FNC209
FNC200-
S3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
Data
FNC219
FNC210-
Depending on how the input value (16-bit binary value) specified by S3 compares to the dead band range
between S1 and S2 , the output value D is controlled.
Command
input
FNC257
BAND
S1 S2 S3 D 28
Data
FNC249
FNC220-
In the case of S1 Lower limit value > S3 Input value .... S3 Input value S1 Lower limit value D Output value
In the case of S2 Upper limit value < S3 Input value .... S3 Input value S2 Upper limit value D Output value
In the case of S1 Lower limit value S3 Input value S2 Upper limit value .................................0 D Output value
29
Output value Output value( D )
Data Table
FNC269
FNC250-
Output value = 0
667
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.2 FNC257 BAND / Dead Band Control
Caution
When the output value overflows, it is handled as follows:
- In the 16-bit operation
The output value is a 16-bit binary value with sign. Accordingly, if the operation result is outside the
range from -32768 to +32767, it is handled as follows:
Lower limit value of dead band [ S1 +1, S1 ] = 1000 Output value = -2,147,483,648-1000
= 80000000H-000003E8H
Input value [ S3 +1, S3 ] = -2,147,483,648 = 7FFFFC18H
= 2,147,482,648
Error
An operation error is caused when the instruction is executed in the setting status shown below; The error flag
M8067 turns ON, and the error code (K6706) is stored in D8067.
Relationship
16-bit operation S1 > S2
32-bit operation [ S1 +1, S1 ] > [ S2 +1, S2 ]
668
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.2 FNC257 BAND / Dead Band Control
21
Program examples
X000 Output
22
FNC 19 K4X020
External Device
FNC179
FNC170-
D0
BIN
END 23
Instructions
Alternate
FNC180
Operation
In the case of D0 < -1000, D0 - (-1000) is output to D1.
Output
In the case of -1000 D0 +1000, 0 is output to D1.
In the case of D0 > +1000, D0 - 1000 is output to D1. 24
Others
FNC189
FNC181-
-1000 0
Input
1000
25
Block Data
FNC199
FNC190-
2. Program example 2
In the program example shown below, the BCD data set in X020 to X057 is controlled by the dead band from
-10000 to +10000, and a controlled value is output to D11 and D10 when X000 turns ON.
Output
X000
FNC 19 K8X020 D0 26
DBIN
Character String
FNC209
FNC200-
FNC257 K-10000 K10000 D0 D10
DBAND Input
END
27
Data
FNC219
FNC210-
Operation
In the case of (D1, D0) < -10000, (D1, D0) - (-10000) is
output to (D11, D10). Output
In the case of -10000 (D1, D0) +10000, 0 is output to
(D11, D10). 28
In the case of (D1, D0) > +10000, (D1, D0) - 10000 is output -10000 0
Data
FNC249
FNC220-
Input
to (D11, D10). +10000
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
669
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.3 FNC258 ZONE / Zone Control
Outline
Depending on how the input value compares to positive or negative, the output value is controlled by the bias
value specified.
1. Instruction format
FNC 258 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand Type Description Data Type
S1 Negative bias value to be added to the input value
D Head device number storing the output value controlled by the zone
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3 3 3 3 3 3 3 3 3 3
S3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
In the case of S3 Input value < 0 ..... S3 Input value + S1 Negative bias value D Output value
In the case of S3 Input value > 0 ..... S3 Input value + S2 Positive bias value D Output value
Output Output ( D )
value value
Positive bias value
( S2 )
Input 0 Input ( S3 )
value value
670
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.3 FNC258 ZONE / Zone Control
21
2. 32-bit operation (DZONE and DZONEP)
External Device
FNC179
FNC170-
DZONE
S3 +1, S3 D +1, D
23
Instructions
Alternate
FNC180
In the case of Input value = 0 ...........................................................................................0 Output value
Others
FNC189
FNC181-
Positive bias value
[ S2 +1, S2 ]
Input
0 Input value
value
[ S3 +1, S3 ]
25
Negative bias value
Block Data
FNC199
FNC190-
[ S1 +1, S1 ]
Caution
When the output value overflows, it is handled as follows: 26
- In the 16-bit operation
Character String
FNC209
FNC200-
The operation result is a 16-bit binary value with sign. Accordingly, if the output value is outside the
range from -32768 to +32767, it is handled as follows:
Data
FNC219
FNC210-
= 32668
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
671
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.3 FNC258 ZONE / Zone Control
Program examples
1. Program example 1
In the program example shown below, the BCD data set in X020 to X037 is controlled by the zone from
-1000 to +1000, and the controlled value is output to D1 when X000 turns ON.
X000
FNC 19 K4X020 D0
BIN
END
Operation
In the case of D0 < 0, D0 + (-1000) is output to D1. Output
In the case of D = 0, 0 is output to D1.
In the case of D0 > 0, D0 + 1000 is output to D1.
1000
-1000 0
Input
1000
-1000
2. Program example 2
In the program example shown below, the BCD data set in X020 to X057 is controlled by the zone from -
10000 to +10000, and the controlled value is output to D11 and D10 when X000 turns ON.
X000
FNC 19 K8X020 D0
DBIN
END
Operation
In the case of (D1, D0) < 0, (D1, D0) + (-10000) is output to Output
(D11, D10).
In the case of (D1, D0) = 0, the 0 is output to (D11, D10).
In the case of (D1, D0) > 0, (D1, D0) + 10000 is output to 10000
(D11, D10). -10000 0
Input
10000
-10000
672
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.4 FNC259 SCL / Scaling (Coordinate by Point Data)
21
29.4 FNC259 SCL / Scaling (Coordinate by Point Data)
External Device
FNC179
FNC170-
1. Instruction format
FNC 259 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D SCL P 7 steps
SCL Continuous
Operation 13 steps
DSCL Continuous
Operation 23
SCLP Pulse (Single) DSCLP Pulse (Single)
Instructions
Alternate
FNC180
Operation Operation
2. Set data
Operand Type Description Data Type
S1 Input value used in scaling or device number storing the input value
24
Others
FNC189
FNC181-
S2 Head device number storing the conversion table used in scaling 16- or 32-bit binary
3. Applicable devices
Bit Devices Word Devices Others 25
Oper-
Block Data
FNC199
FNC190-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3
26
D 3 3 3 3 3 3 3 3 3
Character String
FNC209
FNC200-
27
Data
FNC219
FNC210-
28
Data
FNC249
FNC220-
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
673
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.4 FNC259 SCL / Scaling (Coordinate by Point Data)
Command
Conversion setting data table for scaling
input Device assignment in
FNC259 Set item
S1 S2 D setting data table
DSCL
Number of coordinate points
(5 in the case shown in the left [ S2 +1, S2 ]
Y
Point 2 figure)
X coordinate [ S2 +3, S2 +2]
Output Point 5 Point 1
value Y coordinate [ S2 +5, S2 +4]
( D ) Point 3
X coordinate [ S2 +7, S2 +6]
Point 4 Point 2
Point 1 Y coordinate [ S2 +9, S2 +8]
X X coordinate [ S2 +11, S2 +10]
Input value ( S1 ) Point 3
Operation Operation Y coordinate [ S2 +13, S2 +12]
error Operation is enabled. error
X coordinate [ S2 +15, S2 +14]
Point 4
Y coordinate [ S2 +17, S2 +16]
X coordinate [ S2 +19, S2 +18]
Point 5
Y coordinate [ S2 +21, S2 +20]
674
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.4 FNC259 SCL / Scaling (Coordinate by Point Data)
21
3. Setting the conversion table for scaling
External Device
FNC179
FNC170-
16-bit operation 32-bit operation
Number of coordinate points S2 [ S2 +1, S2 ]
X coordinate S2 +1 [ S2 +3, S2 +2]
Point 1
Y coordinate
X coordinate
S2 +2 [ S2 +5, S2 +4]
23
S2 +3 [ S2 +7, S2 +6]
Instructions
Alternate
FNC180
Point 2
Y coordinate S2 +4 [ S2 +9, S2 +8]
...
...
...
...
X coordinate S2 +2n-1 [ S2 +4n-1, S2 +4n-2]
Point n (last)
Y coordinate S2 +2n [ S2 +4n+1, S2 +4n]
24
Others
FNC189
FNC181-
Setting example of the conversion table for scaling
A setting example for the 16-bit operation is shown below.
For the 32-bit operation, set each item using a 32-bit binary value.
In the case of the conversion characteristics for scaling shown in the figure below, set the following data table.
Y
25
Block Data
FNC199
FNC190-
Point 3 Point 6(200,250)
(50,100) Point 7
Point 5 (250,90) Point 8(350,90)
(200,70)
Point 2
(20,30) Point 9
Character String
FNC209
FNC200-
X
27
Data
FNC219
FNC210-
28
Data
FNC249
FNC220-
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
675
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.4 FNC259 SCL / Scaling (Coordinate by Point Data)
X coordinate S2 +15 R15 K350 When coordinates are specified using two points in
Point 8
Y coordinate S2 +16 R16 K90 this way, the output value is the Y coordinate at the
next point.
X coordinate S2 +17 R17 K350 In this example, the output value is specified by the
Point 9 Y coordinate of the point 9.
Y coordinate S2 +18 R18 K30
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the Xn data is not set in the ascending order in the data table (error code: K6706)
The data table is searched from the low-order side of device numbers in the data table in the operation.
Accordingly, even if only some Xn data is set in the ascending order in the data table, the instruction is
executed without operation error up to the area of the data table in which the Xn data is set in the
ascending order.
When S1 is outside the data table (error code: K6706)
When the value exceeds the 32-bit data range in the middle of operation (error code: K6706)
In this case, check whether the distance between points is not 65535 or more.
If the distance is 65535 or more, reduce the distance between points.
676
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.4 FNC259 SCL / Scaling (Coordinate by Point Data)
21
Program example
Program
M8000
22
FNC259 D0 R0 D10
External Device
FNC179
FNC170-
SCL
END
Operation
23
Instructions
Alternate
FNC180
Conversion setting data table for scaling
Y Point 3
(30,100) Setting
Set item Device
contents
Number of coordinate
R0 K6
Point 4
points
X coordinate R1 K0
24
Point 2 (40,45) Point 1
Others
FNC189
FNC181-
Output value (10,50) Y coordinate R2 K0
(D10)=35 Point 5
(50,30) X coordinate R3 K10
Point 2
Point 1 Y coordinate R4 K50
(0,0)
X X coordinate R5 K30
Input value(D0)=7 Point 6
(60,0)
Point 3
Y coordinate R6 K100 25
X coordinate R7 K40
Block Data
FNC199
FNC190-
Point 4
Y coordinate R8 K45
X coordinate R9 K50
Point 5
Y coordinate R10 K30
X coordinate R11 K60
Point 6
Y coordinate R12 K0
26
Character String
FNC209
FNC200-
27
Data
FNC219
FNC210-
28
Data
FNC249
FNC220-
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
677
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.5 FNC260 DABIN / Decimal ASCII to BIN Conversion
Outline
This instruction converts numeric data expressed in decimal ASCII codes (30H to 39H) into binary data.
1. Instruction format
FNC 260 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
Operand Type Description Data Type
S Head device number storing data (ASCII codes) to be converted into binary data Character string
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3 3 3
b15 b8 b7 b0
S +0 ASCII code for 10000's digit Sign data b15 b0
+1 ASCII code for 100's digit ASCII code for 1000's digit D
+2 ASCII code for 1's digit ASCII code for 10's digit
16-bit binary data
For example, when S to S +2 store ASCII codes expressing "-25108", 16-bit binary data is stored
in D as follows:
b15 b8 b7 b0
S +0 32H(2) 2DH(-) b15 b0
+1 31H(1) 35H(5) D -25108
+2 38H(8) 30H(0)
678
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.5 FNC260 DABIN / Decimal ASCII to BIN Conversion
21
2. 32-bit operation (DDABIN and DDABINP)
External Device
FNC179
FNC170-
b15 b8 b7 b0
S +0 ASCII code for 1,000,000,000's digit Sign data
D +1 D
+1 ASCII code for 10,000,000's digit ASCII code for 100,000,000's digit
b31 b16 b15 b0
+2 ASCII code for 100,000's digit ASCII code for 1,000,000's digit
High-order 16 bits Low-order 16 bits
+3
+4
ASCII code for 1000's digit
ASCII code for 10's digit
ASCII code for 10000's digit
ASCII code for 100's digit
23
32-bit data
Instructions
Alternate
FNC180
+5 (Ignored) ASCII code for 1's digit
For example, when S to S +5 store ASCII codes expressing "-1,234,543,210", 32-bit binary data
is stored in [ D +1, D ] as follows:
b15 b8 b7 b0 24
S +0 31H(1) 2DH(-)
Others
FNC189
FNC181-
+1 33H(3) 32H(2)
D +1 D
+2 35H(5) 34H(4)
-1234543210
+3 33H(3) 34H(4)
+4 31H(1) 32H(2)
+5 (Ignored) 30H(0)
25
Block Data
FNC199
FNC190-
2) The numeric range of data stored in S to S +5 is from -2,147,483,648 to +2,147,483,647.
The high-order byte of S +5 is ignored.
3) As "sign data" (low-order byte of S ), "20H (space)" is set when the data to be converted is positive,
and "2DH (-)" is set when the data to be converted is negative.
4) An ASCII code for each digit is within the range from 30H to 39H. 26
5) When an ASCII code for each digit is "20H (space)" or "00H (NULL)", it is handled as "30H".
Character String
FNC209
FNC200-
Related instructions
Instruction Description
ASCI(FNC 82) Converts hexadecimal codes into ASCII codes. 27
HEX(FNC 83) Converts ASCII codes into hexadecimal codes.
Data
FNC219
FNC210-
STR(FNC200) Converts binary data into a character string (ASCII codes).
VAL(FNC201) Converts a character string (ASCII codes) into binary data.
BINDA(FNC261) Converts binary data into decimal ASCII codes (30H to 39H).
Errors 28
Data
FNC249
FNC220-
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the sign data stored in S is any value other than "20H (space)" or "2DH (-)" (error code: K6706)
When an ASCII code for each digit stored in S to S +2(5) is any value other than "30H" to "39H",
"20H (space)", or "00H (NULL)" (error code: K6706) 29
Data Table
FNC269
FNC250-
When the numeric range of S to S +2(5) is outside the following range (error code: K6706)
Setting range
16-bit operation 32768 to 32767
32-bit operation 2,147,483,648 to 2,147,483,647
30
When S to S +2(5) exceeds the device range (error code: K6706)
Ex-Device
FNC274
FNC270-
679
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.5 FNC260 DABIN / Decimal ASCII to BIN Conversion
Program example
In the program below, the sign and decimal ASCII codes in five digits stored in D20 to D22 are converted into
a binary value and stored in D0 when X000 is set to ON.
X000
FNC260 D20 D0
DABINP
END
b15 b8 b7 b0
D20 20H(space) 2DH(-) D0
D21 32H(2) 20H(space) -276
D22 36H(6) 37H(7) (It is regarded as Binary
"- 276" "-00276".) value
680
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.6 FNC261 BINDA / BIN to Decimal ASCII Conversion
21
29.6 FNC261 BINDA / BIN to Decimal ASCII Conversion
External Device
FNC179
FNC170-
FNC 261 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
S Device number storing binary data to be converted into ASCII codes 16- or 32-bit binary
Others
FNC189
FNC181-
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 25
Block Data
FNC199
FNC190-
S 3 3 3 3 3 3 3 3 3 3 3 3 3 3
D 3 3 3 3 3
Character String
FNC209
FNC200-
1) Each digit of 16-bit binary data stored in S is converted into an ASCII code (30H to 39H), and stored
in D and later.
Command
input FNC261
BINDAP
S D
27
Data
FNC219
FNC210-
b15 b8 b7 b0
D +0 ASCII code for 10000's digit Sign data
b15 b0
+1 ASCII code for 100's digit ASCII code for 1000's digit
S
+2 ASCII code for 1's digit ASCII code for 10's digit
+3 0000H or source data
16-bit binary data M8091=OFF:0000H
M8091=ON:Does 28
not change.
Data
FNC249
FNC220-
For example, when S stores "-12345", the conversion result is stored in D and later as follows:
b15 b8 b7 b0
D +0 31H(1) 2DH(-)
b15 b0
+1 33H(3) 32H(2) 29
S -12345
+2 35H(5) 34H(4)
Data Table
FNC269
FNC250-
2) The numeric range of 16-bit binary data stored in S is from -32768 to +32767.
3) The conversion result stored in D is as follows:
30
Ex-Device
FNC274
FNC270-
a) As "sign data" (low-order byte of D ), "20H (space)" is set when the 16-bit binary data stored in
S is positive, and "2DH (-)" is set when 16-bit binary data stored in S is negative.
681
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.6 FNC261 BINDA / BIN to Decimal ASCII Conversion
b) "20H (space)" is stored for "0" on the left side of the effective digits (zero suppression).
00 325
Effective digits
20H
For example, when [ S +1, S ] stores "-12,345,678", the conversion result is stored in D and
later as follows:
b15 b8 b7 b0
D +0 20H (space) 2DH(-)
+1 31H(1) 20H (space)
S +1 S
+2 33H(3) 32H(2)
-12345678
+3 35H(5) 34H(4)
+4 37H(7) 36H(6)
+5 00H or 20H 38H(8)
M8091=OFF:00H
M8091=ON:20H
2) The numeric range of 32-bit binary data stored in [ S +1, S ] is from -2,147,483,648 to
+2,147,483,647.
3) The conversion result stored in D is as follows:
a) "sign data" (low-order byte of D ) "20H (space)" is set when the 32-bit binary data stored in
[ S +1, S ] is positive, and "2DH (-)" is set when 32-bit binary data stored in [ S +1, S ] is
negative.
b) "20H (space)" is stored for "0" on the left side of the effective digits (zero suppression).
00 1 2 0 3 4 5 6 0
Effective digits
20H
c) The high-order byte of D +5 is set as follows depending on the ON/OFF status of M8091.
ON/OFF status Contents of processing
M8091=OFF The high-order byte of D +5 is set to "00H (NULL)."
M8091=ON The high-order byte of D +5 is set to "20H (space)."
682
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.6 FNC261 BINDA / BIN to Decimal ASCII Conversion
21
Related devices
M8091
Output character
quantity selector signal
- When M8091 is ON,
For 32-bit operation
D +3 does not change.
22
External Device
FNC179
FNC170-
- When M8091 is OFF, the high-order byte of D +5 is set to "00H (NULL)."
- When M8091 is ON, the high-order byte of D +5 is set to "20H (space)."
Related instructions
Instruction Description 23
Instructions
Alternate
FNC180
ASCI(FNC 82) Converts hexadecimal values into ASCII code.
HEX(FNC 83) Converts ASCII code into hexadecimal values.
STR(FNC200) Converts binary data into a character string (ASCII code).
VAL(FNC201) Converts a character string (ASCII code) into binary data.
DABIN(FNC260) Converts numeric data expressed in decimal ASCII code (30H to 39H) into binary data.
24
Others
FNC189
FNC181-
Cautions
1. Occupied device points
The table below shows the occupied device points of D for 16-bit operation(BINDA/BINDAP) when
M8091 is ON/OFF and 32-bit operation (DBINDA/DBINDAP). 25
Block Data
FNC199
FNC190-
Occupied Points of D
M8091=ON 3
16-bit operation
M8091=OFF 4
32-bit operation 6
26
Errors
Character String
FNC209
FNC200-
An operation error is caused in the following case; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the occupied device point of D storing the ASCII code character string exceeds the
corresponding device rang (error code: K6706).
27
Data
FNC219
FNC210-
28
Data
FNC249
FNC220-
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
683
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.6 FNC261 BINDA / BIN to Decimal ASCII Conversion
Program example
In the program below, 16-bit binary data stored in D1000 is converted into decimal ASCII codes when X000 is
set to ON, and the ASCII codes converted by PR (FNC 77) instruction are output one by one in the time
division method to Y040 to Y051.
By setting to OFF the output character selector signal M8091 and setting to ON PR mode flag M8027, ASCII
codes up to "00H" are output.
For PR mode flag and PR (FNC 77) instruction, refer to Section 15.8.
X000
RST M8091
SET M8027
FNC261 D1000 D0
BINDAP
FNC 77 D0 Y040
PR
END
b15 b8 b7 b0
D0 20H (space) 20H (space) PR (FNC 77)
D1000 instruction
D1 31H(1) 35H(5)
5126 Y040 to Y051
D2 36H(6) 32H(2)
16-bit binary " 5126" is
D3 0000H output.
data
M8091=OFF
684
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.7 FNC269 SCL2 / Scaling 2 (Coordinate by X/Y Data)
21
29.7 FNC269 SCL2 / Scaling 2 (Coordinate by X/Y Data)
External Device
FNC179
FNC170-
SCL2 instruction is supported in the FX3UC Series Ver. 1.30 or later.
For SCL (FNC259) instruction, refer to Section 29.4.
1. Instruction format
Instructions
Alternate
FNC180
Operation Operation
SCL2P Pulse (Single) DSCL2P Pulse (Single)
Operation Operation
2. Set data
Operand Type Description Data Type 24
Others
FNC189
FNC181-
S1 Input value used in scaling or device number storing the input value
S2 Head device number storing the conversion table used in scaling 16- or 32-bit binary
3. Applicable devices 25
Bit Devices Word Devices Others
Block Data
FNC199
FNC190-
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 3 3 3 3 3 3
S2 3 3 3
26
Character String
FNC209
FNC200-
D 3 3 3 3 3 3 3 3 3
27
Data
FNC219
FNC210-
28
Data
FNC249
FNC220-
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
685
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.7 FNC269 SCL2 / Scaling 2 (Coordinate by X/Y Data)
Command
Conversion setting data table for scaling
input Device assignment in
FNC 269 Set item
S1 S2 D setting data table
SCL2
Number of coordinate points
Y (5 in the case shown in the left S2
Point 2 figure)
Output Point 5 Point 1 S2 +1
value
( D ) Point 3 Point 2 S2 +2
X coordinate Point 3 S2 +3
Point 1 Point 4
Point 4 S2 +4
X
Input value ( S1 ) Point 5 S2 +5
Operation Operation
error Operation is enabled. Point 1 S2 +6
error
Point 2 S2 +7
Y coordinate Point 3 S2 +8
Point 4 S2 +9
Point 5 S2 +10
686
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.7 FNC269 SCL2 / Scaling 2 (Coordinate by X/Y Data)
21
3. Setting the conversion table for scaling
External Device
FNC179
FNC170-
16-bit operation 32-bit operation
Number of coordinate points S2 [ S2 +1, S2 ]
Point 1 S2 +1 [ S2 +3, S2 +2]
Point 2
X coordinate
S2 +2 [ S2 +5, S2 +4]
23
...
...
...
Instructions
Alternate
FNC180
Point n (last) S2 +n [ S2 +2n+1, S2 +2n]
Point 1 S2 +n+1 [ S2 +2n+3, S2 +2n+2]
Point 2 S2 +n+2 [ S2 +2n+5, S2 +2n+4]
Y coordinate
24
...
...
...
Point n (last) S2 +2n [ S2 +4n+1, S2 +4n]
Others
FNC189
FNC181-
25
Block Data
FNC199
FNC190-
26
Character String
FNC209
FNC200-
27
Data
FNC219
FNC210-
28
Data
FNC249
FNC220-
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
687
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.7 FNC269 SCL2 / Scaling 2 (Coordinate by X/Y Data)
Point 4 S2 +4 R4 K200
Point 5 S2 +5 R5 K200 Refer to *1.
X coordinate
Point 6 S2 +6 R6 K200
Point 7 S2 +7 R7 K250
Point 8 S2 +8 R8 K350
Refer to *2.
Point 9 S2 +9 R9 K350
Point 10 S2 +10 R10 K400
*1. When coordinates are specified using three points as shown in the points 4, 5 and 6, the output value
can be set to an intermediate value.
In this example, the output value (intermediate value) is specified by the Y coordinate of the point 5.
If the X coordinate is same at three points or more, the value at the second point is output also.
*2. When coordinates are specified using two points as shown in the points 8 and 9, the output value is
the Y coordinate at the next point.
In this example, the output value is specified by the Y coordinate of the point 9.
688
FX3U/FX3UC Series Programmable Controllers 29 Data Table Operation FNC250 to FNC269
Programming Manual - Basic & Applied Instruction Edition 29.7 FNC269 SCL2 / Scaling 2 (Coordinate by X/Y Data)
21
Errors
External Device
FNC179
FNC170-
ascending order.
When S1 is outside the data table (error code: K6706)
When the value exceeds the 32-bit data range in the middle of operation (error code: K6706)
In this case, check whether the distance between points is not 65535 or more.
If the distance is 65535 or more, reduce the distance between points.
23
Instructions
Alternate
FNC180
Program example
In the program example shown below, the value input to D0 is processed by scaling based on the conversion
table for scaling set in R0 and later, and output to D10.
Program 24
Others
FNC189
FNC181-
M8000
FNC 269 D0 R0 D10
SCL2
END
25
Block Data
FNC199
FNC190-
Operation
Conversion setting data table for scaling
Y Point 3 Setting
Set item Device
(30,100) contents
Number of coordinate
R0 K6
26
points
Character String
FNC209
FNC200-
Point 4 Point 1 R1 K0
Point 2 (40,45) Point 2 R2 K10
Output value (10,50)
(D10)=35 Point 5 Point 3 R3 K30
(50,30) X coordinate
Point 4 R4 K40
Point 1
Point 5 R5 K50
27
(0,0)
Data
FNC219
FNC210-
X Point 6 R6 K60
Input value(D0)=7 Point 6
(60,0) Point 1 R7 K0
Point 2 R8 K50
Point 3 R9 K100
Y coordinate
Point 4 R10 K45 28
Point 5 R11 K30
Data
FNC249
FNC220-
Point 6 R12 K0
29
Data Table
FNC269
FNC250-
30
Ex-Device
FNC274
FNC270-
689
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition
Section
270 IVCK IVCK S1 S2 D n Inverter Status Check
30.1
Section
271 IVDR IVDR S1 S2 S3 n Inverter Drive
30.2
Section
272 IVRD IVRD S1 S2 D n Inverter Parameter Read
30.3
Section
273 IVWR IVWR S1 S2 S3 n Inverter Parameter Write
30.4
Section
274 IVBWR IVBWR S1 S2 S3 n Inverter Parameter Block Write
30.5
690
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.1 FNC270 IVCK / Inverter Status Check
21
30.1 FNC270 IVCK / Inverter Status Check
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction reads the operation status of an inverter to a PLC using the computer link operation function
of the inverter. Applicable inverters vary depending on the version.
22
External Device
FNC170-FNC179
This instruction corresponds to the EXTR (K10) instruction in the FX2N/FX2NC Series.
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
1. Instruction format
Instructions
Alternate
FNC180
Operation
2. Set data
Operand Type Description Data Type 24
Others
FNC181-FNC189
S1 Inverter station number (K0 to K31)
Operation
Block Data
FNC190-FNC199
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 26
Control
Character String
FNC200-FNC209
S2 3 3 3 3 3 3
D 3 3 3 3 3 3 3 3 3
n 3 3
Operation 3
Data
FNC210-FNC219
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
input
FNC270 S1 S2 D n
IVCK
*2. Refer to the instruction code list shown on the next page.
Refer to the pages in the inverter manual on which the computer link function is explained in detail.
*3. Mitsubishi FREQROL-F700/A700 Series general-purpose inverters are supported in Ver.2.20 and
later.
*4. Mitsubishi FREQROL-E700 Series general-purpose inverters are supported in Ver.2.32 and later. 30
Inverter Comms
Ex-Device
FNC270-FNC274
691
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.1 FNC270 IVCK / Inverter Status Check
3. Related devices
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Number Number
Description Description
ch1 ch2 ch1 ch2
M8029 Instruction execution complete D8063 D8438 Error code of serial communication error
M8063 M8438 Serial communication error D8150 D8155 Response wait time in inverter communication
M8151 M8156 Inverter communicating *1 D8151 D8156 Step number in inverter communication*2
M8152 M8157 Inverter communication error*1 D8152 D8157 Error code of inverter communication error*1
Inverter communication error Latch of inverter communication error
M8153 M8158 D8153 D8158
latch*1 occurrence step*2
M8154 M8159 IVBWR instruction error*1 D8154 D8159 IVBWR instruction error parameter number*2
*1. Cleared when the PLC mode switches from STOP to RUN.
*2. Initial value: -1
Cautions
For other cautions, refer to the Data Communication Edition manual.
It is not permitted to use the RS (FNC 80)/RS2 (FNC 87) instruction and an inverter communication
instruction (FNC270 to FNC274) for the same port.
Two or more inverter communication instructions (FNC270 to FNC274) can be driven for the same port at
the same time.
692
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.2 FNC271 IVDR / Inverter Drive
21
30.2 FNC271 IVDR / Inverter Drive
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction writes a inverter operation required control value to an inverter using the computer link
operation function of the inverter.
22
External Device
FNC170-FNC179
This instruction corresponds to the EXTR (K11) instruction in the FX2N/FX2NC Series.
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
1. Instruction format
Instructions
Alternate
FNC180
Operation
2. Set data
Operand Type Description Data Type 24
Others
FNC181-FNC189
S1 Inverter station number (K0 to K31)
Operation
Block Data
FNC190-FNC199
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 26
S1 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
S2 3 3 3 3 3 3
S3 3 3 3 3 3 3 3 3
n 3 3
27
Explanation of function and operation
Operation 3
Data
FNC210-FNC219
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
Command
input
FNC271 S1 S2 S3 n
IVDR
*2. Refer to the instruction code list shown on the next page.
Refer to the pages in the inverter manual on which the computer link function is explained in detail.
*3. Mitsubishi FREQROL-F700/A700 Series general-purpose inverters are supported in Ver.2.20 and
later.
*4. Mitsubishi FREQROL-E700 Series general-purpose inverters are supported in Ver.2.32 and later.
30
Inverter Comms
Ex-Device
FNC270-FNC274
693
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.2 FNC271 IVDR / Inverter Drive
3. Related devices
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Number Number
Description Description
ch1 ch2 ch1 ch2
M8029 Instruction execution complete D8063 D8438 Error code of serial communication error
M8063 M8438 Serial communication error D8150 D8155 Response wait time in inverter communication
M8151 M8156 Inverter communicating*1 D8151 D8156 Step number in inverter communication*2
Error code of inverter communication
M8152 M8157 Inverter communication error*1 D8152 D8157
error*1
Inverter communication error Latch of inverter communication error
M8153 M8158 D8153 D8158
latch*1 occurrence step*2
M8154 M8159 IVBWR instruction error*1 D8154 D8159 IVBWR instruction error parameter number*2
*1. Cleared when the PLC mode switches from STOP to RUN.
*2. Initial value: -1
Cautions
For other cautions, refer to the Data Communication Edition manual.
It is not permitted to use the RS (FNC 80)/RS2 (FNC 87) instruction and an inverter communication
instruction (FNC270 to FNC274) for the same port.
Two or more inverter communication instructions (FNC270 to FNC274) can be driven for the same port at
the same time.
694
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.3 FNC272 IVRD / Inverter Parameter Read
21
30.3 FNC272 IVRD / Inverter Parameter Read
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction reads an inverter parameter to the PLC using the computer link operation function of the
inverter.
22
External Device
FNC170-FNC179
This instruction corresponds to the EXTR (K12) instruction in the FX2N/FX2NC Series.
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
1. Instruction format
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type 24
Others
FNC181-FNC189
S1 Inverter station number (K0 to K31)
Operation
Block Data
FNC190-FNC199
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3 26
Control
Character String
FNC200-FNC209
S2 3 3 3 3 3 3
D 3 3 3 3
n 3 3
Operation 3
Data
FNC210-FNC219
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
input
FNC272 S1 S2 D n
IVRD
*2. Mitsubishi FREQROL-F700/A700 Series general-purpose inverters are supported in Ver.2.20 and
later.
*3. Mitsubishi FREQROL-E700 Series general-purpose inverters are supported in Ver.2.32 and later.
30
Inverter Comms
Ex-Device
FNC270-FNC274
695
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.3 FNC272 IVRD / Inverter Parameter Read
2. Related devices
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Number Number
Description Description
ch1 ch2 ch1 ch2
M8029 Instruction execution complete D8063 D8438 Error code of serial communication error
M8063 M8438 Serial communication error D8150 D8155 Response wait time in inverter communication
M8151 M8156 Inverter communicating*1 D8151 D8156 Step number in inverter communication*2
Error code of inverter communication
M8152 M8157 Inverter communication error*1 D8152 D8157
error*1
Inverter communication error Latch of inverter communication error
M8153 M8158 *1 D8153 D8158
latch occurrence step*2
M8154 M8159 IVBWR instruction error*1 D8154 D8159 IVBWR instruction error parameter number*2
*1. Cleared when the PLC mode switches from STOP to RUN.
*2. Initial value: -1
Cautions
For other cautions, refer to the Data Communication Edition manual.
It is not permitted to use the RS (FNC 80)/RS2 (FNC 87) instruction and an inverter communication
instruction (FNC270 to FNC274) for the same port.
Two or more inverter communication instructions (FNC270 to FNC274) can be driven for the same port at
the same time.
696
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.4 FNC273 IVWR / Inverter Parameter Write
21
30.4 FNC273 IVWR / Inverter Parameter Write
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction writes an inverter parameter of an inverter using the computer link operation function of the
inverter.
22
External Device
FNC170-FNC179
This instruction corresponds to the EXTR (K13) instruction in the FX2N/FX2NC Series.
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
1. Instruction format
Instructions
Alternate
FNC180
Operation
2. Set data
Operand Type Description Data Type 24
Others
FNC181-FNC189
S1 Inverter station number (K0 to K31)
Operation
Block Data
FNC190-FNC199
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 26
S1 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
S2 3 3 3 3 3 3
S3 3 3 3 3 3 3
n 3 3
27
Explanation of function and operation
Operation 3
Data
FNC210-FNC219
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
Command
input
FNC273 S1 S2 S3 n
IVWR
*2. Mitsubishi FREQROL-F700/A700 Series general-purpose inverters are supported in Ver.2.20 and
later.
*3. Mitsubishi FREQROL-E700 Series general-purpose inverters are supported in Ver.2.32 and later.
30
Inverter Comms
Ex-Device
FNC270-FNC274
697
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.4 FNC273 IVWR / Inverter Parameter Write
2. Related devices
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Number Number
Description Description
ch1 ch2 ch1 ch2
M8029 Instruction execution complete D8063 D8438 Error code of serial communication error
M8063 M8438 Serial communication error D8150 D8155 Response wait time in inverter communication
M8151 M8156 Inverter communicating*1 D8151 D8156 Step number in inverter communication*2
Error code of inverter communication
M8152 M8157 Inverter communication error*1 D8152 D8157
error*1
Inverter communication error Latch of inverter communication error
M8153 M8158 *1 D8153 D8158
latch occurrence step*2
M8154 M8159 IVBWR instruction error*1 D8154 D8159 IVBWR instruction error parameter number*2
*1. Cleared when the PLC mode switches from STOP to RUN.
*2. Initial value: -1
Cautions
For other cautions, refer to the Data Communication Edition manual.
It is not permitted to use the RS (FNC 80)/RS2 (FNC 87) instruction and an inverter communication
instruction (FNC270 to FNC274) for the same port.
Two or more inverter communication instructions (FNC270 to FNC274) can be driven for the same port at
the same time.
698
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.5 FNC274 IVBWR / Inverter Parameter Block Write
21
30.5 FNC274 IVBWR / Inverter Parameter Block Write
Control
Real Time Clock
FNC160-FNC169
Outline
This instruction writes parameters of an inverter at one time using the computer link operation function of the
inverter.
22
For detailed explanation of the instruction, refer to the Data Communication Edition manual.
External Device
FNC170-FNC179
1. Instruction format
FNC 274 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
IVBWR 9 steps
IVBWR Continuous
Operation
23
Instructions
Alternate
FNC180
2. Set data
Operand Type Description Data Type
S1 Station number of an inverter (K0 to K31)
24
Others
FNC181-FNC189
S2 Number of parameters in an inverter to be written at one time
16-bit binary
S3 Head device number of a parameter table to be written to an inverter
n Used channel (K1: ch 1, K2: ch 2)
3. Applicable devices 25
Operation
Block Data
FNC190-FNC199
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3 3 3 3
26
S2 3 3 3 3 3 3
Control
Character String
FNC200-FNC209
S3 3 3 3 3
n 3 3
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
699
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.5 FNC274 IVBWR / Inverter Parameter Block Write
S3 +2 Parameter number
2nd parameter
S3 +3 Set value
...
...
...
S3 +2 S2 -4 Parameter number
S2 -1th parameter
S3 +2 S2 -3 Set value
S3 +2 S2 -2 Parameter number
S2 th parameter
S3 +2 S2 -1 Set value
*3. Mitsubishi FREQROL-F700/A700 Series general-purpose inverters are supported in Ver.2.20 and
later.
*4. Mitsubishi FREQROL-E700 Series general-purpose inverters are supported in Ver.2.32 and later.
2. Related devices
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Number Number
Description Description
ch1 ch2 ch1 ch2
M8029 Instruction execution complete D8063 D8438 Error code of serial communication error
M8063 M8438 Serial communication error D8150 D8155 Response wait time in inverter communication
M8151 M8156 Inverter communicating*1 D8151 D8156 Step number in inverter communication*2
Error code of inverter communication
M8152 M8157 Inverter communication error*1 D8152 D8157
error*1
Inverter communication error Latch of inverter communication error
M8153 M8158 D8153 D8158
latch*1 occurrence step*2
M8154 M8159 IVBWR instruction error*1 D8154 D8159 IVBWR instruction error parameter number*2
*1. Cleared when the PLC mode switches from STOP to RUN.
*2. Initial value: -1
700
FX3U/FX3UC Series Programmable Controllers 30 External Device Communication (Inverter Communication) FNC270 to FNC274
Programming Manual - Basic & Applied Instruction Edition 30.5 FNC274 IVBWR / Inverter Parameter Block Write
21
Cautions
Control
Real Time Clock
FNC160-FNC169
For other cautions, refer to the Data Communication Edition manual.
It is not permitted to use the RS (FNC 80)/RS2 (FNC 87) instruction and an inverter communication
instruction (FNC270 to FNC274) for the same port.
Two or more inverter communication instructions (FNC270 to FNC274) can be driven for the same port at
the same time.
22
External Device
FNC170-FNC179
Applicable models depending on the PLC version
Available inverter models are added depending on the version, as shown in the table below.
Applicable version
FX3U FX3UC
Item Outline of function
23
Addition of applicable Mitsubishi FREQROL-E700 Series general-purpose inverters
Instructions
Alternate
FNC180
Ver.2.32 or later Ver.2.32 or later
models are supported.
Addition of applicable Mitsubishi FREQROL-F700/A700 Series general-purpose
Ver.2.20 or later Ver.2.20 or later
models inverters are supported.
24
Others
FNC181-FNC189
25
Operation
Block Data
FNC190-FNC199
26
Control
Character String
FNC200-FNC209
27
Operation 3
Data
FNC210-FNC219
28
Comparison
Data
FNC220-FNC249
29
Operation
Data Table
FNC250-FNC269
30
Inverter Comms
Ex-Device
FNC270-FNC274
701
FX3U/FX3UC Series Programmable Controllers 31 Data Transfer 3 FNC275 to FNC279
Programming Manual - Basic & Applied Instruction Edition
275
276
277
Section
278 RBFM RBFM m1 m2 D n1 n2 Divided BFM Read
31.1
Section
279 WBFM WBFM m1 m2 S n1 n2 Divided BFM Write
31.2
702
FX3U/FX3UC Series Programmable Controllers 31 Data Transfer 3 FNC275 to FNC279
Programming Manual - Basic & Applied Instruction Edition 31.1 FNC278 RBFM / Divided BFM Read
31
31.1 FNC278 RBFM / Divided BFM Read
Transfer 3
Data
FNC275-FNC279
Outline
This instruction reads data from continuous buffer memories (BFM) in a special function block/unit over
several operation cycles by the time division method. This instruction is convenient for reading receive data,
32
Processing 2
High Speed
FNC280-FNC289
etc. stored in buffer memories in a special function block/unit for communication by the time division method.
FROM (FNC 78) instruction is also available to read the buffer memory (BFM) data.
For FROM (FNC 78) instruction, refer to Section 15.9.
1. Instruction format
33
FNC 278 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Register
Extension File
FNC290-FNC299
RBFM Continuous
11 steps RBFM Operation
2. Set data
Operand Type Description Data Type
34
Programming
SFCSTL
m1 Unit number [0 to 7]
m2 Head buffer memory (BFM) number [0 to 32766]
D Head device number storing data to be read from buffer memory (BFM) 16-bit binary data
n1 Number of all buffer memories (BFM) to be read [1 to 32767]
n2 Number of points transferred in one operation cycle [1 to 32767] 35
Function
Interrupt
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 36
Special Device
m1 3 3 3 3
m2 3 3 3 3
D S 3 3
n1 3 3 3 3
n2 3 3 3 3 37
Error Code
S: Except special data register (D)
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
703
FX3U/FX3UC Series Programmable Controllers 31 Data Transfer 3 FNC275 to FNC279
Programming Manual - Basic & Applied Instruction Edition 31.1 FNC278 RBFM / Divided BFM Read
When the instruction is finished normally, the instruction execution complete flag M8029 turns ON. When
the instruction is finished abnormally, the instruction execution abnormally complete flag M8329 turns ON.
When RBFM (FNC278) or WBFM (FNC279) instruction is executed in another step for the same unit
number, the instruction non-execution flag M8328 is set to ON, and execution of such an instruction is
paused.
When execution of the other target instruction is complete, the paused instruction resumes.
Related devices
For the flag use methods for instruction execution complete and instruction execution
abnormally complete, refer to Subsection 6.5.2.
Device Name Description
M8029 Instruction execution complete Turns ON when an instruction is finished normally.
Turns ON when RBFM (FNC278) or WBFM (FNC279)
M8328 Instruction non-execution instruction in another step is executed for the same unit
number.
M8329 Instruction execution abnormally complete Turns ON when an instruction is finished abnormally.
Related instructions
Instruction Description
FROM(FNC 78) Read from a special function block
TO(FNC 79) Write to a special function block
WBFM(FNC279) Divided BFM write
Errors
An operation error is caused in the following case; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the unit number "m1" does not exist (error code: K6708)
704
FX3U/FX3UC Series Programmable Controllers 31 Data Transfer 3 FNC275 to FNC279
Programming Manual - Basic & Applied Instruction Edition 31.1 FNC278 RBFM / Divided BFM Read
31
31.1.1 Common items between RBFM (FNC278) instruction and WBFM (FNC279)
Transfer 3
Data
FNC275-FNC279
instruction
Processing 2
High Speed
FNC280-FNC289
refer to the manual of the PLC used and special function block/unit.
Register
Extension File
FNC290-FNC299
Built-in Unit Unit Unit
CC-Link/LT No. 1 No. 2 No. 3
Programming
SFCSTL
A unit number is automatically assigned to each special extension unit/block connected to the PLC.
The unit number is assigned in the way "No. 0 No. 1 No. 2 ... starting from the equipment nearest the
main unit.
Function
Interrupt
memories.
The buffer memory number is from "0" to "32766", and the contents are determined according to each special
function unit/block.
Setting range: K0 to K32766
For the contents of buffer memories, refer to the manual of the special function block/unit used.
36
Cautions
Special Device
A watchdog timer error may occur when many numbers of points are transferred in one operation cycle. In
such a case, take either of the following countermeasures:
- Change the watchdog timer time
By overwriting the contents of D8000 (watchdog timer time), the watchdog timer detection time is
changed (initial value: K200).
37
Error Code
When the program shown below is input, the sequence program will be monitored with the new
watchdog timer time.
M8002
FNC 12 K300 D8000 Watchdog timer time: 300 ms
0
MOV
Initial pulse
FNC 07
Watchdog timer refresh A
When WDT (FNC 07) instruction is not programmed, the value
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
705
FX3U/FX3UC Series Programmable Controllers 31 Data Transfer 3 FNC275 to FNC279
Programming Manual - Basic & Applied Instruction Edition 31.1 FNC278 RBFM / Divided BFM Read
Do not stop the driving of the instruction while it is being executed. If driving is stopped, the buffer memory
(BFM) reading/writing processing is suspended, but the data acquired in the middle of reading/writing
processing is stored in D and later and buffer memories (BFM).
Command
input
SET M{{
M{{
FNC278 m1 m2 D n1 n2
RBFM
M8029
RST M{{
Instruction execution complete
When indexing is executed, the contents of index registers at the begining of execution are used.
Even if the contents of index registers are changed after the instruction, such changes do not affect the
process of the instruction.
The contents of "n1" devices starting from D change while RBFM (FNC278) instruction is executed.
After execution of the instruction is completed, execute another instruction for "n1" devices starting from
D .
Do not update (change) the contents of "n1" devices starting from S while WBFM (FNC279) instruction
is executed. If the contents are updated, the intended data may not be written to the buffer memories
(BFM).
Do not update (change) the contents of "n1" buffer memories (BFM) starting from the buffer memory No.
"m2" while RBFM (FNC278) instruction is executed. If the contents are updated, the intended data may
not be read.
706
FX3U/FX3UC Series Programmable Controllers 31 Data Transfer 3 FNC275 to FNC279
Programming Manual - Basic & Applied Instruction Edition 31.1 FNC278 RBFM / Divided BFM Read
31
Program example
Transfer 3
Data
FNC275-FNC279
In the example shown below, data is read from and written to the buffer memories (BFM) in the unit No. 2 as
follows:
When X000 is set to ON, data stored in D100 to D179 (80 points) are written to the buffer memories (BFM)
#1001 to 1080 in the special function block/unit whose unit number is No. 2 by 16 points in each operation
cycle. 32
Processing 2
High Speed
FNC280-FNC289
When X001 is set to ON, the buffer memories (BFM) #2001 to 2080 (80 points) in the special function
block/unit whose unit number is No. 2 are written to D200 to D279 by 16 points in each operation cycle.
Register
Extension File
FNC290-FNC299
M0 FNC279 K2 K1001 D100 K80 K16 the buffer memories #1001 to 1080 in
WBFM the unit No. 2 (in 5 operation cycles).
BFM write
start M8029
RST M0 The BFM write start flag is set to OFF.
Instruction execution complete
M8328
34
Execution of the WBFM instruction is
Programming
SFCSTL
Y000
waited.
Instruction non-execution
M8329
RST M0 The BFM write start flag is set to OFF.
Instruction execution
X001
abnormally complete
35
SET M5 The BFM read start flag is set to ON.
Function
Interrupt
BFM read
start
M5 The buffer memories #2001 to 2080 (80
FNC278 K2 K2001 D200 K80 K16 points) in the unit No. 2 are read to
RBFM D200 to D279 (in 5 operation cycles).
BFM read
start M8029 36
RST M5 The BFM read start flag is set to OFF.
Special Device
Instruction execution complete
M8328
Execution of the RBFM instruction is
Y001
waited.
Instruction non-execution
M8329
RST M5 The BFM read start flag is set to OFF. 37
Instruction execution
Error Code
abnormally complete
END
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
707
FX3U/FX3UC Series Programmable Controllers 31 Data Transfer 3 FNC275 to FNC279
Programming Manual - Basic & Applied Instruction Edition 31.2 FNC279 WBFM / Divided BFM Write
Outline
This instruction writes data to continuous buffer memories (BFM) in a special function block/unit over several
operation cycles by the time division method. This instruction is convenient for writing send data, etc. to
buffer memories in a special function block/unit for communication by the time division method.
TO (FNC 79) instruction is also available for writing data to the buffer memory (BFM).
For TO (FNC 79) instruction, refer to Section 15.10.
1. Instruction format
FNC 279 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
WBFM Continuous
11 steps WBFM Operation
2. Set data
Operand Type Description Data Type
m1 Unit number [0 to 7]
m2 Head buffer memory (BFM) number [0 to 32766]
S Head device number storing data to be written to buffer memory (BFM) 16-bit binary data
n1 Number of all buffer memories (BFM) to be written [1 to 32767]
n2 Number of points transferred in one operation cycle [1 to 32767]
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
m1 3 3 3 3
m2 3 3 3 3
S S 3 3
n1 3 3 3 3
n2 3 3 3 3
708
FX3U/FX3UC Series Programmable Controllers 31 Data Transfer 3 FNC275 to FNC279
Programming Manual - Basic & Applied Instruction Edition 31.2 FNC279 WBFM / Divided BFM Write
31
Explanation of function and operation
Transfer 3
Data
FNC275-FNC279
1. 16-bit operation (WBFM)
"n1" word units from S in the PLC are written to buffer memory (BFM) location # "m2" in special function
unit/block No. "m1". While transfering, "n1" is divided by "n2" so n1/n2 words (rounded up when there is a
remainder) are transferred per scan time. 32
For the unit No., buffer memory (BFM) No., cautions, and program example,
Processing 2
High Speed
FNC280-FNC289
refer to Subsection 31.1.1.
Command
input FNC278 PLC Unit No. "m1"
m1 m2 S n1 n2 *1
WBFM Write
S BFM#(m2)
M8029
M{{
Instruction execution 33
complete
Register
Extension File
FNC290-FNC299
M8328 S +n1-1 BFM#(m2+n1-1)
Instruction
M
non-execution *1 "n2" points are written in each
M8329 operation cycle. Writing is executed
Instruction execution
MUU in "n1/n2" transfers. ("n1/n2" is
abnormally complete
rounded up if it is not an integer.)
34
Programming
SFCSTL
When the instruction is finished normally, the instruction execution complete flag M8029 turns ON. When
the instruction is finished abnormally, the instruction execution abnormally complete flag M8329 turns ON.
When the RBFM (FNC278) or WBFM (FNC279) instruction is executed in another step for the same unit
number, the instruction non-execution flag M8328 is set to ON, and execution of such an instruction is
paused.
When execution of the first target instruction is complete, the paused instruction resumes.
35
Function
Interrupt
Related devices
For the flag use methods for instruction execution complete and instruction execution
abnormally complete, refer to Subsection 6.5.2.
Device Name Description 36
M8029 Instruction execution complete Turns ON when an instruction is finished normally.
Special Device
Turns ON when RBFM (FNC278) or WBFM (FNC279)
M8328 Instruction non-execution
instruction in another step is executed for a same unit number.
M8329 Instruction execution abnormally complete Turns ON when an instruction is finished abnormally.
Related instructions 37
Error Code
Instruction Description
FROM(FNC 78) Read from a special function block
TO(FNC 79) Write to a special function block
RBFM(FNC278) Divided BFM read
A
Errors
Information
Version Up
An operation error is caused in the following case; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the unit number "m1" does not exist (error code: K6708)
B
Execution Times
C
Instruction List
Applicable
709
FX3U/FX3UC Series Programmable Controllers 32 High Speed Processing 2 FNC280 to FNC289
Programming Manual - Basic & Applied Instruction Edition
281
282
283
284
285
286
287
288
289
710
FX3U/FX3UC Series Programmable Controllers 32 High Speed Processing 2 FNC280 to FNC289
Programming Manual - Basic & Applied Instruction Edition 32.1 FNC280 HSCT / High Speed Counter Compare With Data Table
31
32.1 FNC280 HSCT / High Speed Counter Compare With Data Table
Transfer 3
Data
FNC275-FNC279
Outline
This instruction compares the current value of a high speed counter with a data table of comparison points,
and then sets or resets up to 16 output devices.
32
Processing 2
High Speed
FNC280-FNC289
1. Instruction format
FNC 280 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
D HSCT 21 steps
DHSCT Continuous
Operation
33
Register
Extension File
FNC290-FNC299
2. Set data
Operand Type Description Data Type
S1
m
Head device number storing the data table
Number of comparison points in data table [1 m 128]
16- or 32-bit binary
16-bit binary
34
Programming
SFCSTL
S2 High speed counter number (C235 to C255) 32-bit binary
3. Applicable devices 35
Function
Interrupt
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S1 3 3 3
36
m 3 3
Special Device
S2 S 3
D 3 3 3 3
n 3 3
Error Code
Explanation of function and operation
1. 32-bit operation (DHSCT)
The current value of a high speed counter specified in S2 is compared with the data table shown below
which has (3m) points stored in S1 and later, and the operation output set value (ON or OFF) specified A
in the data table is output to D to D +n-1.
Information
Version Up
Command
input
FNC280 S1 m S2 D n
DHSCT
B
Execution Times
C
Instruction List
Applicable
711
FX3U/FX3UC Series Programmable Controllers 32 High Speed Processing 2 FNC280 to FNC289
Programming Manual - Basic & Applied Instruction Edition 32.1 FNC280 HSCT / High Speed Counter Compare With Data Table
...
...
m-2 S1 +3m-5, S1 +3m-6 S1 +3m-4
m-1 S1 +3m-2, S1 +3m-3 S1 +3m-1
Operation output setting When the current value of the high speed counter
= HA716 becomes equivalent to the comparison value, the
operation output setting pattern is output.
In the case of " D = :ON
Y000, n = K10" Y Y Y Y Y Y YYYY :OFF
0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0
1 0 7 6 5 4 3 2 1 0
D +n-1 D
1) When this instruction is executed, the data table is set as the comparison target.
2) When the current value of the high speed counter, specified in S2 , becomes equivalent to the
comparison value in the data table, the corresponding operation output specified in the data table is
output to D to D +n-1.
If an output (Y) is specified in D , the output processing is executed immediately without waiting for
the output refresh executed by the END instruction.
When specifying an output (Y), make sure that the least significant digit of the device number is 0.
Examples: Y000, Y010 and Y020
3) Immediately after step 2), 1 is added to the current table counter value D8138.
4) The next comparison point is set as the comparison target data.
5) Steps 2) and 3) are repeated until the current value of the table counter D8138 becomes "m".
When the current value becomes "m", the instruction execution complete flag M8138 turns ON, and the
execution returns to step 1). At this time, the table counter D8138 is reset to "0".
6) When the command contact is set to OFF, execution of the instruction is stopped and the table counter
D8138 is reset to 0.
712
FX3U/FX3UC Series Programmable Controllers 32 High Speed Processing 2 FNC280 to FNC289
Programming Manual - Basic & Applied Instruction Edition 32.1 FNC280 HSCT / High Speed Counter Compare With Data Table
31
Operation example
Transfer 3
Data
FNC275-FNC279
X010
FNC280 D200 K5 C235 Y010 K3
DHSCT
M8000
FNC 54
DHSCR
K900 C235 C235
32
Processing 2
High Speed
FNC280-FNC289
Comparison data SET/RESET pattern
Comparison Operation
Comparison Table counter D8138
point number Device Device output set
value
value
0 D201,D200 K321 D202 H0001 0
33
1 D204,D203 K432 D205 H0007 1
Register
Extension File
FNC290-FNC299
2 D207,D206 K543 D208 H0002 2
3 D210,D209 K764 D211 H0000 3
4 D213,D212 K800 D214 H0003 4 (Repeated from 0)
34
Current value
Programming
SFCSTL
of C235
900 900
900 800
800 764
675
543
764
543 35
Function
Interrupt
450 432 432
321
321
225
0
Command Time
36
contact
Special Device
X010 OFF
ON
Error Code
*1
Y012 OFF ON
4
HSCT table 3 3
counter 2 2
D8138 0 1 0 1 0
HSCT
A
Information
Version Up
instruction
execution
complete flag
M8138 OFF ON
2. Related device
Device Name Description
HSCT(FNC280) instruction
M8138 Turns ON when the operation for the final table No. "m-1" is completed.
execution complete flag
D8138 HSCT(FNC280) table counter Stores the comparison point number handled as the comparison target. C
Instruction List
Applicable
713
FX3U/FX3UC Series Programmable Controllers 32 High Speed Processing 2 FNC280 to FNC289
Programming Manual - Basic & Applied Instruction Edition 32.1 FNC280 HSCT / High Speed Counter Compare With Data Table
Cautions
This instruction can be executed only once in a program.
If this instruction is programmed two or more times, an operation error is caused by the second instruction
and later, and the instruction will not be executed. (error code: K6765)
This instruction constructs the data table at the END instruction of the first execution of the instruction.
Accordingly, the operation output works after the second scan and later.
With regard to DHSCT (FNC280), DHSCS (FNC 53), DHSCR (FNC 54) and DHSZ (FNC 55) instructions,
up to 32 instructions can be executed in one operation cycle. An operation error is caused by the 33rd
instruction and later, and the instruction will not be executed. (error code: K6705)
If an output (Y) is specified in D , the output processing is executed immediately without waiting for the
output refresh executed by END instruction.
When specifying an output (Y), make sure that the least significant digit of the device number is 0.
Examples: Y000, Y010 and Y020
When a high speed counter specified in S2 is indexed with index, all high speed counters are handled
as software counters.
For this instruction, only one comparison point (one line) is handled as the comparison target at one time.
Processing will not move to the next comparison point until the current counter value becomes equivalent
to the comparison point currently selected as the comparison target.
If the current value of a high speed counter executes up counting using the comparison data table shown
in the operation example on the previous page, make sure to execute the instruction while the current
value of the high speed counter is smaller than the comparison value in comparison point No. 1.
When the DHSCT instruction is used with a hardware counter (C235, C236, C237, C238, C239, C240,
C244 (OP), C245 (OP), C246, C248 (OP), C251, C253), the hardware counter is automatically switched to
a software counter, and the maximum frequency and total frequency are affected.
Errors
An operation error occurs in the following cases; The error flag M8067 turns ON, and the error code is stored
in D8067.
When any devices other than high speed counters C235 to C255 are specified in S2 (error code: K6706)
When the 3m-1th device from a device specified in S1 exceeds the last number of the device (error
code: K6706)
When the nth device from a device specified in D exceeds the last number of the device (error code:
K6706)
When this instruction is used two or more times in a program (error code: K6765)
With regard to DHSCT (FNC280), DHSCS (FNC 53), DHSCR (FNC 54) and DHSZ (FNC 55) instructions,
up to 32 instructions can be executed in one operation cycle. An operation error is caused by the 33rd
instruction and later, and the instruction will not be executed. (error code: K6705)
714
FX3U/FX3UC Series Programmable Controllers 32 High Speed Processing 2 FNC280 to FNC289
Programming Manual - Basic & Applied Instruction Edition 32.1 FNC280 HSCT / High Speed Counter Compare With Data Table
31
Program example
Transfer 3
Data
FNC275-FNC279
In the program shown below, the current value of C235 (counting X000) is compared with the comparison
data table set in R0 and later, and a specified pattern is output to Y010 to Y013.
M8000
M8235 C235 is used as an up counter.
32
M8000
Processing 2
High Speed
FNC280-FNC289
C235
K0
FNC 12 H0008 K1Y010 Initial output
MOVP
FNC 54
DHSCR
K400 C235 C235 Ring length: 0 to 400 33
Register
Extension File
FNC290-FNC299
FNC280 R0 K5 C235 Y010 K4
DHSCT
END
34
Programming
SFCSTL
Operation example
Comparison data SET/RESET pattern
Comparison Operation
Comparison Table counter D8138
point Device Device output set
value
value 35
0 R1,R0 K100 R2 H0007 0
Function
Interrupt
1 R4,R3 K150 R5 H0004 1
2 R7,R6 K200 R8 H0003 2
3 R10,R9 K250 R11 H0006 3
4 R13,R12 K300 R14 H0008 4 (Repeated from 0)
36
Special Device
400
300
250 37
200
Error Code
150
100
0
Time A
Y010 OFF ON
Information
Version Up
Y011 OFF ON
Y012 OFF ON
Y013 ON OFF
4
B
3 3
Execution Times
Table
counter 2 2
D8138 0 1 0 1
C
Instruction List
Applicable
715
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition
Section
290 LOADR LOADR S n Load From ER
33.1
Section
291 SAVER SAVER S m D Save to ER
33.2
Section
292 INITR INITR S n Initialize R and ER
33.3
Section
293 LOGR LOGR S m D1 n D2 Logging R and ER
33.4
Section
294 RWER RWER S n Rewrite to ER
33.5
Section
295 INITER INITER S n Initialize ER
33.6
296
297
298
299
716
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.1 FNC290 LOADR / Load From ER
31
33.1 FNC290 LOADR / Load From ER
Transfer 3
Data
FNC275-FNC279
Outline
This instruction reads the current values of extension file registers (ER) stored in a memory cassette (flash
memory), and transfers them to extension registers (R) stored in the PLC's built-in RAM.
32
Processing 2
High Speed
FNC280-FNC289
1. Instruction format
FNC 290 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
Register
Extension File
FNC290-FNC299
2. Set data
Operand Type Description Data Type
Device number of extension register (transfer destination) to which data is to be
S
transferred 34
(The extension file register having the same number is handled as the data 16-bit binary
Programming
SFCSTL
transfer source.)
n Number of points to be read (transferred) [0 n 32767]
3. Applicable devices
Oper-
Bit Devices Word Devices Others 35
Special Con- Real Charac-
Function
Interrupt
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3
n 3 3 3
36
Special Device
Explanation of function and operation
1. 16-bit operation (LOADR and LOADRP)
The contents (current values) of extension file registers (ER) stored in a memory cassette (flash memory)
having the same numbers with the extension registers specified by S to S +n-1 are read, and
transferred to the extension registers specified by S to S +n-1 stored in the PLC's built-in RAM.
37
Error Code
Command
input
FNC290 S n
LOADRP
E S S
E S +1 S +1
E S +2 S +2
E S +3 S +3
B
Execution Times
E S +n-2 S +n-2
E S +n-1 S +n-1
Reading and transfer are executed in units of device. Up to 32768 devices can be read and transferred. C
Different from SAVER (FNC291), INITR (FNC292) and LOGR (FNC293) instructions, it is not necessary to
Instruction List
Applicable
717
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.1 FNC290 LOADR / Load From ER
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the last device number to be transferred exceeds 32767 (error code: K6706)
At this time, devices up to the last one (R32767) are read and transferred.
When a memory cassette is not connected (error code: K6771)
Program example
In the program example shown below, the contents (current value) of 4000 extension file registers ER1 to
ER4000 inside the memory cassette are read, and transferred to 4000 extension registers R1 to R4000 inside
the built-in RAM.
M0
FNC290 R1 K4000
LOADR
718
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.2 FNC291 SAVER / Save to ER
31
33.2 FNC291 SAVER / Save to ER
Transfer 3
Data
FNC275-FNC279
Outline
This instruction writes the current values of extension registers (R) stored in the PLC's built-in RAM to
extension file registers (ER) stored in a memory cassette (flash memory) in units of sector (2048 points).
32
Processing 2
High Speed
FNC280-FNC289
RWER (FNC294) instruction provided in FX3UC PLCs Ver.1.30 or later and FX3U PLCs writes (transfers) only
arbitrary number of points. It is not necessary to execute INITR (FNC292) or INITER (FNC295) instruction
every time when RWER instruction is used.
For RWER instruction, refer to Section 33.5.
1. Instruction format 33
Register
Extension File
FNC290-FNC299
FNC 291 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
2. Set data
34
Programming
SFCSTL
Operand Type Description Data Type
Device number of extension register to which data is to be written
S (Only the head device number of a sector of extension registers can be
specified.)
16-bit binary
n Number of points written (transferred) in one operation cycle [0 n 2048] 35
D Device number storing the number of already written points
Function
Interrupt
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and
Type
System User Digit Specification System User
Unit
Index
stant Number ter String
Pointer
36
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
Special Device
S 3 3
n 3 3
D 3 3
37
Explanation of function and operation
Error Code
1. 16-bit operation (SAVER)
The contents (current values) of extension registers (R) specified by S to S +2047 are written
(transferred) to extension file registers (ER) inside a memory cassette (flash memory) having the same
device numbers in 2048/n operation cycles (2048/n+1 cycles if there is the remainder). A
While the instruction is being executed, the number of already written points is stored in D .
Information
Version Up
Command
input
FNC291 S n D
SAVER
Instruction execution complete flag
M8029
M{{ Instruction execution complete
B
flag for SAVER instruction
Execution Times
C
Instruction List
Applicable
719
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.2 FNC291 SAVER / Save to ER
S +1 E S +1
S +2 E S +2
S +2047 E S +2047
2. Related device
For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Device
Name Description
number
When execution of the target instruction is completed, the instruction execution
complete flag M8029 turns ON.
Instruction execution In a program, however, there may be two or more instructions which can use the
M8029
complete flag flag M8029. To avoid confusion, make sure to use the NO contact of this flag
immediately under SAVER instruction so that this flag works only for SAVER
instruction.
Cautions
1. Cautions on writing data to a memory cassette
Memory cassettes adopt flash memory. Note the following contents when writing data to extension file
registers in a memory cassette with the FNC291 instruction.
It takes about 340ms to write 2048 points. If n is set to K0 or K2048, the operation cycle for executing this
instruction becomes longer than about 340ms.
If the operation cycle is severely affected, write data in two or more operation cycles.
When writing data in two or more operation cycles, set n in the range from K1 to K1024.
720
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.2 FNC291 SAVER / Save to ER
31
Do not abort execution of this instruction in the middle of operation. If execution is aborted, unexpected
Transfer 3
Data
FNC275-FNC279
data may be written to extension file registers.
If execution of this instruction is aborted by turning OFF the power, execute the instruction again using step
2 described below after turning ON the power again.
Write
command
SET M{{ 32
Processing 2
High Speed
FNC280-FNC289
M{{
FNC295 S n
INTERP
FNC291 S n D
SAVER
Instruction execution complete flag 33
M8029
Register
Extension File
FNC290-FNC299
RST M{{
Execute INITER (FNC295) or INITR (FNC292) instruction to target extension file registers (ER) before
executing SAVER instruction. If SAVER instruction is driven before INITER (FNC295) or INITR (FNC292)
instruction is executed, an operation error (error code: K6770) may be caused. 34
To avoid such an operation error, make a program for executing SAVER instruction in the following
Programming
SFCSTL
sequence:
[1] When storing data of 2048 extension registers (R) in one sector to
extension file registers (ER) 35
1) Execute INITER (FNC295) instruction to extension file registers (ER) specified as targets in
Function
Interrupt
SAVER instruction.
2) Execute SAVER instruction.
[2] When storing the contents of an arbitrary number of extension registers (R) to extension file
registers (ER)
Use RWER instruction.
36
Special Device
For RWER (FNC294) instruction, refer to Section 33.5.
[1] When storing data of 2048 extension registers (R) in one sector to
extension file registers (ER)
If the extension registers (R) have data to be stored in extension file registers (ER), use the procedure
37
Error Code
[2].
1) Execute INITR (FNC292) instruction to extension registers (R) and extension file registers (ER)
specified as targets in SAVER instruction.
2) Store data to extension registers (R) specified as targets.
3) Execute SAVER instruction. A
Information
Version Up
[2] When storing data of 2048 extension registers (R) in one sector to extension file registers (ER)
1) Temporarily withdraw the data of extension registers (R) specified as targets in SAVER instruction
to data registers or unused 2048 extension registers (R) by using BMOV (FNC 15) instruction.
2) Execute INITR (FNC292) instruction to extension registers (R) and extension file registers (ER)
specified as targets in SAVER instruction.
3) Return the data of 1024 points temporarily withdrawn in step 1) to extension registers (R) specified
B
Execution Times
C
Instruction List
Applicable
721
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.2 FNC291 SAVER / Save to ER
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When any device number other than the head device number of a sector of extension file registers is set to
S (error code: K6706)
When a memory cassette is not connected (error code: K6771)
When the protect switch of the memory cassette is set to ON (error code: K6770)
When the collation result after data writing is "mismatch" due to omission of initialization or for another
reason (error code: K6770)
When this error occurs, the current values (data) of extension registers (R) may be lost. To avoid the data
loss, back up the data of extension registers (R) in advance using the following procedure:
1)Set the PLC mode to STOP.
2)Create a new project in GX Developer.
This step is not necessary if it is alright to overwrite the current project.
3)Read the contents of extension registers (R) to GX Developer.
[1]Select Online Read from PLC..." to
display the Read from PLC window.
[2]Click PLC parameter and Device data
FX3U(C)*1
to put a check mark to each of them.
[3]Click [Execute] button to execute reading.
[4]When reading is completed, save the
project.
4)Change the current program inside the PLC to
the program shown in 1. Cautions on writing
data to a memory cassette in Cautions on
the previous page.
722
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.2 FNC291 SAVER / Save to ER
31
Program examples
Transfer 3
Data
FNC275-FNC279
1) In the case of FX3UC PLCs Ver. 1.30 or later and FX3U PLCs Ver. 2.20 or later
In the example shown below, only extension registers R10 to R19 (in sector 0) need to be updated in the
extension file registers (ER). When X000 is set to ON, sector 0 (head device R0) is written to the
32
Processing 2
High Speed
FNC280-FNC289
extension file registers 128 points at a time. (128 points are written in one operation cycle)
Program
X000
SET M0
33
M0
Register
Extension File
FNC290-FNC299
FNC295 R0 K1 (1)
INITERP
FNC 07
WDTP
Programming
SFCSTL
Instruction execution complete flag
M8029
RST M0
END 35
Function
Interrupt
Operation
Special Device
R0 K100 ER0 K100 ER0 HFFFF
R1 K105 ER1 K105 ER1 HFFFF
. . . . . .
. . . . . .
.
R10 K200
. .
ER10
.
K300
.
ER10
.
HFFFF
37
Error Code
Changed data
. . . . . .
. . . . . .
R99 K1000 ER99 K1000 ER99 HFFFF
R100 HFFFF ER100 HFFFF ER100 HFFFF
. . . . . .
Unused
. . . . . .
. . . . . . B
R2047 HFFFF ER2047 HFFFF ER2047 HFFFF
Execution Times
C
Instruction List
Applicable
723
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.2 FNC291 SAVER / Save to ER
Changed data
724
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.2 FNC291 SAVER / Save to ER
31
2) In the case of FX3UC PLCs former than Ver.1.30
Transfer 3
Data
FNC275-FNC279
In the program example shown below, the changed content settings of the extension registers R10 to
R19 (sector 0) are reflected on extension file registers (ER) when X000 is set to ON. (128 points are
written in one operation cycle.) 32
Processing 2
High Speed
FNC280-FNC289
Program
X000
SET M0
M0
FNC 15 R0 R30720 K100 (1)
33
BMOVP
Register
Extension File
FNC290-FNC299
FNC292 R0 K1 (2)
INITRP
FNC 07
WDTP
34
FNC 15 R30720 R0 K100
Programming
SFCSTL
(3)
BMOVP
Function
Interrupt
END
Operation 36
Special Device
Setting data Setting backup data Temporarily withdrawn data*1
Extension file registers Unused extension
Extension registers (R) (ER) registers
Device number Current Device number Current Device number Current
value value value
R0 K100 ER0 K100 R30720 K100
37
R1 K105 ER1 K105 R30721 K105
Error Code
. . . . . .
. . . . . .
. . . . . .
Setting data (A)
. . . . BMOV . .
. . . . instruction . . instruction
R19 K350 ER19 K400 R30739 K350
. . . . . .
. . . . . .
. . . . . .
R99 K1000 ER99 K1000 R30819 K1000 B
R100 HFFFF ER100 HFFFF
Execution Times
C
Instruction List
Applicable
725
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.2 FNC291 SAVER / Save to ER
726
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.3 FNC292 INITR / Initialize R and ER
31
33.3 FNC292 INITR / Initialize R and ER
Transfer 3
Data
FNC275-FNC279
Outline
This instruction initializes (to HFFFF <K-1>) extension registers (R) in the RAM built in a PLC and extension
file registers in a memory cassette (flash memory) before data logging by LOGR (FNC293) instruction.
32
Processing 2
High Speed
FNC280-FNC289
In FX3UC PLCs former than Ver.1.30, use this instruction to initialize extension file registers (ER) before
writing data to them using SAVER (FNC291) instruction.
In FX3UC PLCs Ver.1.30 or later and FX3U PLCs, INITER (FNC295) instruction is also provided to initialize (to
"HFFFF" <K-1>) only extension file registers (ER) in a memory cassette (flash memory) in units of sector.
For SAVER (FNC291) instruction, refer to Section 33.2.
For LOGR (FNC293) instruction, refer to Section 33.4. 33
For INITER (FNC295) instruction, refer to Section 33.6.
Register
Extension File
FNC290-FNC299
1. Instruction format
FNC 292 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
INITR P INITR
34
Continuous
5 steps Operation
INITRP Pulse (Single)
Programming
SFCSTL
Operation
2. Set data
Operand Type Description Data Type
*1
Device number of extension register and extension file register to be initialized 35
S It is possible to specify only the head device number in a sector of extension
Function
Interrupt
registers. 16-bit binary
Number of sectors of extension registers and extension file registers to be
n
initialized
*1. When a memory cassette is not used, extension file registers (ER) are not initialized.
36
3. Applicable devices
Special Device
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3 37
Error Code
n 3 3
sectors of extension file registers in a memory cassette (flash memory) having the same device numbers are
initialized (to HFFFF <K-1>).
Initialization is executed in units of sector.
Command
input
FNC292
INITRP
S n B
Execution Times
C
Instruction List
Applicable
727
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.3 FNC292 INITR / Initialize R and ER
The table below shows the head device number in each sector:
Sector Head device Sector Head device
Initialized device range Initialized device range
number number number number
R0 to R2047, R16384 to R18431,
Sector 0 R0 Sector 8 R16384
ER0 to ER2047 ER16384 to ER18431
R2048 to R4095, R18432 to R20479,
Sector 1 R2048 Sector 9 R18432
ER2048 to ER4095 ER18432 to ER20479
R4096 to R6143, R20480 to R22527,
Sector 2 R4096 Sector 10 R20480
ER4096 to ER6143 ER20480 to ER22527
R6144 to R8191, R22528 to R24575,
Sector 3 R6144 Sector 11 R22528
ER6144 to ER8191 ER22528 to ER24575
R8192 to R10239, R24576 to R26623,
Sector 4 R8192 Sector 12 R24576
ER8192 to ER10239 ER24576 to ER26623
R10240 to R12287, R26624 to R28671,
Sector 5 R10240 Sector 13 R26624
ER10240 to ER12287 ER26624 to ER28671
R12288 to R14335, R28672 to R30719,
Sector 6 R12288 Sector 14 R28672
ER12288 to ER14335 ER28672 to ER30719
R14336 to R16383, R30720 to R32767,
Sector 7 R14336 Sector 15 R30720
ER14336 to ER16383 ER30720 to ER32767
...
...
...
...
...
S +(2048n)-1 HABCD HFFFF S +(2048n)-1 HCDEF HFFFF
Caution
When a memory cassette is attached, 18 ms is required to initialize one sector.
(When a memory cassette is not attached, only 1 ms or less is required to initialize one sector.)
When initializing two or more sectors, take either measures shown below.
Set a large value to the watchdog timer D8000 using the following program
Initial pulse
M8002
FNC 12 K{{{ D8000
MOV
728
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.3 FNC292 INITR / Initialize R and ER
31
Guideline of the watchdog timer set value
Transfer 3
Data
FNC275-FNC279
A value acquired by the following procedure can be regarded as the guideline of the watchdog timer set
value.
If an acquired value is 200 ms or less, however, it is not necessary to change the watchdog timer set value.
1) Write a program to be executed from GX Developer to the PLC.
[Online][Write to PLC...]
32
Processing 2
High Speed
FNC280-FNC289
2) Set the current value of D8000 (unit: ms) to "1000" using the device test function in GX Developer.
[Online][Debug][Device test...] "Word device/buffer memory" in Device test dialogbox
3) Set the PLC mode to RUN, and execute the program. (Execute this instruction also.)
4) Monitor the maximum scan time D8012 (unit: 0.1ms) using the device batch monitoring function in GX
Developer. 33
5) Set the watchdog timer to the maximum scan time (D8012) or more.
Register
Extension File
FNC290-FNC299
D8012 stores the maximum scan time in increments of 0.1 ms.
Rough guide to the watchdog timer set value D8000 (unit: ms) is the "value stored in D8012 divided by
10" added by 50 to 100.
Setting WDT (FNC 07) instruction just before and after INITR instruction as shown below:
Command
34
Programming
SFCSTL
input
FNC 07
WDT The watchdog timer is reset.
FNC292 S n
INITR
FNC 07
The watchdog timer is reset.
35
WDT
Function
Interrupt
If the processing time of the INITR command exceeds 200ms, set the watchdog timer value D8000 (unit: ms)
to the proceessing time or more.
Errors 36
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
Special Device
stored in D8067.
When any device number other than the head device number of a sector of extension file registers is set to
S (error code: K6706)
When a device number to be initialized exceeds "32767" (error code: K6706)
In this case, devices up to R32767 (ER32767) are initialized.
37
Error Code
When the protect switch of the memory cassette is set to ON (error code: K6770)
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
729
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.3 FNC292 INITR / Initialize R and ER
Program example
In the program example shown below, the extension registers R0 to R2047 in the sector 0 are initialized.
Note that the extension file registers ER0 to ER2047 are also initialized if a memory cassette is attached.
X000
FNC 07
WDT
FNC292 R0 K1
INITR
FNC 07
WDT
END
...
...
730
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.4 FNC293 LOGR / Logging R and ER
31
33.4 FNC293 LOGR / Logging R and ER
Transfer 3
Data
FNC275-FNC279
Outline
This instruction logs specified devices, and stores the logged data to extension registers (R) in the RAM and
extension file registers (ER) in a memory cassette.
32
Processing 2
High Speed
FNC280-FNC289
1. Instruction format
FNC 293 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
LOGR P 11 steps
LOGR Continuous
33
Operation
LOGRP Pulse (Single)
Operation
Register
Extension File
FNC290-FNC299
2. Set data
Operand Type Description Data Type
logged*1
S
m
Head device number to be
Number of devices to be logged [1 m 8000]
34
Programming
SFCSTL
D1 Head device number used in logging 16-bit binary
n Number of sectors of devices used in logging [1 n 16]
D2 Number of logged data
Function
Interrupt
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P 36
S 3 3 3 3
Special Device
m 3 3 3
D1 3
n 3 3
D2 3 3 37
Error Code
Explanation of function and operation
1. 16-bit operation (LOGR and LOGRP)
While the instruction is driven, m devices starting from S are logged until n sectors of extension
registers (R) starting from D1 and extension file registers (ER) in a memory cassette are filled. A
The number of logged data is stored to D2 .
Information
Version Up
If a memory cassette is not used, data is not written to extension file registers (ER).
Command
input
FNC293 S m D1 n D2
LOGRP
B
Execution Times
C
Instruction List
Applicable
731
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.4 FNC293 LOGR / Logging R and ER
D1 +m
Destination storing 2nd logging data
to D1 = 2m
S to S +m-1
D1 +2m-1
D1 +2m Data writing
Destination storing 3rd logging data
to D1 = 3m area
D1 +3m-1 1926 n
. . . Logging data
. . . storage area
. . . 2048 n
. . .
. . .
. . .
. . .
The table below shows the head device number in each sector:
Sector Head device Sector Head device
Written device range Written device range
number number number number
R0 to R2047, R16384 to R18431,
Sector 0 R0 Sector 8 R16384
ER0 to ER2047 ER16384 to ER18431
R2048 to R4095, R18432 to R20479,
Sector 1 R2048 Sector 9 R18432
ER2048 to ER4095 ER18432 to ER20479
R4096 to R6143, R20480 to R22527,
Sector 2 R4096 Sector 10 R20480
ER4096 to ER6143 ER20480 to ER22527
R6144 to R8191, R22528 to R24575,
Sector 3 R6144 Sector 11 R22528
ER6144 to ER8191 ER22528 to ER24575
R8192 to R10239, R24576 to R26623,
Sector 4 R8192 Sector 12 R24576
ER8192 to ER10239 ER24576 to ER26623
R10240 to R12287, R26624 to R28671,
Sector 5 R10240 Sector 13 R26624
ER10240 to ER12287 ER26624 to ER28671
R12288 to R14335, R28672 to R30719,
Sector 6 R12288 Sector 14 R28672
ER12288 to ER14335 ER28672 to ER30719
R14336 to R16383, R30720 to R32767,
Sector 7 R14336 Sector 15 R30720
ER14336 to ER16383 ER30720 to ER32767
732
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.4 FNC293 LOGR / Logging R and ER
31
Cautions
Transfer 3
Data
FNC275-FNC279
LOGR instruction executes logging in each operation in the continuous operation type.
When logging should be executed only once by one input, use the pulse operation type.
Caution on using a memory cassette
Flash memory is adopted in a memory cassette. Make sure to initialize the data storage area in units of
sector before starting logging. 32
If LOGR instruction is executed without initializing the data storage area, an operation error (error code:
Processing 2
High Speed
FNC280-FNC289
K6770) may be caused.
Logging data storage area initialization
command input
FNC292 *1 *2
D1 n
INITR
33
Register
Extension File
FNC290-FNC299
*1 Specify the same device as D1 in LOGR instruction.
*2 Specify the same number as (n) in LOGR instruction.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is 34
stored in D8067.
Programming
SFCSTL
When any device number other than the head device number of a sector of extension file registers is set to
S (error code: K6706)
While data is written, the remaining area and the data quantity to be written are compared with each other.
If the remaining storage area is insufficient, only a limited amount of data is written. (error code: K6706)
35
When the protect switch of the memory cassette is set to ON (error code: K6770)
Function
Interrupt
When the collation result after data writing is "mismatch" due to omission of initialization or for another
reason (error code: K6770)
When this error occurs, the current values (data) of extension registers (R) may be lost. To avoid the data
loss, back up the data of extension registers (R) in advance using the following procedure:
1)Set the PLC mode to STOP. 36
Special Device
2)Create a new project in GX Developer.
This step is not necessary if it is alright to overwrite the current project.
3)Read the contents of extension registers (R) to GX Developer.
[1]Select "Online" "Read from PLC..." to
display "Read from PLC" window.
[2]Click "Parameter" and "Device data" to 37
FX3U(C)*1
put a check mark next to each of them.
Error Code
[3]Click [Execute] button to execute reading.
[4]When reading is completed, save the
project.
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
733
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.4 FNC293 LOGR / Logging R and ER
4)Change the current program inside the PLC to the program shown in Cautions on using a memory
cassette in Cautions on the previous page.
5)To the PLC, write the data which was temporarily withdrawn to GX Developer.
[1]Select Online Write to PLC... to
display the Write to PLC window.
[2]Click PLC parameter and MAIN to put
FX3U(C)*2
a check mark to each of them.
[3]Click [Execute] button to execute writing.
734
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.4 FNC293 LOGR / Logging R and ER
31
Program example
Transfer 3
Data
FNC275-FNC279
In the program example shown below, D1 and D2 are logged to the area from R2048 to R6143 every time
X001 turns ON.
X001
FNC293 D1 K2 R2048 K2 D100
LOGRP 32
Processing 2
High Speed
FNC280-FNC289
X001 X001
Initial value OFFON OFFON
1st time 2nd time
R2048 HFFFF H1234 H1234
R2049 HFFFF H5678 H5678 33
Register
Extension File
FNC290-FNC299
R2050 HFFFF HFFFF H9ABC
R2051 HFFFF HFFFF H1122 Data writing
R2052 HFFFF HFFFF HFFFF area
Programming
SFCSTL
OFF (0).
Function
Interrupt
two bits are set to
OFF (0). control area
36
Special Device
D1 H1234 D1 H9ABC
D2 H5678 D2 H1122
Error Code
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
735
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.5 FNC294 RWER / Rewrite to ER
Outline
This instruction writes the current values of an arbitrary number of extension registers (R) in the PLCs built-in
RAM to extension file registers (ER) in a memory cassette (flash memory).
Because RWER (FNC294) instruction is not supported in FX3UC PLCs former than Ver.1.30, use SAVER
(FNC291) instruction instead.
For SAVER (FNC291) instruction, refer to Section 33.2.
1. Instruction format
FNC 294 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
RWER P 5 steps
RWER Continuous
Operation
RWERP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
S Device number of extension register storing data
16-bit binary
n Number of written (transferred) devices [0 n 32767]
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3
n 3 3 3
S +1 E S +1
S +2 E S +2
S +n-1 E S +n-1
736
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.5 FNC294 RWER / Rewrite to ER
31
Cautions
Transfer 3
Data
FNC275-FNC279
1. Cautions on writing data to a memory cassette
Memory cassettes adopt flash memory. Note the following contents when writing data to extension file
registers in a memory cassette with the FNC294 instruction.
Though extension file registers to be written can be specified arbitrarily, writing is executed in units of 32
sector.
Processing 2
High Speed
FNC280-FNC289
It takes about 47 ms to write one sector. If the extension file registers to be written are located in two
sectors, the instruction execution time will be about 94 ms.
Make sure to change the set value of the watchdog timer D8000 before executing this instruction.
Writing command input
PLS M100 33
Register
Extension File
FNC290-FNC299
M100
FNC 12 D8000 D200
MOV
FNC 07
34
Programming
SFCSTL
WDT
FNC294 R1000 K100 The contents of R1000 to R1099 in the sector 0 are
RWER written to ER1000 to ER1099.
D200 D8000
MOV
35
Function
Interrupt
FNC 07
WDT
The table below shows the head device number in each sector:
Sector number Device range Sector number Device range
Sector 0 ER0 to ER2047 Sector 8 ER16384 to ER18431 36
Special Device
Sector 1 ER2048 to ER4095 Sector 9 ER18432 to ER20479
Sector 2 ER4096 to ER6143 Sector 10 ER20480 to ER22527
Sector 3 ER6144 to ER8191 Sector 11 ER22528 to ER24575
Sector 4 ER8192 to ER10239 Sector 12 ER24576 to ER26623
Sector 5 ER10240 to ER12287 Sector 13 ER26624 to ER28671 37
Sector 6 ER12288 to ER14335 Sector 14 ER28672 to ER30719
Error Code
Sector 7 ER14336 to ER16383 Sector 15 ER30720 to ER32767
Do not turn OFF the power while this instruction is being executed. If the power is turned OFF, execution
of this instruction may be aborted. If execution is aborted, the data may be lost. Make sure to back up the
data before executing this instruction.
For the backup method, refer to the next page. A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
737
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.5 FNC294 RWER / Rewrite to ER
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When the last device number to be transferred exceeds 32767 (error code: K6706)
When a memory cassette is not connected (error code: K6771)
When the protect switch of the memory cassette is set to ON (error code: K6770)
738
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.5 FNC294 RWER / Rewrite to ER
31
Program example
Transfer 3
Data
FNC275-FNC279
In the program example shown below, the contents of extension registers R10 to R19 (sector 0) used for
setting data are reflected on extension file registers (ER) when X000 turns ON.
Program
X000 32
PLS M0
Processing 2
High Speed
FNC280-FNC289
M0
MOV D8000 D200
Register
Extension File
FNC290-FNC299
FNC 07
WDT
Programming
SFCSTL
FNC 07
WDT
END
35
Function
Interrupt
Operation
Setting data Setting backup data
Extension registers (R) Extension file registers
(ER)
Device number Current Device number Current
value value 36
R0 K100 ER0 K100
Special Device
R1 K105 ER1 K105
. . . .
. . . .
. . . .
Setting data (A)
Error Code
R12 K400 ER12 K400
. . Write . .
. . . .
. . (when X000 . .
R19 K350 turns ON) ER19 K350
. . . .
.
.
.
.
.
.
.
. A
R99 K1000 ER99 K1000
Information
Version Up
. . . .
. . . .
. . . .
R2047 HFFFF ER2047 HFFFF
B
Execution Times
C
Instruction List
Applicable
739
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.6 FNC295 INITER / Initialize ER
Outline
This instruction initializes extension file registers (ER) to HFFFF (<K-1>) in a memory cassette (flash
memory) before executing the SAVER (FNC291) instruction.
Because the INITER (FNC295) instruction is not supported in FX3UC PLCs earlier than Ver.1.30, use INITR
(FNC292) instruction instead.
For SAVER (FNC291) instruction, refer to Section 33.2.
For INITR (FNC292) instruction, refer to Section 33.3.
1. Instruction format
FNC 295 16-bit Instruction Mnemonic Operation Condition 32-bit Instruction Mnemonic Operation Condition
INITER P 5 steps
INITER Continuous
Operation
INITERP Pulse (Single)
Operation
2. Set data
Operand Type Description Data Type
Head device number of extension register sector with the same device number
S
as the extension file register to be initialized 16-bit binary
n Number of sectors of extension file registers to be initialized
3. Applicable devices
Bit Devices Word Devices Others
Oper-
Special Con- Real Charac-
and System User Digit Specification System User Index Pointer
Unit stant Number ter String
Type
X Y M T C S D.b KnX KnY KnM KnS T C D R U\G V Z Modify K H E "" P
S 3 3
n 3 3
The table below shows the head device number in each sector:
Sector Head device Sector Head device
Initialized device range Initialized device range
number number number number
Sector 0 R0 ER0 to ER2047 Sector 8 R16384 ER16384 to ER18431
Sector 1 R2048 ER2048 to ER4095 Sector 9 R18432 ER18432 to ER20479
Sector 2 R4096 ER4096 to ER6143 Sector 10 R20480 ER20480 to ER22527
Sector 3 R6144 ER6144 to ER8191 Sector 11 R22528 ER22528 to ER24575
Sector 4 R8192 ER8192 to ER10239 Sector 12 R24576 ER24576 to ER26623
Sector 5 R10240 ER10240 to ER12287 Sector 13 R26624 ER26624 to ER28671
Sector 6 R12288 ER12288 to ER14335 Sector 14 R28672 ER28672 to ER30719
Sector 7 R14336 ER14336 to ER16383 Sector 15 R30720 ER30720 to ER32767
740
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.6 FNC295 INITER / Initialize ER
31
Operation
Transfer 3
Data
FNC275-FNC279
Extension file registers (ER) [inside the memory cassette]
Current value
Device number
Before execution After execution
S H1234 HFFFF 32
H5678 HFFFF
Processing 2
High Speed
FNC280-FNC289
S +1
S +2 H90AB HFFFF
...
...
...
S +(2048n)-1 HCDEF HFFFF
33
Caution
Register
Extension File
FNC290-FNC299
About 25 ms is required to initialize one sector.
When initializing two or more sectors, take either measure shown below.
Set a large value to the watchdog timer D8000 using the following program
Initial pulse 34
M8002
Programming
SFCSTL
FNC 12 K{{{ D8000
MOV
Function
Interrupt
If an acquired value is 200 ms or less, however, it is not necessary to change the watchdog timer set value.
1) Write a program to be executed from GX Developer to the PLC.
[Online][Write to PLC...]
2) Set the current value of D8000 (unit: ms) to "1000" using the device test function in GX Developer.
[Online][Debug][Device test...] "Word device/buffer memory" in Device test dialogbox 36
3) Set the PLC mode to RUN, and execute the program. (Execute this instruction also.)
Special Device
4) Monitor the maximum scan time D8012 (unit: 0.1ms) using the device batch monitoring function in GX
Developer.
5) Set the watchdog timer to the maximum scan time (D8012) or more.
D8012 stores the maximum scan time in increments of 0.1 ms.
Rough guide to the watchdog timer set value D8000 (unit: ms) is the "value stored in D8012 divided by 37
10" added by 50 to 100.
Error Code
Setting WDT (FNC 07) instruction just before and after INITER instruction as shown below:
Command
input
FNC 07
WDT The watchdog timer is reset.
A
FNC295
Information
Version Up
S n
INITER
FNC 07
The watchdog timer is reset.
WDT
If the processing time of the INITER command exceeds 200ms, set the watchdog timer value D8000 (unit: B
ms) to the processing time or more.
Execution Times
C
Instruction List
Applicable
741
FX3U/FX3UC Series Programmable Controllers 33 Extension File Register Control FNC290 to FNC299
Programming Manual - Basic & Applied Instruction Edition 33.6 FNC295 INITER / Initialize ER
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
When any device number other than the head device number of a sector of extension file registers (ER) is
set to S (error code: K6706)
When a device number to be initialized exceeds 32767 (error code: K6706)
In this case, devices up to R32767 (ER32767) are initialized.
When the protect switch of the memory cassette is set to ON (error code: K6770)
When a memory cassette is not connected (error code: K6771)
Program example
In the program example shown below, the extension file registers ER0 to ER2047 in sector 0 are initialized.
X000
FNC 07
WDT
FNC295 R0 K1
INITER
FNC 07
WDT
END
...
...
742
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
Transfer 3
Data
FNC275-FNC279
34. SFC Program and Step Ladder
This chapter explains the programming procedures and sequence operations for the SFC and step ladder 32
programming methods in GX Developer.
Processing 2
High Speed
FNC280-FNC289
34.1 SFC Program
34.1.1 Outline
33
Register
Extension File
FNC290-FNC299
Sequence control using the SFC (sequential function chart) is available in FX PLCs.
In SFC programs, the role of each process and the overall control flow can be expressed easily based on
machine operations, so sequence design is easy. Accordingly, machine operations can be easily transmitted
to any person, and created programs are efficient in maintenance, specifications changes and actions against
problems. 34
When SFC programs and step ladder instructions are programmed conforming to the same rules, they are
Programming
SFCSTL
compatible with each other.
As a result, the same contents can be handled in relay ladder charts which are familiar and easy to
understand.
Function
Interrupt
In SFC programs, a state relay State S is regarded as one control process, and the input conditions and
output control sequence are programmed in each process.
Because the preceding process is stopped when the program execution proceeds to the next process, a
machine can be controlled using simple sequences for each process.
Special Device
In SFC programs, each process performed by the machine is expressed by a state relay.
When a state relay turns ON, a connected circuit (internal circuit) is activated.
When a state relay turns OFF, a connected internal circuit is deactivated.
After one operation cycle, non-driving of an instruction (jump status) is not available.
When a condition (transfer condition) provided between state relays is satisfied, the next state relay turns 37
ON, and the state relay which has been ON so far turns OFF (transfer operation).
Error Code
In the state relay ON status transfer process, both state relays are ON only momentarily (for one operation
cycle).
In the next operation cycle after the ON status is transferred to the next state relay, the former state is reset
to OFF.
When the transfer state relay S is used in a contact instruction, however, the contact image is executed in
the OFF status immediately after the transfer condition is satisfied.
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
743
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
1. Operation example
Start
Moving
forward LS1
1) When the start pushbutton switch is pressed, the truck moves forward. When the limit switch LS1 turns
ON, the truck immediately starts to move backward.
(The limit switch LS1 is normally OFF, and turns ON when the truck reaches the forward limit. Other limit
switches function in the same way.)
2) When the truck moves backward and the limit switch LS2 turns ON, the truck stops for 5 seconds, and
then starts to move forward again. When the limit switch LS3 turns ON, the truck immediately starts to
move backward.
3) When LS2 turns ON after that, the truck driving motor stops.
4) When the start pushbutton switch is pressed again after a series of operations finish, the above operation
is repeated.
744
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
2. Creating a process drawing
Transfer 3
Data
FNC275-FNC279
Create the process drawing shown on the right using
the following procedure: Initial
process
Processing 2
High Speed
FNC280-FNC289
process MC1 is driven.
operation from top to bottom.
2) Connect each process with vertical lines, and Limit switch for minor
LS1 forward movement
write the condition for each proceeding process.
Register
Extension File
FNC290-FNC299
LS2 movement
3) Write the operation performed in each process on
the right side of each rectangle indicating a Stop
process Stop timer
process.
Timer
34
3rd Truck moves forward.
Programming
SFCSTL
process MC1 is driven.
Function
Interrupt
LS2 Limit switch for backward
movement
36
Special Device
37
Error Code
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
745
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
3. Assigning devices
Assign devices of a PLC in the created process drawing.
In this example, only the SFC program creating procedure is explained. In practical cases, a circuit for setting
the initial state relay to ON is required to execute the SFC program.
Create a circuit for setting the initial state relay to ON using the relay ladder.
At this time, use SET instruction to set the initial state relay to ON.
Initial pulse
M8002
SET S0
746
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
4. Inputting and indicating a program using GX Developer
Transfer 3
Data
FNC275-FNC279
Input a circuit for setting the initial state relay to ON using the relay ladder.
In this example, the initial state relay S0 is set to ON in a ladder block using the special auxiliary relay
M8002 which turns ON momentarily when the PLC mode is changed from STOP to RUN.
When inputting a program using GX Developer, write a relay ladder program to a ladder block, and write an
SFC program to an SFC block. 32
Processing 2
High Speed
FNC280-FNC289
Programs expressing operations in state relays and transfer conditions are handled as internal circuits of
the state relays and transfer conditions.
Create each one using a relay ladder.
Register
Extension File
FNC290-FNC299
belonging to SFC to a Ladder block SET S0 relay to ON
ladder block using a
relay ladder. Indicate the state relay number and
transfer condition number.
Write an SFC program
to an SFC block. SFC block 0
X000
34
0 TRAN
Programming
SFCSTL
Y023
20 Y021
X001
1 TRAN
Y021
35
21 Y023
Function
Interrupt
X002
2 TRAN
Input them as
22 T0
K50 internal circuits. 36
T0
Special Device
3 TRAN
Y023
23 Y021
X003
4 TRAN
37
Y021
Error Code
24 Y023
X002
5 TRAN
S0
When a program is input using GX Developer,
A
RET END
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
747
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
SFC block 0
X000
0 TRAN
Y023
20 Y021
X001
1 TRAN
X003
4 TRAN
Y021
24 Y023
X002
5 TRAN
S0
RET END
748
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
34.1.5 Latched (battery backed) type state relays
Transfer 3
Data
FNC275-FNC279
In the latched (battery backed) type state relays S , the ON/OFF status is backed up by the battery
against power failure.
Use this type of state relays if the operation should be restarted from the last point at power recovery after
power failure occurred in the middle of machine operations. 32
Processing 2
High Speed
FNC280-FNC289
34.1.6 Role of RET instruction
Register
Extension File
FNC290-FNC299
When there are ladder blocks and SFC blocks, put RET instruction at the end of each SFC program.
34
List of sequence instructions available in states
Programming
SFCSTL
Instruction
LD/LDI/LDP/LDF,
AND/ANI/ANDP/ANDF,
OR/ORI/ORP/ORF, ANB/ORB/MPS/MRD/
State relay MC/MCR
INV,MEP/MEF,
OUT,SET/RST,
MPP 35
Function
Interrupt
PLS/PLF
Initial/general state relay Available Available*1 Not available
Branch/ Drive processing Available Available*1 Not available
recombination state
Transfer processing Available Not available Not available
relay
36
STL instruction cannot be used in interrupt programs and subroutine programs.
Special Device
When using SFC programs (STL instruction), do not drive state relays S using SET or OUT instructions in
an interrupt program.
It is not prohibited to use jump instructions in state relays. However, it is not recommended to use jump
instructions because complicated movements will result.
*1. The MPS instruction cannot be used immediately after a state relay (STL instruction), even in a drive
37
Error Code
processing circuit.
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
749
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
Interlock of outputs
In the state relay ON status transfer process, both Y002
20 Y001
states turn ON only instantaneously (during one
operation cycle) at the same time. Forward
Accordingly, between a pair of outputs which should not rotation
be set to ON at the same time, provide an interlock Y001
21 Y002
outside the PLC in conformance to the handy manual of
the PLC so that simultaneous ON can be prevented. Backward rotation
In addition, provide interlock in the program as shown in
the right figure.
750
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
Use of a timer two or more times
Transfer 3
Data
FNC275-FNC279
In the same way as an output coil, a timer coil can be
40 T1
programmed in different state relays. However, it is not K10
permitted to program the same timer coil in adjacent
state relays. If the same timer coil is programmed in
adjacent state relays, the timer coil is not set to OFF at
41 T1
Not 32
process transfer, so the current value is not reset. allowed
Processing 2
High Speed
FNC280-FNC289
42 T1
K20
33
Output driving method
Register
Extension File
FNC290-FNC299
It is not permitted to write program an instruction not requiring a contact after LD or LDI instruction from a
bus line in a state relay.
Change such a circuit as shown below.
34
10 Y001
Programming
SFCSTL
X005
Y002
Y003
35
Change Change
Function
Interrupt
10 Y001 10 Y001
X005
Y003 or Y002
X005
Y002
M8000
Y003 36
Move the RUN Insert "Always ON"
Special Device
position. monitor contact.
37
Error Code
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
751
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
Operations of and V
Use to express transfer to a state relay in an upper position (repeat), transfer to a state relay in a lower
position (jump), or transfer to a state relay in another separate flow.
Use V to express reset of a state relay.
1) Transfer source program
Repeat Jump
0
70 80
Jump to S80
19
0
Return to S0
20
3) Reset circuit program
In the program example shown below, S65 is reset from S65 by way of X007.
Reset of another state relay (S70, for example) from S65 is executed in the same way, but in this case
S65 is not reset because this is not transfer.
In GX Developer, z is automatically displayed in a state relay to be reset.
X006
65 Y003 When S65 is reset, Y003 turns
OFF.
X007
TRAN
65
752
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
Reset of state relays at one time and output disability
Transfer 3
Data
FNC275-FNC279
For output disability corresponding to emergency stop, follow Cautions on safety described in the PLC
manual.
1) Resetting many state relays at one time by specifying a range
Fifty-one state relays from S0 to S50 are reset at one time.
32
Processing 2
High Speed
FNC280-FNC289
Reset FNC 40
Ladder block S0 S50
ZRST
SFC block 0
Register
Extension File
FNC290-FNC299
50
S0
Programming
SFCSTL
Output disable
Ladder block SET M10
Function
Interrupt
Y005
When the output disable
M30 contact turns ON, these
outputs turn OFF.
T4
36
Special Device
3) Setting to OFF all output relays (Y) in a PLC
Even while the special auxiliary relay M8034 is ON, the sequence program is executed continuously, but
all output relays (Y) turn OFF. (These output relays are in the ON status in the monitor.)
Ladder block
Output disable
M8034 37
Error Code
Even while the special auxiliary relay M8034 is ON, the sequence
program is executed continuously, but all output relays (Y) turn OFF.
Program MPS, MRD or MPP instruction after LD or LDI instruction as shown below.
LD
X001 X003
Y001
10 MPS X004 B
Y002
Execution Times
MRD
X005
Y003
MPP
753
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
1 1
X004 X004
30 Y000 Change 30 Y000
X000 X001 X000 X001
2 TRAN M0
X002 X003 X002 X003
M0
31 TRAN
2
3
31
Limit switch
X030
30 Y030
2 PLS M100
Motor
X030
PLS M101
M M100 M101
31 TRAN
Forward
rotation Y030
754
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
Transfer of state relay ON status by a same signal
Transfer 3
Data
FNC275-FNC279
In some cases, it is necessary to transfer the state relay ON status by the ON/OFF operation of one
pushbutton switch.
To achieve such a transfer, it is necessary to convert the transfer signal into pulses in programming.
The following two methods are available to convert the transfer condition into pulses:
Processing 2
High Speed
FNC280-FNC289
Immediately after M0 turns ON and then S50 turns ON, the Pulse signal
M0
transfer condition M1 (NC contact) is open. As a result, it 1 TRAN
is not possible to transfer the ON status to S51 at the same
time when S50 turns ON. 50 PLS M1
When M0 turns ON again, the ON status is transferred to
S51. 2
M1 M0
TRAN 33
Register
Extension File
FNC290-FNC299
51 PLS M2
M2 M0
3 TRAN
34
Programming
SFCSTL
2. Procedure using a pulse contact instruction
(M2800 to M3071) X001 (Transfer input)
Ladder block M2800
By using an auxiliary relay M2800 to M3071 in a rising/ M2800
falling edge detection instruction (LDP, LDF, ANDP,
ANDF, ORP or ORF), the ON status can be efficiently M2800
transferred by the same signal. *1 35
When M2800 or later is specified as a device in a rising/
Function
Interrupt
SFC block 0
falling edge detection instruction, only the first rising/falling M2800
edge detection instruction after a coil instruction is 1 TRAN
executed. Accordingly, when X001 is set to ON, only the 50
transfer condition in a state relay currently in the ON status M2800
is ON during one operation cycle, and then the ON status 2 TRAN 36
is transferred to the next state relay. 51
Special Device
M2800
3 TRAN
*1. It is alright to program a device number used in LD, LDI, OR or ORI instructions after a corresponding
coil in the ladder block. However, if a same device number is programmed in LDP, LDF, ANDP,
37
Error Code
ANDF, ORP or ORF instruction, the priority is given to such an instruction and the transfer condition is
not effective.
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
755
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
S3 X013
M6
X013 X014
SET S70 M7
X014 S3
Change M6
SET S70
M7
When the ON status is transferred to S70 at the falling edge of X013 and then X014 turns OFF after that, the
falling edge of X014 is not detected at this point because S3 is OFF. When S3 turns ON the next time, the
falling edge of X014 is detected.
Accordingly, when S3 turns ON the next time, the ON status is immediately transferred to S70.
756
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
34.1.8 SFC flow formats
Transfer 3
Data
FNC275-FNC279
This section shows operation patterns of single flows and operation patterns when selective branches and
parallel branches are combined in SFC programs.
Processing 2
High Speed
FNC280-FNC289
Direct transfer to a state relay in a lower position or transfer to a state relay in a different flow is called
jump, and the transfer destination state relay is indicated by .
20 20
22
30 40 30
42
40
33
Register
Extension File
FNC290-FNC299
21 21 31 41 31 41
22 22 32 42 32 42 34
Programming
SFCSTL
23 23
2) Repeat 35
Transfer to a state relay in an upper position is called repeat, and the transfer destination state relay is
Function
Interrupt
indicated by in the same way as jump.
0 0 60 60
36
Special Device
50 50 61 61
51 51 62 62
37
60
Error Code
63 63
59 59
S0 A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
757
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
Separation of flow
When creating an SFC program having two or more initial state relays, separate the blocks for each initial
state relay.
The ON status can be transferred among SFC programs created by block separation (jump to a different flow).
A state relay in a program created in a different block can be used as a contact for the internal circuit or transfer
condition of another state relay.
1. Separation of flow
3 4
20 40
21 41
22 42
3 4
3 4
20 40
41
21 41
22 42
3 4
3 4
S40
0 TRAN 0
20 40
S20
1 1 TRAN
S41 S21
21 Y000 41 Y010
2 2
22 42
3 3
3 4
758
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
Composite flows with branches and recombination
Transfer 3
Data
FNC275-FNC279
The single flow format is the fundamental style in process transfer control. Only single flow is sufficient in
sequence control for simple operations. When various input conditions and operator manipulations intervene,
however, complicated conditions can be easily handled by using selective branches and parallel branches.
A branch for selectively processing many processes depending on a condition is called selective branch. A
branch for processing many processes at the same time is called translational branch. 32
Processing 2
High Speed
FNC280-FNC289
1. Selective branch
Either one among many flows is selected and executed.
Branch state
relay
33
Register
Extension File
FNC290-FNC299
34
Programming
SFCSTL
Recombination
state relay
35
2. Parallel branch
Function
Interrupt
All of many flows are executed at the same time.
Branch state
relay
36
Special Device
37
B
Execution Times
C
Instruction List
Applicable
759
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
Selective branch
After making a branch, create a transfer condition.
20
21 31 41
Selective recombination
After creating a transfer condition, recombine.
29 39 49
X010 X011 X012
10 TRAN 20 TRAN 30 TRAN
50
Parallel branch
After creating a transfer condition, make a branch.
20
X000
1 TRAN
21 31 41
Parallel recombination
After recombining, create a transfer condition.
29 39 49
X010
10 TRAN
50
760
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
34.1.10 Rule for creating branch circuit
Transfer 3
Data
FNC275-FNC279
Limitation in the number of branch circuits
In one parallel branch or selective branch, up to eight circuits can be provided.
When there are many parallel branches and selective branches, however, the total number of circuits per 32
initial state is limited to 16 or less.
Processing 2
High Speed
FNC280-FNC289
8 circuits or less in 1 (parallel or selective) branch
1 2 3 4 5 6 7 8
33
Register
Extension File
FNC290-FNC299
34
(Note)
Programming
SFCSTL
35
Function
Interrupt
1 2 3 4 5 6 7 8 9 ...... 16
It is not permitted to execute transfer or reset from a recombination line or state relay before recombination to 36
a branch state relay.
Special Device
Make sure to provide a dummy state, then execute transfer or reset from a branch line to a separate state
relay.
37
Error Code
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
761
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
20 30 40 20 30 40 20 30 20 30
50 60
50 60 40 50 40 50
Deform it
as follows.
20 30 40 20 30 40 20 30 20 30
Dummy
100 Dummy
relay
state 101 Dummy
relay
state 102 state 103 Dummy
relay
state
relay
50 60 50 60 40 50 40 50
762
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
2. When there are selective branches continuously, reduce the number of branches.
Transfer 3
Data
FNC275-FNC279
20
X000 X010 32
1 TRAN 9 TRAN
Processing 2
High Speed
FNC280-FNC289
X014
X001 X004 X011 14 TRAN
2 TRAN 6 TRAN 10 TRAN
21 23 25 27
15
33
3 7 11
Register
Extension File
FNC290-FNC299
22 24 26 28
5
X007
TRAN 13
X017
TRAN
34
Programming
SFCSTL
29
Transform
as follows.
35
Function
Interrupt
20
Special Device
21 23 25 27
2 5 8 11
22 24 26 28
37
Error Code
X003 X007 X006 X007 X013 X017 X016 X017
3 TRAN 6 TRAN 9 TRAN 12 TRAN
24
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
763
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
* * * *
4. In the flow shown below, it is not determined whether a selective or parallel branch is
provided. Change it as shown below.
764
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
5. The following flows are allowed.
Transfer 3
Data
FNC275-FNC279
Flow B is alright. In flow A, however, note that an operation is paused at a point where parallel branches are
recombined.
A B
32
Processing 2
High Speed
FNC280-FNC289
B A
33
Register
Extension File
FNC290-FNC299
34
Programming
SFCSTL
6. It is not permitted to cross flows in SFC programs.
Change a flow on the left to a flow on the right. This change enables inverse conversion from a program on
the instruction word basis into an SFC program. (The flow on the left cannot be converted into an SFC
program.)
35
Function
Interrupt
36
Special Device
Change
Cross is not 37
allowed.
Error Code
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
765
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
20 Y001
1 1.5
second seconds T1 K15
T1
1 TRAN
3
766
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
2. Example of fountain control
Transfer 3
Data
FNC275-FNC279
1) Cyclic operation (X001 = OFF, X002 = OFF)
When the start button X000 is pressed, the outputs turn ON in the order Y000 (wait indication) Y001
(center lamp) Y002 (center fountain) Y003 (loop line lamp) Y007 (loop line fountain) Y000
(wait indication), and then the outputs return to the wait status.
Each output is switched in turn every 2 seconds by a timer. 32
2) Continuous operation (X001 = ON)
Processing 2
High Speed
FNC280-FNC289
Y001 to Y007 turn ON in turn repeatedly.
3) Stepping operation (X002 = ON)
Every time the start button is pressed, each output turns ON in turn.
Ladder
M8000
M8047
Enable
STL SFC 3 Y000
Wait
indication
33
block RUN monitor monitoring block
Register
Extension File
FNC290-FNC299
STL Start button
X002 X000 X000
M8040 transfer 0 TRAN
Stepping Start disable
M8002 Initial state 20 Y001 Center lamp
SET S3
Initial pulse
relay
T1 K20 34
T1
Programming
SFCSTL
1 TRAN
Center
21 Y002
fountain
T2 K20
T2
2 TRAN
35
Loop line
22 Y003
Function
Interrupt
lamp
T3 K20
T3
3 TRAN
Loop line
27 Y007
fountain 36
T7 K2
Special Device
0
T7 X001 T7 X001
4 TRAN 5 TRAN
20 3
Continuous RET END Cyclic/stepping
37
Error Code
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
767
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
X012
X013
Origin
large backward rotation, and then stops.
M8000 Origin
Ladder M8047 SFC 6 Y020
block block indication
RUN monitor Enable STL
monitoring X000
0 TRAN
M8002 X000 Start
M8040
Initial pulse Start STL Y023
transfer Forward
521 Y021
M8040 Y020 disable rotation
M8034 X011
All outputs disable 1 TRAN
M8002 M8046 Small forward
rotation
SET S6
Initial pulse STL Y021 Backward
state Initial state relay 522 Y023
ON
rotation
X010
2 TRAN
Small backward
rotation
Y023 Forward
523 Y021
rotation
X013
3 TRAN
Large forward
rotation
Y021 Backward
524 Y023
rotation
X012
4 TRAN
Large backward
6 rotation
RET END
768
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
4. Example of sequential start and stop
Transfer 3
Data
FNC275-FNC279
The motors M1 to M4 are started in turn by a timer, and stopped in turn in the reverse order.
This SFC flow is based on a single flow, and has jumps of state relays.
Start M1 Ladder block
X000 M8002 32
SET S0
Processing 2
High Speed
FNC280-FNC289
Initial pulse
In the case of stop in the middle of operation, the motors are stopped also in turn in the reverse order.
2 seconds
M3
SFC block
0
33
3 seconds X000
Register
Extension File
FNC290-FNC299
0 TRAN
M3
Start
Start
Motor M1 is
20 SET Y000 started.
T0
K20
4 seconds
M4 T0 X001 X001 34
1 TRAN 9 TRAN
Programming
SFCSTL
Stop
Motor
21 SET Y001 M2 is 27
started.
T1 K30
2
T1 X001
TRAN 10
X001
TRAN 35
Stop M4 Stop
Function
Interrupt
Motor
22 SET Y002 M3 is 26
X001 started.
T2 K40
4 seconds
T2 X001 X001
M3
3 TRAN 11 TRAN 36
Motor
Special Device
23 SET Y003 M4 is 25
started.
Stop
3 seconds X001
4 TRAN
M2 Stop
Motor
24 RST Y003 M4 is
stopped.
37
T4 K40
Error Code
2 seconds
M1 T4
5 TRAN
Motor
25 RST Y002 M3 is
stopped.
T5 K30 A
Information
Version Up
T5
6 TRAN
Motor
26 RST Y001 M2 is
stopped.
T6
K20
7
T6
TRAN
B
Execution Times
Motor M1
27 RST Y000 is
stopped.
Y000
8 TRAN
0
RET END C
Instruction List
Applicable
This SFC program shows an example in which a part of the flow is skipped according to a condition, and the
execution is transferred to a state in a lower position.
The execution can be transferred to a state in an upper position.
769
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
The partial skip flow shown on the previous page can be expressed in a flow of selective branches and
recombination as shown below.
Make sure that a flow proceeds from top to bottom, and that a flow does not cross except branch lines and
recombination lines.
Ladder block
M8002
SET S0
Initial pulse
SFC block
0
X000
0 TRAN
Start
20 SET Y000
T0
K20
T0 X001 X001
1 TRAN 13 TRAN
Stop
21 SET Y001
T1 K30
T1 X001 X001
2 TRAN 11 TRAN
Stop
22 SET Y002
T2 K40
T2 X001 X001
3 TRAN 9 TRAN
Stop
23 SET Y003 30* 31* 32*
X001
4 TRAN
Stop
24 RST Y003
T4 K40
T4 S30
5 TRAN 10 TRAN
25 RST Y002
T5 K30
T5 S31
6 TRAN 12 TRAN
26 RST Y001
T6 K20
T6 S32
7 TRAN 14 TRAN
770
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
Examples of flows having selective branches and recombination
Transfer 3
Data
FNC275-FNC279
1. Operation of selective branch
When two or more flows are provided 20
and either one is selected and
executed, it is called a selective branch.
1
X000
TRAN 4
X010
TRAN 7
X020
TRAN
32
In the example shown on the right,
Processing 2
High Speed
FNC280-FNC289
X000, X010 and X020 should not turn 21 31 41
ON at the same time.
2 5 8
For example, when X000 turns ON
while S20 is ON, the ON status is 22 32 42
transferred to S21; S20 turns OFF, and X002 X012 X022
33
S21 turns ON. 3 TRAN 6 TRAN 9 TRAN
Register
Extension File
FNC290-FNC299
Accordingly, even if X010 or X020 turns
ON after that, S31 and S41 do not turn
50
ON.
The recombination state relay S50 is 10
driven by either one among S22, S32 34
and S42.
Programming
SFCSTL
2. Example of selecting and carrying large and small balls
The figure below shows a mechanism which selects and carries large and small balls using conveyors.
The upper left position is regarded as the origin, and the mechanism performs in the order moving down
suction moving up moving rightward moving down release moving up moving leftward.
When the arm moves down and the electromagnet pushes a large ball, the lower limit switch LS2 turns OFF. 35
When the electromagnet pushes a small ball, LS2 turns ON.
Function
Interrupt
X026 X004 X005
Start X001
LS1 Left limit switch LS4 LS5
Moving
rightward:
Y003 M Origin X003 36
indication LS3 Upper
Moving
Special Device
Y007 limit switch
leftward:
Y004
+ +
Moving up:
Y002
CY1 When a large ball is pushed, the piston does
not reach the lower limit and X002 does not
37
Moving down: turn ON.
Error Code
Y000
X002
LS2 Lower limit switch
Electromagnet
A
Y001
Information
Version Up
Proximity
switch Small Large
PS0
X000
B
Execution Times
C
Instruction List
Applicable
771
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
In an SFC program for selecting large and small products or judging products as accepted or rejected,
selective branches and recombination are adopted as shown in the figure below.
Ladder block
M8002
SET S0
Initial pulse
X001 X003 Y001 Origin
Y007
Left Upper Release indication
limit limit
SFC block
T0 X002 T0 X002
1 TRAN 9 TRAN
Lower limit Lower limit
switch: ON (small ball) switch: OFF (large ball)
T1 T1 K10
K10
T1
T1 10 TRAN
2 TRAN
Moving Moving
23 Y002 up 26 Y002
up
X003 X003
TRAN 11 TRAN
3 Upper limit switch
Upper limit switch
X004 Y004 X005 Y004 Moving
24 Y003 Moving 27 Y003
rightward
rightward X005
X004 TRAN
4 TRAN 12
Right limit switch Right limit switch
(small bucket) (large bucket)
772
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
31
Example of flows having parallel branches and recombination
Transfer 3
Data
FNC275-FNC279
1. Operation of parallel branch
Branches in which all flows proceed at the same time are called 20
parallel branches.
X000
In the example shown on the left, when X000 turns ON while S20 is 1 TRAN 32
ON, S21, S24 and S27 turn ON at the same time and the operation is
Processing 2
High Speed
FNC280-FNC289
started in each flow. 21 24 27
When the operation is finished in each flow and X007 turns ON, the
2 4 6
recombination state relay S30 turns ON. S23, S26 and S29 turn
OFF. 22 25 28
Such recombination is sometimes called wait recombination. 3 5 7
33
Register
Extension File
FNC290-FNC299
(The original flow continues its operation until all flows finish their
23 26 29
operations and join the original flow.)
When the parts A, B and C are processed in parallel and then X007
8 TRAN
assembled afterward, flows having parallel branches and recombination
are used. 30 34
Programming
SFCSTL
2. Example of pushbutton type crosswalk
A pushbutton type crosswalk shown in the figure below can be expressed in flows having parallel branches
and recombination.
Y003: Green Y002: Yellow Y001: Red
35
Function
Interrupt
36
Special Device
37
Error Code
The SFC program for a pushbutton type crosswalk is as shown below. In this example, a partial flow (jump to
A
Information
Version Up
a state relay located in an upper position) is repeated for blinking the green lamp on the crosswalk.
When the PLC mode is changed from STOP to RUN, the initial state relay S0 turns ON. Normally, the
green lamp is ON for the road and the red lamp is ON for the sidewalk.
When the crossing button X000 or X001 is pressed, the state relay S21 specifies road: green and the
state relay S30 specifies sidewalk: red. The signal lamp status is not changed.
30 seconds later, the yellow lamp turns ON for the road. 10 seconds later after that, the red lamp turns ON
B
Execution Times
773
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.1 SFC Program
Ladder block
M8002
SET S0
Initial pulse
SFC block
Road:
21 Y003 30 Y005 Sidewalk: Red
Green
T0 K300
T0 T2
1 TRAN 3 TRAN
Road:
22 Y002 31 Y006 Sidewalk: Green
Yellow
T1 T3
K100 K150
T1 T3
2 TRAN 4 TRAN
Road:
23 Y001 32 T4
Red K5
T2 K50 T4
5 TRAN
This counter counts how
33 Y006 many times the state
C0 relay S33 turns ON.
K5 When S33 turns ON five
T5 times, the contact C0
K5 turns ON.
C0 T5 C0 T5
6 TRAN 7 TRAN
32
34 Y005 Sidewalk: Red
RST C0
T6 K50
T6
8 TRAN
0
RET END
774
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
31
34.2 Step Ladder
Transfer 3
Data
FNC275-FNC279
34.2.1 Outline
In programs using step ladder instructions, a state relay State S is assigned to each process based on 32
machine operations, and sequences of input condition and output control are programmed as circuits
Processing 2
High Speed
FNC280-FNC289
connected to contacts (STL contacts) of state relays in the same way as SFC programs.
The concept of program creation and the types and operations of state relays are the same as for SFC
programs. However, because the contents can be expressed in the ladder format, step ladder programs can
be handled as familiar relay ladder charts even though the actual contents are the same as those of SFC
programs.
In step ladder programs, the list format is also available. 33
SFC programs and step ladder programs can be converted each other if they are programmed in the same
Register
Extension File
FNC290-FNC299
rules respectively.
This section explains the expressions and cautions of step ladder programs in comparison with SFC
programs, and the input order in the list format.
Programming
SFCSTL
In a step ladder program, a state relay State S is regarded as one control process, and a sequence of input
condition and output control are programmed in a state relay.
Because the preceding process is not performed any more when the program execution proceeds to the next
process, a machine can be controlled using simple sequences for each process.
Function
Interrupt
In a step ladder program, each process performed by the machine is expressed by a state relay.
A state relay consists of a drive coil and contact (STL contact) in the same way as other relays.
Use SET or OUT instruction to drive a coil, and use STL instruction for a contact.
When a state relay turns ON, a connected circuit (internal circuit) is activated by way of an STL contact.
When a state relay turns OFF, a connected internal circuit is deactivated by way of an STL contact. 36
After one operation cycle, non-driving of an instruction (jump status) is not available.
Special Device
When a condition (transfer condition) provided between state relays is satisfied, the next state relay turns
ON, and the state relay which has been ON so far turns OFF (transfer operation).
In the state relay ON status transfer process, the both state relays are ON only instantaneously (during one
operation cycle).
In the next operation cycle after the ON status was transferred, the former state is reset to OFF.
When the transfer state relay S is used in a contact instruction, however, the contact image is executed in
37
Error Code
the OFF status immediately after the transfer condition is satisfied.
One state relay number can be used only once.
*1
A
Y030 Y030
Information
Version Up
Process of
S31
SET Y31 When X001 turns ON, SET Y31 Y31 programmed in
S32 turns ON and S31 SET instruction remains
X001 is automatically reset. X001 ON even if S31 is reset.
SET S32 SET S32
B
STL S32 STL S32
Execution Times
*1
Y030 Y030
Process of
S32 Activated
Y032 Y032
X002 X002
C
SET S33 SET S33
Instruction List
Applicable
775
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
776
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
31
34.2.4 Creation of step ladder program (SFC program STL program)
Transfer 3
Data
FNC275-FNC279
The figure on the left shows one state relay extracted as an example from an SFC program.
Each state relay has three functions, driving a load, specifying a transfer destination and specifying a transfer
condition.
The step ladder shown on the right expresses this SFC program as a relay sequence.
In this program, a load is driven, and then the ON status is transferred.
32
Processing 2
High Speed
FNC280-FNC289
In a state relay without any load, the drive processing is not required.
For the program creation procedure, refer to the description on SFC programs.
For the program creation procedure, refer to Subsection 34.1.3.
For the handling and role of initial state relays, refer to Subsection 34.1.4.
For latched (battery backed) type state relays, refer to Subsection 34.1.5.
For RET instruction, refer to Subsection 34.1.6. 33
Register
Extension File
FNC290-FNC299
<SFC program> <Step ladder>
Programming
SFCSTL
X000 X001 X011
1 TRAN
X000 X001
SET
SET S21
21
35
Function
Interrupt
<List program>
0 STL S20
1 OUT Y010
2 LD X010 The above program can be expressed in the list format
3 OR X011 (list program) shown on the left. 36
4 OUT Y011 The segment from the STL instruction to the RET
Special Device
5 LD X000 instruction is handled as a step ladder program.
6 ANI X001
7 SET S21 *1
*1. SET and RST instructions for a state relay are two-step instructions. 37
Error Code
When every state relay used in an SFC program is defined, programming is complete.
Program a step ladder program starting from the initial state relay in the order of state relay ON status
transfer.
Make sure to put the RET instruction at the end of a step ladder program.
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
777
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
2 52
Use OUT instruction in the jump/
Jump/repeated part repeated part.
List of sequence instructions available between STL instruction and RET instruction
Instruction
LD/LDI/LDP/LDF,
AND/ANI/ANDP/ANDF,
OR/ORI/ORP/ORF, ANB/ORB/MPS/MRD/
State relay MC/MCR
INV,MEP/MEF, MPP
OUT,SET/RST,
PLS/PLF
Initial/general state relay Available Available*1 Not available
Branch/ Drive processing Available Available*1 Not available
recombination state
relay Transfer processing Available Not available Not available
778
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
31
Special auxiliary relays
Transfer 3
Data
FNC275-FNC279
For efficiently creating step ladder programs, it is necessary to use some special auxiliary relays. The table
below shows major ones.
The special auxiliary relays shown below are the same as those available in SFC programs.
Device
number
Name Function and application 32
This relay is normally ON while the PLC is in the RUN mode.
Processing 2
High Speed
FNC280-FNC289
M8000 RUN monitor Use this relay as the program input condition requiring the normally driven status or for
indicating the PLC operation status.
This relay turns ON and remains ON only instantaneously when the PLC mode is changed from
M8002 Initial pulse STOP to RUN.
Use this relay for the initial setting of a program or for setting the initial state relay.
When this relay is set to ON, transfer of the ON status is disabled among all state relays.
33
STL transfer
Register
Extension File
FNC290-FNC299
M8040 Because programs in state relays are operating even in the transfer disabled status, output coils
disable
do not turn OFF automatically.
This relay automatically turns ON when any of the state relays S0 to S899 or S1000 to S4095
M8046*1 STL state ON turn ON.
Use this relay to prevent simultaneous start up of another float or as a process ON/OFF flag.
When this relay is driven, the device number of a state relay in the ON status having the 34
smallest device number among S0 to S899 and S1000 to S4095 is stored to D8040, and the
Programming
SFCSTL
state relay number in the ON status having the next smallest device number is stored to D8041.
In this way, up to eight state relays in the ON status are stored up to D8047.
Enable STL
M8047*1 In the FX-PCS/WIN(-E), FX-20P(-E) and FX-10P(-E), when this relay is driven, the state
monitoring
relays in the ON status are automatically read and displayed.
For details, refer to the manual of each peripheral equipment.
In the SFC monitor in GX Developer, the automatic scroll monitoring function is valid even if 35
this relay is not driven.
Function
Interrupt
*1. Processed when END instruction is executed.
Block
M8002
A step ladder program is created as ladder circuits in the SET S0
same way as relay ladder. Accordingly, different from Initial pulse Relay ladder 36
SFC programs, it is not necessary to divide blocks for SET S1
Special Device
relay ladder parts and SFC parts. STL S0 Step ladder is
When there are ladder blocks and SFC blocks, put RET started by STL
instruction at the end of each step ladder program. instruction.
Y000
A PLC starts the step ladder processing by STL X000
instruction, and returns to the relay ladder processing SET S20 37
from the step ladder processing by RET instruction.
Step ladder
Error Code
STL S20
However, when consecutively programming a step
ladder in a different flow (when there is no relay ladder Y001
before the step ladder in the different flow), RET It can be
X001 omitted.
instruction between flows can be omitted, and RET S0
instruction can be programmed only at the end of the last Step ladder is
flow. RET finished by RET
instruction.
A
Information
Version Up
Y003
X003
S1 Step ladder is
finished by RET
RET instruction.
C
END Relay ladder
Instruction List
Applicable
779
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
STL S20
Y001
X005
Y002
Y003
Change Change
Y001 Y001
or
X005
Y003 Y002
X005 M8000
Y002 Y003
Move the RUN Insert "Always ON"
position. monitor contact.
STL S41
Replacing and V
Replace the symbol used in SFC programs to express repeat, jump or transfer to a state relay in another
separate flow with the OUT instruction.
Replace the symbol V (used to express reset of a state relay) with the RST instruction.
<SFC program> <Step ladder>
X001
40 Y001 STL S40
X001
Y001
X002 X003 X002
1 TRAN 3 TRAN SET S41
X003 Replacement of
41 S52
in the part 52
X004 STL S41
2 TRAN 52
X004 Replacement of
41 RST S41
in the part 41
780
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
31
34.2.6 Program with state relays in branches and recombination
Transfer 3
Data
FNC275-FNC279
1. Example of selective branch
Do not use MPS, MRD, MPP, ANB and ORB instructions in a transfer processing program with branches and
recombination.
Even in a load driving circuit, MPS instructions cannot be used immediately after STL instructions. 32
In the same way as programs for general state relays, program the drive processing first, and then program
Processing 2
High Speed
FNC280-FNC289
the transfer processing.
Continuously program all transfer processing.
<SFC program>
33
20 Y000
Register
Extension File
FNC290-FNC299
X000 X001 X002
1 TRAN 2 TRAN 3 TRAN
21 31 41
34
Programming
SFCSTL
<Step ladder> <List program>
STL S20
STL S20
Drive OUT Y000
Y000
processing LD X000 35
SET S21
Function
Interrupt
X000
SET S21 LD X001
X001 Transfer SET S31
SET S31 processing LD X002
X002 SET S41
SET S41
36
Special Device
37
Error Code
A
Information
Version Up
B
Execution Times
C
Instruction List
Applicable
781
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
<SFC program>
50
STL S49
X012
SET S50
782
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
31
3. Example of parallel branch
Transfer 3
Data
FNC275-FNC279
Do not use MPS, MRD, MPP, ANB and ORB instructions in a program with branches and recombination.
Even in a load driving circuit, MPS instructions cannot be used immediately after STL instructions.
In the same way as programs for general state relays, program the drive processing first, and then program
the transfer processing.
Continuously program all transfer processing. 32
<SFC program> <Step ladder> <List program>
Processing 2
High Speed
FNC280-FNC289
STL S20
20 Y000 STL S20 OUT Y000
Drive
X000 processing LD X000
1 TRAN Y001
SET S21
X000
SET S21 SET S31 33
SET S41
Transfer
Register
Extension File
FNC290-FNC299
21 31 41 SET S31
processing
SET S41
Programming
SFCSTL
Even in a load driving circuit, MPS instructions cannot be used immediately after STL instructions.
Pay attention to the programming order so that a branch line does not cross a recombination line.
<SFC program>
Function
Interrupt
X010 X011 X012
9 TRAN
50
36
Special Device
<Step ladder> <List program>
STL S29
STL S29
OUT Y010
Y010 STL S39
OUT Y011 37
STL S39 STL S49
Error Code
Drive OUT Y012
Y011 processing STL S29
STL S39
STL S49
STL S49
LD X010
Y012
AND X011 A
STL S29 AND X012
Information
Version Up
SET S50
STL S39 Transfer
processing
STL S49
X010 X011 X012
SET S50 B
Execution Times
C
Instruction List
Applicable
783
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
SET S60
50 60
784
FX3U/FX3UC Series Programmable Controllers 34 SFC Program and Step Ladder
Programming Manual - Basic & Applied Instruction Edition 34.2 Step Ladder
31
4) Parallel recombination and selective branch
Transfer 3
Data
FNC275-FNC279
<SFC program> <Step ladder> <List program>
Processing 2
High Speed
FNC280-FNC289
SET S103 STL S103
103 Dummy state LD X001
STL S103
SET S40
X001
X001 X002 SET S40 LD X002
2 TRAN 3 TRAN SET S50
X002
SET S50 33
40 50
Register
Extension File
FNC290-FNC299
34.2.7 Program examples
34
Programming
SFCSTL
Examples of single flows
1. Example of flicker circuit
When the PLC mode is changed from STOP to RUN, the state relay S3 is driven by the initial pulse
(M8002). 35
The state relay S3 outputs Y000. 1 second later, the ON status transfers to the state relay S20.
Function
Interrupt
The state relay S20 outputs Y001. 1.5 seconds later, the ON status returns to the state relay S3.
Special Device
Y000 3 STL S3 3 STL S3
4 OUT Y000
4 Y000 5 OUT T0 K10
Y001 8 LD T0
T0 K10 9 SET S20
1 1.5