Summary of Contents for IDEC microSmart pentra FC5A Series
Page 1
FC9Y-B1273(1) FC5A SERIES User’s Manual Advanced Volume...
Page 3
P AFETY RECAUTIONS •Read this user’s manual to make sure of correct operation before starting installation, wiring, operation, maintenance, and inspection of the MicroSmart •All MicroSmart modules are manufactured under IDEC’s rigorous quality control system, but users must add a backup or failsafe provision to the control system when using the MicroSmart in applications where heavy damage or personal injury may be caused in case the MicroSmart should fail. •In this user’s manual, safety precautions are categorized in order of importance to Warning and Caution: Warning notices are used to emphasize that improper operation may cause Warning severe personal injury or death. •Turn off power to the MicroSmart before installation, removal, wiring, maintenance, and inspection of the MicroSmart. Failure to turn power off may cause electrical shocks or fire hazard. •Special expertise is required to install, wire, program, and operate the MicroSmart. People without such expertise must not use the MicroSmart. •Emergency stop and interlocking circuits must be configured outside the MicroSmart. If such a circuit is configured inside the MicroSmart, failure of the MicroSmart may cause disorder of the control system, damage, or accidents. •Install the MicroSmart according to the instructions described in this user’s manual. Improper installation will result in falling, failure, or malfunction of the MicroSmart. Caution notices are used where inattention might cause personal injury or dam‐ Caution age to equipment. •The MicroSmart is designed for installation in a cabinet. Do not install the MicroSmart outside a cabinet. •Install the MicroSmart in environments described in this user’s manual. If the MicroSmart is used in places where the MicroSmart is subjected to high‐temperature, high‐humidity, condensation, corrosive gases, excessive vibrations, and excessive shocks, then electrical shocks, fire hazard, or malfunction will result. •The environment for using the MicroSmart is “Pollution degree 2.” Use the MicroSmart in environments of pollution degree 2 (according to IEC 60664‐1). •Prevent the MicroSmart from falling while moving or transporting the MicroSmart, otherwise damage or malfunction of the MicroSmart will result. •Prevent metal fragments and pieces of wire from dropping inside the MicroSmart housing. Put a cover on the MicroSmart modules during installation and wiring. Ingress of such fragments and chips may cause fire hazard, damage, or malfunc‐ tion. •Use a power supply of the rated value. Use of a wrong power supply may cause fire hazard. •Use an IEC 60127‐approved fuse on the power line outside the MicroSmart. This is required when equipment containing the MicroSmart is destined for Europe. •Use an IEC 60127‐approved fuse on the output circuit. This is required when equipment containing the MicroSmart is des‐ tined for Europe. •Use an EU‐approved circuit breaker. This is required when equipment containing the MicroSmart is destined for Europe.
Page 4
Revision Record The table below summarizes the changes to this manual since the first printing of FC9Y‐B927‐0 in April, 2006. Upgraded and new functions listed below have been implemented in the FC5A MicroSmart CPU modules. The availability of these functions depends on the model and the system program version of the FC5A MicroSmart CPU modules. To confirm the system program version of the MicroSmart CPU module, use WindLDR on a computer connected with the CPU module. The system program version is indicated on the PLC Status dialog box. See page 13‐1 (Basic Vol.). To confirm the WindLDR version, select the WindLDR application button at the upper‐left corner of the WindLDR screen, followed by WindLDR Options > Resources. The WindLDR version is found under About WindLDR. Upgraded and New Functions List All‐In‐One Type Slim Type FC5A‐C10R2 FC5A‐D16RK1 FC5A‐C10R2C FC5A‐D16RS1 FC5A‐C24R2 CPU Module WindLDR Page FC5A‐C10R2D FC5A‐D32K3 FC5A‐C24R2C FC5A‐C16R2 FC5A‐D32S3 FC5A‐C24R2D FC5A‐C16R2C FC5A‐D12K1E FC5A‐C16R2D FC5A‐D12S1E (Note 1) Basic Vol. HMI Module Upgrade (Note 2) 110 or higher 101 or higher — 5‐60 110 or higher FC5A‐SIF2 Expansion RS232C Communi‐ Basic Vol. cation Module Compatibility (Note 3) 2‐86, 25‐1 —...
Page 5
All‐In‐One Type Slim Type FC5A‐C10R2 FC5A‐D16RK1 FC5A‐C10R2C FC5A‐D16RS1 FC5A‐C24R2 CPU Module WindLDR Page FC5A‐C10R2D FC5A‐D32K3 FC5A‐C24R2C FC5A‐C16R2 FC5A‐D32S3 FC5A‐C24R2D FC5A‐C16R2C FC5A‐D12K1E FC5A‐C16R2D FC5A‐D12S1E (Note 1) Basic Vol. Key Matrix Input (Note 6) — 5‐38 Basic Vol. User Program Protection Upgrade 5‐44 5.3 or 210 or higher 210 or higher Exchange Instruction (XCHG) 3‐15 higher 210 or higher Increment Instruction (INC) 5‐13 Decrement Instruction (DEC) 5‐13 Sum Instruction (SUM) 5‐16 Random Instruction (RNDM) 5‐19 Decrement Jump Non‐zero (DJNZ)
Page 6
About This Manual This user’s manual primarily describes programming and powerful communications of the MicroSmart. Chapter 1: Basic Instructions Reference Programming of the basic instructions, available devices, and sample programs. Chapter 2: Advanced Instructions General rules of using advanced instructions, terms, data types, and formats used for advanced instructions. Chapter 3 through Chapter 20: Detailed descriptions on advanced instructions grouped into 18 chapters. Chapter 21 through Chapter 25: Various communication functions such as computer link, modem mode, Modbus TCP, AS‐Interface, and expansion RS232C/RS485 communication. Index Alphabetical listing of key words. IMPORTANT INFORMATION Under no circumstances shall IDEC Corporation be held liable or responsible for indirect or consequential damages resulting from the use of or the application of IDEC PLC components, individually or in combination with other equipment. All persons using these components must be willing to accept responsibility for choosing the correct component to suit their application and for choosing an application appropriate for the component, individually or in combination with other equipment. All diagrams and examples in this manual are for illustrative purposes only. In no way does including these diagrams and examples in this manual constitute a guarantee as to their suitability for any specific application. To test and approve all programs, prior to installation, is the responsibility of the end user. Preface‐4 FC5A MicroSmart User’s Manual FC9Y‐B1273...
Page 7
M ELATED ANUALS The following manuals related to the FC5A series MicroSmart are available. Refer to them in conjunction with this man‐ ual. Type No. Manual Name Description Describes basic instruction list, move instructions, data comparison instruc‐ tions, binary arithmetic instructions, boolean computation instructions, shift/rotate instructions, data conversion instructions, week programmer instructions, interface instructions, program branching instructions, refresh FC5A Series instructions, interrupt control instructions, coordinate conversion instruc‐ MicroSmart Pentra FC9Y‐B1273 tions, average instructions, pulse output instructions, PID instructions, dual/ User's Manual teaching timer instructions, intelligent module access instructions, trigono‐ Advanced Volume (this manual) metric function instructions, logarithm/power instructions, file data process‐ ing instructions, clock instructions, computer link communication, modem communication, Modbus TCP communication, expansion RS232C/RS485 communication modules, and AS‐Interface master modules. FC5A Series Describes module specifications, installation instructions, wiring instructions, MicroSmart Pentra basic operation, function settings, device list, basic instruction list, basic FC9Y‐B1268 User's Manual instructions, analog modules, user communication, data link communication, Basic Volume Modbus ASCII/RTU communication, and troubleshooting. FC5A Series MicroSmart Pentra Describes FC5A Slim Type Web Server CPU Module specifications and func‐ FC9Y‐B1278 User's Manual tions. Web Server CPU Module Volume FC5A Series FC9Y‐B1283 PID Module...
1: B I R ASIC NSTRUCTIONS EFERENCE Introduction This chapter describes the list of basic instructions and brief description of each instruction. For detail about each basic instruction, see the corresponding page in FC5A User's Manual Basic Volume (FC9Y‐B1268). Basic Instruction List Symbol Name Function See Page Basic Series connection of NO contact Vol. 7‐5 Basic AND LOD And Load Series connection of circuit blocks Vol. 7‐6 Basic ANDN And Not Series connection of NC contact Vol. 7‐5 Restores the result of bit logical operation which was saved tempo‐ Basic Bit Pop rarily Vol. 7‐7 Basic Bit Push Saves the result of bit logical operation temporarily Vol. 7‐7 Basic Bit Read Reads the result of bit logical operation which was saved temporarily Vol. 7‐7 Basic ...
Page 16
1: B I R ASIC NSTRUCTIONS EFERENCE Symbol Name Function See Page Basic LODN Load Not Stores intermediate results and reads inverted contact status Vol. 7‐3 Basic Master Control Reset Ends a master control Vol. 7‐28 Basic Master Control Set Starts a master control Vol. 7‐28 Basic Parallel connection of NO contact Vol. 7‐5 Basic OR LOD Or Load Parallel connection of circuit blocks Vol. 7‐6 Basic Or Not Parallel connection of NC contact Vol. 7‐5 Basic Output Outputs the result of bit logical operation Vol. 7‐3 Basic OUTN Output Not Outputs the inverted result of bit logical operation...
2: A I DVANCED NSTRUCTIONS Introduction This chapter describes general rules of using advanced instructions, terms, data types, and formats used for advanced instructions. Advanced Instruction List Valid Data Type Group Symbol Name See Page No Operation 2‐10 Move 3‐1 MOVN Move Not 3‐5 IMOV Indirect Move 3‐6 IMOVN Indirect Move Not 3‐8 BMOV Block Move 3‐9 Move IBMV Indirect Bit Move 3‐10 IBMVN Indirect Bit Move Not 3‐12 NSET N Data Set 3‐13 N Data Repeat Set 3‐14 XCHG Exchange...
Page 18
2: A I DVANCED NSTRUCTIONS Valid Data Type Group Symbol Name See Page SFTL Shift Left 7‐1 SFTR Shift Right 7‐3 BCDLS BCD Left Shift 7‐5 Shift and Rotate WSFT Word Shift 7‐7 ROTL Rotate Left 7‐8 ROTR Rotate Right 7‐10 HTOB Hex to BCD 8‐1 BTOH BCD to Hex 8‐3 HTOA Hex to ASCII 8‐5 ATOH ASCII to Hex 8‐7 BTOA BCD to ASCII 8‐9...
Page 19
2: A I DVANCED NSTRUCTIONS Valid Data Type Group Symbol Name See Page XYFS XY Format Set 12‐1 CVXTY Convert X to Y 12‐2 Coordinate Conversion CVYTX Convert Y to X 12‐3 AVRG Average 12‐7 PULS1 Pulse Output 1 13‐2 PULS2 Pulse Output 2 13‐2 PULS3 Pulse Output 3 13‐2 PWM1 Pulse Width Modulation 1 13‐8 PWM2 Pulse Width Modulation 2 13‐8 Pulse PWM3 Pulse Width Modulation 3 13‐8 RAMP1 Ramp Pulse Output 1...
2: A I DVANCED NSTRUCTIONS Advanced Instruction Applicable CPU Modules Applicable advanced instructions depend on the type of CPU modules as listed in the table below. All‐in‐One Type CPU Modules Slim Type CPU Modules FC5A‐D32K3 FC5A‐C10R2 FC5A‐C16R2 FC5A‐C24R2 Group Symbol FC5A‐D16RK1 FC5A‐D32S3 FC5A‐C10R2C FC5A‐C16R2C FC5A‐C24R2C FC5A‐D16RS1 FC5A‐D12K1E FC5A‐C10R2D FC5A‐C16R2D FC5A‐C24R2D FC5A‐D12S1E MOVN IMOV IMOVN BMOV Move IBMV IBMVN NSET XCHG TCCST CMP= CMP<> CMP< CMP> CMP<= CMP>= Data Comparison ICMP>=...
Page 21
2: A I DVANCED NSTRUCTIONS All‐in‐One Type CPU Modules Slim Type CPU Modules FC5A‐D32K3 FC5A‐C10R2 FC5A‐C16R2 FC5A‐C24R2 Group Symbol FC5A‐D16RK1 FC5A‐D32S3 FC5A‐C10R2C FC5A‐C16R2C FC5A‐C24R2C FC5A‐D16RS1 FC5A‐D12K1E FC5A‐C10R2D FC5A‐C16R2D FC5A‐C24R2D FC5A‐D12S1E HTOB BTOH HTOA ATOH BTOA ATOB ENCO Data Conversion DECO BCNT CVDT DTDV DTCB SWAP WKTIM Week Programmer WKTBL DISP Interface DGRD...
Page 22
2: A I DVANCED NSTRUCTIONS All‐in‐One Type CPU Modules Slim Type CPU Modules FC5A‐D32K3 FC5A‐C10R2 FC5A‐C16R2 FC5A‐C24R2 Group Symbol FC5A‐D16RK1 FC5A‐D32S3 FC5A‐C10R2C FC5A‐C16R2C FC5A‐C24R2C FC5A‐D16RS1 FC5A‐D12K1E FC5A‐C10R2D FC5A‐C16R2D FC5A‐C24R2D FC5A‐D12S1E PULS1 PULS2 PULS3 PWM1 PWM2 Pulse PWM3 RAMP1 RAMP2 ZRN1 ZRN2 ZRN3 PID Instruction DTML DTIM Dual / Teaching DTMH Timer DTMS TTIM...
2: A I DVANCED NSTRUCTIONS Structure of an Advanced Instruction Source Device Destination Device Opcode The opcode is a symbol to identify the advanced instruction. Opcode Repeat Cycles Data Type Specifies the word (W), integer (I), double word (D), long (L), MOV(W) S1 R D1 R ***** ***** or float (F) data type. Source Device Data Type Repeat The source device specifies the 16‐ or 32‐bit data to be pro‐ Designation cessed by the advanced instruction. Some advanced instruc‐ tions require two source devices. Repeat Designation Specifies whether repeat is used for the device or not. Destination Device The destination device specifies the 16‐ or 32‐bit data to Repeat Cycles store the result of the advanced instruction. Some advanced Specifies the quantity of repeat cycles: 1 through 99. instructions require two destination devices. Input Condition for Advanced Instructions Almost all advanced instructions must be preceded by a contact, except NOP (no operation), LABEL (label), LRET (label return), and STPA (stop access) instructions. The input condition can be programmed using a bit device such as input, output, internal relay, or shift register. Timer and counter can also be used as an input condition to turn on the contact when the timer times out or the counter counts out. While the input condition is on, the advanced instruction is MOV(W) S1 –...
2: A I DVANCED NSTRUCTIONS Data Types for Advanced Instructions (Integer Type) When using move, data comparison, binary arithmetic, Boolean computation, bit shift/rotate, data conversion, and coor‐ dinate conversion instructions, data types can be selected from word (W), integer (I), double word (D), long (L), or float (F). For other advanced instructions, the data is processed in units of 16‐bit word. Quantity of Data Data Type Symbol Bits Range of Decimal Values Registers Used Word (Unsigned 16 bits) 16 bits 0 to 65,535 Integer (Signed 15 bits) 16 bits –32,768 to 32,767 Double Word (Unsigned 32 bits) 32 bits 0 to 4,294,967,295 Long (Signed 31 bits) 32 bits –2,147,483,648 to 2,147,483,647 Float (Floating point) 32 bits –3.40282310 to 3.40282310 Decimal Values and Hexadecimal Storage (Word, Integer, Double, and Long Data Types) The following table shows hexadecimal equivalents which are stored in the CPU, as a result of addition and subtraction of the decimal values shown: Data Type Result of Addition Hexadecimal Storage Result of Subtraction Hexadecimal Storage 0000 65535 FFFF 65535 FFFF...
Page 25
2: A I DVANCED NSTRUCTIONS Floating‐Point Data Format The FC5A MicroSmart can specify the floating‐point data type (F) for advanced instructions. Like the double word (D) and long integer (L) data types, the floating‐point data type also uses two consecutive data registers to execute advanced instructions. The FC5A MicroSmart supports the floating‐point data based on the single storage format of the IEEE (The Institute of Electrical and Electronics Engineers) Standard 754. Single Storage Format The IEEE single format consists of three fields: a 23‐bit fraction, f; an 8‐bit biased exponent, e; and 1‐bit sign, s. These fields are stored contiguously in one 32‐bit word, as shown in the figure below. Bits 0:22 contain the 23‐bit fraction, f, with bit 0 being the least significant bit of the fraction and bit 22 being the most significant; bits 23:30 contain the 8‐bit biased exponent, e, with bit 23 being the least significant bit of the biased exponent and bit 30 being the most significant; and the highest‐order bit 31 contains the sign bit, s. 31 30 23 22 e[30:23] f[22:0] 8‐bit biased exponent 23‐bit fraction Sign bit (0: positive, 1: negative) Single Storage Format The table below shows the correspondence between the values of the three constituent fields s, e, and f and the value represented by the single format bit pattern. When any value out of the bit pattern is entered to the advanced instruction or when execution of advanced instructions, such as division by zero, has produced any value out of the bit pattern, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the CPU module. Single Format Bit Patters Value e–127 0 < e < 255 (–1) 2 1.f (normal numbers) e–127 e = 0; f = 0 (all bits in f are zero) (–1) 2 0.0 (signed zero) Carry and Borrow in Floating‐Point Data Processing When advanced instructions involving floating‐point data are executed, special internal relay M8003 (carry and borrow) ...
2: A I DVANCED NSTRUCTIONS Double‐word Devices in Data Registers When the double‐word data type is selected for the source or destination device, the data is loaded from or stored to two consecutive data registers. The order of the two devices depends on the device type. When a data register, timer, or counter is selected as a double‐word device, the high‐word data is loaded from or stored to the first device selected. The low‐word data is loaded from or stored to the subsequent device. Example: When data register D10 is designated as a double‐word source device and data register D20 is designated as a double‐word destination device, the data is loaded from or stored to two consecutive data registers as illustrated below. Source Device Destination Device Double‐word Data 4660 4660 High Word D10 High Word D20 (1234h) (1234h) 305419896 (12345678h) 22136 22136 Low Word D11 Low Word D21 (5678h) (5678h) Note: The above example is the default setting of the FC5A MicroSmart. The order of two devices can be selected on CPU modules ( with system program version 110 or higher. See page 5‐46 Basic Vol.). Discontinuity of Device Areas Each device area is discrete and does not continue, for example, from input to output or from output to internal relay. In addition, special internal relays M8000 through M8157 (all‐in‐one type CPU) or M8317 (slim type CPU) are in a separate area from internal relays M0 through M2557. Data registers D0 through D1999, expansion data registers D2000 through D7999 (slim type CPU only), and special data registers D8000 through D8199 (all‐in‐one type CPU) or D8499 (slim type CPU) are in separate areas and do not continue with each other. The internal relay ends at M2557. Since the MOV (move) instruction reads 16 MOV(W) S1 –...
3: M I NSTRUCTIONS Introduction Data can be moved using the MOV (move), MOVN (move not), IMOV (indirect move), or IMOVN (indirect move not) instruction. The moved data is 16‐ or 32‐bit data, and the repeat operation can also be used to increase the quantity of data moved. In the MOV or MOVN instruction, the source and destination device are designated by S1 and D1 directly. In the IMOV or IMOVN instruction, the source and destination device are determined by the offset values designated by S2 and D2 added to source device S1 and destination device D1. The BMOV (block move) instruction is useful to move consecutive blocks of timer, counter, and data register values. The IBMV (indirect bit move) and IBMVN (indirect bit move not) instructions move one bit of data from a source device to a destination device. Both devices are determined by adding an offset to the device. NSET (N data set) and NRS (N data repeat set) instructions can be used to set values to a group of devices. The XCHG (exchange) instruction is used to swap word or double‐word data between two devices. The current values of timer or counter can be changed using the TCCST (timer/counter current value store) instruction. Since the move instructions are executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used as required. MOV (Move) S1 D1 MOV(*) S1(R) D1(R) When input is on, 16‐ or 32‐bit data from device designated by S1 is moved to ***** ***** device designated by D1. The float data type is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) First device address to move 1‐99...
Page 28
3: M I NSTRUCTIONS Examples: MOV Data Type: Word D10 M0 MOV(W) S1 – D1 – When input I2 is on, the data in data register D10 designated by source device S1 is moved to 16 internal relays starting with M0 designated by destination device 12345 M0 through M7, M10 through M17 The data in the source data register is converted into 16‐bit binary data, and the ON/OFF statuses of the 16 bits are moved to internal relays M0 through M7 and M10 through M17. M0 is the LSB (least significant bit). M17 is the MSB (most significant bit). Data Type: Word 810 D2 MOV(W) S1 – D1 – When input I0 is on, constant 810 designated by source device S1 is moved to data register D2 desig‐ nated by destination device D1. Data move operation for the integer data type is the same as for the word data type. Data Type: Double Word 810 D2∙D3 MOV(D) S1 – D1 – When input I0 is on, constant 810 designated by source device S1 is moved to data registers D2 and D3 designated by destination device D1. Data move operation for the long data type is the same as for the double‐word data type. Data Type: Word D10 D2 MOV(W) S1 – D1 – When input I1 is on, the data in data register D10 ...
Page 29
3: M I NSTRUCTIONS Repeat Operation in the Move Instructions Repeat Source Device When the S1 (source) is designated with repeat, devices as many as the repeat cycles starting with the device designated by S1 are moved to the destination. As a result, only the last of the source devices is moved to the destination. • Data Type: Word Source (Repeat = 3) Destination (Repeat = 0) MOV(W) S1 R D1 – • Data Type: Double Word Source (Repeat = 3) Destination (Repeat = 0) MOV(D) S1 R D1 – Repeat Destination Device When the D1 (destination) is designated to repeat, the source device designated by S1 is moved to all destination devices as many as the repeat cycles starting with the destination designated by D1. • Data Type: Word Source (Repeat = 0) Destination (Repeat = 3) MOV(W) S1 – D1 R • Data Type: Double Word Source (Repeat = 0) Destination (Repeat = 3) MOV(D) S1 – D1 R Repeat Source and Destination Devices When both S1 (source) and D1 (destination) are designated to repeat, devices as many as the repeat cycles starting with the device designated by S1 are moved to the same quantity of devices starting with the device designated by D1. Note: The BMOV (block move) instruction has the same effect as the MOV instruction with both the source and destination designated to repeat. • Data Type: Word Source (Repeat = 3) Destination (Repeat = 3) MOV(W)
Page 30
3: M I NSTRUCTIONS • Data Type: Double Word Source (Repeat = 3) Destination (Repeat = 3) MOV(D) S1 R D1 R • Data Type: Float When a source data does not comply with the normal floating‐point format in any repeat operation, a user program exe‐ cution error occurs, and the source data is not moved to the destination. Source (Repeat = 3) Destination (Repeat = 3) MOV(F) S1 R D1 R D10∙D11 D20∙D21 Invalid 11.1 D12∙D13 D22∙D23 3.44 3.44 D14∙D15 D24∙D25 Repeat Bit Devices The MOV (move) instruction moves 16‐bit data (word or integer data type) or 32‐bit data (double‐word or integer data type). When a bit device such as input, output, internal relay, or shift register is designated as the source or destination device, 16 or 32 bits starting with the one designated by S1 or D1 are the target data. If a repeat operation is designated for a bit device, the target data increases in 16‐ or 32‐bit increments, depending on the selected data type. • Data Type: Word Source (Repeat = 0) Destination (Repeat = 3) MOV(W) S1 – D1 R M0 through M7, M10 through M17 M20 through M27, M30 through M37 M40 through M47, M50 through M57 • Data Type: Double Word...
3: M I NSTRUCTIONS MOVN (Move Not) S1 NOT D1 MOVN(*) S1(R) D1(R) When input is on, 16‐ or 32‐bit data from device designated by S1 is inverted bit ***** ***** by bit and moved to device designated by D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) First device address to move 1‐99 D1 (Destination 1) First device address to move to — — 1‐99 ( For the valid device address range, see pages 6‐1 and 6‐2 Basic Vol.). Internal relays M0 through M2557 can be designated as D1. Special internal relays cannot be designated as D1. When T (timer) or C (counter) is used as S1, the timer/counter current value (TC or CC) is read out. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535. Valid Data Types When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is designated as W (word) the source or destination, 16 points (word or integer data type) or 32 points (double‐word or long data ...
3: M I NSTRUCTIONS IMOV (Indirect Move) S1 + S2 D1 + D2 IMOV(*) S1(R) D1(R) When input is on, the values contained in devices designated ***** ***** ***** ***** by S1 and S2 are added to determine the source of data. The 16‐ or 32‐bit data so determined is moved to destination, which is determined by the sum of values contained in devices designated by D1 and D2. The float data type is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Base address to move from — 1‐99 S2 (Source 2) Offset for S1 — — D1 (Destination 1) Base address to move to —...
Page 33
3: M I NSTRUCTIONS Example: IMOV • Data Type: Word IMOV(W) S1 – D1 – D20 C10 D10 + D25 Source device S1 and destination device D1 determine the type of device. Source device S2 and destination device D2 are the offset values to determine the source and destination devices. If the current value of counter C10 designated by source device S2 is 4, the source data is determined by adding the offset to data register D20 designated by source device S1: 6450 D(20 + 4) = D24 If data register D25 contains a value of 20, the destination is determined by adding the offset to data regis‐ ter D10 designated by destination device D1: 6450 D(10 + 20) = D30 As a result, when input I0 is on, the data in data register D24 is moved to data register D30. • Data Type: Float IMOV(F) S1 – D1 – 2.73 D22∙D23 D20 + D50 D10 + D51 If data register D50 contains a value of 2, the source data is determined by adding the offset to data register 2.73 D30∙D31 D20 designated by source device S1: D(20 + 2) = D22 If data register D51 contains a value of 20, the destination is determined by adding the offset to data regis‐ ter D10 designated by destination device D1: D(10 + 20) = D30 As a result, when input I0 is on, the data in data registers D22∙D23 is moved to data registers D30∙D31. FC5A M U ’ M FC9Y‐B1273 3‐7 ICRO...
3: M I NSTRUCTIONS IMOVN (Indirect Move Not) S1 + S2 NOT D1 + D2 IMOVN(*) S1(R) D1(R) When input is on, the values contained in devices designated ***** ***** ***** ***** by S1 and S2 are added to determine the source of data. The 16‐ or 32‐bit data so determined is inverted and moved to des‐ tination, which is determined by the sum of values contained in devices designated by D1 and D2. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Base address to move from — 1‐99 S2 (Source 2) Offset for S1 — — D1 (Destination 1) Base address to move to — —...
3: M I NSTRUCTIONS BMOV (Block Move) S1, S1+1, S1+2, ... , S1+N–1 D1, D1+1, D1+2, ... , D1+N–1 BMOV(W) N‐W When input is on, N blocks of 16‐bit word data starting with device designated ***** ***** ***** by S1 are moved to N blocks of destinations, starting with device designated by D1. N‐W specifies the quantity of blocks to move. N blocks of 16‐bit data N blocks of 16‐bit data First 16‐bit data First 16‐bit data S1+1 Second 16‐bit data D1+1 Second 16‐bit data Block Move S1+2 Third 16‐bit data D1+2 Third 16‐bit data S1+N–1 Nth 16‐bit data D1+N–1 Nth 16‐bit data Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device...
3: M I NSTRUCTIONS IBMV (Indirect Bit Move) S1 + S2 D1 + D2 IBMV S1(R) D1(R) When input is on, the values contained in devices designated ***** ***** ***** ***** by S1 and S2 are added to determine the source of data. The 1‐bit data so determined is moved to destination, which is determined by the sum of values contained in devices desig‐ nated by D1 and D2. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Base address to move from — — 0 or 1 1‐99 S2 (Source 2) Offset for S1 0‐65535 — D1 (Destination 1) Base address to move to —...
Page 37
3: M I NSTRUCTIONS D10 5 D20 + 12 IBMV S1 – D1 – SOTU Since source device S1 is a data register and the value of source device Bit 15 14 13 12 11 10 9 S2 is 5, the source data is bit 5 of data register D10 designated by source device S1. Bit 5 Since destination device D1 is a data register and the value of source device D2 is 12, the destination is bit 12 of data register D20 designated by destination device D1. Bit 15 14 13 12 11 10 9 As a result, when input I0 is on, the ON/OFF status of data register D10 bit 5 is moved to data register D20 bit 12. Bit 12 Repeat Operation in the Indirect Bit Move Instructions Repeat Bit Devices (Source and Destination) If a repeat operation is designated for bit devices such as input, output, internal relay, or shift register, bit devices as many as the repeat cycles are moved. M10 5 Q30 + 9 IBMV S1 R D1 R SOTU Repeat = 3 Since source device S1 is internal relay M10 and the value of source ...
3: M I NSTRUCTIONS IBMVN (Indirect Bit Move Not) S1 + S2 NOT D1 + D2 IBMVN S1(R) D1(R) When input is on, the values contained in devices designated ***** ***** ***** ***** by S1 and S2 are added to determine the source of data. The 1‐bit data so determined is inverted and moved to destina‐ tion, which is determined by the sum of values contained in devices designated by D1 and D2. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Base address to move from — — 0 or 1 1‐99 S2 (Source 2) Offset for S1 0‐65535 — D1 (Destination 1) Base address to move to —...
3: M I NSTRUCTIONS NSET (N Data Set) S1, S2, S3, ... , Sn D1, D2, D3, ... , Dn ..NSET(*) When input is on, N blocks of 16‐ or 32‐bit data in devices designated ***** ***** ***** ***** by S1, S2, S3, ... , Sn are moved to N blocks of destinations, starting with device designated by D1. This instruction is available on upgraded CPU modules with system pro‐ gram version 200 or higher. N blocks of 16‐/32‐bit data N blocks of 16‐/32‐bit data First 16‐/32‐bit data First 16‐/32‐bit data Second 16‐/32‐bit data D1+1 or D1+2 Second 16‐/32‐bit data N Data Set Third 16‐/32‐bit data D1+2 or D1+4 Third 16‐/32‐bit data Nth 16‐/32‐bit data D1+N–1 or D1+2N–2 Nth 16‐/32‐bit data Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1...
3: M I NSTRUCTIONS NRS (N Data Repeat Set) S1 D1, D2, D3, ... , Dn–1 NRS(*) N‐W When input is on, 16‐ or 32‐bit data designated by S1 is set to N blocks of desti‐ ***** ***** ***** nations, starting with device designated by D1. This instruction is available on upgraded CPU modules with system program version 200 or higher. N blocks of 16‐/32‐bit data First 16‐/32‐bit data Source data for repeat set D1+1 or D1+2 Second 16‐/32‐bit data N Data Repeat Set 16‐/32‐bit data D1+2 or D1+4 Third 16‐/32‐bit data D1+N–1 or D1+2N–2 Nth 16‐/32‐bit data Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat N‐W (N blocks) Quantity of blocks to move...
3: M I NSTRUCTIONS XCHG (Exchange) Word data type: D1 D2 XCHG(*) Double‐word data type: D1∙D1+1 D2, D2+1 ***** ***** When input is on, the 16‐ or 32‐bit data in devices designated by D1 and D2 are exchanged with each other. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat D1 (Destination 1) First device address to exchange — — — — — D2 (Destination 2) First device address to exchange — — — — —...
3: M I NSTRUCTIONS TCCST (Timer/Counter Current Value Store) S1 D1 TCCST(*) S1(R) D1(R) When input is on, 16‐ or 32‐bit data designated by S1 is read out and stored to ***** ***** the current value of device designated by D1. This instruction is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) First device address to move 1‐99 D1 (Destination 1) First device address to move to — — — — — — 1‐99 For the valid device address range, see pages 6‐1 and 6‐2 (Basic Vol.).
4: D C I OMPARISON NSTRUCTIONS Introduction Data can be compared using data comparison instructions, such as equal to, unequal to, less than, greater than, less than or equal to, and greater than or equal to. When the comparison result is true, an output or internal relay is turned on. The repeat operation can also be used to compare more than one set of data. New logical OR operation option is added to the CMP instructions when the repeat operation is enabled. Repeated com‐ parison results of CMP instructions can be selected from AND or OR operation, and the result is outputted to an output or internal relay. This option is available on upgraded CPU modules with system program version 200 or higher. Three values can also be compared using the ICMP>= instruction. Load comparison instructions have been added. The comparison result is loaded so that the following instructions can be initiated. These instructions are available on upgraded CPU modules with system program version 200 or higher. Since the data comparison instructions are executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used as required. CMP= (Compare Equal To) Data type W or I: S1 = S2 D1 on Data type D, L, or F: S1∙S1+1 = S2∙S2+1 D1 on CMP=(*) S1(R) S2(R) D1(R) AND/OR When input is on, 16‐ or 32‐bit data designated by source devices S1 ***** ***** ***** and S2 are compared. When S1 data is equal to S2 data, destination device D1 is turned on. When the condition is not met, D1 is turned off. CMP<> (Compare Unequal To) Data type W or I: S1 S2 D1 on Data type D, L, or F: S1∙S1+1 ...
4: D C I OMPARISON NSTRUCTIONS CMP>= (Compare Greater Than or Equal To) Data type W or I: S1 S2 D1 on Data type D, L, or F: S1∙S1+1 S2∙S2+1 D1 on CMP>=(*) S1(R) S2(R) D1(R) AND/OR When input is on, 16‐ or 32‐bit data designated by source devices S1 ***** ***** ***** and S2 are compared. When S1 data is greater than or equal to S2 data, destination device D1 is turned on. When the condition is not met, D1 is turned off. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat Repeat Result Logical AND or OR operation — — — — — — — —...
Page 45
4: D C I OMPARISON NSTRUCTIONS Examples: CMP>= The following examples are described using the CMP instruction. Data comparison operation for all other data compari‐ son instructions is the same for the CMP instruction. • Data Type: Word CMP>=(W) S1 – S2 – D1 – Q0 turned on Q0 turned off • Data Type: Integer CMP>=(I) S1 – S2 – D1 – –3 Q1 turned on –4 –3 Q1 turned off • Data Type: Double Word CMP>=(D) S1 – S2 – D1 – 23456789 12345678 D50∙D51 D60∙D61 Q2 turned on 23456789 34567890 D50∙D51 D60∙D61 Q2 turned off • Data Type: Long CMP>=(L) S1 –...
Page 46
4: D C I OMPARISON NSTRUCTIONS Repeat Operation in the Data Comparison Instructions The following examples are described using the CMP instruction of the word and double word data types. Repeat oper‐ ation for all other data comparison instructions and other data types is the same as the following examples. New logical OR operation option is added to the CMP instructions when the repeat operation is enabled. Repeated com‐ parison results of CMP instructions can be selected from AND or OR operation, and the result is outputted to an output or internal relay. This option is available on upgraded CPU modules with system program version 200 or higher. Repeat One Source Device When only S1 (source) is designated to repeat, source devices (as many as the repeat cycles, starting with the device des‐ ignated by S1) are compared with the device designated by S2. The comparison results are ANDed or ORed and set to the destination device designated by D1. • Data Type: Word (Repeat Logical Operation AND) S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) CMP>=(W) S1 R S2 – D1 – • Data Type: Word (Repeat Logical Operation OR) S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) CMP>=(W) S1 R S2 – D1 – • Data Type: Double Word (Repeat Logical Operation AND) S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) CMP>=(D) S1 R S2 – D1 – D20∙D21 D30∙D31 D22∙D23 D30∙D31...
Page 47
4: D C I OMPARISON NSTRUCTIONS Repeat Source and Destination Devices When S1, S2 (source), and D1 (destination) are designated to repeat, source devices (as many as the repeat cycles, start‐ ing with the devices designated by S1 and S2) are compared with each other. The comparison results are set to destina‐ tion devices (as many as the repeat cycles, starting with the device designated by D1). • Data Type: Word S1 (Repeat = 3) S2 (Repeat = 3) D1 (Repeat = 3) CMP>=(W) S1 R S2 R D1 R M10 turned on M11 turned on M12 turned off • Data Type: Double Word S1 (Repeat = 3) S2 (Repeat = 3) D1 (Repeat = 3) CMP>=(D) S1 R S2 R D1 R D20∙D21 D30∙D31 D22∙D23 D32∙D33 D24∙D25 D34∙D35 Comparison Output Status The comparison output is usually maintained while the input to the data comparison instruction is off. If the comparison output is on, the on status is maintained when the input is turned off as demonstrated by this program. Input I0 CMP>=(W) S1 – S2 –...
4: D C I OMPARISON NSTRUCTIONS ICMP>= (Interval Compare Greater Than or Equal To) Data type W or I: S1 S2 S3 D1 on ICMP>=(*) Data type D, L, F: S1∙S1+1 S2∙S2+1 S3∙S3+1 D1 on ***** ***** ***** ***** When input is on, the 16‐ or 32‐bit data designated by S1, S2, and S3 are compared. When the condition is met, destination device D1 is turned on. When the condition is not met, D1 is turned off. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Data to compare — S2 (Source 2) Data to compare — S3 (Source 3) Data to compare — D1 (Destination 1) Comparison output —...
Page 49
4: D C I OMPARISON NSTRUCTIONS Example: ICMP>= D10 D11 D12 Q1 goes on ICMP>=(W) SOTU When input I0 is turned on, data of data registers D10, D11, and D12 designated by source devices S1, S2, and S3 are compared. When the condition is met, internal relay Q1 designated by destination device D1 is turned on. When the condition is not met, Q1 is turned off. M8150 M8151 M8152 M8004 > Q1 goes on < < Q1 goes off FC5A M U ’ M FC9Y‐B1273 4‐7 ICRO MART ANUAL...
4: D C I OMPARISON NSTRUCTIONS LC= (Load Compare Equal To) Data type W or I: S1 = S2 Data type D, L, or F: S1∙S1+1 = S2∙S2+1 LC=(*) This instruction constantly compares 16‐ or 32‐ bit data designated by S1 and S2. When S1 ***** ***** data is equal to S2 data, the output to the following instructions is turned on. When the con‐ dition is not met, the output is turned off. LC<> (Load Compare Unequal To) Data type W or I: S1 S2 Data type D, L, or F: S1∙S1+1 S2∙S2+1 LC<>(*) This instruction constantly compares 16‐ or 32‐ bit data designated by S1 and S2. When S1 data ***** ***** is not equal to S2 data, the output to the following instructions is turned on. When the condi‐ tion is not met, the output is turned off. LC< (Load Compare Less Than) Data type W or I: S1 < S2 Data type D, L, or F: S1∙S1+1 < S2∙S2+1 LC<(*) ...
Page 51
4: D C I OMPARISON NSTRUCTIONS Valid Data Types When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is designated, 16 W (word) points (word or integer data type) or 32 points (double‐word or long data type) are used. I (integer) When a word device such as T (timer), C (counter), or D (data register) is designated, 1 point (word or D (double word) integer data type) or 2 points (double‐word, long, or float data type) are used. L (long) F (float) Examples: LC Ladder Diagram 1 Program List Reset Instruction Data CNTD 100000 Pulse CNTD 100000 LC=(D) LC=(D) 99997 99997 LC>=(D) LC>=(D) 99996 99996 Timing Chart Reset Input I0 99995 99996 99997 99998 99999 100000 Pulse Input I1...
Page 52
4: D C I OMPARISON NSTRUCTIONS 4‐10 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
5: B A I INARY RITHMETIC NSTRUCTIONS Introduction The binary arithmetic instructions make it possible for the user to program computations using addition, subtraction, multiplication, and division. For addition and subtraction devices, internal relay M8003 is used to carry or to borrow. The ROOT instruction can be used to calculate the square root of the value stored in one or two data registers. INC (increment), DEC (decrement), SUM (sum), and RNDM (random) instructions are added to upgraded CPU modules with system program version 210 or higher. ADD (Addition) Data type W or I: S1 + S2 D1, CY ADD(*) S1(R) S2(R) D1(R) Data type D, L, or F: S1∙S1+1 + S2∙S2+1 D1∙D1+1, CY ***** ***** ***** When input is on, 16‐ or 32‐bit data designated by source devices S1 and S2 are added. The result is set to destination device D1 and carry (M8003). SUB (Subtraction) Data type W or I: S1 – S2 D1, BW SUB(*) S1(R) S2(R) D1(R) Data type D, L, or F: S1∙S1+1 – S2∙S2+1 D1∙D1+1, BW ***** ***** ***** When input is on, 16‐ or 32‐bit data designated by source device S2 is subtracted from 16‐ or 32‐bit data designated by source device S1. ...
Page 54
5: Binary Arithmetic Instructions Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Data for calculation 1‐99 S2 (Source 2) Data for calculation 1‐99 D1 (Destination 1) Destination to store results — — 1‐99 ( For the valid device address range, see pages 6‐1 and 6‐2 Basic Vol.). Internal relays M0 through M2557 can be designated as D1. Special internal relays cannot be designated as D1. When T (timer) or C (counter) is used as S1 or S2, the timer/counter current value (TC or CC) is read out. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535. When F (float) data type is selected, only data register and constant can be designated as S1 and S2. When F (float) data type is selected and S1 or S2 does not comply with the normal floating‐point format, a user program execution error will result, turning on special internal relay M8004 and ERR LED on the CPU module. Since the binary arithmetic instructions are executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used as required. Valid Data Types When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is designated as W (word) the source, 16 points (word or integer data type) or 32 points (double‐word, long, or float data type) I (integer) are used. When repeat is designated for a bit device, the quantity of device bits increases in 16‐ or 32‐...
Page 55
5: Binary Arithmetic Instructions Examples: ADD • Data Type: Word This example demonstrates the use of a carry signal from special internal relay M8003 to set an alarm signal. D2 + 500 D2 ADD(W) S1 – S2 – D1 – SOTU When a carry occurs, output Q0 is set as a warning indicator. M8003 Acknowledge When the acknowledge pushbutton (input I1) is pressed, the Pushbutton warning indicator is reset. • Data Type: Integer ADD(I) S1 – S2 – D1 – –4 –11 –15 • Data Type: Double Word ADD(D) S1 – S2 – D1 – D10∙D11 1957400 D20∙D21 4112600 D30∙D31 6070000 • Data Type: Long ADD(L) S1 – S2 – D1 – 216283 –964355 –748072...
Page 56
5: Binary Arithmetic Instructions Examples: MUL • Data Type: Word MUL(W) S1 – S2 – D1 – 300000 D30∙D31 (01F4h) (0258h) (000493E0h) When input I1 is on, data of D10 is multiplied by data of D20, and the result is set to D30 and (0004h) D31. 37856 (93E0h) • Data Type: Integer MUL(I) S1 – S2 – D1 – –500 –300000 D30∙D31 (FE0Ch) (0258h) (FFFB6C20h) 65531 (FFFBh) 27680 (6C20h) • Data Type: Double Word MUL(D) S1 – S2 – D1 – D10∙D11 100000 D20∙D21...
Page 57
5: Binary Arithmetic Instructions Examples: DIV • Data Type: Word ÷ DIV(W) S1 – S2 – D1 – Quotient Remainder When input I2 is on, data of D10 is divided by data of D20. The quotient is set to D30, and the remainder is set to D31. Note: Since the destination uses two word devices in the division operation of word data type, data register D1999 cannot be used as destination device D1. When using a bit device such as internal relay for destination, 32 internal relays are required; so M2521 or a larger number cannot be used as destination device D1. • Data Type: Integer –7 –7 ÷ DIV(I) S1 – S2 – D1 – Quotient Remainder Note: Since the destination uses two word devices in the division operation of integer data type, data register D1999 cannot be used as destination device D1. When using a bit device such as internal relay for destination, 32 internal relays are required; so M2521 or a larger number cannot be used as destination device D1. • Data Type: Double Word DIV(D) S1 – S2 – D1 – 100000 ÷ 70000 30000 D10∙D11 D20∙D21 D30∙D31 D32∙D33 Quotient Remainder...
Page 58
5: Binary Arithmetic Instructions Repeat Operation in the ADD and SUB Instructions Source devices S1 and S2 and destination device D1 can be designated to repeat individually or in combination. When destination device D1 is not designated to repeat, the final result is set to destination device D1. When repeat is desig‐ nated, consecutive devices as many as the repeat cycles starting with the designated device are used. Since the repeat operation works similarly on the ADD (addition) and SUB (subtraction) instructions, the following examples are described using the ADD instruction. Repeat One Source Device • Data Type: Word and Integer When only S1 (source) is designated to repeat, the final result is set to destination device D1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) ADD(W) S1 R S2 – D1 – SOTU (35) (40) • Data Type: Double Word, Long, and Float When only S1 (source) is designated to repeat, the final result is set to destination device D1∙D1+1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) ADD(D) S1 R S2 – D1 – SOTU D10∙D11 D20∙D21 (D30∙D31) D12∙D13 D20∙D21 (D30∙D31) D14∙D15 D20∙D21 D30∙D31 Repeat Destination Device Only • Data Type: Word and Integer When only D1 (destination) is designated to repeat, the same result is set to 3 devices starting with D1.
Page 59
5: Binary Arithmetic Instructions Repeat Source and Destination Devices • Data Type: Word and Integer When S1 (source) and D1 (destination) are designated to repeat, different results are set to 3 devices starting with D1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 3) ADD(W) S1 R S2 – D1 R SOTU • Data Type: Double Word, Long, and Float When S1 (source) and D1 (destination) are designated to repeat, different results are set to 3 devices starting with D1∙D1+1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 3) ADD(D) S1 R S2 – D1 R SOTU D10∙D11 D20∙D21 D30∙D31 D12∙D13 D20∙D21 D32∙D33 D14∙D15 D20∙D21 D34∙D35 Repeat All Source and Destination Devices • Data Type: Word and Integer When all devices are designated to repeat, different results are set to 3 devices starting with D1. S1 (Repeat = 3) S2 (Repeat = 3) D1 (Repeat = 3) ADD(W) S1 R S2 R D1 R SOTU...
Page 60
5: Binary Arithmetic Instructions Repeat Operation in the MUL Instruction Since the MUL (multiplication) instruction uses two destination devices, the result is stored to destination devices as described below. Source devices S1 and S2 and destination device D1 can be designated to repeat individually or in com‐ bination. When destination device D1 is not designated to repeat, the final result is set to destination device D1 and D1+1. When repeat is designated, consecutive devices as many as the repeat cycles starting with the designated device are used. Since the repeat operation works similarly on the word and integer data types, the following examples are described using the word data type. Repeat One Source Device When only S1 (source) is designated to repeat, the final result is set to destination device D1∙D1+1. • Data Type: Word and Integer S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) MUL(W) S1 R S2 – D1 – SOTU (D30∙D31) (D30∙D31) D30∙D31 • Data Type: Double Word, Long, and Float S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) MUL(D) S1 R S2 – D1 – SOTU D10∙D11 D20∙D21 (D30∙D31) D12∙D13 D20∙D21 (D30∙D31)
Page 61
5: Binary Arithmetic Instructions Repeat Source and Destination Devices When S1 (source) and D1 (destination) are designated to repeat, different results are set to 3 devices starting with D1∙D1+1. • Data Type: Word and Integer S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 3) MUL(W) S1 R S2 – D1 R SOTU D30∙D31 D32∙D33 D34∙D35 • Data Type: Double Word, Long, and Float S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 3) MUL(D) S1 R S2 – D1 R SOTU D10∙D11 D20∙D21 D30∙D31 D12∙D13 D20∙D21 D32∙D33 D14∙D15 D20∙D21 D34∙D35 Repeat All Source and Destination Devices When all devices are designated to repeat, different results are set to 3 devices starting with D1∙D1+1.
Page 62
5: Binary Arithmetic Instructions Repeat Operation in the DIV Instruction Since the DIV (division) instruction (except the float data type) uses two destination devices, the quotient and remainder are stored as described below. Source devices S1 and S2 and destination device D1 can be designated to repeat individu‐ ally or in combination. When destination device D1 is not designated to repeat, the final result is set to destination device D1 (quotient) and D1+1 (remainder). When repeat is designated, consecutive devices as many as the repeat cycles start‐ ing with the designated device are used. Division instructions in the float data type do not generate remainders and use two consecutive data registers to store quotients. When repeat is designated for destination of the float data type, consecutive data registers as many as the repeat cycles are used. Repeat One Source Device • Data Type: Word and Integer When only S1 (source) is designated to repeat, the final result is set to destination devices D1 and D1+1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) DIV(W) S1 R S2 – D1 – SOTU ÷ (D30) (D31) ÷ (D30) (D31) ÷ Quotient Remainder • Data Type: Double Word and Long When only S1 (source) is designated to repeat, the final result is set to destination devices D1∙D1+1 and D1+2∙D1+3. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) DIV(D) S1 R S2 – D1 – SOTU D10∙D11 ÷...
Page 63
5: Binary Arithmetic Instructions Repeat Two Source Devices • Data Type: Word and Integer When S1 and S2 (source) are designated to repeat, the final result is set to destination devices D1 and D1+1. S1 (Repeat = 3) S2 (Repeat = 3) D1 (Repeat = 0) DIV(W) S1 R S2 R D1 – SOTU ÷ (D30) (D31) ÷ (D30) (D31) ÷ Quotient Remainder • Data Type: Double Word and Long When S1 and S2 (source) are designated to repeat, the final result is set to destination devices D1∙D1+1 and D1+2∙D1+3. S1 (Repeat = 3) S2 (Repeat = 3) D1 (Repeat = 0) DIV(D) S1 R S2 R D1 – SOTU D10∙D11 ÷ D20∙D21 (D30∙D31) (D32∙D33) D12∙D13 ÷ D22∙D23 (D30∙D31) (D32∙D33) D14∙D15 ÷...
Page 64
5: Binary Arithmetic Instructions Repeat All Source and Destination Devices • Data Type: Word and Integer When all devices are designated to repeat, different results are set to 6 devices starting with D1. S1 (Repeat = 3) S2 (Repeat = 3) D1 (Repeat = 3) DIV(W) S1 R S2 R D1 R SOTU ÷ ÷ ÷ Quotient Remainder • Data Type: Double Word and Long When all devices are designated to repeat, different results are set to 6 devices starting with D1∙D1+1. S1 (Repeat = 3) S2 (Repeat = 3) D1 (Repeat = 3) DIV(D) S1 R S2 R D1 R SOTU D10∙D11 ÷ D20∙D21 D30∙D31 D36∙D37 D12∙D13 ÷ D22∙D23 D32∙D33 D38∙D39 D14∙D15 ÷ D24∙D25 D34∙D35 D40∙D41 Quotient...
5: Binary Arithmetic Instructions INC (Increment) Data type W or I: S/D + 1 S/D INC(*) Data type D or L: S/D∙S/D+1 + 1 S/D∙S/D+1 ***** When input is on, one is added to the 16‐ or 32‐bit data designated by device S/D and the result is stored to the same device. This instruction is available on upgraded CPU modules with system program version 210 or higher. DEC (Decrement) Data type W or I: S/D – 1 S/D DEC(*) Data type D or L: S/D∙S/D+1 – 1 S/D∙S/D+1 ***** When input is on, one is subtracted from the 16‐ or 32‐bit data designated by device S/D and the result is stored to the same device. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S/D (Source/Destination) Device to increment data — — — — — — —...
Page 66
5: Binary Arithmetic Instructions Example: INC INC(W) SOTU When input I0 is turned on, the data of D10 is incremented by one. If the SOTU is not programmed, the data of D10 is incremented in each scan. Example: DEC DEC(W) – SOTU When input I1 is turned on, the data of D20 is decremented by one. If the SOTU is not programmed, the data of D20 is decremented in each scan. 5‐14 FC5A MicroSmart User’s Manual FC9Y‐B1273...
5: Binary Arithmetic Instructions ROOT (Root) S1 Data type W: ROOT(*) When input is on, the square root of device designated by S1 is extracted ***** ***** and is stored to the destination designated by D1. The square root is calculated to two decimals, omitting the figures below the second place of decimals, and multiplied by 100. S1·S1+1 Data type D: D1∙D1+1 When input is on, the square root of device designated by S1∙S1+1 is extracted and is stored to the destination designated by D1∙D1+1. The square root is calculated to two decimals, omitting the figures below the second place of decimals, and multiplied by 100. S1·S1+1 Data type F: D1∙D1+1 When input is on, the square root of device designated by S1∙S1+1 is extracted and is stored to the destination designated by D1∙D1+1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data...
5: Binary Arithmetic Instructions SUM (Sum) Calculate the total of designated data, depending on the calculation option. SUM(*) ADD: ADD/XOR ***** ***** ***** When input is on, N blocks of 16‐ or 32‐bit data starting at device designated by S1 are added and the result is stored to device designated by D1. S2 specifies the quantity of data blocks. XOR: When input is on, N blocks of 16‐bit data starting at device designated by S1 are XORed and the result is stored to device designated by D1. S2 specifies the quantity of data blocks. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) First device address to calculate — — — — — — S2 (Source 2) Quantity of data blocks —...
Page 69
5: Binary Arithmetic Instructions Carry and Borrow In advanced instructions involving D (double word), L (long), or F (floating point) data, special internal relay M8003 (carry and borrow) is turned on when the execution of the instruction results in the following value. Data Type M8003 Execution Result D (double word) Out of the range between 0 to 4,294,967,295 L (long) Out of the range between –2,147,483,648 to 2,147,483,647 F (float) See the figure below. Carry and Borrow in Floating‐Point Data Processing When advanced instructions involving floating‐point data are executed, special internal relay M8003 (carry and borrow) is updated. M8003 Execution Result Value 0 Overflow (out of the range between –3.40282310 and 3.40282310 –38 –38 Not zero (within the range between –1.17549510 and 1.17549510 Zero Not Zero Overflow Overflow M8003 –38 –38 Execution Result –3.40282310 –1.17549510 1.17549510 3.40282310 Examples: SUM • Data Type: Word SUM(W) SOTU...
5: Binary Arithmetic Instructions RNDM (Random) When input is on, pseudorandom numbers are generated. RNDM(W) Source devices S1 and S2 specify the minimum and maximum values of the gen‐ ***** ***** ***** erated pseudorandom numbers, respectively. S2 value must be larger than S1 value. S1 and S2 values must be between 0 and 32767. The result is stored to the destination designated by device D1. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Minimum value of pseudorandom numbers — — — — — — — S2 (Source 2) Maximum value of pseudorandom numbers — — — — — — —...
6: B C I OOLEAN OMPUTATION NSTRUCTIONS Introduction Boolean computations use the AND, OR, and exclusive OR statements as carried out by the ANDW, ORW, and XORW instructions in the word data type, respectively. ANDW (AND Word) S1 ∙ S2 D1 ANDW(*) S1(R) S2(R) D1(R) When input is on, 16‐ or 32‐bit data designated by source devices S1 ***** ***** ***** and S2 are ANDed, bit by bit. The result is set to destination device D1. S1 = 1 S2 = 1 D1 = 1 ORW (OR Word) S1 + S2 D1 ORW(*) S1(R) S2(R) D1(R) When input is on, 16‐ or 32‐bit data designated by source devices S1 ***** ***** ***** and S2 are ORed, bit by bit. The result is set to destination device D1. S1 = 1 S2 = 1 D1 = 1 XORW (Exclusive OR Word) ...
Page 74
6: B C I OOLEAN OMPUTATION NSTRUCTIONS Valid Devices Device Function Constant Repeat S1 (Source 1) Data for computation 1‐99 S2 (Source 2) Data for computation 1‐99 D1 (Destination 1) Destination to store results — — 1‐99 ( For the valid device address range, see pages 6‐1 and 6‐2 Basic Vol.). Internal relays M0 through M2557 can be designated as D1. Special internal relays cannot be designated as D1. When T (timer) or C (counter) is used as S1 or S2, the timer/counter current value (TC or CC) is read out. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535. Since the Boolean computation instructions are executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used as required. Valid Data Types When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is designated as W (word) the source or destination, 16 points (word data type) or 32 points (double‐word data type) are used. I (integer) — When repeat is designated for a bit device, the quantity of device bits increases in 16‐ or 32‐point incre‐ ments. D (double word) When a word device such as T (timer), C (counter), or D (data register) is designated as the source or L (long) —...
Page 75
6: B C I OOLEAN OMPUTATION NSTRUCTIONS Repeat Operation in the ANDW, ORW, and XORW Instructions Source devices S1 and S2 and destination device D1 can be designated to repeat individually or in combination. When destination device D1 is not designated to repeat, the final result is set to destination device D1. When repeat is desig‐ nated, consecutive devices as many as the repeat cycles starting with the designated device are used. Since the repeat operation works similarly on the ANDW (AND word), ORW (OR word), and XORW (exclusive OR word) instructions, the following examples are described using the ANDW instruction. Repeat One Source Device • Data Type: Word When only S1 (source) is designated to repeat, the final result is set to destination device D1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) ANDW(W) S1 R S2 – D1 – SOTU ∙ (D30) ∙ (D30) ∙ • Data Type: Double Word When only S1 (source) is designated to repeat, the final result is set to destination device D1∙D1+1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 0) ANDW(D) S1 R S2 – D1 – SOTU ∙ D10∙D11 D20∙D21 (D30∙D31) ∙...
Page 76
6: B C I OOLEAN OMPUTATION NSTRUCTIONS Repeat Source and Destination Devices • Data Type: Word When S1 (source) and D1 (destination) are designated to repeat, different results are set to 3 devices starting with D1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 3) ANDW(W) S1 R S2 – D1 R SOTU ∙ ∙ ∙ • Data Type: Double Word When S1 (source) and D1 (destination) are designated to repeat, different results are set to 3 devices starting with D1∙D1+1. S1 (Repeat = 3) S2 (Repeat = 0) D1 (Repeat = 3) ANDW(D) S1 R S2 – D1 R SOTU ∙ D10∙D11 D20∙D21 D30∙D31 ∙ D12∙D13 D20∙D21 D32∙D33 ∙ D14∙D15 D20∙D21 D34∙D35...
7: S / R I HIFT OTATE NSTRUCTIONS Introduction Bit shift instructions are used to shift the data string starting with source device S1 to the left or right by 1 to 15 bits as designated. The data string can be 1 to 65535 bits. The result is set to the source device S1 and a carry (special internal relay M8003). The LSB or MSB is filled with 0 or 1 as designated. Bit shift and rotate instructions are used to shift the 16‐ or 32‐bit data string in the designated source device S1 to the left or right by the quantity of bits designated. The result is set to the source device S1 and a carry (special internal relay M8003). The BCD left shift instruction shifts the BCD digits in two consecutive data registers to the left. The word shift instruction is used to move 16‐bit data to a destination data register and shifts down the data of subse‐ quent data registers as many as designated. SFTL (Shift Left) CY S1 SFTL Bits When input is on, N_B‐bit data string starting with source device S1 is ***** ***** ***** shifted to the left by the quantity of bits designated by device Bits. The result is set to source device S1, and the last bit status shifted out is set to a carry (special internal relay M8003). Zero or 1 designated by source device S2 is set to the LSB. Bits = 1 • S2 = 0, N_B = 16, Before shift: M8003 Shift to the left After shift: M8003 Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices...
Page 78
7: S / R I HIFT OTATE NSTRUCTIONS Examples: SFTL • N_B = 16 bits M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – When the CPU starts operation, the MOV (move) instruction 43690 M8120 sets 43690 to data register D10. SFTL Bits SOTU Each time input I0 is turned on, 16‐bit data of data register D10 is shifted to the left by 1 bit as designated by device Bits. The last bit status shifted out is set to a carry (special internal relay M8003). Zeros are set to the LSB. Bits to shift = 1 Before shift: D10 = 43690 M8003 Shift to the left After first shift: D10 = 21844 M8003 After second shift: D10 = 43688 M8003 • N_B = 32 bits M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – When the CPU starts operation, the MOV (move) instruc‐ M8120 tions set 0 and 65535 to data registers D10 and D11, respec‐ MOV(W) S1 –...
7: S / R I HIFT OTATE NSTRUCTIONS SFTR (Shift Right) S1 CY SFTR Bits When input is on, N_B‐bit data string starting with source device S1 is ***** ***** ***** shifted to the right by the quantity of bits designated by device Bits. The result is set to source device S1, and the last bit status shifted out is set to a carry (special internal relay M8003). Zero or 1 designated by source device S2 is set to the MSB. its = 1 • S2 = 0, N_B = 16, B Before shift: Shift to the right M8003 After shift: M8003 Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) First data for bit shift — —...
Page 80
7: S / R I HIFT OTATE NSTRUCTIONS Example: SFTR • Data Type: Word M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – When the CPU starts operation, the MOV (move) instruction M8120 sets 29 to data register D10. SFTR Bits SOTU Each time input I0 is turned on, 16‐bit data of data register D10 is shifted to the right by 2 bits as designated by device Bits. The last bit status shifted out is set to a carry (special internal relay M8003). Zeros are set to the MSB. Bits to shift = 2 Before shift: D20 = 29 M8003 Shift to the right After first shift: D20 = 7 M8003 After second shift: D20 = 1 M8003 • Data Type: Double Word M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – When the CPU starts operation, the MOV (move) instruc‐ 65535 M8120 tions set 65535 and 0 to data registers D10 and D11, respec‐ MOV(W) S1 –...
7: S / R I HIFT OTATE NSTRUCTIONS BCDLS (BCD Left Shift) When input is on, the 32‐bit binary data designated by S1 is converted into 8 BCD digits, BCDLS shifted to the left by the quantity of digits designated by S2, and converted back to 32‐ ***** bit binary data. Valid values for each of S1 and S1+1 are 0 through 9999. The quantity of digits to shift can be 1 through 7. Zeros are set to the lowest digits as many as the digits shifted. When S2 = 1 ( digits to shift) S1+1 Before shift: Shift to the left After shift: Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Data for BCD shift — — — — — — —...
Page 82
7: S / R I HIFT OTATE NSTRUCTIONS Example: BCDLS M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – When the CPU starts operation, the MOV (move) instructions set 123 and 4567 M8120 to data registers D10 and D11, respectively. MOV(W) S1 – D1 – Each time input I0 is turned on, the 32‐bit binary data of data registers D10 and 4567 D11 designated by S1 is converted into 8 BCD digits, shifted to the left by 1 digit as designated by device S2, and converted back to 32‐bit binary data. BCDLS SOTU Zeros are set to the lowest digits as many as the digits shifted. digits to shift) When S2 = 1 ( Before shift: Shift to the left After first shift: After second shift: 7‐6 FC5A MicroSmart User’s Manual FC9Y‐B1273...
7: S / R I HIFT OTATE NSTRUCTIONS WSFT (Word Shift) When input is on, N blocks of 16‐bit word data starting with device designated WSFT by D1 are shifted up to the next 16‐bit positions. At the same time, the data ***** ***** ***** designated by device S1 is moved to device designated by D1. S2 specifies the quantity of blocks to move. quantity of blocks to shift) When S2 = 3 ( 16‐bit data 16‐bit data D1+0 First 16‐bit data D1+0 S1 data D1+1 Second 16‐bit data D1+1 First 16‐bit data D1+2 Third 16‐bit data D1+2 Second 16‐bit data D1+3 Fourth 16‐bit data 3 blocks (S2) D1+3 Third 16‐bit data D1+4 Fifth 16‐bit data D1+4 Fifth 16‐bit data Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D...
7: S / R I HIFT OTATE NSTRUCTIONS ROTL (Rotate Left) When input is on, 16‐ or 32‐bit data of the designated source device S1 is rotated to the ROTL(*) bits left by the quantity of bits designated by device bits. ***** The result is set to the source device S1, and the last bit status rotated out is set to a carry (special internal relay M8003). bits to rotate = 1) • Data Type: Word ( Before rotation: M8003 Rotate to the left After rotation: M8003 • Data Type: Double Word ( bits to rotate = 1) Before rotation: M8003 Rotate to the left After rotation: M8003 Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Data for bit rotation —...
Page 85
7: S / R I HIFT OTATE NSTRUCTIONS Example: ROTL • Data Type: Word M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – When the CPU starts operation, the MOV (move) instruction sets 40966 to data 40966 M8120 register D10. ROTL(W) bits SOTU Each time input I0 is turned on, 16‐bit data of data register D10 is rotated to the left by 1 bit as designated by device bits. The status of the MSB is set to a carry (special internal relay M8003). Bits to rotate = 1 Before rotation: D10 = 40966 M8003 After first rotation: D10 = 16397 M8003 After second rotation: D10 = 32794 M8003 • Data Type: Double Word Each time input I1 is turned on, 32‐bit data of data registers D10 and D11 is ROTL(D) bits SOTU rotated to the left by 1 bit as designated by device bits. The status of the MSB is set to a carry (special internal relay M8003). Bits to rotate = 1 Before rotation: D10∙D11 = 2,684,788,742 D10∙D11 M8003 Rotate to the left After rotation: D10∙D11 = 1,074,610,189 D10∙D11...
7: S / R I HIFT OTATE NSTRUCTIONS ROTR (Rotate Right) When input is on, 16‐ or 32‐bit data of the designated source device S1 is rotated to the ROTR(*) bits right by the quantity of bits designated by device bits. ***** The result is set to the source device S1, and the last bit status rotated out is set to a carry (special internal relay M8003). bits to rotate = 1) • Data Type: Word ( Before rotation: Rotate to the right M8003 After rotation: M8003 • Data Type: Double Word ( bits to rotate = 1) Before rotation: Rotate to the right M8003 After rotation: M8003 Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Data for bit rotation —...
Page 87
7: S / R I HIFT OTATE NSTRUCTIONS Example: ROTR • Data Type: Word M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – When the CPU starts operation, the MOV (move) instruction sets 13 to data reg‐ M8120 ister D20. ROTR(W) bits SOTU Each time input I1 is turned on, 16‐bit data of data register D20 is rotated to the right by 2 bits as designated by device bits. The last bit status rotated out is set to a carry (special internal relay M8003). Bits to rotate = 2 Before rotation: D20 = 13 M8003 After first rotation: D20 = 16387 M8003 After second rotation: D20 = 53248 M8003 • Data Type: Double Word Each time input I1 is turned on, 32‐bit data of data registers D20 and D21 is ROTR(D) bits SOTU rotated to the right by 1 bit as designated by device bits. The last bit status rotated out is set to a carry (special internal relay M8003). Bits to rotate = 1 Before rotation: D20∙D21 = 851,981 D20∙D21 Rotate to the right M8003 After rotation: D20∙D21 = 2,147,909,638 D20∙D21 M8003...
Page 88
7: S / R I HIFT OTATE NSTRUCTIONS 7‐12 FC5A MicroSmart User’s Manual FC9Y‐B1273...
8: D C I ONVERSION NSTRUCTIONS Introduction Data conversion instructions convert data format among binary, BCD, and ASCII. The double‐word data type has been added to BTOA (BCD to ASCII) and ATOB (ASCII to BCD) instructions. As a result of added data type, BTOA and ATOB instructions can convert double‐word data on the upgraded CPU modules with system program version 200 or higher. The ENCO (encode), DECO (decode), and BCNT (bit count) instructions processes bit device data. The ALT (alternate output) instruction turns on and off an output each time an input button is pressed. The CVDT (convert data type) instruction converts data types among W (word), I (integer), D (double word), L (long), and F (float). The DTDV (data divide), DTCB (data combine), and SWAP (data swap) instructions have been added as new instructions on the upgraded CPU modules with system program version 200 or higher. The DTDV and DTCB instructions convert data between two one‐byte data and one word data. The SWAP exchanges upper and lower byte‐ or word‐data of word‐ or double‐word‐data respectively. HTOB (Hex to BCD) S1 D1 HTOB(*) When input is on, the 16‐ or 32‐bit data designated by S1 is converted into BCD and ***** ***** stored to the destination designated by device D1. Valid values for the source device are 0 through 9999 for the word data type, and 0 through 9999 9999 for the double‐word data type. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data to convert —...
Page 90
8: D C I ONVERSION NSTRUCTIONS Examples: HTOB • Data Type: Word Binary HTOB(W) SOTU D10 (0000h) D20 (0000h) 1234 4660 D10 (04D2h) D20 (1234h) 9999 39321 D10 (270Fh) D20 (9999h) • Data Type: Double Word Binary HTOB(D) SOTU D10 (0000h) D20 (0000h) D11 (0000h) D21 (0000h) 4660 D10 (00BCh) D20 (1234h) 24910 22136...
8: D C I ONVERSION NSTRUCTIONS BTOH (BCD to Hex) S1 D1 BTOH(*) When input is on, the BCD data designated by S1 is converted into 16‐ or 32‐bit binary ***** ***** data and stored to the destination designated by device D1. Valid values for the source device are 0 through 9999 (BCD) for the word data type, and 0 through 9999 9999 (BCD) for the double‐word data type. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) BCD data to convert — D1 (Destination 1) Destination to store conversion results — — — ( For the valid device address range, see pages 6‐1 and 6‐2 Basic Vol.). Internal relays M0 through M2557 can be designated as D1. Special internal relays cannot be designated as D1. When T (timer) or C (counter) is used as S1, the timer/counter current value (TC or CC) is read out. When T (timer) or C (counter) is used as D1, the data is written in as a preset value (TP or CP) which can be 0 through 65535. Valid values for the source device are 0 through 9999 (BCD) for the word data type, and 0 through 9999 9999 (BCD) for the double‐...
Page 92
8: D C I ONVERSION NSTRUCTIONS Examples: BTOH • Data Type: Word Binary BTOH(W) SOTU D10 (0000h) D20 (0000h) 4660 1234 D10 (1234h) D20 (04D2h) 39321 9999 D10 (9999h) D20 (270Fh) • Data Type: Double Word Binary BTOH(D) SOTU D10 (0000h) D20 (0000h) D11 (0000h) D21 (0000h) 4660 (1234h) (00BCh) 22136 24910...
8: D C I ONVERSION NSTRUCTIONS HTOA (Hex to ASCII) S1 D1, D1+1, D1+2, D1+3 HTOA(W) When input is on, the 16‐bit binary data designated by S1 is read from the ***** ***** ***** lowest digit as many as the quantity of digits designated by S2, converted into ASCII data, and stored to the destination starting with the device designated by D1. The quantity of digits to convert can be 1 through 4. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data to convert — S2 (Source 2) Quantity of digits to convert 1‐4 — D1 (Destination 1) Destination to store conversion results — — — — — — —...
Page 94
8: D C I ONVERSION NSTRUCTIONS Examples: HTOA • Quantity of Digits: 4 Binary ASCII HTOA(W) SOTU 4660 D10 (1234h) D20 (0031h) D21 (0032h) D22 (0033h) D23 (0034h) • Quantity of Digits: 3 Binary ASCII HTOA(W) SOTU 4660 D10 (1234h) D20 (0032h) D21 (0033h) D22 (0034h) • Quantity of Digits: 2 Binary ASCII HTOA(W) 4660 SOTU D10 (1234h)
8: D C I ONVERSION NSTRUCTIONS ATOH (ASCII to Hex) S1, S1+1, S1+2, S1+3 D1 ATOH(W) When input is on, the ASCII data designated by S1 as many as the quantity of ***** ***** ***** digits designated by S2 is converted into 16‐bit binary data, and stored to the destination designated by device D1. Valid values for source data to convert are 30h to 39h and 41h to 46h. The quantity of digits to convert can be 1 through 4. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) ASCII data to convert — — — — — — — — S2 (Source 2) Quantity of digits to convert 1‐4 —...
8: D C I ONVERSION NSTRUCTIONS BTOA (BCD to ASCII) Word data type: S1 D1, D1+1, D1+2, D1+3, D1+4 BTOA(*) Double‐word data type: S1∙S1+1 D1, D1+1, D1+2, ... , D1+9 ***** ***** ***** When input is on, the 16‐ or 32‐bit binary data designated by S1 is converted into BCD, and converted into ASCII data. The data is read from the lowest digit as many as the quantity of digits designated by S2. The result is stored to the destination starting with the device designated by D1. The quantity of digits to convert can be 1 through 5 for the word data type, and 1 through 10 for the double‐word data type. The double‐word data type is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data to convert —...
Page 98
8: D C I ONVERSION NSTRUCTIONS Examples: BTOA(W) • Quantity of Digits: 5 ASCII Binary BTOA(W) SOTU 12345 D10 (3039h) D20 (0031h) D21 (0032h) D22 (0033h) D23 (0034h) D24 (0035h) • Quantity of Digits: 4 ASCII Binary BTOA(W) SOTU 12345 D10 (3039h) D20 (0032h) D21 (0033h) D22 (0034h) D23 (0035h) • Quantity of Digits: 3 ASCII Binary...
8: D C I ONVERSION NSTRUCTIONS ATOB (ASCII to BCD) Word data type: S1, S1+1, S1+2, S1+3, S1+4 D1 ATOB(*) Double‐word data type: S1, S1+1, S1+2, ... , S1+9 D1∙D1+1 ***** ***** ***** When input is on, the ASCII data designated by S1 as many as the quantity of digits designated by S2 is converted into BCD, and converted into 16‐ or 32‐bit binary data. The result is stored to the destination designated by device D1. Valid values for source data to convert are 30h through 39h. The quantity of digits to convert can be 1 through 5 for the word data type, and 1 through 10 for the double‐word data type.The double‐word data type is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) ASCII data to convert —...
Page 101
8: D C I ONVERSION NSTRUCTIONS Examples: ATOB(W) • Quantity of Digits: 5 ASCII Binary ATOB(W) SOTU 12345 D10 (0031h) D20 (3039h) D11 (0032h) D12 (0033h) D13 (0034h) D14 (0035h) • Quantity of Digits: 4 ASCII Binary ATOB(W) SOTU 1234 D10 (0031h) D20 (04D2h) D11 (0032h) D12 (0033h) D13 (0034h) • Quantity of Digits: 3 ASCII Binary...
8: D C I ONVERSION NSTRUCTIONS ENCO (Encode) When input is on, a bit which is on is sought. The search begins at S1 until the first point ENCO which is set (on) is located. The quantity of points from S1 to the first set point (offset) is Bits ***** ***** stored to the destination designated by device D1. If no point is on in the searched area, 65535 is stored to D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) First bit to start search — — — — D1 (Destination 1) Destination to store search results — — — — — Bits Quantity of bits searched —...
8: D C I ONVERSION NSTRUCTIONS DECO (Decode) When input is on, the values contained in devices designated by S1 and D1 are added to DECO determine the destination, and the bit so determined is turned on. ***** ***** Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Offset — — 0‐255 — D1 (Destination 1) First bit to count offset — — — — — ( For the valid device address range, see pages 6‐1 and 6‐2 Basic Vol.). Internal relays M0 through M2557 can be designated as D1. Special internal relays cannot be designated as D1. Valid values for the offset designated by source device S1 are 0 through 255. Make sure that the offset designated by S1 and the last bit ...
8: D C I ONVERSION NSTRUCTIONS BCNT (Bit Count) When input is on, bits which are on are sought in an array of consecutive bits BCNT starting at the point designated by source device S1. Source device S2 desig‐ ***** ***** ***** nates the quantity of bits searched. The quantity of bits which are on is stored to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) First bit to start search — — — — S2 (Source 2) Quantity of bits searched 1‐256 — D1 (Destination 1) Destination to store quantity of ON bits — — —...
8: D C I ONVERSION NSTRUCTIONS ALT (Alternate Output) When input is turned on, output, internal relay, or shift register bit designated by D1 is SOTU turned on and remains on after the input is turned off. ***** When input is turned on again, the designated output, internal relay, or shift register bit is turned off. The ALT instruction must be used with a SOTU or SOTD instruction, otherwise the desig‐ nated output, internal relay, or shift register bit repeats to turn on and off in each scan. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat D1 (Destination 1) Bit to turn on and off — — — — — — ( For the valid device address range, see pages 6‐1 and 6‐2 Basic Vol.). Since the ALT instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction must be used. Example: ALT When input I0 is turned on, output Q0 designated by device D1 is turned on and remains after input I0 is turned off. ...
8: D C I ONVERSION NSTRUCTIONS CVDT (Convert Data Type) S1 D1 CVDT S1(R) D1(R) When input is on, the data type of the 16‐ or 32‐bit data designated by S1 is * TO * ***** ***** converted and stored to the destination designated by device D1. Data types can be designated for the source and destination, separately. Data Type W, I D, L, F Source S1∙S1+1 Destination D1∙D1+1 When the same data type is designated for both source and destination, the CVDT instruction has the same function as the MOV instruction. Unless F (float) data type is selected for both source and destination, only the integral number is moved, omitting the fraction. When the source data exceeds the range of destination data type, the destina‐ tion stores a value closest to the source data within the destination data type. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat...
Page 108
8: D C I ONVERSION NSTRUCTIONS Examples: CVDT • Data Type: Either S1 or D1 is not F (float) Unless F (float) data type is selected for both source and destination, only the integral number is moved, omitting the fraction. Device Data Type Value CVDT S1 – D1 – SOTU FTOW Source 3.141593 Destination When input I0 is turned on, 3 is stored to data register D2. 3.141593 D0∙D1 • Data Type: S1 has a larger data range than D1 When the source data exceeds the range of destination data type, the destination stores a value closest to the source data within the destination data type. Device Data Type Value CVDT S1 – D1 – SOTU DTOW Source 4294967295 Destination 65535 When input I0 is turned on, 65535 is stored to data register D2. 4294967295 65535 D0∙D1 8‐20...
8: D C I ONVERSION NSTRUCTIONS DTDV (Data Divide) S1 D1, D1+1 DTDV(W) When input is on, the 16‐bit binary data designated by S1 is divided into upper and lower ***** ***** bytes. The upper byte data is stored to the destination designated by device D1. The lower byte data is stored to the device next to D1. This instruction is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data to divide — D1 (Destination 1) Destination to store results — — — — — — —...
8: D C I ONVERSION NSTRUCTIONS DTCB (Data Combine) S1, S1+1 D1 DTCB(W) When input is on, the lower‐byte data is read out from 2 consecutive sources starting ***** ***** with device designated by S1 and combined to make 16‐bit data. The lower byte data from the first source device is moved to the upper byte of the destination designated by device D1, and the lower byte data from the next source device is moved to the lower byte of the destination. This instruction is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data to combine — — — — — — — —...
8: D C I ONVERSION NSTRUCTIONS SWAP (Data Swap) S1 D1 SWAP(*) S1(R) D1(R) When input is on, upper and lower byte‐ or word‐data of a word‐ or double‐ ***** ***** word‐data designated by S1 are exchanged, and the result is stored to destina‐ tion designated by D1. This instruction is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data to swap — — — — — — — 1‐99 D1 (Destination 1) Destination to store conversion result...
Page 112
8: D C I ONVERSION NSTRUCTIONS 8‐24 FC5A MicroSmart User’s Manual FC9Y‐B1273...
9: W P I ROGRAMMER NSTRUCTIONS Introduction WKTIM instructions can be used as many as required to turn on and off designated outputs and internal relays at prede‐ termined times and days of the week. Once the internal calendar/clock is set, the WKTIM instruction compares the predetermined time with the clock data in the clock cartridge. When the preset time is reached, internal relay or output designated as destination device is turned on or off as scheduled. For setting the calendar/clock, see page 9‐6. For the specifications of the clock cartridge, see page 2‐95 (Basic Vol.). WKTIM (Week Timer) When input is on, the WKTIM compares the S1 and S2 preset data WKTIM with the current day and time. MODE ***** ***** ***** ***** When the current day and time reach the presets, an output or inter‐ nal relay designated by device D1 is turned on, depending on the week table output control designated by MODE. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat MODE Week table output control — — — — — — — 0‐2 —...
9: W P I ROGRAMMER NSTRUCTIONS S1 — Day of week comparison data (0 through 127) Specify the days of week to turn on the output or internal relay designated by D1. Day of Week Sunday Monday Tuesday Wednesday Thursday Friday Saturday Value Designate the total of the values as device S1 to turn on the output or internal relay. Example: To turn on the output on Mondays through Fridays, designate 62 as S1 because 2 + 4 + 8 + 16 + 32 = 62. S2 — Hour/minute comparison data to turn on S3 — Hour/minute comparison data to turn off Specify the hours and minutes to turn on (S2) or to turn off (S3) the output or internal relay designated by D1. Hour Minute Disable Comparison 00 through 23 00 through 59 10000 Example: To turn on the output or internal relay at 8:30 a.m. using the WKTIM instruction, designate 830 as S2. To turn off the output or internal relay at 5:05 p.m., designate 1705 as S3. When 10000 is set to hour/minute comparison data, the comparison data is ignored. For example, if 10000 is set to the hour/ minute comparison data to turn off (S3), the WKTIM instruction compares only the hour/minute comparison data to turn on (S2). When the hour/minute comparison data to turn on (S2) is larger than the hour/minute comparison data to turn off (S3), the com‐ parison ON output (D1) turns on at S2 on the day designated by S1, remains on across 0 a.m., and turns off at S3 on the next day. For example, if S2 is 2300, S3 is 100, and Monday is included in S1, then the output designated by D1 turns on at 23 p.m. on Mon‐ day and turns off at 1 a.m. on Tuesday. Make sure that the values set for MODE, S1, S2, and S3 are within the valid ranges. If any data is over the valid value, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the CPU module. WKTBL (Week Table) S1, S2, S3, ... , S Week Table ( ..
Page 115
9: W P I ROGRAMMER NSTRUCTIONS S1 through S — Special month/day data Specify the months and days to add or skip days to turn on or off the comparison outputs programmed in WKTIM instructions. Month 01 through 12 01 through 31 Example: To set July 4 as a special day, designate 704 as S1. Make sure that the values set for S1 through S are within the valid ranges. If any data is over the valid value, a user pro‐ gram execution error will result, turning on special internal relay M8004 and the ERR LED on the CPU module. Examples: WKTIM and WKTBL • Without Special Days (MODE = 0) This example is the basic program for week programmer application without using the WKTBL (week table) instruction. While the CPU is running, the WKTIM compares the S1, S2, and S3 preset data with the current day and time. When the current day and time reach the presets, an output designated by device D1 is turned on and off. M8125 is the in‐operation output special internal relay. WKTIM 1715 S1 (62) specifies Monday through Friday. M8125 The WKTIM turns on output Q0 at 8:30 and turns off output Q0 at 17:15 on Monday through Friday. • With Additional Days in the Week Table (MODE = 1) When the current time reaches the hour/minute preset time on the special days programmed in the WKTBL, the desig‐ nated output is turned on or turned off. In addition, the designated output is turned on and off every week as designated by device S1 of WKTIM. In normal execution, when the current day and time coincide with the preset day (S1) and time (S2 or S3) of the WKTIM, the designated output is turned on or off. Execution on the special days has precedence over execution on normal days. This example demonstrates operation on special days in addition to regular weekends. The output is turned on from 10:30 a.m. to 11:10 p.m. on every Saturday and Sunday. Without regard to the day of week, the output is also turned on December 31 through January 3. M8120 is the initialize pulse special internal relay. WKTBL WKTBL designates Dec. 31 to Jan. 3 as special days. 1231 M8120 MODE (1) adds special days.
Page 116
9: W P I ROGRAMMER NSTRUCTIONS • Keep Output ON across 0 a.m. When the hour/minute comparison data to turn on (S2) is larger than the hour/minute comparison data to turn off (S3), the comparison ON output (D1) turns on at S2 on the day designated by S1, remains on across 0 a.m., and turns off at S3 on the next day. This example demonstrates a program to keep the designated output on across 0 a.m. and turn off the output on the next day. M8125 is the in‐operation output special internal relay. WKTIM 2000 M8125 S1 (38) specifies Monday, Tuesday, and Friday. The WKTIM turns on output Q0 at 20:00 on Monday, Tuesday, and Fri‐ day, and turns off output Q0 at 6:00 on the next day. 20:00 6:00 20:00 6:00 20:00 6:00 Output Q0 • Keep Output ON for Several Days Multiple WKTIM instructions can be used to keep an output on for more than 24 hours. This example demonstrates a program to keep the designated output on from 8 a.m on every Monday to 7 p.m. on every Friday. M8125 is the in‐operation output special internal relay. WKTIM 10000 M8125 S1 (2) specifies Monday. S1 (28) specifies Tuesday, Wednesday, and Thursday. WKTIM 10000 10000 S1 (32) specifies Friday. S2 (10000) and S3 (10000) disable comparison of hour and minute WKTIM 10000 1900 data.
9: W P I ROGRAMMER NSTRUCTIONS Using Clock Cartridge When using the week programmer instructions, you have to install a clock cartridge into the CPU module and enable to use the clock cartridge using WindLDR as follows: 1. From the WindLDR menu bar, select Configuration > Cartridges and Modules. The Function Area Settings dialog box for Cartridges and Modules appears. 2. Click the check box to use the clock cartridge. 3. Click the OK button. 4. Download the user program to the CPU module, and turn off and on the power to the CPU module. After removing the clock cartridge, do not run the user program with the Function Area Settings Caution programmed to use the clock cartridge, otherwise clock IC error occurs, turning on the ERR LED on the CPU module. Special data register D8005 (general error code) stores 400h (clock IC error). FC5A M U ’ M FC9Y‐B1273 9‐5 ICRO MART ANUAL...
9: W P I ROGRAMMER NSTRUCTIONS Setting Calendar/Clock Using WindLDR Before using the clock cartridge for the first time, the calendar/clock data in the clock cartridge must be set using WindLDR or executing a user program to transfer correct calendar/clock data from special data registers allocated to the calendar/clock. Once the calendar/clock data is stored, the data is held by the backup battery in the clock cartridge. 1. Select Online from the WindLDR menu bar, then select Monitor. The screen display changes to the monitor window. 2. From the PLC menu, select Status. The MicroSmart PLC Status dialog box is displayed. The current calendar/clock data is read out from the clock cartridge and displayed in the Calendar field. 3. Click the Change button for the Calendar. The Set Calendar and Time dialog box comes up with the date and time values read from the computer internal clock. 4. Click the Down Arrow button on the right of Calendar, then a calendar is displayed where you can change the year, month, and date. Enter or select new values. 5. To change hours and minutes, click in the Time box, and type a new value or use the up/down keys. When new values are entered, click the OK button to transfer the new values to the clock cartridge. Setting Calendar/Clock Using a User Program Another way of setting the calendar/clock data is to store the values in special data registers dedicated to the calendar and clock and to turn on special internal relay M8016, M8017, or M8020. Data registers D8015 through D8021 do not hold the current values of the calendar/clock data but hold unknown values before executing a user program. Special Data Registers for Calendar/Clock Data Data Register No. Data Value Read/Write Updated D8008 Year (current data) 0 to 99 D8009 Month (current data) 1 to 12 D8010 Day (current data) 1 to 31 500 ms or one scan time ...
9: W P I ROGRAMMER NSTRUCTIONS Special Internal Relays for Calendar/Clock Data When M8016 is turned on, data in data registers D8015 through D8018 (calendar new M8016 Calendar Data Write Flag data) are set to the clock cartridge installed on the CPU module. When M8017 is turned on, data in data registers D8019 through D8021 (clock new data) M8017 Clock Data Write Flag are set to the clock cartridge installed on the CPU module. Calendar/Clock Data Write When M8020 is turned on, data in data registers D8015 through D8021 (calendar/clock M8020 Flag new data) are set to the clock cartridge installed on the CPU module. Example: Setting Calendar/Clock Data This example demonstrates how to set calendar/clock data using a ladder program. After storing new calendar/clock data into data registers D8015 through D8021, special internal relay M8020 (calendar/clock data write flag) must be turned on to set the new calendar/clock data to the clock cartridge. M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – M8120 When the CPU starts, seven MOV(W) instructions store calendar/clock data to data registers D0 through D6. MOV(W) S1 – D1 – MOV(W) S1 – D1 – MOV(W) S1 – D1 – MOV(W) S1 –...
9: W P I ROGRAMMER NSTRUCTIONS Adjusting Clock Cartridge Accuracy The optional clock cartridge (FC4A‐PT1) has an initial monthly error of ±2 minutes at 25°C. The accuracy of the clock car‐ tridge can be improved to ±30 seconds using Enable Clock Cartridge Adjustment in the Function Area Settings. Before starting the clock cartridge adjustment, confirm the adjustment value indicated on the clock cartridge. This value is an adjustment parameter measured on each clock cartridge at factory before shipment. Adjustment Value The adjustment value indicated on the clock cartridge was measured at 25°C to achieve the best accuracy. When using the clock cartridge at other temperatures, the clock cartridge accuracy may be impaired. Programming WindLDR 1. From the WindLDR menu bar, select Configuration > Cartridges and Modules. The Function Area Settings dialog box for Cartridges and Modules appears. 2. Click the check box to enable the clock cartridge adjustment, and type the adjustment value found on the clock cartridge in the Adjustment Value field. 3. Click the OK button. 4. Download the user program to the CPU module, and turn off and on the power to the CPU module. Clock Cartridge Backup Duration The clock cartridge data is backed up by a lithium battery in the clock cartridge and held for approximately 30 days at 25°C. If the CPU module is not powered up for a period longer than the backup duration, the clock data is initialized to the following values. Calendar: 00/01/01 Time: 0:00:00 AM 9‐8 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
10: I I NTERFACE NSTRUCTIONS Introduction The DISP (display) instruction is used to display 1 through 5 digits of timer/counter current values and data register data on 7‐segment display units. The DGRD (digital read) instruction is used to read 1 through 5 digits of digital switch settings to a data register. This instruction is useful to change preset values for timers and counters using digital switches. DISP (Display) When input is on, data designated by source device S1 is set to DISP outputs or internal relays designated by device Q. This instruc‐ BCD4 ***** ***** tion is used to output 7‐segment data to display units. Quantity of digits: Eight DISP instructions can be used in a user program. Data phase: 1 to 5 (decimal) Display data can be 0 through 65535 (FFFFh). Low or High 1 to 4 (hex) Latch phase: Conversion: Low or High BCD or BIN Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E — — Note: The DISP instruction requires transistor output terminals. When using all‐in‐one 24‐I/O type CPU module FC5A‐C24R2, connect a transistor output module. Valid Devices Device Function Constant...
Page 122
10: I I NTERFACE NSTRUCTIONS Example: DISP The following example demonstrates a program to display the 4‐digit current value of counter CNT10 on 7‐segment dis‐ play units (IDEC’s DD3S‐F31N) connected to the transistor sink output module. When input I0 is on, the 4‐digit current value of counter C10 is displayed DISP on 7‐segment digital display units. BCD4 Output Wiring Diagram 8‐Transistor Sink Output Module FC4A‐T08K1 COM(–) 24V DC Power (–) Supply (–) (–) (–) (–) Latch Latch Latch Latch Upper Digit Lower Digit 10‐2 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
10: I I NTERFACE NSTRUCTIONS DGRD (Digital Read) When input is on, data designated by devices I and Q is set to a DGRD data register designated by destination device D1. BCD4 ***** ***** ***** This instruction can be used to change preset values for timer and counter instructions using digital switches. The data that can be First output number read using this instruction is 0 through 65535 (5 digits), or FFFFh. First input number Quantity of digits: 1 to 5 (decimal) 1 to 4 (hex) Conversion: BCD or BIN Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E — — Note: The DGRD instruction requires transistor output terminals. When using all‐in‐one 24‐I/O type CPU module FC5A‐C24R2, connect a transistor output module. Valid Devices Device Function Constant Repeat First input number to read — — — — — — —...
Page 124
The DGRD instruction requires a scan time longer than the filter time plus 6 ms. Minimum Required Scan Time (Scan time) (Filter time) + 6 ms The filter time depends on the input terminal used as shown below. Input Terminals Filter Time Filter value selected in the Function Area Settings (default 3 ms) I0 through I7 on CPU Modules See Input Filter on page 5‐42 (Basic Vol.). I10 through I17 on CPU Modules 3 ms (fixed) Inputs on Expansion Input Modules 4 ms (fixed) When the actual scan time is too short to execute the DGRD instruction, use the constant scan function. When the input filter time is set to 3 ms, set a value of 9 or more (in ms) to special data register D8022 (constant scan time preset value). See page 5‐50 ( . When the input filter time is changed, set a proper value to D8022 to make sure of the mini‐ Basic Vol.) mum required scan time shown above. Example: DGRD The following example demonstrates a program to read data from four digital switches (IDEC’s DFBN‐031D‐B) to a data register in the CPU module, using a 8‐point DC input module and a 16‐point transistor sink output module. When input I5 is on, the 4‐digit value from BCD digital switches is read to data DGRD register D10. BCD4 I/O Wiring Diagram 16‐point Transistor 8‐point DC Input Module Sink Output Module FC4A‐N08B1 FC4A‐T16K3 Digital Switches COM(–) 24V DC Power (–) Supply 10‐4 FC5A M...
11: P B I ROGRAM RANCHING NSTRUCTIONS Introduction The program branching instructions reduce execution time by making it possible to bypass portions of the program whenever certain conditions are not satisfied. The basic program branching instructions are LABEL and LJMP, which are used to tag an address and jump to the address which has been tagged. Programming tools include “either/or” options between numerous portions of a program and the ability to call one of several subroutines which return execution to where the normal program left off. The DI or EI instruction disables or enables interrupt inputs and timer interrupt individually. LABEL (Label) This is the label number, from 0 to 127 (all‐in‐one type CPU) or 0 to 255 (slim type CPU), used at the pro‐ LABEL gram address where the execution of program instructions begins for a program branch. An END instruction may be used to separate a tagged portion of the program from the main program. In this way, scan time is minimized by not executing the program branch unless input conditions are satisfied. Note: The same label number cannot be used more than once. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat Label number Tag for LJMP and LCAL — — — — — — — 0‐127, 0‐255 —...
Page 126
11: P B I ROGRAM RANCHING NSTRUCTIONS Example: LJMP and LABEL The following example demonstrates a program to jump to three different portions of program depending on the input. When input I0 is on, program execution jumps to label 0. LJMP LJMP When input I1 is on, program execution jumps to label 1. LJMP When input I2 is on, program execution jumps to label 2. LABEL M8121 is the 1‐sec clock special internal relay. M8121 When jump occurs to label 0, output Q0 oscillates in 1‐sec increments. LABEL M8122 is the 100‐ms clock special internal relay. M8122 When jump occurs to label 1, output Q1 oscillates in 100‐ms increments. LABEL M8123 is the 10‐ms clock special internal relay. M8123 When jump occurs to label 2, output Q2 oscillates in 10‐ms increments. Using the Timer Instruction with Program Branching When the timer start input of the TML, TIM, TMH or TMS instruction is already on, timedown begins immediately at the location jumped to, starting with the timer current value. When using a program branch, it is important to make sure that timers are initialized when desired, after the jump. If it is necessary to initialize the timer instruction (set to the preset value) after the jump, the timer’s start input should be kept off for one or more scan cycles before initialization. Other‐ wise, the timer input on will not be recognized. Using the SOTU/SOTD Instructions with Program Branching Check that pulse inputs of counters and shift registers, and input of single outputs (SOTU and SOTD) are maintained dur‐ ing the jump, if required. Hold the input off for one or more scan cycles after the jump for the rising or falling edge transi‐ tion to be recognized. Although normally, the SOTU instruction produces a pulse LABEL for one scan, when used in a program branch the SOTU pulse will last only until the next time the same SOTU Q1 Internal instruction is executed.
11: P B I ROGRAM RANCHING NSTRUCTIONS LCAL (Label Call) When input is on, the address with label 0 through 127 (all‐in‐one type CPU) or 0 to 255 (slim LCAL type CPU) designated by S1 is called. When input is off, no call takes place, and program execu‐ ***** tion proceeds with the next instruction. The LCAL instruction calls a subroutine, and returns to the main program after the branch is exe‐ cuted. A LRET instruction (see below) must be placed at the end of a program branch which is called, so that normal program execution resumes by returning to the instruction following the LCAL instruction. Note: The END instruction must be used to separate the main program from any subroutines called by the LCAL instruction. A maximum of four LCAL instructions can be nested. When more than four LCAL instructions are nested, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the CPU module. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Label number to call — — — — — — 0‐127, 0‐255 —...
Page 128
11: P B I ROGRAM RANCHING NSTRUCTIONS Correct Structure for Calling Subroutine When a LCAL instruction is executed, the remaining program instructions on the same rung may not be executed upon return, if input conditions are changed by the subroutine. After the LRET instruction of a subroutine, program execution begins with the instruction following the LCAL instruction, depending on current input condition. When instructions following a LCAL instruction must be executed after the subroutine is called, make sure the subroutine does not change input conditions unfavorably. In addition, include subsequent instructions in a new ladder line, sepa‐ rated from the LCAL instruction. Correct Incorrect MOV(W) S1 – D1 – MOV(W) S1 – D1 – LCAL LCAL MOV(W) S1 – D1 – MOV(W) S1 – D1 – Separate the ladder line for each LCAL instruction. I0 status may be changed by the subroutine upon return. Example: LCAL and LRET The following example demonstrates a program to call three different portions of program depending on the input. When the subroutine is complete, program execution returns to the instruction following the LCAL instruction. When input I0 is on, program execution jumps to label 0. LCAL LCAL When input I1 is on, program execution jumps to label 1. LCAL When input I2 is on, program execution jumps to label 2. LABEL M8121 is the 1‐sec clock special internal relay.
11: P B I ROGRAM RANCHING NSTRUCTIONS DJNZ (Decrement Jump Non‐zero) When input is on, the value stored in the data register designated by S1 is decremented DJNZ by one and is checked. If the resultant value is not 0, program execution jumps to ***** ***** address with label 0 through 127 (all‐in‐one CPU) or 255 (slim CPU) designated by S2. If the decrement results in 0, no jump takes place, and program execution proceeds with the next instruction. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Decrement value — — — — — — — — 0‐127 S2 (Source 2) Label number to jump to —...
Page 130
11: P B I ROGRAM RANCHING NSTRUCTIONS Example: DJNZ and LABEL The following example demonstrates a program to store consecutive values 1000 through 1049 to data registers D100 through D149, respectively. M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – 1049 M8120 At start‐up, MOV instructions store initial data. 1049 D0 to store the value for the first cycle. MOV(W) S1 – D1 – 50 D1 to determine the jump cycles. LABEL IMOV(W) S1 – D1 – IMOV moves D0 data 1049 to D1049 in the first cycle. M8120 DEC(W) DEC decrements D0 data to 1048. DJNZ DJNZ jumps to label 255 until D1 value reduces to 0. 1st cycle: Destination: D99 + 50 = D149 1049 1049 D149 2nd cycle: Destination: D99 + 49 = D148 1048 1048 D148 3rd cycle: Destination: D99 + 48 = D147...
11: P B I ROGRAM RANCHING NSTRUCTIONS DI (Disable Interrupt) When input is on, interrupt inputs and timer interrupt designated by source device S1 are dis‐ abled. EI (Enable Interrupt) When input is on, interrupt inputs and timer interrupt designated by source device S1 are enabled. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Interrupt inputs and timer interrupt — — — — — — — 1‐31 — Interrupt inputs I2 through I5 and timer interrupt selected in the Function Area Settings are normally enabled when the CPU starts. When the DI instruction is executed, interrupt inputs and timer interrupt designated as source device S1 are disabled even if the interrupt condition is met in the user program area subsequent to the DI instruction. When the EI instruction is executed, disabled interrupt inputs and timer interrupt designated as source device S1 are enabled again in the user program area subsequent to the EI instruction. Different devices can be selected for the DI and EI instructions to disable and enable interrupt inputs selectively. For Interrupt Input and Timer Interrupt, see pages 5‐34 and 5‐36 ( Basic ...
Page 132
11: P B I ROGRAM RANCHING NSTRUCTIONS Example: DI and EI The following example demonstrates a program to disable and enable interrupt inputs and timer interrupt selectively. For the interrupt input and timer interrupt functions, see pages 5‐34 and 5‐36 ( . In this example, inputs I2 and I3 are Basic Vol.) designated as interrupt inputs and timer interrupt is used with interrupt intervals of 100 ms. M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – D8032 M8120 D8032 stores jump destination label number 0 for interrupt input I2. MOV(W) S1 – D1 – D8033 stores jump destination label number 1 for interrupt input I3. D8033 D8036 stores jump destination label number 2 for timer interrupt. MOV(W) S1 – D1 – D8036 When input I10 is on, DI disables interrupt inputs I2, I3, and timer interrupt, then M8140, M8141, and M8144 turn off. When input I11 is on and I10 is off, EI enables interrupt inputs I2 and I3, then M8140 and M8141 turn on. When input I12 is on and I10 is off, EI enables timer interrupt, then M8144 turns on. End of the main program. LABEL When input I2 is on, program execution jumps to label 0. M8125 is the in‐operation output special internal relay. ALT turns on or off the output Q2 internal memory. M8125 IOREF immediately writes the output Q2 internal memory status to actual out‐...
11: P B I ROGRAM RANCHING NSTRUCTIONS IOREF (I/O Refresh) When input is on, 1‐bit I/O data designated by source device S1 is refreshed immediately regard‐ IOREF less of the scan time. ***** When I (input) is used as S1, the actual input status is immediately read into an internal relay starting with M300 allocated to each input available on the CPU module. When Q (output) is used as S1, the output data in the RAM is immediately written to the actual output available on the CPU module. Refresh instructions are useful when a real‐time response is required in a user program which has a long scan time. The refresh instruction is most effective when using the refresh instruction at a ladder step immediately before using the data. The IOREF instruction can be used with an interrupt input or timer interrupt to refresh data. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) I/O for refresh — — — — — — — Only input or output numbers available on the CPU module can be designated as S1. Input and output numbers for expansion I/O mod‐...
Page 134
11: P B I ROGRAM RANCHING NSTRUCTIONS Example: IOREF The following example demonstrates a program to transfer the input I0 status to output Q0 using the IOREF instruction. Input I2 is designated as an interrupt input. For the interrupt input function, see page 5‐34 ( Basic Vol.) M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – D8032 M8120 D8032 stores 0 to designate jump destination label 0 for interrupt input I2. Main Program When input I2 is on, program execution jumps to label 0. LABEL M8125 is the in‐operation output special internal relay. IOREF immediately reads input I0 status to internal relay M300. IOREF M8125 M300 turns on or off the output Q0 internal memory. M300 Another IOREF immediately writes the output Q0 internal memory status to actual output Q0. IOREF M8125 Program execution returns to the main program. LRET 11‐10 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
11: P B I ROGRAM RANCHING NSTRUCTIONS HSCRF (High‐speed Counter Refresh) When input is on, the HSCRF instruction refreshes the high‐speed counter current values in special data HSCRF registers in real time. The current values of four high‐speed counters HSC1 through HSC4 are usually updated in every scan. The HSCRF can be used in any place in the ladder diagram where you want to read the updated high‐speed counter current value. For the high‐speed counter function, see page 5‐7(Basic Vol.). Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Example: HSCRF The following example demonstrates a program to update the current value of high‐speed counter HSC1 using the HSCRF instruction. For the timer interrupt, see page 5‐36 (Basic Vol.) M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – D8036 M8120 D8036 stores 0 to designate jump destination label 0 for timer inter‐ rupt. Main Program The interrupt program is separated from the main program by the END instruction. While the CPU is running, program execution jumps to label 0 repeat‐ LABEL edly at intervals selected in the Function Area Settings. M8125 is the in‐operation output special internal relay. HSCRF HSCRF updates the HSC1 current value in data registers D8210 and ...
11: P B I ROGRAM RANCHING NSTRUCTIONS FRQRF (Frequency Measurement Refresh) When input is on, the FRQRF instruction refreshes the frequency measurement values in special data reg‐ FRQRF isters in real time. The FRQRF can be used in any place in the ladder diagram where you want to read the updated frequency measurement value. Before the measured results are stored in the special data registers, it takes a maximum of calculation period plus one scan time. Using the FRQRF instruction in the ladder diagram, the latest value of the fre‐ quency measurement can be read out within 250 ms regardless of the input frequency. For the frequency measurement function, see page 5‐30 (Basic Vol.). Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Example: FRQRF The following example demonstrates a program to update the current value of frequency measurement value using the FRQRF instruction. For the timer interrupt, see page 5‐36 (Basic Vol.) M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – D8036 M8120 D8036 stores 0 to designate jump destination label 0 for timer inter‐ rupt. Main Program The interrupt program is separated from the main program by the END instruction. While the CPU is running, program execution jumps to label 0 repeat‐ LABEL edly at intervals selected in the Function Area Settings.
11: P B I ROGRAM RANCHING NSTRUCTIONS COMRF (Communication Refresh) The COMRF instruction refreshes the send and receive data in the expansion communication buffers for COMRF port 3 through port 7 in real time. The send data in the buffer are usually sent out in the END processing. The receive data in the buffer are usually sent to MicroSmart devices in the END processing. The COMRF can be used in any place in the lad‐ der diagram where you want to execute the TXD instruction immediately or to update the received data in a period shorter than the scan time. Note: The COMRF instruction cannot be used in interrupt programs. If used, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the CPU module. This instruction is available on upgraded CPU modules with system program version 110 or higher. Applicable CPU Modules FC5A‐C16R2/C/D FC5A‐C10R2/C/D FC5A‐C24R2/C FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E FC5A‐C24R2D — — Example: COMRF The following example demonstrates a program to execute COMRF instructions among other instructions. Before executing the RXD instruction, COMRF refreshes send and receive data COMRF of the expansion communication ports. D498 BMOV(W) N‐W D500 D502 After executing the TXD instruction, COMRF refreshes send and receive data COMRF of the expansion communication ports. COMRF Execution Time While the expansion RS232C/RS485 communication module sends or receives communication, the CPU module requires ...
Page 138
11: P B I ROGRAM RANCHING NSTRUCTIONS 11‐14 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
12: C C I OORDINATE ONVERSION NSTRUCTIONS Introduction The coordinate conversion instructions convert one data point to another value, using a linear relationship between values of X and Y. (X2, Y2) (X1, Y1) (X0, Y0) ⁄ XYFS (XY Format Set) When input is on, the format for XY conversion is set. The XY ..XYFS(*) coordinates define the linear relationship between X and Y. ***** ***** ***** ***** CPU Module No. of XY Coordinates 0 n 4 All‐in‐One 2 to 5 0 n 31 Slim 2 to 32 Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D...
12: C C I OORDINATE ONVERSION NSTRUCTIONS 65535 32767 Valid Coordinates 65535 –32768 65535 Valid Data Types When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is designated as W (word) Xn or Yn, 16 points are used. I (integer) When a word device such as T (timer), C (counter), or D (data register) is designated as Xn or Yn, 1 point D (double word) — is used. L (long) — F (float) — CVXTY (Convert X to Y) When input is on, the X value designated by device S2 is converted into corre‐ CVXTY(*) sponding Y value according to the linear relationship defined in the XYFS ***** ***** instruction. Device S1 selects a format from a maximum of 6 (all‐in‐one CPU) or 30 (slim CPU) XY conversion formats. The conversion result is set to the device designated by D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device...
12: C C I OORDINATE ONVERSION NSTRUCTIONS D1 (Destination to store results) The conversion result of the Y value is stored to the destination. Data Type Word Integer S2 (X value) 0 to 65535 0 to 65535 D1 (Y value) 0 to 65535 –32768 to 32767 65535 32767 Valid Coordinates 65535 –32768 65535 Valid Data Types When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is designated as S2 W (word) or D1, 16 points are used. I (integer) When a word device such as T (timer), C (counter), or D (data register) is designated as S2 or D1, 1 point D (double word) — is used. L (long) — F (float) — Data Conversion Error The data conversion error is ±0.5. CVYTX (Convert Y to X) When input is on, the Y value designated by device S2 is converted into corre‐ CVYTX(*) sponding X value according to the linear relationship defined in the XYFS ...
Page 142
12: C C I OORDINATE ONVERSION NSTRUCTIONS S2 (Y value) Enter a value for the Y coordinate to convert, within the range specified in the XYFS instruction. Two different data ranges are available depending on the data type. D1 (Destination to store results) The conversion result of the X value is stored to the destination. Data Type Word Integer S2 (Y value) 0 to 65535 –32768 to 32767 D1 (X value) 0 to 65535 0 to 65535 65535 32767 Valid Coordinates 65535 –32768 65535 Valid Data Types When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is designated as S2 W (word) or D1, 16 points are used. I (integer) When a word device such as T (timer), C (counter), or D (data register) is designated as S2 or D1, 1 point D (double word) — (integer data type) is used. L (long) — F (float) — Data Conversion Error The data conversion error is ±0.5.
Page 143
12: C C I OORDINATE ONVERSION NSTRUCTIONS Example: Linear Conversion The following example demonstrates setting up two coordinate points to define the linear relationship between X and Y. The two points are (X0, Y0) = (0, 0) and (X1, Y1) = (8000, 4000). Once these are set, there is an X to Y conversion, as well as a Y to X conversion. M8120 is the initialize pulse special internal relay. XYFS(I) 8000 4000 M8120 At startup, XYFS specifies two points. When input I0 is on, CVXTY converts the value in D10 and CVXTY(I) stores the result in D20. When input I1 is on, CVYTX converts the value in D11 and CVYTX(I) stores the result in D21. The graph shows the linear relationship that is defined by the (X1, Y1) two points: -- - X D11 (2500) If the value in data register D10 is 2000, the value assigned to D20 is 1000. D20 (1000) For Y to X conversion, the following equation is used: (X0, Y0) 8000 If the value in data register D11 is 2500, the value assigned to (2000) (5000) D21 is 5000. FC5A M U ’...
Page 144
12: C C I OORDINATE ONVERSION NSTRUCTIONS Example: Overlapping Coordinates In this example, the XYFS instruction sets up three coordinate points, which define two different linear relationships between X and Y. The three points are: (X0, Y0) = (0, 100), (X1, Y1) = (100, 0), and (X2, Y2) = (300, 100). The two line seg‐ ments define overlapping coordinates for X. That is, for each value of Y within the designated range, there would be two X values assigned. M8120 is the initialize pulse special internal XYFS(I) relay. M8120 At startup, XYFS specifies three points. CVXTY(I) CVXTY converts the value in C10 and stores the result in D90. CVYTX(I) CVYTX converts the value in D95 and stores the result in D30. (X0, Y0) (X2, Y2) (0, 100) (300, 100) D90 (75) D95 (40) (X1, Y1) (100, 0) (60) (250) The first line segment defines the following relationship for X to Y conversion: – The second line segment defines another relationship for X to Y conversion: -- - X 50 – For X to Y conversion, each value of X has only one corresponding value for Y. If the current value of counter C10 is 250, the value ...
12: C C I OORDINATE ONVERSION NSTRUCTIONS AVRG (Average) When input is on, sampling data designated by device S1 is AVRG(*) processed according to sampling conditions designated by ***** ***** ***** ***** ***** devices S2 and S3. When sampling is complete, average, maximum, and mini‐ mum values are stored to 3 consecutive devices starting with device designated by D1, then sampling completion output designated by device D2 is turned on. Data Type W, I D, L, F Average D1∙D1+1 Maximum value D1+1 D1+2∙D1+3 Minimum value D1+2 D1+4∙D1+5 The AVRG instruction is effective for data processing of analog input values. A maximum of 32 AVRG instructions can be programmed in a user program. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function...
Page 146
12: C C I OORDINATE ONVERSION NSTRUCTIONS Valid Data Types When a bit device such as I (input), Q (output), M (internal relay), or R (shift register) is designated as W (word) the source, 16 points (word or integer data type) or 32 points (double‐word or long data type) are used. I (integer) When a word device such as T (timer), C (counter), or D (data register) is designated as the source, 1 D (double word) point (word or integer data type) or 2 points (double‐word, long, or float data type) are used. L (long) F (float) Example: AVRG The following example demonstrates a program to calculate average values of the data register D100 and store the result to data register D200 in every 500 scans. M8125 is the in‐operation output special internal relay. AVRG(W) D100 D200 M100 M8125 When the sampling end input does not turn on While sampling end input I10 is off, the average, maximum, and minimum values are calculated in every 500 scans and stored to data registers D200, D201, and D202, respectively. Sampling completion output M100 is set every 500 scans. 1st scan 2nd scan 500th scan 1st scan 2nd scan Sampling Data D100 In‐operation Special IR M8125 Sampling End Input I10 Sampling Completion Output M100 Average Value D200 Maximum Value D201 Minimum Value D202 Values are set every 500 scans.
Page 147
13: P I ULSE NSTRUCTIONS Introduction The PULS (pulse output) instruction is used to generate pulse outputs of 10 Hz through 100 kHz which can be used to control pulse motors for simple position control applications. The PWM (pulse width modulation) instruction is used to generate pulse outputs of 14.49, 45.96, or 367.65 Hz with a variable pulse width ratio between 0% and 100%, which can be used for illumination control. The RAMP instruction is used for trapezoidal control. The ZRN instruction for zero‐return control. The PULS, PWM, RAMP, and ZRN instructions can be used on all slim type CPU modules, except that PULS3, PWM3, RAMP2, and ZRN3 instructions can not be used on the FC5A‐D16RK1 and FC5A‐D16RS1. Instruction PULS RAMP PULS1 PWM1 ZRN1 RAMP1 PULS2 PWM2 ZRN2 Pulse Output Port PULS3 PWM3 ZRN3 RAMP2 — — — 14.49 Hz, Output Frequency 10 Hz to 100 kHz 45.96 Hz, 10 Hz to 100 kHz 10 Hz to 100 kHz 367.65 Hz Pulse Width Ratio 0 to 100% PULS1 PWM1 RAMP1...
13: P I ULSE NSTRUCTIONS PULS1 (Pulse Output 1) When input is on, the PULS1 instruction sends out a pulse output from output Q0. The PULS output pulse frequency is determined by source device S1. The output pulse width ratio ***** ***** is fixed at 50%. PULS1 can be programmed to generate a predetermined number of output pulses. When pulse counting is disabled, PULS1 generates output pulses while the start input for the PULS1 instruction remains on. PULS2 (Pulse Output 2) When input is on, the PULS2 instruction sends out a pulse output from output Q1. The PULS output pulse frequency is determined by source device S1. The output pulse width ratio ***** ***** is fixed at 50%. PULS2 generates output pulses while the start input for the PULS2 instruction remains on. PULS2 cannot be programmed to generate a predetermined number of output pulses. PULS3 (Pulse Output 3) When input is on, the PULS3 instruction sends out a pulse output from output Q2. The PULS output pulse frequency is determined by source device S1. The output pulse width ratio ***** ***** is fixed at 50%. PULS3 can be programmed to generate a predetermined number of output pulses. Not available on FC5A‐16RK1/RS1 When pulse counting is disabled, PULS3 generates output pulses while the start input for the PULS3 instruction remains on. Note: The PULS1, PULS2, and PULS3 instructions can be used only once in a user program. When PULS1, PULS2, or PULS3 is not used, unused output Q0, Q1, or Q2 can be used for another pulse instruction or ordinary output. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3...
Page 149
13: P I ULSE NSTRUCTIONS Device Function Description 0: Disable pulse counting S1+2 Pulse counting 1: Enable pulse counting (PULS1/PULS3 only) S1+3 Preset value (high word) 1 to 100,000,000 (05F5 E100h) (PULS1/PULS3 only) S1+4 Preset value (low word) S1+5 Current value (high word) 1 to 100,000,000 (05F5 E100h) (PULS1/PULS3 only) S1+6 Current value (low word) S1+7 Error status 0 to 5 Note 1: Devices for high and low words can be swapped on upgraded CPU modules with system program version 110 or higher. See ( page 5‐46 Basic Vol.). Note 2: The frequency range of mode 3 is from 250 Hz to 100 kHz for FC5A‐D12K1E and FC5A‐D12S1E. Note 3: The frequency range of mode 3 is from 25 to 10,000 (x10 Hz) for FC5A‐D12K1E and FC5A‐D12S1E. S1+0 Operation Mode The value stored in the data register designated by device S1+0 determines the frequency range of the pulse output. 0: 10 Hz to 1 kHz 1: 100 Hz to 10 kHz 2: 1 kHz to 100 kHz 3: 200 Hz to 100 kHz S1+1 Output Pulse Frequency When S1+0 is set to 0 through 2, the value stored in the data register designated by device S1+1 specifies the frequency ...
Page 150
13: P I ULSE NSTRUCTIONS S1+5 Current Value (High Word) S1+6 Current Value (Low Word) While the PULS1 or PULS3 instruction is executed with pulse counting enabled, the output pulse count is stored in two consecutive data registers designated by devices S1+5 (high word) and S1+6 (low word). The current value can be 1 through 100,000,000 (05F5 E100h) and is updated in every scan. S1+7 Error Status When the start input for the PULS instruction is turned on, device values are checked. When any error is found in the device values, the data register designated by device S1+7 stores an error code. Error Code Description Normal Operation mode designation error (S1+0 stores other than 0 through 3) Output pulse frequency designation error (S1+1 stores a value that is not within the frequency range of the output pulse.) Pulse counting designation error (S1+2 stores other than 0 and 1) Preset value designation error (S1+3 and S1+4 store other than 1 through 100,000,000) Invalid pulse counting designation for PULS2 (S1+2 stores 1) Destination Device D1 (Status Relay) Three internal relays starting with the device designated by D1 indicate the status of the PULS instruction. These devices are for read only. Device Function Description 0: Pulse output OFF D1+0 Pulse output ON 1: Pulse output ON 0: Pulse output not complete D1+1 Pulse output complete 1: Pulse output complete 0: Overflow not occurred D1+2 Pulse output overflow 1: Overflow occurred (PULS1/PULS3 only) D1+0 Pulse Output ON...
Page 151
13: P I ULSE NSTRUCTIONS Special Data Registers for Pulse Outputs Three additional special data registers store the current frequency of pulse outputs. Device Address Function Description While the PULS1 or RAMP1 instruction is executed, D8055 stores the current Current Pulse Frequency D8055 pulse frequency of output Q0. of PULS1 or RAMP1 (Q0) The value is updated every scan. While the PULS2 or RAMP1 (reversible control dual‐pulse output) instruction is Current Pulse Frequency D8056 executed, D8056 stores the current pulse frequency of output Q1. of PULS2 or RAMP1 (Q1) The value is updated every scan. While the PULS3 or RAMP2 instruction is executed, D8059 stores the current Current Pulse Frequency D8059 pulse frequency of output Q2. of PULS3 or RAMP2 (Q2) The value is updated every scan. Timing Chart for Enable Pulse Counting This program demonstrates a timing chart of the PULS1 instruction when pulse counting is enabled. D202 = 1 (enable pulse counting) PULS D200 Start Input I0 Output Pulse Frequency D201 Preset Value D203∙D204 Output Pulse Q0 Pulse Output ON M50 Pulse Output Complete M51 • When input I0 is turned on, PULS1 starts to generate output pulses at the frequency designated by the value stored in data register D201. While the output pulses are sent out from output Q0, internal relay M50 remains on.
Page 152
13: P I ULSE NSTRUCTIONS Timing Chart for Disable Pulse Counting This program demonstrates a timing chart of the PULS2 instruction without pulse counting. D102 = 0 (disable pulse counting) PULS D100 Start Input I1 Output Pulse Frequency D101 Output Pulse Q1 Pulse Output ON M20 Pulse Output Complete M21 • When input I1 is turned on, PULS2 starts to generate output pulses at the frequency designated by the value stored in data register D101. While the output pulses are sent out from output Q1, internal relay M20 remains on. • When input I1 is turned off, PULS2 stops generating output pulses immediately, then internal relay M20 turns off and inter‐ nal relay M21 turns on. • If the output pulse frequency value in D101 is changed while generating output pulses, the change takes effect in the next scan. When changing the pulse frequency, make sure that the timing of the change is much slower than the output pulse fre‐ quency, so that the pulse frequency is changed successfully. 13‐6 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 153
13: P I ULSE NSTRUCTIONS Sample Program: PULS1 This program demonstrates a user program of the PULS1 instruction to generate 5,000 pulses at a frequency of 200 Hz from output Q0, followed by 60,000 pulses at a frequency of 500 Hz. Programming WindLDR On the WindLDR editing screen, place the cursor where you want to insert the pulse instruction macro, and type PULSST. Enter parameters as shown below. Same device address as S1 for the PULS1 instruc‐ tion Device Settings Device Function Description Device Address (Value) S1+0 Operation mode Frequency range 200 Hz to 100 kHz D0 (3) S1+1 Output pulse frequency 200 Hz D1 (20) S1+2 Pulse counting Enable pulse counting D2 (1) S1+3 Preset value (high word) 5,000 D3/D4 (5000) S1+4 Preset value (low word) S1+5 Current value (high word) 0 to 60,000 D5/D6 S1+6 Current value (low word)
13: P I ULSE NSTRUCTIONS PWM1 (Pulse Width Modulation 1) When input is on, the PWM1 instruction generates a pulse output. The output pulse frequency is selected from 14.49, 45.96, or 367.65 Hz, and the output pulse width ratio ***** ***** is determined by source device S1. PWM1 sends out output pulses from output Q0. PWM1 can be programmed to generate a predetermined number of output pulses. When pulse counting is disabled, PWM1 generates output pulses while the start input for the PWM1 instruction remains on. PWM2 (Pulse Width Modulation 2) When input is on, the PWM2 instruction generates a pulse output. The output pulse frequency is selected from 14.49, 45.96, or 367.65 Hz, and the output pulse width ratio ***** ***** is determined by source device S1. PWM2 sends out output pulses from output Q1. PWM2 generates output pulses while the start input for the PWM2 instruction remains on. PWM2 cannot be programmed to generate a predetermined number of output pulses. PWM3 (Pulse Width Modulation 3) When input is on, the PWM3 instruction generates a pulse output. The output pulse frequency is selected from 14.49, 45.96, or 367.65 Hz, and the output pulse width ratio ***** ***** is determined by source device S1. PWM3 sends out output pulses from output Q2. Not available on FC5A‐16RK1/RS1 PWM3 can be programmed to generate a predetermined number of output pulses. When pulse counting is disabled, PWM3 generates output pulses while the start input for the PWM3 instruction remains on. Note: The PWM1, PWM2, and PWM3 instructions can be used only once in a user program. When PWM1, PWM2, or PWM3 is not used, unused output Q0, Q1, or Q2 can be used for another pulse instruction or ordinary output. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3...
Page 155
13: P I ULSE NSTRUCTIONS Source Device S1 (Control Register) Store appropriate values to data registers starting with the device designated by S1 before executing the PWM instruc‐ tion as required, and make sure that the values are within the valid range. Devices S1+5 through S1+7 are for read only. Device Function Description FC5A‐D16RK1/RS1, FC5A‐D32K3/S3 0: 11.44 Hz 1: 45.78 Hz 2: 366.2 Hz S1+0 Output pulse frequency FC5A‐D12K1E/S1E 0: 15.26 Hz 1: 61.04 Hz 2: 488.3 Hz 1 to 100 S1+1 Pulse width ratio (1% to 100% of the period determined by output pulse frequency S1+0) 0: Disable pulse counting S1+2 Pulse counting 1: Enable pulse counting (PWM1/PWM3 only) S1+3 Preset value (high word) 1 to 100,000,000 (05F5 E100h) (PWM1/PWM3 only) S1+4 Preset value (low word) S1+5 Current value (high word) 1 to 100,000,000 (05F5 E100h) (PWM1/PWM3 only) S1+6 Current value (low word) S1+7 Error status 0 to 5 Note: Devices for high and low words can be swapped on upgraded CPU modules with system program version 110 or higher. See page ...
Page 156
13: P I ULSE NSTRUCTIONS S1+3 Preset Value (High Word) S1+4 Preset Value (Low Word) With pulse counting enabled as described above, PWM1 or PWM3 generates a predetermined number of output pulses as designated by devices S1+3 and S1+4. The preset value can be 1 through 100,000,000 (05F5 E100h) stored in two con‐ secutive data registers designated by S1+3 (high word) and S1+4 (low word). When pulse counting is disabled for PWM1 or PWM3 or when programming PWM2, store 0 to data registers designated by S1+3 and S1+4. S1+5 Current Value (High Word) S1+6 Current Value (Low Word) While the PWM1 or PWM3 instruction is executed, the output pulse count is stored in two consecutive data registers designated by devices S1+5 (high word) and S1+6 (low word). The current value can be 1 through 100,000,000 (05F5 E100h) and is updated in every scan. S1+7 Error Status When the start input for the PWM instruction is turned on, device values are checked. When any error is found in the device values, the data register designated by device S1+7 stores an error code. Error Code Description Normal Output pulse frequency designation error (S1+0 stores other than 0 through 2) Pulse width ratio designation error (S1+1 stores other than 1 through 100) Pulse counting designation error (S1+2 stores other than 0 and 1) Preset value designation error (S1+3 and S1+4 store other than 1 through 100,000,000) Invalid pulse counting designation for PWM2 (S1+2 stores 1) Destination Device D1 (Status Relay) Three internal relays starting with the device designated by D1 indicate the status of the PWM instruction. These devices are for read only. Device Function Description 0: Pulse output OFF D1+0 Pulse output ON 1: Pulse output ON 0: Pulse output not complete...
Page 157
13: P I ULSE NSTRUCTIONS Timing Chart for Enable Pulse Counting This program demonstrates a timing chart of the PWM1 instruction when pulse counting is enabled. D202 = 1 (enable pulse counting) D200 Start Input I0 Pulse Width Ratio D201 PWR1 PWR2 PWR3 Preset Value D203∙D204 PWR1 PWR2 Output Pulse Q0 Pulse Output ON M50 Pulse Output Complete M51 • When input I0 is turned on, PWM1 starts to generate output pulses at the frequency designated by the value stored in data register D200. The pulse width is determined by the value stored in data register D201. While the output pulses are sent out from output Q0, internal relay M50 remains on. • When the quantity of generated output pulses reaches the preset value designated by data registers D203 and D204, PWM1 stops generating output pulses. Then internal relay M50 turns off, and internal relay M51 turns on. • If the pulse width ratio value in D201 is changed while generating output pulses, the change takes effect in the next scan. When changing the pulse width ratio, make sure that the timing of the change is much slower than the output pulse fre‐ quency, so that the pulse width ratio is changed successfully. • If input I0 is turned off before reaching the preset value, PWM1 stops generating output pulses immediately, then internal relay M50 turns off and internal relay M51 turns on. FC5A M U ’ M FC9Y‐B1273 13‐11 ICRO MART ANUAL...
Page 158
13: P I ULSE NSTRUCTIONS Timing Chart for Disable Pulse Counting This program demonstrates a timing chart of the PWM2 instruction without pulse counting. D102 = 0 (disable pulse counting) D100 Start Input I1 Pulse Width Ratio D101 PWR1 PWR2 PWR3 PWR1 PWR2 Output Pulse Q1 Pulse Output ON M20 Pulse Output Complete M21 • When input I1 is turned on, PWM2 starts to generate output pulses at the frequency designated by the value stored in data register D100. The pulse width is determined by the value stored in data register D101. While the output pulses are sent out from output Q1, internal relay M20 remains on. • When input I1 is turned off, PWM2 stops generating output pulses immediately, then internal relay M20 turns off and inter‐ nal relay M21 turns on. • If the pulse width ratio value in D101 is changed while generating output pulses, the change takes effect in the next scan. When changing the pulse width ratio, make sure that the timing of the change is much slower than the output pulse fre‐ quency, so that the pulse width ratio is changed successfully. 13‐12 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 159
13: P I ULSE NSTRUCTIONS Sample Program: PWM2 This program demonstrates a user program of the PWM2 instruction to generate pulses from output Q1, with an ON/OFF ratio of 30% while input I0 is off or 60% when input I0 is on. Programming WindLDR On the WindLDR editing screen, place the cursor where you want to insert the pulse instruction macro, and type PWMST. Enter parameters as shown below. Same device address as S1 for the PWM2 instruc‐ tion Device Settings Device Function Description Device Address (Value) S1+0 Output pulse frequency 367.65 Hz D0 (2) S1+1 Pulse width ratio D1 (30) S1+2 Pulse counting Disable pulse counting D2 (0) S1+3 Preset value (high word) Not used S1+4 Preset value (low word) S1+5 Current value (high word) Not used S1+6 Current value (low word) S1+7 Error status 0: Pulse output OFF...
13: P I ULSE NSTRUCTIONS RAMP1 (Ramp Control 1) When input is on, the RAMP1 instruction sends out a predetermined number of output RAMP pulses from output Q0. The output frequency changes in a trapezoidal pattern deter‐ ***** ***** mined by source device S1. After starting the RAMP1 instruction, the output pulse fre‐ quency increases linearly to a predetermined constant value, remains constant at this value for some time, and then decreases linearly to the original value. The frequency change rate or the frequency change time can be selected for accelera‐ tion and deceleration of the movement. When input is off, the pulse output remains off. When input is turned on again, the RAMP1 instruction starts a new cycle of generating output pulses. RAMP1 can also be used for reversible control to generate a control direction output or reverse output pulse from output Q1. Note: The RAMP1 instruction can be used only once in a user program. When RAMP1 is used with reversible control disabled, unused output Q1 can be used for another pulse instruction PULS2, PWM2, or ZRN2 or ordinary output. RAMP2 (Ramp Control 2) When input is on, the RAMP2 instruction sends out a predetermined number of output RAMP pulses from output Q2. The output frequency changes in a trapezoidal pattern deter‐ ***** ***** mined by source device S1. After starting the RAMP2 instruction, the output pulse fre‐ quency increases linearly to a predetermined constant value, remains constant at this Not available on FC5A‐16RK1/RS1 value for some time, and then decreases linearly to the original value. The frequency change rate or the frequency change time can be selected for accelera‐ tion and deceleration of the movement. When input is off, the pulse output remains off. When input is turned on again, the RAMP2 instruction starts a new cycle of generating output pulses. RAMP2 can not be used for reversible control. Note: The RAMP2 instruction can be used only once in a user program. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3...
Page 161
13: P I ULSE NSTRUCTIONS Source Device S1 (Control Register) Store appropriate values to data registers starting with the device designated as S1 before executing the RAMP instruc‐ tion as required, and make sure that the values are within the valid range. Devices S1+8 through S1+10 are for read only. Device Function Description 0: 10 Hz to 1 kHz 1: 100 Hz to 10 kHz S1+0 Operation mode 2: 1 kHz to 100 kHz 3: 200 Hz to 100 kHz (Note 2) When S1+0 (operation mode) = 0 to 2: 1 to 100 (%) S1+1 Steady pulse frequency (1% to 100% of the maximum frequency of selected mode S1+0) When S1+0 (operation mode) = 3: 20 to 10,000 (10 Hz) (Note 3) When S1+0 (operation mode) = 0 to 2: 1 to 100 (%) S1+2 Initial pulse frequency (1% to 100% of the maximum frequency of selected mode S1+0) When S1+0 (operation mode) = 3: 20 to 10,000 (10 Hz) (Note 3) When S1+0 (operation mode) = 0 to 2: 1 to 100 (%) Frequency change rate (1% to 100% of the maximum frequency of selected mode S1+0) S1+3 When S1+0 (operation mode) = 3: 10 to 10,000 (ms) Frequency change time (designated in increments of 10) 0: Reversible control disabled S1+4 Reversible control enable 1: Reversible control (single‐pulse output) 2: Reversible control (dual‐pulse output) (RAMP1 only) 0: Forward S1+5 Control direction 1: Reverse S1+6...
Page 162
13: P I ULSE NSTRUCTIONS S1+1 Steady Pulse Frequency When S1+0 is set to 0 through 2, the value stored in the data register designated by device S1+1 specifies the frequency of the steady pulse output in percent of the maximum of the frequency range selected by S1+0. Valid values for device S1+1 are 1 through 100, thus the output pulse frequency can be 10 Hz to 1 kHz (operation mode 0), 100 Hz to 10 kHz (operation mode 1), or 1 kHz to 100 kHz (operation mode 2). When S1+0 is set to 3 (200 Hz to 100 kHz), valid values for device S1+1 are 20 through 10,000 (in increments of 10) and the S1+1 value multiplied by 10 determines the steady pulse frequency, thus the output pulse frequency can be set in increments of 10 Hz. The output frequency error is ±5% maximum. Operation Mode (S1+0) S1+1 Steady Pulse Frequency (Hz) 0 to 2 1 to 100 Maximum frequency selected by S1+0 S1+1 value (%) 20 to 10,000 S1+1 value 10 S1+2 Initial Pulse Frequency When S1+0 is set to 0 through 2, the value stored in the data register designated by device S1+2 specifies the frequency of the initial pulse output in percent of the maximum of the frequency range selected by S1+0. Valid values for device S1+2 are 1 through 100, thus the initial pulse frequency can be 10 Hz to 1 kHz (operation mode 0), 100 Hz to 10 kHz (operation mode 1), or 1 kHz to 100 kHz (operation mode 2). When S1+0 is set to 3 (200 Hz to 100 kHz), valid values for device S1+2 are 20 through 10,000 (in increments of 10) and the S1+2 value multiplied by 10 determines the initial pulse frequency, thus the initial pulse frequency can be set in incre‐ ments of 10 Hz. The output frequency error is ±5% maximum. Operation Mode (S1+0) S1+2 Initial Pulse Frequency (Hz) 0 to 2 1 to 100 Maximum frequency selected by S1+0 S1+2 value (%) 20 to 10,000 S1+2 value 10 S1+3 Frequency Change Rate / Frequency Change Time When S1+0 is set to 0 through 2, the value stored in the data register designated by device S1+3 determines the rate of ...
Page 163
13: P I ULSE NSTRUCTIONS S1+4 Reversible Control Enable The value stored in the data register designated by device S1+4 specifies one of the output modes. RAMP1 can designate 0 through 2 for device S1+4, while RAMP2 can designate 0 and 1. S1+4 Value Reversible Control Description Output Q0 or Q2 generates output pulses; used for single‐direction control. Reversible control Output Q0/Q2 disabled Output Q1 can be used for PULS2, PWM2, ZRN2, or an ordinary output. When using RAMP2, output Q3 can be used for an ordinary output. Output Q0 or Q2 generates output pulses, and output Q1 or Q3 generates a direc‐ tion control signal. Output Q0/Q2 Reversible control (Single‐pulse output) Output Q1/Q3 Forward Reverse Output Q1 or Q3 turns on or off depending on the value stored in data register des‐ ignated by device S1+5 (control direction): 0 for forward or 1 for reverse. Output Q0 generates forward output pulses, and output Q1 generates reverse out‐ put pulses. Output Q0 (Forward) Reversible control (RAMP1 only) (Dual‐pulse output) Output Q1 (Reverse) Output Q0 or Q1 generates output pulses alternately depending on the value stored in data register designated by device S1+5 (control direction): 0 for forward or 1 for reverse. If the value stored in the data register designated by device S1+4 is changed after the start input for the RAMP instruction has been turned on, the change can take effect only after the CPU starts again.
Page 164
13: P I ULSE NSTRUCTIONS S1+10 Error Status When the start input for the RAMP instruction is turned on, device values are checked. When any error is found in the device values, the data register designated by device S1+10 stores an error code. Error Code Description Normal Operation mode designation error (S1+0 stores other than 0 through 3) Initial pulse frequency designation error (S1+2 stores a value that is not within the frequency range of the initial pulse output.) Preset value designation error (S1+6 and S1+7 store other than 1 through 100,000,000) Steady pulse frequency designation error (S1+1 stores a value that is not within the frequency range of the steady pulse output.) Frequency change rate designation error Modes 0 to 2: S1+3 stores other than 1 through 100 Mode 3: S1+3 stores other than 10 through 10,000 Reversible control enable designation error (S1+4 stores other than 0 through 2) Control direction designation error (S1+5 stores other than 0 and 1) The number of pulses for the frequency change areas calculated from the steady pulse frequency (S1+1), initial pulse frequency (S1+2), and frequency change rate/time (S1+3) exceeds the preset value (S1+6/7) of the total out‐ put pulses. To correct this error, reduce the value of the steady pulse frequency (S1+1) or initial pulse frequency (S1+2), or increase the frequency change rate/time (S1+3). The initial pulse frequency (S1+2) is equal to or larger than the steady pulse frequency (S1+1). Reduce the initial pulse frequency (S1+2) to a value smaller than the steady pulse frequency (S1+1). Modes 0 to 2: The frequency change rate (S1+3) is larger than the difference between the initial pulse frequency (S1+2) and the steady pulse frequency (S1+1). Reduce the frequency change rate (S1+3) or the initial pulse frequency (S1+2). 13‐18 FC5A M U ’ M FC9Y‐B1273 ICRO...
Page 165
13: P I ULSE NSTRUCTIONS Destination Device D1 (Status Relay) Four internal relays starting with the device designated by D1 indicate the status of the RAMP instruction. These devices are for read only. Device Function Description 0: Pulse output OFF D1+0 Pulse output ON 1: Pulse output ON 0: Pulse output not complete D1+1 Pulse output complete 1: Pulse output complete 0: Steady pulse output D1+2 Pulse output status 1: Changing output pulse frequency 0: Overflow not occurred D1+3 Pulse output overflow 1: Overflow occurred D1+0 Pulse Output ON The internal relay designated by device D1+0 remains on while the RAMP instruction generates output pulses. When the start input for the RAMP instruction is turned off or when the RAMP instruction has completed generating a predeter‐ mined number of output pulses, the internal relay designated by device D1+0 turns off. D1+1 Pulse Output Complete The internal relay designated by device D1+1 turns on when the RAMP instruction has completed generating a predeter‐ mined number of output pulses or when the RAMP instruction is stopped to generate output pulses. When the start input for the RAMP instruction is turned on, the internal relay designated by device D1+1 turns off. D1+2 Pulse Output Status The internal relay designated by device D1+2 turns on while the output pulse frequency is increasing or decreasing, and turns off when the output pulse frequency reaches the steady pulse frequency (S1+1). While the pulse output is off, the internal relay designated by device D1+2 remains off.
Page 166
13: P I ULSE NSTRUCTIONS Timing Chart for Reversible Control Disabled This program demonstrates a timing chart of the RAMP1 instruction when reversible control is disabled. D204 = 0 (reversible control disabled) RAMP D200 Start Input I0 Steady Pulse Frequency Initial Pulse Frequency Output Pulse Q0 Pulse Output ON M50 Pulse Output Complete M51 Pulse Output Status M52 • When input I0 is turned on, RAMP1 generates output pulses starting at the initial frequency designated by the value stored in data register D202. While the output pulses are sent out from output Q0, internal relay M50 remains on. • Operation modes 0 through 2: The pulse frequency increases according to the frequency change rate value stored in data register D203. • Operation mode 3: The pulse frequency increases as long as the frequency change time stored in data register D203. • While the output pulse frequency is on the increase, internal relay M52 remains on. • When the output pulse frequency reaches the steady pulse frequency designated by the value stored in data register D201, internal relay M52 turns off. When the output pulse frequency starts to decrease, internal relay M52 turns on again. • When the quantity of generated output pulses reaches the preset value designated by data registers D206 and D207, RAMP1 stops generating output pulses. Then internal relay M50 and M52 turn off, and internal relay M51 turns on. • If the parameter values in D200 through D207 (except for D204) are changed while generating output pulses, the change takes effect when start input I0 is turned on for the next cycle. • If the value stored in D204 is changed after start input I0 has been turned on, the change can take effect only after the CPU starts again. • If start input I0 is turned off before reaching the preset value, RAMP1 stops generating output pulses immediately, then internal relay M50 turns off and internal relay M51 turns on. When input I0 is turned on again, RAMP1 restarts to generate ...
Page 167
13: P I ULSE NSTRUCTIONS Timing Chart for Reversible Control with Single Pulse Output This program demonstrates a timing chart of the RAMP1 instruction when reversible control is enabled with single pulse output. D204 = 1 (reversible control with single pulse output) RAMP D200 Start Input I0 Control Direction D205 0 (Forward) 1 (Reverse) Steady Pulse Frequency Initial Pulse Frequency Output Pulse Q0 Control Direction Output Q1 Pulse Output ON M50 Pulse Output Complete M51 Pulse Output Status M52 • When input I0 is turned on, RAMP1 generates output pulses starting at the initial frequency designated by the value stored in data register D202. While the output pulses are sent out from output Q0, internal relay M50 remains on. • Operation modes 0 through 2: The pulse frequency increases according to the frequency change rate value stored in data register D203. • Operation mode 3: The pulse frequency increases as long as the frequency change time stored in data register D203. • While the output pulse frequency is on the increase, internal relay M52 remains on. • Depending on the control direction designated by the value stored in data register D205, control direction output Q1 turns off or on while D205 stores 0 (forward) or 1 (reverse), respectively. • When the output pulse frequency reaches the steady pulse frequency designated by the value stored in data register D201, internal relay M52 turns off. When the output pulse frequency starts to decrease, internal relay M52 turns on again. • When the quantity of generated output pulses reaches the preset value designated by data registers D206 and D207, RAMP1 stops generating output pulses. Then internal relay M50 and M52 turn off, and internal relay M51 turns on. •...
Page 168
13: P I ULSE NSTRUCTIONS Timing Chart for Reversible Control with Dual Pulse Output This program demonstrates a timing chart of the RAMP1 instruction when reversible control is enabled with dual pulse output. D204 = 2 (reversible control with dual pulse output) RAMP D200 Start Input I0 Control Direction D205 0 (Forward) 1 (Reverse) Steady Pulse Frequency Initial Pulse Frequency Forward (CW) Output Pulse Q0 Steady Pulse Frequency Initial Pulse Frequency Reverse (CCW) Output Pulse Q1 Pulse Output ON M50 Pulse Output Complete M51 Pulse Output Status M52 • When input I0 is turned on, RAMP1 generates output pulses starting at the initial frequency designated by the value stored in data register D202. While the output pulses are sent out from output Q0 or Q1, internal relay M50 remains on. • Operation modes 0 through 2: The pulse frequency increases according to the frequency change rate value stored in data register D203. • Operation mode 3: The pulse frequency increases as long as the frequency change time stored in data register D203. • While the output pulse frequency is on the increase, internal relay M52 remains on. • Depending on the control direction designated by the value stored in data register D205, output Q0 or Q1 sends out output pulses while D205 stores 0 (forward) or 1 (reverse), respectively. • When the output pulse frequency reaches the steady pulse frequency designated by the value stored in data register D201, internal relay M52 turns off. When the output pulse frequency starts to decrease, internal relay M52 turns on again. • When the quantity of generated output pulses reaches the preset value designated by data registers D206 and D207, RAMP1 stops generating output pulses. Then internal relay M50 and M52 turn off, and internal relay M51 turns on.
Page 169
13: P I ULSE NSTRUCTIONS Sample Program: RAMP1 — Reversible Control Disabled This program demonstrates a user program of the RAMP1 instruction to generate 48,000 pulses from output Q0. Steady pulse frequency: 6 kHz Initial pulse frequency: 300 Hz Frequency change time: 2,000 ms Reversible control enable: Reversible control disabled Preset value: 48,000 pulses total Programming WindLDR On the WindLDR editing screen, place the cursor where you want to insert the pulse instruction macro, and type RAMPST. Enter parameters as shown below. Same device address as S1 for the RAMP1 instruction Device Settings Device Function Description Device Address (Value) S1+0 Operation mode Frequency range 200 Hz to 100 kHz D0 (3) S1+1 Steady pulse frequency 6 kHz D1 (600) S1+2 Initial pulse frequency 300 Hz D2 (30) S1+3 Frequency change time 2,000 ms...
Page 170
13: P I ULSE NSTRUCTIONS Sample Program: RAMP1 — Reversible Control with Single Pulse Output This program demonstrates a user program of the RAMP1 instruction to generate 100,000 pulses from output Q0. Con‐ trol direction output Q1 turns off or on while input I1 is off or on to indicate the forward or reverse direction, respec‐ tively. Steady pulse frequency: 10 kHz Initial pulse frequency: 500 Hz Frequency change time: 2,000 ms Reversible control enable: Reversible control with single pulse output Preset value: 100,000 pulses total Programming WindLDR On the WindLDR editing screen, place the cursor where you want to insert the pulse instruction macro, and type RAMPST. Enter parameters as shown below. Same device address as S1 for the RAMP1 instruction Device Settings Device Function Description Device Address (Value) S1+0 Operation mode Frequency range 200 Hz to 100 kHz D0 (3) S1+1 Steady pulse frequency 10 kHz D1 (1000) S1+2 Initial pulse frequency 500 Hz D2 (50) S1+3...
Page 171
13: P I ULSE NSTRUCTIONS Sample Program: RAMP1 — Reversible Control with Dual Pulse Output This program demonstrates a user program of the RAMP1 instruction to generate 1,000,000 pulses from output Q0 (for‐ ward pulse) or Q1 (reverse pulse) while input I1 is off or on, respectively. Steady pulse frequency: 30 kHz Initial pulse frequency: 10 kHz Frequency change time: 2,000 ms Reversible control enable: Reversible control with dual pulse output Preset value: 1,000,000 pulses total Programming WindLDR On the WindLDR editing screen, place the cursor where you want to insert the pulse instruction macro, and type RAMPST. Enter parameters as shown below. Same device address as S1 for the RAMP1 instruction Device Settings Device Function Description Device Address (Value) S1+0 Operation mode Frequency range 1 kHz to 100 kHz D0 (2) S1+1 Steady pulse frequency 30 kHz D1 (30) S1+2 Initial pulse frequency 10 kHz D2 (10) S1+3 Frequency change time...
13: P I ULSE NSTRUCTIONS ZRN1 (Zero Return 1) When input is on, the ZRN1 instruction sends out a pulse output of a predeter‐ mined high frequency from output Q0. When a deceleration input turns on, ***** ***** ***** the output frequency decreases to a creep frequency. When the deceleration input turns off, the ZRN1 instruction stops generating output pulses. The output pulse width ratio is fixed at 50%. ZRN2 (Zero Return 2) When input is on, the ZRN2 instruction sends out a pulse output of a predeter‐ mined high frequency from output Q1. When a deceleration input turns on, ***** ***** ***** the output frequency decreases to a creep frequency. When the deceleration input turns off, the ZRN2 instruction stops generating output pulses. The output pulse width ratio is fixed at 50%. ZRN3 (Zero Return 3) When input is on, the ZRN3 instruction sends out a pulse output of a predeter‐ mined high frequency from output Q2. When a deceleration input turns on, ***** ***** ***** the output frequency decreases to a creep frequency. When the deceleration input turns off, the ZRN3 instruction stops generating output pulses. Not available on FC5A‐16RK1/RS1 The output pulse width ratio is fixed at 50%. Note: The ZRN1, ZRN2, and ZRN3 instructions can be used only once in a user program. When ZRN1, ZRN2, or ZRN3 is not used, unused output Q0, Q1, or Q2 can be used for another pulse instruction or ordinary output. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E —...
Page 173
13: P I ULSE NSTRUCTIONS Source Device S1 (Control Register) Store appropriate values to data registers starting with the device designated by S1 before executing the ZRN instruction as required, and make sure that the values are within the valid range. Device S1+4 is for read only. Device Function Description 0: 10 Hz to 1 kHz 1: 100 Hz to 10 kHz S1+0 Initial operation mode 2: 1 kHz to 100 kHz 3: 200 Hz to 100 kHz (Note 1) When S1+0 (operation mode) = 0 to 2: 1 to 100 (%) S1+1 Initial pulse frequency (1% to 100% of the maximum frequency of selected mode S1+0) When S1+0 (operation mode) = 3: 20 to 10,000 (10 Hz) (Note 2) 0: 10 Hz to 1 kHz 1: 100 Hz to 10 kHz S1+2 Creep operation mode 2: 1 kHz to 100 kHz 3: 200 Hz to 100 kHz (Note 1) When S1+2 (operation mode) = 0 to 2: 1 to 100 (%) S1+3 Creep pulse frequency (1% to 100% of the maximum frequency of selected mode S1+2) When S1+2 (operation mode) = 3: 20 to 10,000 (10 Hz) (Note 2) S1+4 Error status 0 to 2 Note 1: The frequency range of mode 3 is from 250 Hz to 100 kHz for FC5A‐D12K1E and FC5A‐D12S1E. Note 2: The frequency range of mode 3 is from 25 to 10,000 (x10 Hz) for FC5A‐D12K1E and FC5A‐D12S1E. S1+0 Initial Operation Mode The value stored in the data register designated by device S1+0 determines the frequency range of the high‐frequency initial pulse output.
Page 174
13: P I ULSE NSTRUCTIONS S1+3 Creep Pulse Frequency When S1+2 is set to 0 through 2, the value stored in the data register designated by device S1+3 specifies the frequency of the creep pulse output in percent of the maximum of the frequency range selected by S1+2. Valid values for device S1+3 are 1 through 100, thus the initial pulse frequency can be 10 Hz to 1 kHz (operation mode 0), 100 Hz to 10 kHz (operation mode 1), or 1 kHz to 100 kHz (operation mode 2). When S1+2 is set to 3 (200 Hz to 100 kHz), valid values for device S1+3 are 20 through 10,000 (in increments of 10) and the S1+3 value multiplied by 10 determines the creep pulse frequency, thus the creep pulse frequency can be set in incre‐ ments of 10 Hz. The pulse frequency error is ±5% maximum. Creep Operation Mode (S1+2) S1+3 Creep Pulse Frequency (Hz) 0 to 2 1 to 100 Maximum frequency selected by S1+2 S1+3 value (%) 20 to 10,000 S1+3 value 10 S1+4 Error Status When the start input for the ZRN instruction is turned on, device values are checked. When any error is found in the device values, the data register designated by device S1+4 stores an error code. Error Code Description Normal Operation mode designation error (S1+0 or S1+2 stores other than 0 through 3) Output pulse frequency designation error (S1+1 stores a value that is not within the frequency range of the initial pulse output or S1+3 stores a value that is not within the frequency range of the creep pulse output.) Source Device S2 (Deceleration Input) When the deceleration input turns on while the ZRN instruction is generating output pulses of the initial pulse frequency, the pulse frequency is changed to the creep pulse frequency. When the deceleration input turns off, the ZRN instruction stops generating output pulses. When using the ZRN1, ZRN2, and ZRN3 instructions, designate different input or internal relay numbers as deceleration inputs for the ZRN1, ZRN2, and ZRN3 instructions. If the same deceleration input is used and the ZRN1, ZRN2, and ZRN3 instructions are executed at the same time, the pulse outputs may not turn off when the deceleration input turns on. The deceleration input is available in two types depending on the designated device address. Device Function Description...
Page 175
13: P I ULSE NSTRUCTIONS Destination Device D1 (Status Relay) Two internal relays starting with the device designated by D1 indicate the status of the ZRN instruction. These devices are for read only. Device Function Description 0: Pulse output OFF D1+0 Pulse output ON 1: Pulse output ON 0: Pulse output not complete D1+1 Pulse output complete 1: Pulse output complete D1+0 Pulse Output ON The internal relay designated by device D1+0 remains on while the ZRN instruction generates output pulses. When the start input or deceleration input for the ZRN instruction is turned off to stop generating output pulses, the internal relay designated by device D1+0 turns off. D1+1 Pulse Output Complete The internal relay designated by device D1+1 turns on when the deceleration input for the ZRN instruction is turned off to stop generating output pulses. When the start input for the ZRN instruction is turned on, the internal relay designated by device D1+1 turns off. FC5A M U ’ M FC9Y‐B1273 13‐29 ICRO MART ANUAL...
Page 176
13: P I ULSE NSTRUCTIONS Timing Chart for Zero‐return Operation This program demonstrates a timing chart of the ZRN1 instruction when input I2 is used for a high‐speed deceleration input. D200 Start Input I0 Deceleration Input I2 Initial Pulse Frequency Creep Pulse Frequency Output Pulse Q0 Pulse Output ON M10 Pulse Output Complete M11 • When input I0 is turned on, ZRN1 starts to generate output pulses of the initial pulse frequency designated by the value stored in data register D201. While the output pulses are sent out from output Q0, internal relay M10 remains on. • When deceleration input I2 is turned on, the output pulse frequency immediately reduces to the creep pulse frequency des‐ ignated by the value stored in data register D203. • When deceleration input I2 is turned off, ZRN1 stops generating output pulses immediately. Then internal relay M10 turns off, and internal relay M11 turns on. • If parameter values in D200 through D203 are changed while generating output pulses, the change takes effect when start input I0 is turned on for the next cycle. • If start input I0 is turned off while generating output pulses of either initial or creep pulse frequency, ZRN1 stops generating output pulses, then internal relay M10 turns off and internal relay M11 turns on. When input I0 is turned on again, ZRN1 restarts to generate output pulses for another cycle, starting at the initial pulse frequency. • If deceleration input I2 is already on when start input I0 turns on, ZRN1 starts to generate pulse outputs of the creep pulse frequency. 13‐30 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 177
13: P I ULSE NSTRUCTIONS Sample Program: ZRN1 This program demonstrates a user program of the ZRN1 instruction used for zero‐return operation to generate output pulses of 3 kHz initial pulse frequency from output Q0 while input I1 is on. When deceleration input I3 is turned on, the output pulse frequency reduces to the creep pulse frequency of 800 Hz. When deceleration input I3 is turned off, ZRN1 stops generating output pulses. Initial pulse frequency: 3 kHz Creep pulse frequency: 800 Hz Deceleration input: I3 (high‐speed deceleration input) Programming WindLDR On the WindLDR editing screen, place the cursor where you want to insert the pulse instruction macro, and type ZRNST. Enter parameters as shown below. Same device address as S1 for the ZRN1 instruction Device Settings Device Function Description Device Address (Value) S1+0 Initial operation mode Frequency range 100 Hz to 10 kHz D0 (1) S1+1 Initial pulse frequency 10 kHz 30% = 3 kHz D1 (30) S1+2 Creep operation mode Frequency range 10 Hz to 1 kHz D2 (0) S1+3 Creep pulse frequency 1 kHz 80% = 800 Hz D3 (80)
Page 178
13: P I ULSE NSTRUCTIONS 13‐32 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
14: PID I NSTRUCTION Introduction The PID instruction implements a PID (proportional, integral, and derivative) algorithm with built‐in auto tuning to deter‐ mine PID parameters, such as proportional gain, integral time, derivative time, and control action automatically. In addi‐ tion, advanced auto tuning automatically determines the PID parameters without the need for designating auto tuning parameters. The PID instruction is primarily designed for use with an analog I/O module to read analog input data, and turns on and off a designated output to perform PID control in applications such as temperature control described in the application example on page 14‐18. In addition, the PID instruction also generates an output manipulated variable for analog output module. When this device value is moved to an analog output module, a voltage (0 to 10V DC) or current (4 to 20 mA DC) output can be generated. Special technical knowledge about the PID control is required to use the PID function of the Warning MicroSmart. Use of the PID function without understanding the PID control may cause the MicroSmart to perform unexpected operation, resulting in disorder of the control system, damage, or accidents. When using the PID instruction for feedback control, emergency stop and interlocking circuits must be configured outside the MicroSmart. If such a circuit is configured inside the MicroSmart, failure of inputting the process variable may cause equipment damage or accidents. PID (PID Control) When input is on, auto tuning and/or PID action is executed PID(*) according to the value (0 through 4) stored in a data register 0‐ **** ***** ***** ***** ***** ***** device assigned for operation mode. Applicable CPU Modules and Quantity of PID Instructions A maximum of 32 or 56 PID instructions can be used in a user program, depending on the CPU module type. FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E —...
Page 180
14: PID I NSTRUCTION Valid Devices Device Function Constant D0‐D7973 S1 (Source 1) Control register — — — — — — — D10000‐D49973 S2 (Source 2) Control relay — Q0‐Q620 M0‐M2550 — — — — — D0‐D7999 0‐4095 S3 (Source 3) Set point — — — — — — D10000‐D49999 0‐50000 Process variable D0‐D7999 S4 (Source 4) —...
Page 181
14: PID I NSTRUCTION Source Device S1 (Control Register) Store appropriate values to data registers starting with the device designated by S1 before executing the PID instruction as required, and make sure that the values are within the valid range. Devices S1+0 through S1+2, S1+23, and S1+24 are for read only. For programming the devices using a macro, see page 14‐21. Device Function Description When S1+4 (control mode) = 1 or 3 (enable linear conversion): Process variable Stores the process variable after conversion. S1+0 (after conversion) When S1+4 (control mode) = 0 or 2 (disable linear conversion): Stores the process variable without conversion. Stores the output manipulated variable (manual mode output variable and AT output S1+1 Output manipulated variable manipulated variable) in percent. 0 to 100 (0% to 100%) S1+2 Operating status Stores the operating or error status of the PID instruction. 0: PID action 1: AT (auto tuning) + PID action S1+3 Operation mode 2: AT (auto tuning) 3: Advanced AT + PID action 4: Advanced AT 0: Disable linear conversion, proportional gain Control mode 1: Enable linear conversion, proportional gain S1+4 (linear conversion and 2: Disable linear conversion, proportional band proportional term) 3: Enable linear conversion, proportional band Word data type: 0 to 65535 S1+5 Linear conversion maximum value Integer data type: –32768 to +32767...
Page 182
14: PID I NSTRUCTION Device Function Description Manual mode output S1+18 0 to 100 (101 designates 100) manipulated variable 1 to 10000 (0.01 sec to 100.00 sec) S1+19 AT sampling period 0 designates 0.01 sec, 10001 designates 100.00 sec 1 to 500 (0.1 sec to 50.0 sec) S1+20 AT control period 0 designates 0.1 sec, 501 designates 50.0 sec When S1+4 (control mode) = 0 or 2: 0 to 4095 (4096 designates 4095) 0 to 50000 (50001 designates 50000) S1+21 AT set point When S1+4 (control mode) = 1 or 3: Linear conversion min. AT set point Linear conversion max. When S1+21 < S1+6 (linear conversion min.), S1+6 becomes AT set point. When S1+21 > S1+5 (linear conversion max.), S1+5 becomes AT set point. S1+22 AT output manipulated variable 0 to 100 (101 designates 100) S1+23 Output manipulated variable % –32768 to 32767 (–327.68% to 327.67%) Converted from output manipulated variable (S1+1) depending on analog output mod‐ Output manipulated variable for ule type S1+24 analog output module 0 to 4095 (0% to 100%)
Page 183
14: PID I NSTRUCTION Status Code Description Operation The operation mode (S1+3) is set to a value over 4. The control mode (S1+4) is set to a value over 3. When the linear conversion is enabled (S1+4 to 1 or 3), the linear conversion maximum value (S1+5) and the linear conversion minimum value (S1+6) are set to the same value. The output manipulated variable upper limit (S1+16) is set to a value smaller than the output manipulated variable lower limit (S1+17). When the linear conversion is enabled (S1+4 set to 1 or 3), the AT set point (S1+21) is set to a value larger than the linear conversion maximum value (S1+5) or smaller than the linear conversion mini‐ mum value (S1+6). When the linear conversion is disabled (S1+4 set to 0 or 2), the AT set point (S1+21) is set to a value larger than 4095 or 50000, depending on the analog I/O module type. PID action or AT is When the linear conversion is enabled (S1+4 set to 1 or 3), the set point (S3) is set to a value larger stopped because of than the linear conversion maximum value (S1+5) or smaller than the linear conversion minimum incorrect parameter set‐ value (S1+6). tings. When the linear conversion is disabled (S1+4 set to 0 or 2), the set point (S3) is set to a value larger than 4095 or 50000, depending on the analog I/O module type. While the AT + PID action is executed (S1+3 set to 1 or 3), the process variable (S1+0) cannot reach the AT set point (S1+21). • In the direct control action (S2+0 on), the AT + PID action is started when the process variable is in the following relationship: Set point (S3) Process variable (S1+0) AT set point (S1+21) To solve this problem, set the AT set point to a value smaller than the process variable. • In the reverse control action (S2+0 off), the AT + PID action is started when the process variable is in the following relationship: AT set point (S1+21) Process variable (S1+0) Set point (S3) To solve this problem, set the AT set point to a value greater than the process variable.
Page 184
14: PID I NSTRUCTION 3: Advanced AT (auto tuning) + PID action Auto tuning is first executed according to the AT parameters which are designated automatically, such as AT sampling period (S1+19), AT control period (S1+20), AT set point (S1+21), and AT output manipulated variable (S1+22). As a result of auto tuning, PID parameters are determined such as proportional term (S1+7), integral time (S1+8), derivative time (S1+9), sampling period (S1+12), control period (S1+13), and control direction (S2+0), then PID action is executed according to the derived PID parameters. 4: Advanced AT (auto tuning) Auto tuning is executed according to automatically designated AT parameters, except for AT set point (S1+21), to determine PID parameters such as proportional term (S1+7), integral time (S1+8), derivative time (S1+9), sampling period (S1+12), control period (S1+13), and control direction (S2+0); PID action is not executed. Device Designations by Operation Mode (S1+3) The following table summarizes devices which have to be designated for each operation mode. When auto tuning is used, several devices are automatically determined and do not have to be designated. Operation Mode (S1+3) AT (auto tuning) Advanced AT PID action AT (auto tuning) Advanced AT + PID action + PID action S1+7 Proportional term Designate * Auto * Auto Auto * Auto S1+8 Integral time Designate * Auto * Auto Auto * Auto S1+9 Derivative time Designate * Auto * Auto...
Page 185
14: PID I NSTRUCTION Linear Conversion Result Linear Conversion Maximum Value (S1+5) Set point (S3), AT set point (S1+21), and process vari‐ able (S1+0) must be within this range. Linear Conversion Minimum Value (S1+6) Analog Input Data 4095 50000 Analog Input Minimum Value Analog Input Maximum Value Proportional gain or proportional band The proportional term (S1+7) can be selected from the proportional gain (S1+4 set to 0 or 1) or the proportional band (S1+4 set to 2 or 3). S1+5 Linear Conversion Maximum Value When the linear conversion is enabled (S1+4 set to 1 or 3), set the linear conversion maximum value to the data register designated by S1+5. Valid values are 0 through 65535 (word data type) or –32768 through 32767 (integer data type), and the linear conversion maximum value must be larger than the linear conversion minimum value (S1+6). Select an appro‐ priate value for the linear conversion maximum value to represent the maximum value of the input signal to the analog I/O module. When the linear conversion is disabled (S1+4 set to 0 or 2), you do not have to set the linear conversion maximum value. S1+6 Linear Conversion Minimum Value When the linear conversion is enabled (S1+4 set to 1 or 3), set the linear conversion minimum value to the data register designated by S1+6. Valid values are 0 through 65535 (word data type) or –32768 through 32767 (integer data type), and the linear conversion minimum value must be smaller than the linear conversion maximum value (S1+5). Select an appro‐ priate value for the linear conversion minimum value to represent the minimum value of the input signal to the analog I/ O module. When the linear conversion is disabled (S1+4 set to 0 or 2), you do not have to set the linear conversion minimum value. Example: When type K thermocouple is connected, the analog input data ranges from 0 through 4095. To convert the analog input data to actual measured temperature values, set the following parameters. Linear conversion (S1+4): 1 or 3 (enable linear conversion) Linear conversion maximum value (S1+5): 1300 (1300°C) Linear conversion minimum value (S1+6): 0 (0°C) Process Variable after Conversion (S1+0) Linear Conversion Maximum Value (S1+5): 1300 (1300°C) Linear Conversion Minimum Value (S1+6): 0 (0°C)
Page 186
14: PID I NSTRUCTION When auto tuning is not used by setting the operation mode (S1+3) to 0 (PID), set a required value of 1 through 10000 to specify a proportional gain of 0.01% through 100.00% or a proportional band of ±0.01% through ±100.00% to the data register designated by S1+7. When S1+7 stores 0, the proportional gain is set to 0.01% or the proportional band is set to ±0.01%. When S1+7 stores a value larger than 10000, the proportional gain is set to 100.00% or the proportional band is set to ±100.00%. When the proportional gain is selected, the output manipulated variable (S1+1) is calculated from the deviation between the set point (S3) and the process variable (S4). When the proportional gain is set to a large value, the proportional band becomes small and the response becomes fast, but overshoot and hunching will be caused. In contrast, when the propor‐ tional gain is set to a small value, overshoot and hunching are suppressed, but response to disturbance will become slow. The proportional band is the range of inputs (deviation between the set point and the process variable) required for the output manipulated variable (S1+1) to change from 0% to 100%. The output manipulated variable (S1+1) of the propor‐ tional term is calculated from the current input with respect to the proportional band. When the proportional band is selected, the integral action is enabled only while the process variable (S1+0) is within the proportional band, that is while the calculated value for the output manipulated variable is between 0% and 100%. While the process variable (S1+0) is out of the proportional band, the integral action is disabled. While the PID action is in progress, the proportional term value can be changed by the user. S1+8 Integral Time When only the proportional action is used, a certain amount of difference (offset) between the set point (S3) and the process variable (S1+0) remains after the control target has reached a stable state. An integral action is needed to reduce the offset to zero. The integral time is a parameter to determine the amount of integral action. When auto tuning or advanced auto tuning is used by setting the operation mode (S1+3) to 1 (AT+PID), 2 (AT), 3 (advanced AT+PID), or 4 (advanced AT), an integral time is determined automatically and does not have to be designated by the user. When auto tuning is not used by setting the operation mode (S1+3) to 0 (PID), set a required value of 1 through 65535 to specify an integral time of 0.1 sec through 6553.5 sec to the data register designated by S1+8. When S1+8 is set to 0, the integral action is disabled. When the integral time is too short, the integral action becomes too large, resulting in hunching of a long period. In con‐ trast, when the integral time is too long, it takes a long time before the process variable (S1+0) reaches the set point (S3). The integral action is executed within the range between the plus proportional band and the minus proportional band. When the process variable (S1+0) runs out of the proportional band due to an external noise or a change in the set point, the integral action is disabled. As a result, the manipulated variable quickly follows up the set point, with smaller over‐ shoot and undershoot. While the PID action is in progress, the integral time value can be changed by the user. Output Manipulated Variable S1+4: 2 or 3 (proportional band) (S1+1) S1+7: 1000 (proportional band: ±10%) Integral Action Range 100% –Proportional Band...
Page 187
14: PID I NSTRUCTION S1+9 Derivative Time The derivative action is a function to adjust the process variable (S1+0) to the set point (S3) by increasing the manipulated variable (D1) when the set point (S3) is changed or when the difference between the process variable (S1+0) and the set point (S3) is increased due to disturbance. The derivative time is a parameter to determine the amount of derivative action. When auto tuning is used by setting the operation mode (S1+3) to 1 (AT+PID), 2 (AT), 3 (advanced AT+PID), or 4 (advanced AT), a derivative time is determined automatically and does not have to be designated by the user. When auto tuning is not used by setting the operation mode (S1+3) to 0 (PID), set a required value of 1 through 65535 to specify a derivative time of 0.1 sec through 6553.5 sec to the data register designated by S1+9. When S1+9 is set to 0, the derivative action is disabled. When the derivative time is set to a large value, the derivative action becomes large. When the derivative action is too large, hunching of a short period is caused. While the PID action is in progress, the derivative time value can be changed by the user. S1+10 Integral Start Coefficient The integral start coefficient specifies the threshold value to start the integral action. If the integral action is enabled from the start of execution of the PID instruction, this may cause the process variable to be overshot. Overshooting can be controlled by delaying the start of the integral action with the integral start coefficient linked to the proportional term. If the integral start coefficient is too small, overshooting is eliminated, but a certain amount of difference (offset) between the set point and the process variable may occur. If the integral start coefficient is too large, the offset becomes smaller, but overshooting may occur. To enable the integral start coefficient, turn off the integral start coefficient disable relay (S2+3). To disable the integral start coefficient, turn on the integral start coefficient disable relay (S2+3). Process Variable Process Variable Set Point Set Point Reverse Control Ac on Time Reverse Control Ac on Time When the integral start coefficient is large When the integral start coefficient is small...
Page 188
14: PID I NSTRUCTION S1+12 Sampling Period The sampling period determines the interval to execute the PID instruction. Set a required value of 1 through 10000 to spec‐ ify a sampling period of 0.01 sec through 100.00 sec to the data register designated by S1+12. When S1+12 stores 0, the sam‐ pling period is set to 0.01 sec. When S1+12 stores a value larger than 10000, the sampling period is set to 100.00 sec. When a sampling period is set to a value smaller than the scan time, the PID instruction is executed every scan. Example – Sampling period: 40 ms, Scan time: 80 ms (Sampling period Scan time) 1 scan 1 scan 1 scan 1 scan 1 scan 1 scan 80 ms 80 ms 80 ms 80 ms 80 ms Executed Executed Executed Executed Executed Executed Example – Sampling period: 80 ms, Scan time: 60 ms (Sampling period > Scan time) 1 scan 1 scan 1 scan 1 scan 1 scan 1 scan 1 scan 1 scan 60 ms 60 ms 60 ms 60 ms 60 ms 60 ms...
Page 189
14: PID I NSTRUCTION S1+15 Low Alarm Value The low alarm value is the lower limit of the process variable (S1+0) to generate an alarm. When the process variable is lower than or equal to the low alarm value, the low alarm output control relay (S2+5) is turned on. When the process variable is higher than the low alarm value, the low alarm output control relay (S2+5) is turned off. When the linear conversion is disabled (S1+4 set to 0 or 2), set a required low alarm value of 0 through 4095 or 50000 depending on the analog I/O module type to the data register designated by S1+15. When S1+15 stores a value larger than 4095 or 50000, the low alarm value is set to 4095 or 50000, respectively. When the linear conversion is enabled (S1+4 set to 1 or 3), set a required low alarm value of 0 through 65535 (word data type) or –32768 through 32767 (integer data type) to the data register designated by S1+15. The low alarm value must be larger than or equal to the linear conversion minimum value (S1+6) and must be smaller than or equal to the linear con‐ version maximum value (S1+5). If the low alarm value is set to a value smaller than the linear conversion minimum value (S1+6), the linear conversion minimum value will become the low alarm value. If the low alarm value is set to a value larger than the linear conversion maximum value (S1+5), the linear conversion maximum value will become the low alarm value. S1+16 Output Manipulated Variable Upper Limit The value contained in the data register designated by S1+16 specifies the upper limit of the output manipulated variable (S1+1) in two ways: direct and proportional. S1+16 Value 0 through 100 When S1+16 contains a value 0 through 100, the value directly determines the upper limit of the output manipulated variable (S1+1). If the manipulated variable (D1) is greater than or equal to the upper limit value (S1+16), the upper limit value is outputted to the output manipulated variable (S1+1). Set a required value of 0 through 100 for the output manip‐ ulated variable upper limit to the data register designated by S1+16. When S1+16 stores a value larger than 100 (except 10001 through 10099), the output manipulated variable upper limit (S1+16) is set to 100. The output manipulated vari‐ able upper limit (S1+16) must be larger than the output manipulated variable lower limit (S1+17). To enable the manipulated variable upper limit, turn on the output manipulated variable limit enable control relay (S2+2). When S2+2 is turned off, the output manipulated variable upper limit (S1+16) has no effect. S1+16 Value 10001 through 10099 (disables Output Manipulated Variable Lower Limit S1+17) When S1+16 contains a value 10001 through 10099, the value minus 10000 determines the ratio of the output manipu‐ lated variable (S1+1) in proportion to the manipulated variable (D1) of 0 through 100. The output manipulated variable (S1+1) can be calculated by the following equation: Output manipulated variable (S1+1) = Manipulated variable (D1) (N – 10000) where N is the value stored in the output manipulated variable upper limit (S1+16), 10001 through 10099. If the manipulated variable (D1) is greater than or equal to 100, 100 multiplied by (N – 10000) is outputted to the output manipulated variable (S1+1). If D1 is less than or equal to 0, 0 is outputted to S1+1. To enable the manipulated variable upper limit, turn on the output manipulated variable limit enable control relay (S2+2). When S2+2 is turned off, the output manipulated variable upper limit (S1+16) has no effect. When S1+16 is set to a value 10001 through 10099, the output manipulated variable lower limit (S1+17) is disabled.
Page 190
14: PID I NSTRUCTION S1+18 Manual Mode Output Manipulated Variable The manual mode output manipulated variable specifies the output manipulated variable (0 through 100) for manual mode. Set a required value of 0 through 100 for the manual mode output manipulated variable to the data register desig‐ nated by S1+18. When S1+18 stores a value larger than 100, the manual mode output manipulated variable is set to 100. To enable the manual mode, turn on the auto/manual mode control relay (S2+1). While in manual mode, the PID action is disabled. The specified value of the manual mode output manipulated variable (S1+18) is outputted to the output manipulated variable (S1+1) and the output manipulated variable for analog output module (S1+24). The control output (S2+6) is turned on and off according to the control period (S1+13) and the manual mode output manipulated variable (S1+18). The S1+18 value has no effect on the manipulated value (D1) and the output manipulated variable % (S1+23). Auto Tuning (AT) and Advanced Auto Tuning (Advanced AT) When auto tuning is selected with the operation mode (S1+3) set to 1 (AT+PID) or 2 (AT), the auto tuning is executed before starting PID control to determine PID parameters, such as proportional term (S1+7), integral time (S1+8), deriva‐ tive time (S1+9), and control action (S2+0) automatically. The MicroSmart uses the step response method to execute auto tuning. To enable auto tuning, set four parameters for auto tuning before executing the PID instruction, such as AT sampling period (S1+19), AT control period (S1+20), AT set point (S1+21), and AT output manipulated variable (S1+22). When advanced auto tuning is selected with the operation mode (S1+3) set to 3 (advanced AT+PID) or 4 (advanced AT), most AT parameters are determined automatically and do not have to be designated by the user. Only when advanced auto tuning is used with S1+3 set to 4 (advanced AT), the user has to designate the AT set point (S1+21). AT Parameters Before executing auto tuning, AT parameters must be designated by the user as summarized in the table below. AT sampling period AT control period AT set point AT output manipulated Operation Mode (S1+3) (S1+19) (S1+20) (S1+21) variable (S1+22) 0: PID action — — — — 1: AT (auto tuning) + PID action By user ...
Page 191
14: PID I NSTRUCTION S1+19 AT Sampling Period The AT sampling period determines the interval of sampling during auto tuning. When using auto tuning with operation mode (S1+3) set to 1 (AT+PID) or 2 (AT), set a required value of 1 through 10000 to specify an AT sampling period of 0.01 sec through 100.00 sec to the data register designated by S1+19. When S1+19 stores 0, the AT sampling period is set to 0.01 sec. When S1+19 stores a value larger than 10000, the AT sampling period is set to 100.00 sec. Set the AT sampling period to a long value to make sure that the current process variable is smaller than or equal to the previous process variable during direct control action (S2+0 is on) or that the current process variable is larger than or equal to the previous process variable during reverse control action (S2+0 is off). When using advanced auto turing with operation mode (S1+3) set to 3 (advanced AT+PID) or 4 (advanced AT), the AT sampling period is determined automatically and does not have to be set by the user. S1+20 AT Control Period The AT control period determines the duration of the ON/OFF cycle of the control output (S2+6) during auto tuning. For operation of the control output, see “Control Period” on page 14‐10. When using auto tuning with operation mode (S1+3) set to 1 (AT+PID) or 2 (AT), set a required value of 1 through 500 to specify an AT control period of 0.1 sec through 50.0 sec to the data register designated by S1+20. When S1+20 stores 0, the AT control period is set to 0.1 sec. When S1+20 stores a value larger than 500, the AT control period is set to 50.0 sec. When using advanced auto turing with operation mode (S1+3) set to 3 (advanced AT+PID) or 4 (advanced AT), the AT con‐ trol period is determined automatically and does not have to be set by the user. S1+21 AT Set Point While auto tuning is executed, the AT output manipulated variable (S1+22) is outputted to the output manipulated vari‐ able (S1+1) until the process variable (S1+0) reaches the AT set point (S1+21). When the process variable (S1+0) reaches the AT set point (S1+21), auto tuning is complete and the output manipulated variable (S1+1) is reduced to zero. When PID action is selected with operation mode (S1+3) set to 1 (AT+PID) or 3 (advanced AT+PID), the PID action follows imme‐ diately. When the operation mode (S1+3) is set to 1 (AT+PID), 2 (AT), or 4 (advanced AT), set a required AT set point to the data register designated by S1+21. When the operation mode (S1+3) is set to 3 (advanced AT+PID), the AT set point is deter‐ mined automatically and does not have to be set by the user. When the linear conversion is disabled (S1+4 set to 0 or 2), set a required AT set point of 0 through 4095 or 50000 depending on the analog I/O module type to the data register designated by S1+21. When S1+21 stores a value larger than 4095 or 50000, the AT set point is set to 4095 or 50000. When the linear conversion is enabled (S1+4 set to 1 or 3), set a required AT set point of 0 through 65535 (word data type) or –32768 through 32767 (integer data type) to the data register designated by S1+21. The AT set point must be larger than or equal to the linear conversion minimum value (S1+6) and must be smaller than or equal to the linear con‐ version maximum value (S1+5). In the direct control action (see page 14‐15), set the AT set point (S1+21) to a value sufficiently smaller than the process variable (S4) at the start of the auto tuning. In the reverse control action, set the AT set point (S1+21) to a value suffi‐...
Page 192
14: PID I NSTRUCTION S1+23 Output Manipulated Variable % While the PID action is in progress, the data register designated by S1+23 holds the manipulated variable, –32768 through 32767 (–327.68% through 327.67%), indicating the value to the second decimal place. While manual mode is enabled with the auto/manual mode control relay (S2+1) set to on, S1+23 holds an indefinite value. While auto tuning or advanced auto tuning is in progress, S1+23 holds an indefinite value. S1+24 Output Manipulated Variable for Analog Output Module While the PID action is in progress, the data register designated by S1+24 holds a value of 0 through 4095 or 50000, depending on the analog I/O module type. The value is converted from the value of 0 through 100 stored in S1+1 to rep‐ resent the output manipulated variable of 0% through 100%. While manual mode is enabled with the auto/manual mode control relay (S2+1) set to on, S1+24 holds a value of 0 through 4095 or 50000 converted from the manual mode output manipulated variable (S1+18). While auto tuning or advanced auto tuning is in progress, S1+24 holds a value of 0 through 4095 or 50000 read from the AT output manipulated variable (S1+22). S1+25 Proportional Band Offset Value When the proportional band is selected (S1+4 set to 2 or 3), the output manipulated variable (S1+1) of 0% through 100% can be shifted by an offset of –100% through 100%. Set a required offset value of –100 through 100 to the data register designated by S1+25 before executing auto tuning. When the proportional gain is selected (S1+4 set to 0 or 1), the proportional band offset value (S1+25) has no effect. S1+26 Derivative Gain The derivative gain can be selected from 0% through 100%. When the derivative gain is set to a small value, the output manipulated variable (S1+1) is susceptible to an external noise or a change in the set point. When the derivative gain is set to a large value, the output manipulated variable (S1+1) becomes less susceptible to an external noise or a change in the set point, but stability is adversely affected during normal operation. Set a required derivative gain of 0 through 100 to the data register designated by S1+26 before executing auto tuning. Recommended values are 20% through 30% when the process variable fluctuates or is subject to noise. Source Device S2 (Control Relay) Turn on or off appropriate outputs or internal relays starting with the device designated by S2 before executing the PID instruction as required. Devices S2+4 through S2+7 are for read only to reflect the PID and auto tuning statuses. Device Function Description ON: Direct control action S2+0 Control action OFF: Reverse control action...
Page 193
14: PID I NSTRUCTION S2+0 Control Action When auto tuning is executed with the operation mode (S1+3) set to 1 (AT+PID), 2 (AT), 3 (advanced AT+PID), or 4 (advanced AT), the control action is determined automatically. When auto tuning results in a direct control action, the control action control relay designated by S2+0 is turned on. When auto tuning results in a reverse control action, the control action control relay designated by S2+0 is turned off. The PID action is executed according to the derived control action, which remains in effect during the PID action. Process Variable (S1+0) When auto tuning is not executed with the operation mode (S1+3) set to 0 (PID), turn on or off the control action control relay (S2+0) to select a direct or reverse control action, respec‐ Direct Control Action tively, before executing the PID instruction. In the direct control action, the manipulated variable (D1) is Set Point (S3) increased while the process variable (S1+0) is larger than the set point (S3). Temperature control for cooling is executed in Time the direct control action. Process Variable (S1+0) In the reverse control action, the manipulated variable (D1) is increased while the process variable (S1+0) is smaller than the Set Point (S3) set point (S3). Temperature control for heating is executed in the reverse control action. In either the direct or reverse control action, the manipulated Reverse Control Action variable (D1) is increased while the difference between the process variable (S1+0) and the set point (S3) increases. Time S2+1 Auto/Manual Mode To select auto mode, turn off the auto/manual mode control relay designated by S2+1 before or after starting the PID instruction. In auto mode, the PID action is executed and the manipulated variable (D1) stores the PID calculation result. The control output (S2+6) is turned on and off according to the control period (S1+13) and the output manipulated vari‐ able (S1+1). To select manual mode, turn on the auto/manual mode control relay (S2+1). When using manual mode, set a required value to the manual mode output manipulated variable (S1+18) before enabling manual mode. In manual mode, the out‐ put manipulated variable (S1+1) stores the manual mode output manipulated variable (S1+18), and the output manipu‐...
Page 194
14: PID I NSTRUCTION S2+5 Low Alarm Output When the process variable (S1+0) is lower than or equal to the low alarm value (S1+15), the low alarm output control relay (S2+5) goes on. When S1+0 is higher than S1+15, S2+5 is off. S2+6 Control Output During auto tuning in auto mode with the auto/manual mode control relay (S2+1) set to off, the control output (S2+6) is turned on and off according to the AT control period (S1+20) and AT output manipulated variable (S1+22). During PID action in auto mode with the auto/manual mode control relay (S2+1) set to off, the control output (S2+6) is turned on and off according to the control period (S1+13) and the output manipulated variable (S1+1) calculated by the PID action. While advanced auto tuning is in progress, the control output (S2+6) remains on. In manual mode with the auto/manual mode control relay (S2+1) set to on, the control output (S2+6) is turned on and off according to the control period (S1+13) and the manual mode output manipulated variable (S1+18). S2+7 AT Complete Output The AT complete output control relay (S2+7) goes on when auto tuning is complete or failed, and remains on until reset. Operating status codes are stored to the operating status control register (S1+2). See page 14‐4. Source Device S3 (Set Point) The PID action is executed to adjust the process variable (S1+0) to the set point (S3). When the linear conversion is disabled (S1+4 set to 0 or 2), set a required set point value of 0 through 4095 or 50000, depending on the analog I/O module type, to the device designated by S3. Valid devices are data register and constant. When the linear conversion is enabled (S1+4 set to 1 or 3), designate a data register as device S3 and set a required set point value of 0 through 65535 (word data type) or –32768 through 32767 (integer data type) to the data register desig‐ nated by S3. The set point value (S3) must be larger than or equal to the linear conversion minimum value (S1+6) and smaller than or equal to the linear conversion maximum value (S1+5). When an invalid value is designated as a set point, the PID action is stopped and an error code is stored to the data regis‐ ter designated by S1+2. See “Operating Status” on page 14‐4. Source Device S4 (Process Variable before Conversion) The PID instruction is designed to use analog input data from an analog I/O module as process variable. The analog I/O module converts the input signal to a digital value of 0 through 4095 or 50000, and stores the digital value to a data reg‐ ister depending on the mounting position of the analog I/O module and the analog input channel connected to the ana‐ log input source. Designate a data register as source device S4 to store the process variable. For the data register number to designate as source device S4, see page 9‐3 ( . Specify the data register number Basic Vol.) shown under Data in the Configure Parameters dialog box as source device S4 (process variable) of the PID instruction. The analog input data in the selected data register is used as the process variable of the PID instruction. Destination Device D1 (Manipulated Variable) The data register designated by destination device D1 stores the manipulated variable of –32768 through 32767 calcu‐...
Page 195
14: PID I NSTRUCTION While manual mode is enabled with the auto/manual mode control relay (S2+1) set to on, S1+1 stores 0 through 100 of the manual mode output manipulated variable (S1+18), and D1 stores an indefinite value irrespective of the S1+18 value. While auto tuning is in progress, S1+1 stores 0 through 100 of the AT output manipulated variable (S1+22), and D1 stores an indefinite value. While advanced auto tuning is in progress, S1+1 and D1 store an indefinite value. Examples of Output Manipulated Variable Values Output Manipulated Output Manipulated Output Manipulated Output Manipulated Manipulated Variable Variable Limit Enable Variable Upper Limit Variable Lower Limit Variable (D1) (S2+2) (S1+16) (S1+17) (S1+1) 100 OFF (disabled) — — 1 to 99 1 to 99 0 50 26 to 49 26 to 49 25 ON (enabled) 100 10050 —...
14: PID I NSTRUCTION Application Examples The following two application examples demonstrate an advanced auto tuning and PID action to keep a heater tempera‐ ture at 200°C. In both examples, when the program is started, the PID instruction first executes advanced auto tuning to determine the AT parameters, such as AT sampling period, AT control period, AT set point, and AT output manipulated variable, using the temperature data inputted to the analog input module, then executes auto tuning to determine PID parameters such as proportional term, integral time, derivative time, sampling period, control period, and control action. When auto tuning is complete, PID action starts to control the temperature to 200°C using the derived PID parameters. Example 1: ON/OFF Control Using Relay Output The heater is turned on and off according to the output manipulated variable calculated by the PID action. When the heater temperature is higher than or equal to 250°C, an alarm light is turned on by the high alarm output. The analog input operating status is also monitored to force off the heater power switch and force on the high alarm light. System Setup FC5A‐C24R2 FC4A‐L03AP1 +24V DC IN DC OUT – Type K Thermocouple – 100-240VAC Ry.OUT Ry.OUT Ry.OUT Ry.OUT COM0 COM1 COM2 10 COM3 11 Heater Output Q1 High Alarm Light Fuse Output Q0...
Page 197
14: PID I NSTRUCTION Device Settings Device Function Description Device Address (Value) S1+3 Operation mode Advanced AT (auto tuning) + PID action D3 (3) S1+4 Control mode Enable linear conversion, proportional band D4 (3) S1+5 Linear conversion maximum value 1300°C D5 (13000) S1+6 Linear conversion minimum value 0°C D6 (0) S1+10 Integral start coefficient 100% D10 (100) S1+11 Input filter coefficient D11 (70) S1+14 High alarm value 250°C D14 (2500) S1+15 Low alarm value 0°C D15 (0) S1+25 Proportional band offset value D25 (0) S1+26 Derivative gain...
Page 198
14: PID I NSTRUCTION Ladder Program The ladder diagram shown below describes an example of using the PID instruction. The user program must be modified according to the application and simulation must be performed before actual operation. M8120 is the initialize pulse special internal relay. ANST NO.1 L03AP1 When the CPU starts, the ANST (analog macro) instruction stores M8120 parameters for the analog I/O module function. PIDST The PIDST (PID macro) instruction also stores parameters for the D100 M8120 PID function. PID(I) D760 is the analog input data of analog I/O module 1, analog 0‐4095 D100 D760 input channel 0; stores 0 through 4095 When internal relay M4 (high alarm output) is turned on or M11 is turned on (analog input operating status is 3 or more), Q0 (heater output) is turned off and output Q1 (high alarm light) is turned on. When M4 and M11 are off and M6 (control output) is turned on, Q0 (heater output) is turned on and output Q1 (high alarm light) is turned off. When D761 (analog input operating status) stores 3 or more, CMP>=(W) S1 – S2 – D1 – internal relay M11 is turned on. D761 Set Analog Module Parameters (ANST) Dialog Box WindLDR has a macro to program parameters for analog I/O modules. Place the cursor where to insert the ANST instruc‐ tion, click the right mouse button, and select Macro Instructions > ANST (Set Analog Module Parameters) . In the ANST dia‐ log box, press the ...
Page 199
14: PID I NSTRUCTION Set PID Parameters (PIDST) Dialog Box Place the cursor where to insert the PIDST instruction, click the right mouse button, and select Macro Instructions > PIDST . In the PIDST dialog box, program as shown below. (Set PID Parameters) Select options and device address as with the PID instruction. S1+3 S1+10 S2+3 S1+4 S1+5 S1+6 S1+11 S1+14 S1+15 S1+26 S2+2 S1+25 S1+3 Operation mode S1+14 High alarm value S1+4 Control mode S1+15 Low alarm value S1+5 Linear conversion maximum value S1+25 Proportional band offset value S1+6 Linear conversion minimum value S1+26 Derivative gain S1+10 Integral start coefficient S2+2 Output manipulated variable limit enable S1+11...
Page 200
14: PID I NSTRUCTION Example 2: ON/OFF Control Using Analog Output The output manipulated variable for analog output module (S1+24) of the PID instruction is moved to the analog output data (D772) and the analog I/O module sends out a voltage output of 0 to 10V DC. The analog output is then connected to a thyristor unit which controls the AC power using phase control. System Setup Thyristor Unit FC5A‐C24R2 FC4A‐L03AP1 +24V DC IN DC OUT – – – IN0 Type K 100-240VAC Ry.OUT Ry.OUT Ry.OUT Ry.OUT COM0 COM1 COM2 10 COM3 11 Thermocouple Heater Fuse Temperature Control by Auto Tuning and PID Action Process Variable after Conversion (S1+0) High Alarm Value (S1+14): 2500 (250°C) Set Point (S3): 2000 (200°C) AT Set Point (automatically determined) Time PID Action ...
Page 201
14: PID I NSTRUCTION Ladder Program The ladder diagram shown below describes an example of using the PID instruction. The user program must be modified according to the application and simulation must be performed before actual operation. Programming in the dialog boxes of the ANST (Set Analog Module Parameters), PIDST (Set PID Parameters), and PID (PID Control) instructions are the same as the preceding example. M8120 is the initialize pulse special internal relay. ANST NO.1 L03AP1 When the CPU starts, the ANST (analog macro) instruction M8120 stores parameters for the analog I/O module function. PIDST The PIDST (PID macro) instruction also stores parameters for D100 M8120 the PID function. PID(I) D760 is the analog input data of analog I/O module 1, analog 0‐4095 D100 D760 input channel 0; stores 0 through 4095 MOV(W) S1 – D1 – When internal relay M4 (high alarm output) is turned on or D772 M11 is turned on (analog input operating status is 3 or more), 0 is set to D772 (analog output data), turning off the heater power. When M4 and M11 are off, D24 (output manipulated variable MOV(W) S1 – D1 – for analog output module S1+24) of the PID instruction is D772 moved to D772 (analog output data). CMP>=(W) S1 –...
Page 202
14: PID I NSTRUCTION 14‐24 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
15: D / T T I EACHING IMER NSTRUCTIONS Introduction Dual timer instructions generate ON/OFF pulses of required durations from a designated output, internal relay, or shift register bit. Four dual timers are available and the ON/OFF duration can be selected from 1 ms up to 65535 sec. Teaching timer instruction measures the ON duration of the start input for the teaching timer instruction and stores the measured data to a designated data register, which can be used as a preset value for a timer instruction. DTML (1‐sec Dual Timer) While input is on, destination device D1 repeats to turn on and off DTML for a duration designated by devices S1 and S2, respectively. ***** ***** ***** ***** The time range is 0 through 65535 sec. DTIM (100‐ms Dual Timer) While input is on, destination device D1 repeats to turn on and off DTIM for a duration designated by devices S1 and S2, respectively. ***** ***** ***** ***** The time range is 0 through 6553.5 sec. DTMH (10‐ms Dual Timer) While input is on, destination device D1 repeats to turn on and off DTMH for a duration designated by devices S1 and S2, respectively. ***** ***** ***** ***** The time range is 0 through 655.35 sec. DTMS (1‐ms Dual Timer) While input is on, destination device D1 repeats to turn on and off ...
Page 204
15: D / T T I EACHING IMER NSTRUCTIONS Valid Devices Device Function Constant S1 (Source 1) ON duration — — — — — — 0‐65535 S2 (Source 2) OFF duration — — — — — — 0‐65535 D1 (Destination 1) Dual timer output — — — — — D2 (Destination 2) System work area — — — — — — —...
15: D / T T I EACHING IMER NSTRUCTIONS TTIM (Teaching Timer) While input is on, the ON duration is measured in units of 100 ms and the measured value is TTIM stored to a data register designated by destination device D1. ***** The measured time range is 0 through 6553.5 sec. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant D1 (Destination 1) Measured value — — — — — — — ( For the valid device address range, see pages 6‐1 and 6‐2 Basic Vol.). Destination device D1 (measured value) uses 3 data registers starting with the device designated as D1. Data registers D0‐D1997, D2000‐D7997, and D10000‐D49997 can be designated as D1. Subsequent two data registers starting with destination device D1+1 are used for a system work area. Do not use these two data registers for destinations of other advanced instructions, and do not change values of these data registers using the Point Write function on WindLDR. If the data in these data registers are changed, the teaching timer does not operate correctly.
Page 206
15: D / T T I EACHING IMER NSTRUCTIONS 15‐4 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 207
16: I M A I NTELLIGENT ODULE CCESS NSTRUCTIONS Introduction Intelligent module access instructions are used to read or write data between the CPU module and a maximum of seven intelligent modules while the CPU module is running or when the CPU module is stopped. Intelligent Module Access Overview The Run Access Read instruction reads data from the designated address in the intelligent module and stores the read data to the designated device while the CPU module is running. The Run Access Write instruction writes data from the designated device to the designated address in the intelligent module while the CPU module is running. The Stop Access Read instruction reads data from the designated address in the intelligent module and stores the read data to the designated device when the CPU module is stopped. The Stop Access Write instruction writes data from the designated device to the designated address in the intelligent module when the CPU module is stopped. Data movement while the CPU module is running Intelligent Module RUNA(*) While the CPU module is running and Read ****** READ the input is on, RUNA READ is exe‐ cuted to read data from the intelli‐ RUNA(*) ****** gent module, and RUNA WRITE to READ write data to the intelligent module. RUNA(*) Write ****** WRITE RUNA(*) ****** WRITE STPA(*) ****** READ STPA(*)
16: I M A I NTELLIGENT ODULE CCESS NSTRUCTIONS RUNA READ (Run Access Read) While input is on, data is read from the area starting RUNA(*) DATA STATUS SLOT ADDRESS BYTE at ADDRESS in the intelligent module designated by READ ***** ***** SLOT and stored to the device designated by DATA. BYTE designates the quantity of data to read. STATUS stores the operating status code. Applicable CPU Modules FC5A‐C16R2/C/D FC5A‐C10R2/C/D FC5A‐C24R2/C FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E FC5A‐C24R2D — — Valid Devices (Run Access Read) Device Function Constant Repeat DATA First device address to store read data —...
16: I M A I NTELLIGENT ODULE CCESS NSTRUCTIONS RUNA WRITE (Run Access Write) While input is on, data in the area starting at the RUNA(*) DATA(R) STATUS SLOT ADDRESS BYTE device designated by DATA is written to ADDRESS in WRITE ***** ***** the intelligent module designated by SLOT. BYTE designates the quantity of data to write. STATUS stores the operating status code. Applicable CPU Modules FC5A‐C16R2/C/D FC5A‐C10R2/C/D FC5A‐C24R2/C FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E FC5A‐C24R2D — — Valid Devices (Run Access Write) Device Function Constant Repeat DATA First device address to extract data from STATUS Operating status code —...
16: I M A I NTELLIGENT ODULE CCESS NSTRUCTIONS STPA READ (Stop Access Read) When the CPU module stops, data is read from the STPA(*) DATA STATUS SLOT ADDRESS BYTE area starting at ADDRESS in the intelligent module READ ***** ***** designated by SLOT and stored to the device desig‐ Start input is not needed for this instruction. nated by DATA. BYTE designates the quantity of data to read. STATUS stores the operating status code. Note: STPA READ and STPA WRITE instructions can be used 64 times in a user program. When more than 64 STPA READ and STPA WRITE instructions are used in a user program, the excess instructions are not executed and error code 7 is stored in the data register designated as STATUS. Applicable CPU Modules FC5A‐C16R2/C/D FC5A‐C10R2/C/D FC5A‐C24R2/C FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E FC5A‐C24R2D — — Valid Devices (Stop Access Read) Device Function Constant Repeat...
16: I M A I NTELLIGENT ODULE CCESS NSTRUCTIONS STPA WRITE (Stop Access Write) When the CPU module stops, data in the area start‐ STPA(*) DATA(R) STATUS SLOT ADDRESS BYTE ing at the device designated by DATA is written to WRITE ***** ***** ADDRESS in the intelligent module designated by Start input is not needed for this instruction. SLOT. BYTE designates the quantity of data to write. STATUS stores the operating status code. Note: STPA READ and STPA WRITE instructions can be used 64 times in a user program. When more than 64 STPA READ and STPA WRITE instructions are used in a user program, the excess instructions are not executed and error code 7 is stored in the data register designated as STATUS. Applicable CPU Modules FC5A‐C16R2/C/D FC5A‐C10R2/C/D FC5A‐C24R2/C FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E FC5A‐C24R2D — — Valid Devices (Run Access Write) Device Function Constant Repeat...
Page 212
16: I M A I NTELLIGENT ODULE CCESS NSTRUCTIONS Intelligent Module Access Status Code The data register designated as STATUS stores a status code to indicate the operating status and error of the intelligent module access operation. When status code 1, 3, or 7 is stored, take a corrective measure as described in the table below: Status Status Description RUNA STPA Code Normal Intelligent module access is normal. The intelligent module is not installed correctly. Bus error Power down the MicroSmart modules, and re‐install the intelligent module correctly. The designated module number is not found. Invalid module number Confirm the intelligent module number and correct the program. More than 64 STPA READ and STPA WRITE instructions are used. Elim‐ Excessive multiple usage — inate the excess instructions. STPA Execution during Program Download When downloading a user program, the CPU module is automatically stopped as default. Depending on the timing of the initiation of the download and the total time to execute all STPA Read and Write instructions, some of the STPA instruc‐ tions may not be executed. If this is the case, manually stop the CPU module. After more than 1 second, initiate user pro‐ gram download as shown in the chart below. Automatic Stop Sequence Initiate download Actual start Automatic stop to download Power up CPU module...
Page 213
16: I M A I NTELLIGENT ODULE CCESS NSTRUCTIONS Example: RUNA READ The following example illustrates the data movement of the RUNA READ instruction. The data movement of the STPA READ is the same as the RUNA READ instruction. While input I0 is on, data of 5 bytes is read from the RUNA(W) DATA STATUS SLOT ADDRESS BYTE area starting at address 1 in intelligent module 1 and READ D100 stored to the 5‐byte area in data registers starting at D9. Status code is stored in data register D100. Intelligent Module 1 CPU Module Address 0 High Address 1 Address 2 Address 3 Address 4 Address 5 Example: RUNA WRITE without Repeat The following example illustrates the data movement of the RUNA WRITE instruction without repeat designation. The data movement of the STPA WRITE is the same as the RUNA WRITE instruction. While input I1 is on, data in data register D19 is writ‐ RUNA(W) DATA – STATUS SLOT ADDRESS BYTE...
Page 214
16: I M A I NTELLIGENT ODULE CCESS NSTRUCTIONS 16‐8 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
17: T F I RIGONOMETRIC UNCTION NSTRUCTIONS Introduction Trigonometric function instructions are used for conversion between radian and degree values, conversion from radian value to sine, cosine, and tangent, and also calculation of arc sine, arc cosine, and arc tangent values. RAD (Degree to Radian) S1∙S1+1° /180 D1∙D1+1 rad RAD(F) When input is on, the degree value designated by source device S1 is converted into a ***** ***** radian value and stored to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Degree value to convert into radian — — — — — — — D1 (Destination 1) Destination to store conversion results —...
17: T F I RIGONOMETRIC UNCTION NSTRUCTIONS DEG (Radian to Degree) S1∙S1+1 rad 180/ D1∙D1+1° DEG(F) When input is on, the radian value designated by source device S1 is converted into a ***** ***** degree value and stored to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Radian value to convert into degree — — — — — — — D1 (Destination 1) Destination to store conversion results — — — — — — —...
17: T F I RIGONOMETRIC UNCTION NSTRUCTIONS SIN (Sine) sin S1∙S1+1 D1∙D1+1 SIN(F) When input is on, the sine of the radian value designated by source device S1 is stored ***** ***** to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Radian value to convert into sine value — — — — — — — D1 (Destination 1) Destination to store conversion results — — — — — — —...
17: T F I RIGONOMETRIC UNCTION NSTRUCTIONS COS (Cosine) cos S1∙S1+1 D1∙D1+1 COS(F) When input is on, the cosine of the radian value designated by source device S1 is ***** ***** stored to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Radian value to convert into cosine value — — — — — — — D1 (Destination 1) Destination to store conversion results — — — — — — —...
17: T F I RIGONOMETRIC UNCTION NSTRUCTIONS TAN (Tangent) tan S1∙S1+1 D1∙D1+1 TAN(F) When input is on, the tangent of the radian value designated by source device S1 is ***** ***** stored to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Radian value to convert into tangent value — — — — — — — D1 (Destination 1) Destination to store conversion results — — — — — — —...
17: T F I RIGONOMETRIC UNCTION NSTRUCTIONS ASIN (Arc Sine) asin S1∙S1+1 D1∙D1+1 rad ASIN(F) When input is on, the arc sine of the value designated by source device S1 is stored in ***** ***** radians to the destination designated by device D1. The S1∙S1+1 value must be within the following range: ‐1.0 S1∙S1+1 ‐1.0 If the S1∙S1+1 value is not within this range, an indefinite value is stored to D1∙D1+1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Arc sine value to convert into radian — — — — — — —...
17: T F I RIGONOMETRIC UNCTION NSTRUCTIONS ACOS (Arc Cosine) acos S1∙S1+1 D1∙D1+1 rad ACOS(F) When input is on, the arc cosine of the value designated by source device S1 is stored in ***** ***** radians to the destination designated by device D1. The S1∙S1+1 value must be within the following range: ‐1.0 S1∙S1+1 ‐1.0 If the S1∙S1+1 value is not within this range, an indefinite value is stored to D1∙D1+1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Arc cosine value to convert into radian — — — — — — —...
17: T F I RIGONOMETRIC UNCTION NSTRUCTIONS ATAN (Arc Tangent) atan S1∙S1+1 D1∙D1+1 rad ATAN(F) When input is on, the arc tangent of the value designated by source device S1 is stored ***** ***** in radians to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Arc tangent value to convert into radian — — — — — — — D1 (Destination 1) Destination to store conversion results — — — — — — —...
18: L / P I OGARITHM OWER NSTRUCTIONS Introduction This chapter describes logarithm and power instructions which are used to calculate logarithm or powered values of source devices. LOGE (Natural Logarithm) S1∙S1+1 D1∙D1+1 LOGE(F) When input is on, the natural logarithm of the binary data designated by source device ***** ***** S1 is stored to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data to convert into natural logarithm — — — — — — — D1 (Destination 1) Destination to store conversion results — — — — — — —...
18: L / P I OGARITHM OWER NSTRUCTIONS LOG10 (Common Logarithm) S1∙S1+1 D1∙D1+1 LOG10(F) When input is on, the common logarithm of the binary data designated by source ***** ***** device S1 is stored to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data to convert into common logarithm — — — — — — — D1 (Destination 1) Destination to store conversion results — — — — — — —...
18: L / P I OGARITHM OWER NSTRUCTIONS EXP (Exponent) S1∙S1+1 D1∙D1+1 EXP(F) When input is on, e is raised to the power S1∙S1+1 designated by source device S1 and ***** ***** is stored to the destination designated by device D1. e (base of natural logarithm) = 2.7182818 Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data of exponent — — — — — — — D1 (Destination 1) Destination to store results — — — — — — —...
18: L / P I OGARITHM OWER NSTRUCTIONS POW (Power) S2∙S2+1 S1∙S1+1 D1∙D1+1 POW(F) When input is on, binary data designated by source device S1 is raised to the ***** ***** ***** power S2∙S2+1 designated by source device S2 and the operation result is stored to the destination designated by device D1. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Binary data of base — — — — — — — S2 (Source 2) Binary data of exponent —...
19: F D P I ROCESSING NSTRUCTIONS Introduction File data processing instructions implement the first‐in first‐out (FIFO) data structure. FIFOF (FIFO Format) instructions initialize the FIFO data files storing the data. FIEX (First‐In Execute) instructions store new data to the FIFO data files, and FOEX (First‐Out Execute) instructions retrieve the stored data from the FIFO data files. The first data to be stored to the FIFO data files by FIEX instructions will be the first data to be retrieved by FOEX instructions. NDSRC (N Data Search) instruction has been added to search a designated value through a specified range. FIFOF (FIFO Format) When input is on, FIFOF instruction initializes an FIFO data file. Each FIFOF(W) data file has unique number 0 through 9. A maximum of 10 data files ***** ***** can be used in a user program. This instruction is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat N (File Number) File Number — — — — — — — 0‐9 —...
Page 228
19: F D P I ROCESSING NSTRUCTIONS Destination Device D1 (FIFO Data File) FIFO data files are initialized when corresponding FIFOF instructions are executed. FIFO data file is placed in the area starting with the device designated by D1 and occupies as many as S1S2+2 data registers. The size of each record is equal to S1. S2 records of data can be stored in an FIFO data file using FIEX instructions. The stored data can be retrieved from the FIFO data file using FOEX instructions. Device Function Description The FI pointer indicates the position to store new data into the FIFO data file. When an FIEX instruction is executed, the new data in data registers starting with the device designated by S1 of the FIEX instruction is stored at the posi‐ D1+0 FI pointer tion indicated by the FI pointer, and the FI pointer is incremented by 1 to indi‐ cate the position to store the next data. When the FI pointer indicates the last record of the FIFO data file, and an FIEX instruction is executed, the FI pointer will return to 0. The FO pointer indicates the position to retrieve the stored data from the FIFO data file. When an FOEX instruction is executed, the data at the position indi‐ cated by the FIFO pointer is retrieved and stored to the data registers starting D1+1 FO pointer with the device designated by D1 of the FOEX instruction, and the FO pointer is incremented by 1 to indicate the position to retrieve the next data. When the FO pointer indicates the last record of the FIFO data file, and an FOEX instruction is executed, the FO pointer will return to 0. D1+2 Record 0 The first record to store the data. D1+(S1+1) D1+(S1+2) Record 1 The second record to store the data. D1+(S12+1) D1+(S1(S2–1)+2) Record S2–1 The last record to store the data.
19: F D P I ROCESSING NSTRUCTIONS FIEX (First‐In Execute) When input is on, the data stored in data registers starting with the device designated by S1 is FIEX(W) stored to the corresponding FIFO data file. ***** This instruction is available on upgraded CPU modules with system program version 200 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat N (File Number) File number — — — — — — — 0‐9 — S1 (Source 1) First data register to store data to FIFO data file — — — — — — —...
Page 230
19: F D P I ROCESSING NSTRUCTIONS Valid Data Types When a D (data register) is designated as the destination, data registers as many as the value stored in W (word) device S1 of the corresponding FIFOF instruction are used. I (integer) — D (double word) — L (long) — F (float) — Example: FIFOF, FIEX, and FOEX This program demonstrates a user program of the FIFOX, FIEX, and FOEX instructions to use an FIFO data file. File number: Quantity of data registers per record: Quantity of records: FIFO Data file: D100 through D113 (34+2 data registers) FIFO status outputs: M100 through M102 Ladder Diagram M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 R D100 When the CPU starts, MOV sets 0 to FI and FO pointers, and FIFOF ini‐ M8120 tializes FIFO data file 2. FIFOF(W) D100 M100 When input I0 is turned on, the data in D10 through D12 are stored to ...
19: F D P I ROCESSING NSTRUCTIONS NDSRC (N Data Search) When input is on, a value specified by device S1 is sought. Data regis‐ NDSRC(*) ters are searched, starting with the data register designated by ***** ***** ***** ***** device S2. Device S3 specifies the quantity of 1‐word or 2‐word blocks of data registers to search, depending on the data type. The offset of the data register where a match first occurred is stored in data register designated by device D1. The quantity of times the value was matched is stored in the next data register. When the search results in no match, 65535 is stored in device D1 and 0 is stored in device D+1. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Value to be sought — — — — — — —...
Page 232
19: F D P I ROCESSING NSTRUCTIONS Examples: NDSRC The following examples demonstrate the NDSRC instruction to search data of three different data types. • Data Type: Word NDSRC(W) D100 D200 1234 1234 Search Offset D100 1234 D101 1 (match) D200 Offset of first match Result D102 D201 Quantity of matches 1234 D103 3 (match) D104 D105 1234 • Data Type: Double Word NDSRC(D) D100 D200 12345678 12345678 D10∙D11 D98∙D99 Search Offset D100∙D101...
20: C I LOCK NSTRUCTIONS Introduction TADD (time addition) and TSUB (time subtraction) instructions perform addition or subtraction of two time data, respec‐ tively. The data can be selected from time (hour, minute, and second) or date/time (year, month, day, day of week, hour, minute, and second). HTOS (HMS to sec) and STOH (sec to HMS) instructions perform conversion of time data between hours, minutes, sec‐ onds and seconds. HOUR (hour meter) instruction measures the on duration of the input and compares the total duration to a preset value. When the preset value is reached, an output or internal relay is turned on. TADD (Time Addition) S1 + S2 D1, CY TADD When input is on, time data designated by source device S2 are added to Mode ***** date/time data designated by source device S1, depending on the selected mode. The result is stored to destination device D1 and carry (M8003). This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat Mode Selection of S1 data range — — — — — — — 0, 1 —...
Page 234
20: C I LOCK NSTRUCTIONS Mode 0 When mode 0 is selected, time data (hour, minute, and second) stored in 3 data registers starting with source device S2 are added to the time data (hour, minute, and second) stored in 3 data registers starting with source device S1. The results are stored to 3 data reg‐ isters starting with destination device D1. Source 1 Source 2 Destination 1 Hour Hour Hour (0‐23) (0‐23) (0‐23) Minute Minute Minute S1+1 S2+1 D1+1 (0‐59) (0‐59) (0‐59) Second Second Second S1+2 S2+2 D1+2 (0‐59) (0‐59) (0‐59) Hour data can be 0 through 23. Minute and second data can be 0 through 59. When the execution result exceeds 23:59:59, the result is subtracted by 24 hours and stored to the data register designated by destina‐ tion device D1, turning on special internal relay M8003 (carry). When any of the hour, minute, or second data is out of the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the CPU module. Mode 1 When mode 1 is selected, time data (hour, minute, and second) stored in 3 data registers starting with source device S2 are added to ...
Page 235
20: C I LOCK NSTRUCTIONS Examples: TADD The following examples demonstrate the TADD instruction to add time data in two different modes. • Mode 0 TADD SOTU Source 1 Source 2 Destination 1 (Hour) (Hour) (Hour) D1 (Minute) D11 (Minute) D21 (Minute) D2 (Second) D12 (Second) D22 (Second) When the result exceeds 23:59:59, the resultant hour data is subtracted by 24, turning on special internal relay M8003 (carry). Source 1 Source 2 Destination 1 (Hour) (Hour) (Hour) D1 (Minute) D11 (Minute) D21 (Minute) D2 (Second) D12 (Second) D22 (Second)
Page 236
20: C I LOCK NSTRUCTIONS When the result exceeds 23:59:59, the resultant hour data is subtracted by a multiple of 24 and the day data is incremented. Source 1 Destination 1 D8008 D200 (Year) (Year) D8009 (Month) D201 (Month) D8010 D202 (Day) (Day) D8011 (D of W) (Note) D203 (D of W) Source 2 D8012 D100 D204 (Hour) (Hour) (Hour) D8013 (Minute) D101 (Minute) D205 (Minute) D8014 (Second) D102 (Second) D206 (Second) Note: D8011 in source 1 is not used for execution and need not be designated. The day of week is calculated automatically from ...
20: C I LOCK NSTRUCTIONS TSUB (Time Subtraction) S1 – S2 D1, CY TSUB When input is on, time data designated by source device S2 are subtracted Mode ***** from date/time data designated by source device S1, depending on the selected mode. The result is stored to destination device D1 and borrow (M8003). This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat Mode Selection of S1 data range — — — — — — — 0, 1 — S1 (Source 1) Date/time data to subtract from —...
Page 238
20: C I LOCK NSTRUCTIONS Mode 0 When mode 0 is selected, time data (hour, minute, and second) stored in 3 data registers starting with source device S2 are subtracted from the time data (hour, minute, and second) stored in 3 data registers starting with source device S1. The results are stored to 3 data registers starting with destination device D1. Source 1 Source 2 Destination 1 Hour Hour Hour (0‐23) (0‐23) (0‐23) Minute Minute Minute – S1+1 S2+1 D1+1 (0‐59) (0‐59) (0‐59) Second Second Second S1+2 S2+2 D1+2 (0‐59) (0‐59) (0‐59) Hour data can be 0 through 23. Minute and second data can be 0 through 59. When the execution result is less than 00:00:00, the result is added with 24 hours and stored to the data register designated by desti‐ nation device D1, turning on special internal relay M8003 (borrow). When any of the hour, minute, or second data is out of the valid range, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the CPU module.
Page 239
20: C I LOCK NSTRUCTIONS Examples: TSUB The following examples demonstrate the TSUB instruction to subtract time data in two different modes. • Mode 0 TSUB SOTU Source 1 Source 2 Destination 1 (Hour) (Hour) (Hour) – D1 (Minute) D11 (Minute) D21 (Minute) D2 (Second) D12 (Second) D22 (Second) When the result is less than 00:00:00, the resultant hour data is added with 24, turning on special internal relay M8003 (borrow). Source 1 Source 2 Destination 1 (Hour) (Hour) (Hour) – D1 (Minute) D11 (Minute) D21 (Minute) D2 (Second) D12 (Second)
Page 240
20: C I LOCK NSTRUCTIONS When the result is less than 00:00:00, the resultant hour data is added with a multiple of 24 and the day data is decremented. Source 1 Destination 1 D8008 D200 (Year) (Year) D8009 (Month) D201 (Month) D8010 D202 (Day) (Day) (Note) D8011 (D of W) D203 (D of W) Source 2 D8012 D100 D204 (Hour) (Hour) (Hour) – D8013 (Minute) D101 (Minute) D205 (Minute) D8014 (Second) D102 (Second) D206 (Second) Note: D8011 in source 1 is not used for execution and need not be designated. The day of week is calculated automatically from ...
20: C I LOCK NSTRUCTIONS HTOS (HMS to Sec) Hours, minutes, seconds Seconds HTOS When input is on, time data in hours, minutes, and seconds designated by source ***** ***** device S1 is converted into seconds. The result is stored to destination device D1. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Time data in hours, minutes, seconds — — — — — — — — D1 (Destination 1) Destination to store results — — — — — — —...
20: C I LOCK NSTRUCTIONS STOH (Sec to HMS) Seconds Hours, minutes, seconds STOH When input is on, time data in seconds designated by source device S1 is converted into ***** ***** hours, minutes, and seconds. The result is stored to destination device D1. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Time data in seconds — — — — — — — D1 (Destination 1) Destination to store results — — — — — — —...
20: C I LOCK NSTRUCTIONS HOUR (Hour Meter) S1 D1 D2 HOUR While input is on, the ON duration is measured. The measured time ***** ***** ***** ***** value (hour, minute, and second) is stored to 3 consecutive data reg‐ isters designated by destination device D1 and compared with the preset value designated by source device S1. When the D1 value reaches the S1 value, an output or internal relay designated by destination device D2 is turned on. Two data registers starting with destination device D3 are reserved for system work area. This instruction is available on upgraded CPU modules with system program version 210 or higher. Applicable CPU Modules FC5A‐C10R2/C/D FC5A‐C16R2/C/D FC5A‐C24R2/C/D FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E Valid Devices Device Function Constant Repeat S1 (Source 1) Preset value — — — — — — 0‐65535 —...
Page 244
20: C I LOCK NSTRUCTIONS Examples: HOUR The following examples demonstrate the HOUR instruction to measure the input ON duration value in hours, minutes, and seconds and to compare the value in two different ways. • Source Device S1: Data Register D0∙D1∙D2 D100∙D101∙D102 Q2 HOUR While input I0 is on, the ON duration is measured. The measured D100 D1900 time value (hour, minute, and second) is stored to data registers D100∙D101∙D102 designated by destination device D1 and compared Source 1 Destination 1 with the preset value stored in data registers D0∙D1∙D2 designated D100 by source device S1. (Hour) (Hour) When the measured value reaches the preset value, output Q2 des‐ D101 (Minute) D1 (Minute) ignated by destination device D2 is turned on. Data registers D1900 and D1901 designated by destination device D3 D2 (Second) D102 (Second) are reserved for system work area. • Source Device S1: Constant 50 D100∙D101∙D102 Q2 HOUR While input I0 is on, the ON duration is measured. The measured D100 D1900 time value (hour, minute, and second) is stored to data registers ...
21: C L C OMPUTER OMMUNICATION Introduction When the MicroSmart CPU module is connected to a computer, operating status and I/O status can be monitored on the computer, data in the CPU module can be monitored or updated, and user programs can be downloaded and uploaded. The CPU module can also be started and stopped from the computer. A maximum of 32 CPU modules can be connected to one computer in the 1:N computer link system. This chapter describes the 1:N computer link system. For the 1:1 computer link system, see page 4‐1 (Basic Vol.). For computer link communication on port 3 through port 7 using expansion RS232C/RS485 communication modules, see page 25‐1. Computer Link System Setup (1:N Computer Link System) To set up a 1:N communication computer link system, install the RS485 communication adapter (FC4A‐PC3) to the port 2 connector on the all‐in‐one type CPU module, or mount the RS485 communication module (FC4A‐HPC3) next to the slim type CPU module. Connect the RS232C/RS485 converter to the RS485 terminals A, B, and SG on every CPU module using a shielded twisted pair cable as shown below. The total length of the cable for the computer link system can be extended up to 200 meters (656 feet). Connect the RS232C port on the computer to the RS232C/RS485 converter using the RS232C cable. The RS232C cable has a D‐sub 9‐pin female connector for connection with a computer. FC4A MicroSmart, OpenNet Controllers, MICRO , and MICRO C can be connected to the same 1:N computer link system. RS485 1st Unit (Network No. 0) Communication Adapter FC4A-PC3 A B SG Port 1 Port 2 RS232C/RS485 Cable Converter...
21: C L C OMPUTER OMMUNICATION Programming WindLDR In the 1:1 computer link system, a computer can be connected to either port 1 or 2 on the MicroSmart CPU module. In the 1:N computer link system, a computer must be connected to port 2 on the CPU module and every CPU module must have a unique network number 0 through 31. The Communication page in the Function Area Settings must be pro‐ grammed for each station in the computer link system. If required, communication parameters can also be changed. Since these settings relate to the user program, the user program must be downloaded to the MicroSmart after changing any of these settings. 1. From the WindLDR menu bar, select Configuration > Comm. Ports. The Function Area Settings dialog box for Communication Ports appears. 2. In the Communication Mode pull‐down list for Port 1 or 2, select Maintenance Protocol. 3. Click the Configure button. The Communication Parameters dialog box appears. Change settings, if required. 1200, 2400, 4800, 9600, 19200, Baud Rate (bps) 38400, 57600, 115200 Data Bits 7 or 8 Parity Even, Odd, None Stop Bits 1 or 2 10 to 2540 (10‐ms increments) Receive Timeout (ms) (Receive timeout is disabled when 2550 is selected.) Network Number 0 to 31 Mode Selection Input Any input number Note: When a mode selection input has been designated and the mode selection input is turned on, the selected communica‐ tion parameters are enabled. When communication parameters are changed without designating a mode selection input, the changed communication parameters take effect immediately when the user program is downloaded. 4. Click the OK button. 21‐2 FC5A M U...
21: C L C OMPUTER OMMUNICATION Assigning Network Numbers When assigning a unique network number of 0 through 31 to each CPU module for the 1:N computer link network, download the user program containing the network number setting to each CPU module in the 1:1 computer link system, then the new network number is assigned to the CPU module. Make sure that there is no duplication of network num‐ bers in a 1:N computer link network. Communication Settings When monitoring the MicroSmart operation or downloading a user program using WindLDR , make sure that the same communication settings are selected for the CPU module and WindLDR , so that the computer communicates with the MicroSmart in either the 1:1 or 1:N computer link system. To change the communication settings for WindLDR , access the dialog box from the Configure menu as shown below. Communication Settings When communicating in the 1:N computer link system for monitoring or downloading, select the network number of the CPU module also in the Communication Settings dialog box. Monitoring PLC Status The following example describes the procedures to monitor the operating status of the MicroSmart assigned with net‐ work number 12 in a 1:N communication computer link system. 1. From the WindLDR menu bar, select Online > Set Up. The Communication Settings dialog box appears. 2. Under PLC Network Setting, click the 1:N button to select 1:N communication, and select 12 in the Network Number field. 3. From the WindLDR menu bar, select Online > Monitor > Monitor. The ladder diagram on the screen enters the monitor mode. 4. From the WindLDR menu bar, select Online > Status. The PLC Status dialog box appears. Network Number: Enter 12 to select a network num‐...
Page 248
21: C L C OMPUTER OMMUNICATION 21‐4 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
22: M M ODEM Introduction This chapter describes the modem mode designed for communication between the MicroSmart and another MicroSmart or any data terminal equipment through telephone lines. Using the modem mode, the MicroSmart can initialize a modem, dial a telephone number, send an AT command, enable the answer mode to wait for an incoming call, and dis‐ connect the telephone line. These operations can be performed simply by turning on a start internal relay dedicated to each operation. The modem mode provides for a simple modem control function so that the MicroSmart can ini‐ Caution tialize a modem, dial a destination telephone number, or answer an incoming call. The perfor‐ mance of the modem communication using the modem mode depends on the modem functions and telephone line situations. The modem mode does not prevent intrusion or malfunctions of other systems. For practical applications, confirm the communication function using the actual system setup and include safety provisions. While communicating through modems, the telephone line may be disconnected unexpectedly or receive data errors may occur. Provisions against such errors must be included in the user pro‐ gram. System Setup To connect a modem to the MicroSmart, install the RS232C communication adapter (FC4A‐PC1) to the port 2 connector on the all‐in‐one type CPU module, or mount the RS232C communication module (FC4A‐HPC1) next to the slim type CPU module, and use the modem cable 1C (FC2A‐KM1C). To enable the modem mode, select Modem Protocol for Port 2 using WindLDR ( Configuration > Comm. Port ). CPU Module To Port 2 To RS232C Port RS232C Communication Adapter Modem FC4A‐PC1 Modem Cable 1C FC2A‐KM1C D‐sub 25‐pin 3m (9.84 ft.) long Male Connector...
22: M M ODEM Applicable Modems Any Hayes compatible modem can be used. Modems with a communications rate of 9600 bps or more between modems are recommended. Use modems of the same make and model at both ends of the communication line. Special Internal Relays for Modem Mode Special internal relays M8050‐M8077 are allocated to the modem mode. M8050‐M8056 are used to send an AT com‐ mand or disconnect the telephone line. M8060‐M8066 and M8070‐M8076 turn on to indicate the results of the com‐ mand. M8057, M8067, and M8077 are used to indicate the status of the modem mode. All completion and failure internal relays are turned off when another start internal relay is turned on. Start and Result Internal Relays Mode Command Start IR Completion IR Failure IR Data Register Initialization String M8050 M8060 M8070 D8145‐D8169 Originate Mode M8051 M8061 M8071 — Dialing M8052 M8062 M8072 D8170‐D8199 Disconnect Mode Disconnect Line M8053 M8063 M8073 — AT General Command Mode AT Command M8054 M8064...
22: M M ODEM Special Data Registers for Modem Mode Special data registers D8103 and D8109‐D8199 are allocated to the modem mode. When the MicroSmart starts to run, D8109 and D8110 store the default values, and D8145‐D8169 store the default initialization string. Data Register Stored Data Description The D8103 value selects the protocol for the RS232C port 2 after telephone line is con‐ nected. Online Mode D8103 Protocol Selection 0 (other than 1): Maintenance protocol User protocol The D8109 value selects how many retries will be made until the operation initiated by a start internal relay M8050‐M8056 is completed. Retry Cycles D8109 (default = 3) No retry 1‐65535: Executes a specified number of retries The D8110 value specifies the interval to start a retry of dialing when a dialing fails with the retry cycles set to a value more than 1. (Other start commands are repeated contin‐ uously as many as the retry cycles.) Retry Interval D8110 Valid value: 0 to 65535 (seconds) (default = 90 sec) If a telephone line is not connected within the retry interval, the MicroSmart starts a retry. Consequently, if the retry interval is set to a too small value, the telephone line can not be connected correctly. Modem Mode Modem mode status is stored (see page 22‐7). When not in the modem mode, D8111 D8111 Status stores 0.
Page 252
22: M M ODEM AT and are appended at the beginning and end of the initialization string automatically by the system program and are not stored in data registers. 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 &D 2& 4& &W 0D00 Depending on your modem and telephone line, the initialization string may have to be modified. Consult the manual for your modem. Changes can be made by entering required values to data registers D8145‐D8169. Store two characters in one data regis‐ ter; the first character at the upper byte and the second character at the lower byte in the data register. AT and need not be stored in data registers. Use the MOV (move) instructions on WindLDR to set the initialization string characters and ASCII value 0Dh for at the end. Program the MOV instructions to replace the default values in D8145‐D8169 stored in the first scan and execute the MOV instructions in a subsequent scan. For essential commands which must be included in the initialization string, see page 22‐8. After the new values are stored, turn on M8050 to send the new initial‐ ization string to the modem. When the initialization string has been sent successfully, internal relay M8060 is turned on. If the initialization string fails, internal relay M8070 is turned on. When the subsequent commands of ATZ and dialing are also completed successfully, ...
22: M M ODEM As described above, when start internal relay M8050 is turned on, the initialization string is sent, followed by the ATZ command and the dial command. When start internal relay M8051 is turned on, the ATZ command is sent, followed by the dial command. The dial command can also be sent separately by turning on start internal relay M8052. If retry cycles are set to data register D8109, the dial command is repeated at retry intervals specified by D8110 (default 90 seconds) as many as the specified retry cycles (default 3 cycles) until the telephone line is connected. When the dial command has been completed successfully, internal relay M8062 is turned on. If the dial command fails, internal relay M8072 is turned on. The dial command is determined successful when the DCD signal is turned on. Note: When the MicroSmart is powered down while the telephone line is connected, the telephone line is disconnected because the DTR signal is turned off. This method should not be used for disconnecting the telephone line. Always use M8053 to disconnect the telephone line as described below. RS232C Port Communication Protocol Before the telephone line is connected in the modem mode after powerup, the RS232C port 2 can only send out an AT command by turning on a start internal relay M8050‐M8056. The communication protocol for the RS232C port 2 after the telephone line is connected is selected by the value stored in data register D8103. D8103 Value RS232C Port 2 Communication Protocol in the Online Mode 0 (other than 1) Maintenance protocol User protocol When the telephone line is disconnected, the RS232C port 2 restores the state as before the telephone line was con‐ nected, whether D8103 is set to 0 or 1. When using a TXD or RXD instruction in the user communication mode while the telephone line is connected, insert internal relay M8077 (line connection) as an input condition for the TXD or RXD instruction. After the telephone line is connected, make sure of an approximately 1‐second interval before executing the TXD or RXD instruction until the tele‐ phone line connection stabilizes. Note: When the MicroSmart is stopped while the telephone line is connected, the RS232C port 2 protocol changes to the maintenance protocol even if D8103 is set to 1 (user protocol in the online mode); then the telephone line remains connected. When the MicroSmart is restarted, the user protocol is enabled again. Disconnect Mode The disconnect mode includes only one command to disconnect the telephone line. To disconnect the telephone line, turn on internal relay M8053. The telephone line is disconnected by turning off the DTR signal since the initialization string includes the &D2 command. While a modem command is executed, another command cannot be executed. If two or more start internal relays are turned on simultaneously, an error will result and error code 61 is stored in modem mode status data register D8111 (see page 22‐7). When the disconnect command has been completed successfully, internal relay M8063 is turned on. If the disconnect command fails, internal relay M8073 is turned on.
22: M M ODEM CR LF Example of AT Command: ATE0Q0V1 AT and are appended at the beginning and end of the AT general command string automatically by the system pro‐ gram and need not be stored in data registers. To program the AT command string of the example above, store the com‐ mand characters and ASCII value 0Dh for to data registers starting with D8130. 4530h D8130 45h = “E” 30h = “0” 51h = “Q” 30h = “0” 5130h D8131 56h = “V” 31h = “1” D8132 5631h 0D00h D8133 0Dh = All characters subsequent to are ignored. When the AT general command has been completed successfully, internal relay M8064 is turned on. If the AT general command fails, internal relay M8074 is turned on. The AT general command is determined successful when result code returned from the modem is CR LF CR LF received. Answer Mode The answer mode is used to send an initialization string to the modem and to issue the ATZ command to reset the modem. To execute a command, turn on one of start internal relays M8055 or M8056. If two or more start internal relays ...
22: M M ODEM Modem Mode Status Data Register When the modem mode is enabled, data register D8111 stores a modem mode status or error code. D8111 Value Status Description Not in the modem mode Modem mode is not enabled. Start internal relays except for disconnecting line can be Ready for connecting line turned on. Sending initialization string (originate mode) Sending ATZ (originate mode) Dialing A start internal relay is in operation in the first try or subse‐ Disconnecting line quent retrial. Sending AT command Sending initialization string (answer mode) Sending ATZ (answer mode) Waiting for resending initialization string (originate mode) Waiting for resending ATZ (originate mode) Waiting for re‐dialing The command started by a start internal relay was not com‐ Waiting for re‐disconnecting line pleted and is waiting for retrial. Waiting for resending AT command Waiting for resending initialization string (answer mode) Waiting for resending ATZ (answer mode) Telephone line is connected. Only M8053 (disconnect line) Line connected can be turned on. Command started by M8054‐M8056 is completed success‐ AT command completed successfully fully. Invalid character is included in the initialization string, dial ...
22: M M ODEM Initialization String Commands The built‐in initialization string (see page 22‐3) include the commands shown below. For details of modem commands, see the user’s manual for your modem. When you make an optional initialization string, modify the initialization string to match your modem. Characters NOT echoed. The modem mode of the MicroSmart operates without echo back. Without the E0 command, the MicroSmart misunderstands an echo for a result code. An error will be caused although a command is executed correctly. This command must be included in the initialization string. Result codes displayed. The modem mode of the MicroSmart is configured to use result codes. Without the Q0 command, a timeout error will be caused although a command is executed correctly. This command must be included in the initialization string. Word result code. The modem mode of the MicroSmart is configured to use word result codes. Without the V1 command, result codes are regarded as invalid and a timeout error will be caused although a command is executed correctly. This command must be included in the initialization string. Hang up and disable auto‐answer on DTR detection. When the DTR signal turns off, the telephone line is disconnected. The MicroSmart uses this function to dis‐ &D2 connect the telephone line. This command must be included in the initialization string. DCD ON with carrier from remote modem. DCD tracks the state of the data carrier from the remote modem. An ON condition of DCD indicates the pres‐ &C1 ence of a carrier. This command must be included in the initialization string. MNP result codes disabled. Conventional result codes are used and reliable link result codes are not used. Enables dial tone and busy detection. Enables hardware flow control. &K3 The software flow control (XON/XOFF) cannot be used for the MicroSmart modem mode. This command must be included in the initialization string. Set MNP maximum block size to 64 bytes. MNP auto‐reliable mode Ring to answer ON. S0=2 Specifies the ring on which the modem will pick up the telephone line. S0=2 specifies that the modem ...
22: M M ODEM Preparations for Using Modem Before using a modem, read the user’s manual for your modem. The required initialization string depends on the model and make of the modem. When the MicroSmart starts to run the user program, the default modem initialization strings is stored to D8145‐D8169. See page 22‐3. Default Initialization String: ATE0Q0V1&D2&C1\V0X4&K3\A0\N5S0=2&W CR LF Programming Data Registers and Internal Relays To enable the modem mode and communicate through the telephone line, the following settings are needed. 1. If the default initialization string does not match your modem, program a proper initialization string and enter the ASCII val‐ ues to data registers starting with D8145 (initialization string). To send out the new initialization string, turn on internal relay M8050 (initialization string start IR) after the new values have been stored to the data registers. 2. Program to move 0 or 1 to data register D8103 (online mode protocol selection) to select maintenance protocol or user pro‐ tocol for the RS232C port 2 after telephone line is connected. 3. Program the destination telephone number if dialing is required. Enter the ASCII values of the telephone number to data registers starting with D8170 (telephone number). Store two characters each in one data register. Enter 0Dh at the end of the telephone number. See page 22‐4. 4. If you want to change the default value of 3 retry cycles, program to move a required value to data register D8109. 5. Include internal relays M8050‐M8077 in the user program to control the modem communication as required. Setting Up the CPU Module 1. Install the RS232C communication adapter (FC4A‐PC1) to the port 2 connector on the all‐in‐one type CPU module. When using any slim type CPU module, mount the RS232C communication module (FC4A‐HPC1) next to the slim type CPU module, and use the port 2 on the RS232C communication module. When using the HMI base module with any slim type CPU module, install the RS232C communication adapter (FC4A‐PC1) to the port 2 connector on the HMI base module. 2. Connect the MicroSmart CPU module port 2 to a modem using the modem cable 1C (FC2A‐KM1C) as shown on page 22‐1. FC5A M U ’ M FC9Y‐B1273 22‐9...
22: M M ODEM Programming WindLDR The Communication page in the Function Area Settings must be programmed to enable the modem communication for port 2. If required, communication parameters of the CPU module port 2 can also be changed. Since these settings relate to the user program, the user program must be downloaded to the MicroSmart after changing any of these settings. 1. From the WindLDR menu bar, select Configuration > Comm Ports. The Function Area Settings dialog box for Communication Ports appears. 2. In the Communication Mode pull‐down list for Port 2, select Modem Protocol. 3. Click the Configure button. The Communication Parameters dialog box appears. Change settings, if required. 1200, 2400, 4800, 9600, 19200, Baud Rate (bps) 38400, 57600 Data Bits 7 or 8 Parity Even, Odd, None Stop Bits 1 or 2 10 to 2540 (10‐ms increments) Receive Timeout (ms) (Receive timeout is disabled when 2550 is selected.) Network Number 0 to 31 The default communication parameters shown below are recommended. Baud rate 9600 bps Only when the modem connected on the communication line uses differ‐ ent communication parameters than the default values of the Start bit MicroSmart, set the matching communication parameters. Since the total Data bits of modem communication parameters is 10 bits, set the value to a total Parity Even of 10 bits.
22: M M ODEM Operating Procedure for Modem Mode 1. After completing the user program including the Function Area Settings, download the user program to the MicroSmart from a computer running WindLDR. 2. Start the MicroSmart to run the user program. 3. Turn on start internal relay M8050 or M8055 to initialize the modem. When originating the modem communication, turn on M8050 to send the initialization string, the ATZ command, and the dial command. If the initialization string has been stored in the non‐volatile memory of the modem, turn on M8051 to start with the ATZ command followed by the dial command. When answering an incoming call, turn on M8055 to send the initialization string and the ATZ command. If the initialization string has been stored in the non‐volatile memory of the modem, turn on M8056 to send the ATZ command only. 4. Transmit or receive communication through the modem. 5. Turn on start internal relay M8053 to disconnect the telephone line. FC5A M U ’ M FC9Y‐B1273 22‐11 ICRO MART ANUAL...
22: M M ODEM Sample Program for Modem Originate Mode This program demonstrates a user program for the modem originate mode to move values to data registers assigned to the modem mode, initialize the modem, dial the telephone number, and disconnect the telephone line. While the tele‐ phone line is connected, user communication instruction TXD2 sends a character string “Connect.” M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – The MOV instruction stores 1 to D8103 to enable user protocol D8103 M8120 after telephone line is connected. MOV instructions set a dial command ATD1234 CR LF MOV(W) S1 – D1 – 12594 D8170 “12” (3132h = 12594) D8170 M8120 “34” (3334h = 13108) D8171 MOV(W) S1 – D1 – 13108 D8171 “CR” (0D00h = 3328) D8172 to enter at the end of the telephone number. MOV(W) S1 – D1 – 3328 D8172 When input I0 is turned on, M8050 (initialization string) is turned on to send the initialization string, ATZ, and dial com‐...
22: M M ODEM Sample Program for Modem Answer Mode This program demonstrates a user program for the modem answer mode to move a value to a data register assigned to the modem mode and initialize the modem. While the telephone line is connected, user communication instruction RXD2 is executed to receive an incoming communication. M8120 is the initialize pulse special internal relay. MicroSmart When the starts to run, M8055 is turned on to send the ini‐ M8120 M8055 tialization string for the modem answer mode. The MOV instruction stores 1 to D8103 to enable user protocol after MOV(W) S1 – D1 – telephone line is connected. D8103 M8120 M8077 (line connection status) is on while telephone line is connected. RXD2 receives incoming communication and stores received data to data registers starting with D10. M8077 The RXD2 instruction is programmed using WindLDR with parameters shown below: Source S1: Data register D10, No conversion, 2 digits, Repeat 10 FC5A M U ’ M FC9Y‐B1273 22‐13 ICRO MART ANUAL...
22: M M ODEM Troubleshooting in Modem Communication When a start internal relay is turned on, the data of D8111 (modem mode status) changes, but the modem does not work. Cause: A wrong cable is used or wiring is incorrect. Solution: Use the modem cable 1C (FC2A‐KM1C). The DTR or ER indicator on the modem does not turn on. Cause: A wrong cable is used or wiring is incorrect. Solution: Use the modem cable 1C (FC2A‐KM1C). When a start internal relay is turned on, the data of D8111 (modem mode status) does not change. Cause: Modem protocol is not selected for port 2. Solution: Select Modem Protocol for Port 2 using WindLDR ( Configure > Function Area Settings > Communication ) and download the user program to the CPU module. When an initialization string is sent, a failure occurs, but sending ATZ completes successfully. Cause: The initialization string is not valid for the modem. Solution: Refer to the user’s manual for the modem and correct the initialization string. When a dial command is sent, a result code “NO DIALTONE” is returned and the telephone line is not connected. Cause 1: The modular cable is not connected. Solution 1: Connect the modular cable to the modem. Cause 2: The modem is used in a PBX environment. Solution 2: Add X0 or X3 to the initialization string stored in data registers D8145‐D8169, and try initialization again. Dialing completes successfully, but the telephone line is disconnected in a short period of time.
23: M TCP C ODBUS OMMUNICATION Introduction This chapter describes the Modbus TCP master (client) and slave (server) communication function of the FC5A MicroSmart CPU module. All FC5A MicroSmart CPU modules with system program ver. 210 or higher can use the Modbus TCP communication to send and receive data with Modbus devices through the Ethernet line. Modbus TCP Communication General Information When connected with the web server module (FC4A‐SX5ES1E), the FC5A MicroSmart CPU module can be used as a mas‐ ter (client) or a slave (server) of the Modbus TCP communication. Using the Modbus TCP master communication, the CPU module can change or monitor data in Modbus server devises through communication port 2. In the Modbus TCP slave communication, a Modbus master device can change or monitor device values in the MicroSmart CPU module through communication port 1 or port 2. Modbus TCP master communication functions and configuration are described on page 23‐2. Modbus TCP slave commu‐ nication functions and configuration are described on page 23‐5. To use the Modbus TCP communication, FC5A MicroSmart CPU modules with system program ver. 210 or higher and WindLDR ver. 5.3 or higher are required. The system program version can be confirmed using WindLDR. See page 13‐1 (Basic Vol.). When the CPU module system program version is lower than 210, you can download the latest system program using WindLDR ver. 5.1 or higher. See page A‐9 (Basic Vol.). Applicable CPU Modules All FC5A CPU modules System Program Version 210 or higher WindLDR Version 5.3 or higher FC5A M U ’ M FC9Y‐B1273 23‐1 ICRO MART ANUAL...
23: M TCP C ODBUS OMMUNICATION Modbus TCP Master Communication Basic functions and specifications of the Modbus TCP master communication are the same as those of the Modbus mas‐ ter communication, except that only one slave can be connected. WindLDR Function Area Settings are used to configure communication settings for the Modbus TCP master and to create requests to be sent to the Modbus TCP slave. Modbus TCP master communication is processed in asynchronism with user program execution. Requests are sent through the web server module (FC4A‐SX5ES1E) to the Modbus TCP slave. Modbus TCP Master (Client) Modbus TCP Slave (Server) Web Server Module All‐in‐one Type FC4A‐SX5ES1E CPU Module RS232C Communication Adapter FC4A‐PC1 Ethernet RS232C Communication Mod‐ ule FC4A‐HPC1 Slim Type Web Server Module CPU Module FC4A‐SX5ES1E Ethernet Note: Only one Modbus TCP slave can be connected to one Modbus TCP master. Modbus TCP Master Communication Specifications Mode Modbus TCP Master Communication Applicable Communication Port Port 2 Baud Rate 9600, 19200, 38400, 57600 bps Data Bits 8 bits (fixed) Parity Even, Odd, None Stop bits 1, 2 bits 1 to 247 Slave Number (0: broadcast slave number) Maximum Number of Slaves...
Page 265
23: M TCP C ODBUS OMMUNICATION Programming Modbus TCP Master Communication Using WindLDR Modbus TCP master communication settings and request tables for Modbus slave stations can be programmed using the WindLDR Function Area Settings. Since these settings relate to the user program, the user program must be downloaded to the MicroSmart after changing any of these settings. 1. From the WindLDR menu bar, select Configuration > Comm. Ports. The Function Area Settings dialog box for Communication Ports appears. 2. In the Communication Mode pull‐down list for Port 2, select Modbus TCP Master (Client). The Modbus TCP Master Request Table (Port 2) appears. The Modbus TCP Master Request Table (Port 2) can also be opened by clicking the Configure button for Port 2. FC5A M U ’ M FC9Y‐B1273 23‐3 ICRO MART ANUAL...
Page 266
23: M TCP C ODBUS OMMUNICATION 3. Click the Communication Settings button. The Communication Settings dialog box appears. Change settings, if required. Baud Rate (bps) * 9600, 19200, 38400, 57600 Parity * Even, Odd, None Stop Bits * 1 or 2 Retry Cycle 1 to 10 Receive Timeout 1 to 255 (10 ms) *: Select the same values set for the web server module (FC4A‐ SX5ES1E). 4. Click the OK button to return to the Modbus TCP Master Request Table (Port 2). Designate requests under the Function Code. A maximum of 2040 requests can be entered in one request table. Choose to use Request Execution Device and Error Status data registers. When using Request Execution Device and Error Status data registers, enter the first number of the devices. Notes for Editing the Request Table Request execution devices and error status data registers are allocated in the order of request numbers. When deleting a request or changing the order of requests, the relationship of the request to the request execution devices and error status data register is changed. If the internal relay or data register is used in the user program, the device addresses must be changed accordingly. After completing the changes, download the user program again. 5. When editing the Modbus TCP Master Request Table (Port 2) is complete, click the OK button to save changes. 6. Download the user program to the CPU module. Now, programming for the Modbus TCP master is complete. Parameters and valid values are the same as Modbus master communication. For details, see pages 12‐7 through 12‐9 (Basic Vol.). 23‐4 FC5A M U ’ M FC9Y‐B1273 ICRO...
23: M TCP C ODBUS OMMUNICATION Modbus TCP Slave Communication WindLDR Function Area Settings are used to configure communication settings for the Modbus TCP slave communication through communication port 1 or 2 of the MicroSmart CPU module. In the Modbus TCP communication, when the Mod‐ bus TCP slave receives a request from the Modbus TCP master, the Modbus TCP slave reads or writes devices according to the request. The request is processed at the END processing of the user program. The web server module (FC4A‐ SX5ES1E) is used to set up a Modbus TCP slave. Modbus TCP Master (Client) Modbus TCP Slave (Server) Web Server Module All‐in‐one Type FC4A‐SX5ES1E CPU Module RS232C Communication Adapter FC4A‐PC1 Ethernet RS232C Communication Mod‐ ule FC4A‐HPC1 Slim Type Web Server Module CPU Module FC4A‐SX5ES1E Ethernet Note: Only one Modbus TCP slave can be connected to one Modbus TCP master. FC5A M U ’ M FC9Y‐B1273 23‐5 ICRO MART ANUAL...
Page 268
23: M TCP C ODBUS OMMUNICATION Modbus TCP Slave Communication Specifications Mode Modbus TCP Slave (Server) Communication Applicable Communication Port Port 1 Port 2 Baud Rate 9600, 19200, 38400, 57600 bps Data Bits 8 bits (fixed) Parity Odd, even, none Stop bits 1, 2 bits Slave Number 1 to 247 Response Time 1.5 ms 1 to 5000 ms (in increments of 1 ms) Receive Timeout 10 to 2550 ms (in increments of 10 ms) M8005: Communication error Special Internal Relay — M8080: Communication completion relay D8053: Error code Special Data Register — D8054: Transmission wait time (in increments of 1 ms) 01 Read Coil Status 02 Read Input Status 03 Read Holding Registers 04 Read Input Registers...
Page 269
23: M TCP C ODBUS OMMUNICATION Programming Modbus TCP Slave Communication Using WindLDR Modbus TCP slave (server) communication settings can be programmed using the WindLDR Function Area Settings. Since these settings relate to the user program, the user program must be downloaded to the MicroSmart after changing any of these settings. 1. From the WindLDR menu bar, select Configuration > Comm. Ports. The Function Area Settings dialog box for Communication Ports appears. 2. In the Communication Mode pull‐down list for Port 1 or Port 2, select Modbus TCP Slave (Server). The Modbus TCP Slave dialog box appears. The Modbus TCP Slave dialog box can also be opened by clicking the Configure button for Port 1 or Port 2. 3. Change the communication settings, if required. Baud Rate (bps) 9600, 19200, 38400, 57600 Parity Even, Odd, None Stop Bits 1 or 2 Receive Timeout 1 to 5000 (ms) Slave Number 1 to 247 4. Click the OK button to return to the Communication tab page. 5. Click the OK button to save changes. 6. Download the user program to the CPU module. Now, programming for the Modbus TCP slave is complete. Parameters and valid values are the same as Modbus slave communication. For details, see pages 12‐15 through 12‐22 (Basic Vol.). FC5A M U ’ M FC9Y‐B1273 23‐7...
23: M TCP C ODBUS OMMUNICATION Programming the Web Server Module (FC4A‐SX5ES1E) For details about the web server module, see the web server module user’s manual (FC9Y‐B919). 1. Set the function selector switch on the web server module to USER. 2. Select the same parameters values set in the Communication Settings. 3. On the Advanced tab page, enter a value 10 ms or larger in the field under “Send after the following number of idle millisec‐ onds.” 23‐8 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
23: M TCP C ODBUS OMMUNICATION Modbus TCP Communication Format This section describes the communication format used for Modbus TCP master and slave communication. Modbus TCP communication format starts with the Modbus TCP header followed by the RTU mode communication format without the idle 3.5 characters at both ends and CRC as shown below. Modbus TCP Communication Format Transaction Protocol Message Length Function Unit ID Data (bytes) Code 2 bytes 2 bytes 2 bytes 1 byte 1 byte N bytes Modbus TCP Header Slave Function Data Idle Idle RTU Mode Code Communication Format 3.5 characters 3.5 characters 1 byte 1 byte N bytes 2 bytes Transaction ID The Modbus TCP slave (server) returns the request ID sent from the master (client) without change. When receiving the returned request ID, the master can confirm to which request the response was returned. When confirmation is not ...
Page 272
23: M TCP C ODBUS OMMUNICATION 23‐10 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
24: AS‐I M C NTERFACE ASTER OMMUNICATION Introduction This chapter describes general information about the Actuator‐Sensor‐Interface, abbreviated AS‐Interface, and detailed information about using the AS‐Interface master module. About AS‐Interface AS‐Interface is a type of field bus that is primarily intended to be used to control sensors and actuators. AS‐Interface is a network system that is compatible with the IEC62026 standard and is not proprietary to any one manufacturer. A master device can communicate with slave devices such as sensors, actuators, and remote I/Os, using digital and analog signals transmitted over the AS‐Interface bus. The AS‐Interface system is comprised of the following three major components: One master, such as the MicroSmart AS‐Interface master module (FC4A‐AS62M) One or more slave devices, such as sensors, actuators, switches, and indicators Dedicated 30V DC AS‐Interface power supply (26.5 to 31.6V DC) These components are connected using a two‐core cable for both data transmission and AS‐Interface power supply. AS‐ Interface employs a simple yet efficient wiring system and features automatic slave address assignment function, while installation and maintenance are also very easy. Applicable Sensors and Actuators for AS‐Interface AS‐Interface Compatible Sensors and Actuators AS‐Interface compatible sensors and actuators communicate using the built‐in AS‐Interface function, and serve as AS‐ Interface slaves when connected directly to the AS‐Interface bus via a branch unit or a T‐junction unit. Sensors/Actuators Not Compatible with AS‐Interface Conventional sensors and actuators that are not compatible with the AS‐Interface can also be connected to the AS‐Inter‐ face bus using a remote I/O slave and be handled in the same way as devices that are compatible with the AS‐Interface. Branch Unit T‐junction Unit Remote I/O Type Slave AS‐Interface Bus AS‐Interface Non‐compatible AS‐Interface Compatible Sensors/Actuators Sensors/Actuators Maximum I/O points when using one or two AS‐Interface master modules AS‐Interface Master Module 1 module 2 modules Maximum Slaves 62 slaves 124 slaves Maximum I/O Points...
Page 274
24: AS‐I M C NTERFACE ASTER OMMUNICATION AS‐Interface System Requirements Master The AS‐Interface master controls and monitors the status of slave devices connected to the AS‐Interface bus. Normally, the AS‐Interface master is connected to a PLC (sometimes called ‘host’) or a gateway. For example, the MicroSmart AS‐Interface master module is connected to the MicroSmart CPU module. The FC5A MicroSmart CPU module can be used with one or two AS‐Interface master modules, so two separate AS‐Inter‐ face networks can be set up. Applicable FC5A MicroSmart CPU Modules FC5A‐C24R2 FC5A‐C24R2C FC5A‐D16RK1 AS‐Interface Master Module FC4A‐AS62M FC5A‐D16RS1 FC5A‐D32K3 One or two AS‐Interface master modules can be FC5A‐D32S3 mounted. FC5A‐D12K1E Note: The AS‐Interface master module can not FC5A‐D12S1E be mounted to the right of the expansion inter‐ Note: FC5A‐C24R2D cannot use the face module. AS‐Interface master module. The AS‐Interface master module can connect a maximum of 62 digital I/O slaves. A maximum of seven analog I/O slaves can also be connected to the AS‐Interface master module (compliant with AS‐Interface ver. 2.1 and analog slave profile 7.3). The AS‐Interface master module cannot be connected to the all‐in‐one 10‐I/O and 16‐I/O type CPU Caution modules and the expansion interface module. One or two AS‐Interface master modules can be connected to the CPU module. If more than two AS‐Interface master modules are connected, an error occurs and special data register D8037 ...
Page 275
24: AS‐I M C NTERFACE ASTER OMMUNICATION AS‐Interface Power Supply The AS‐Interface bus uses a dedicated 30V DC power supply (AS‐Interface power supply), which is indicated with the AS‐Interface mark. General‐purpose power sup‐ ply units cannot be used for the AS‐Interface bus. AS‐Interface Marks When using two AS‐Interface master modules, two AS‐Interface power supplies are needed. Since the AS‐Interface cable transmits both signals and power, each net‐ work requires a separate power supply. Use a VLSV (very low safety voltage) to power the AS‐Interface bus. Caution The normal output voltage of the AS‐Interface power supply is 30V DC. Recommended IDEC AS‐Interface Power Supplies Input Voltage Output Voltage Output Wattage Type No. PS2R‐Q30ABL 100 to 240V AC 30.5V DC 145W PS2R‐F30ABL Cables The AS‐Interface bus uses only one cable to transmit signals and power. Use one of the following cable types (the wire does not have to be stranded). Standard yellow unshielded AS‐Interface cable (with polarity) Ordinary two‐wire flat cable AS‐Interface Cable Two‐wire Flat Cable Applicable Cable Specifications Cable Type Cable Size/Manufacturer Cross‐sectional View Cable sheath color: Yellow Conductor cross section:...
Page 276
24: AS‐I M C NTERFACE ASTER OMMUNICATION Main Features of AS‐Interface V2 with Slave Expansion Capability The AS‐Interface is a reliable bus management system in which one master periodically monitors each slave device con‐ nected on the AS‐Interface bus in sequence. The master manages the I/O data, parameters, and identification codes of each slave in addition to slave addresses. The management data depends on the type of the slave as follows: Standard Slaves A maximum of four inputs and four outputs for each slave Four parameters for setting a slave’s operation mode (P3, P2, P1, P0) Four identification codes (ID code, I/O code, ID2 code, and ID1 code) A/B Slaves A maximum of four inputs and three outputs for each slave Three parameters for setting a slave’s operation mode (P2, P1, P0) Four identification codes (ID code, I/O code, ID2 code, and ID1 code) Note 1: Parameters P3 through P0 are used to set an operation mode of the slave. For details, see the user’s manual for the slave. Note 2: The slaves connected to the AS‐Interface bus are distinguished from each other by the ID code and I/O code contained in each slave. Some slaves have ID2 code and ID1 code to indicate the internal functions of the slave. For example, analog slaves use the ID2 code to represent the channel number of the slave. Note 3: The MicroSmart AS‐Interface master module is also compatible with AS‐Interface ver. 2.1 and earlier slaves. Slave Addresses Each standard slave connected to the AS‐Interface bus can be allocated an address of 1 through 31. Each A/B slave can be allocated an address of 1A through 31A or 1B through 31B. All slaves are set to address 0 at factory before shipment. The address of a slave can be changed using the “addressing tool.” Using WindLDR , the addresses of slaves connected to the AS‐Interface master modules 1 and 2 can also be changed (see page 24‐35). When a slave fails during operation and needs to be replaced, if the auto addressing function is enabled on the master module, just replace the slave with a new one (with address 0 and the same identification codes). The new slave will automatically be allocated the same address as the slave that was removed, and you do not have to set the address again. For details of the ASI command to enable auto addressing, see page 24‐30.
Page 277
24: AS‐I M C NTERFACE ASTER OMMUNICATION Quantities of Slaves and I/O Points The quantity of slaves that can be connected to one AS‐Interface master module is as follows. Standard slaves: 31 maximum A/B slaves: 62 maximum The limits for slave quantities given above apply when the slaves are either all standard slaves or are all A/B slaves. When 62 A/B slaves (with four inputs and three outputs) are connected, a maximum of 434 I/O points (248 inputs and 186 outputs) can be controlled by one AS‐Interface master module. When using a mix of standard slaves and A/B slaves together, the standard slaves can only use addresses 1(A) through 31(A). Also, when a standard slave takes a certain address, the B address of the same number cannot be used for A/B slaves. AS‐Interface Bus Topology and Maximum Length The AS‐Interface bus topology is flexible, and you can wire the bus freely according to your requirements. When repeaters or extenders are not used, the bus length can be 100m (328 feet) at the maximum. The FC4A‐AS62M AS‐Interface master module can use two repeaters to extend the bus length to 300m. AS‐Interface Bus Cycle Time The AS‐Interface bus cycle time is the amount of time required for a master to cycle through every slave on the bus. The information for each slave is continuously transmitted over the bus in sequence, so the AS‐Interface bus cycle time depends on the quantity of active slaves. When up to 19 slaves are active, the bus cycle time is 3 ms. When 20 to 62 slaves are active, the bus cycle time is 0.156 (1+N) ms where N is the number of slaves. When A slave and B slave have the same address number (e.g. 12A and 12B), the two slaves are alternately updated each cycle. Therefore, when the system consists of 31 A slaves and 31 B slaves, then the AS‐Interface bus cycle time will be 10 Maximum AS‐Interface Bus Cycle Time When 31 slaves are connected, the maximum bus cycle time is 5 ms. When 62 slaves are connected, the maximum bus cycle time is 10 ms. High Reliability and Security The AS‐Interface employs a transfer process of high reliability and high security. The master monitors the AS‐Interface ...
24: AS‐I M C NTERFACE ASTER OMMUNICATION Operation Basics This section describes simple operating procedures for the basic AS‐Interface system from programming WindLDR on a computer to monitoring the slave operation. AS‐Interface System Setup The sample AS‐Interface system consists of the following devices: Name Type No. Description FC5A MicroSmart Slim Type CPU Module FC5A‐D16RK1 — MicroSmart AS‐Interface Master Module FC4A‐AS62M — WindLDR FC9Y‐LP2CDW Version 5.0 or higher 1 unit AS‐Interface Standard Slave — Address 0 ID: 0, I/O: 7, ID2: F, ID1: 7 AS‐Interface Power Supply PS2R‐Q30ABL Output 30.5V DC, 2.4A (73W) Slim Type CPU Module AS‐Interface Master Module FC5A‐D16RK1 FC4A‐AS62M Computer Link Cable 4C FC2A‐KC4C 3m (9.84 ft.) long Standard ...
Page 279
24: AS‐I M C NTERFACE ASTER OMMUNICATION Power Supply When turning off the power to the CPU module, also turn off the AS‐Interface power supply. If the Caution CPU module is powered down and up while the AS‐Interface power remains on, AS‐Interface com‐ munication may stop due to a configuration error, resulting in a communication error. Turn on the AS‐Interface power supply no later than the CPU module power supply, except when slave address 0 exists on the network. The two power supplies may be turned off in any order. Immediately after power‐up, the CPU module cannot access slave I/O data in the AS‐Interface mas‐ ter module. Make the user program so that slave I/O data are accessed after special internal relay M1945 (Normal_Operation_Active) has turned on. See page 24‐25. Power Supply Wiring Diagram A recommended power supply wiring diagram is shown below. Use a common power switch for both the CPU module power supply and AS‐Interface power supply to make sure that both power supplies are turned on and off at the same time. Slim Type CPU Module AS‐Interface Master Module FC5A‐D32K3 FC4A‐AS62M AC Power AS‐Interface Cable Connector Power Switch CPU Module Power Supply 24V DC AS‐Interface Power Switch (Note) Slave 2 AS‐Interface Power Supply 30V DC VLSV (very low safety voltage) Slave 1 Note: A failed slave can be replaced with a new slave with address 0 without turning off the power to the CPU module and the AS‐ Interface line. But, if power has been turned off before replacing the slaves, install a new slave with address 0 and take one of the fol‐...
Page 280
24: AS‐I M C NTERFACE ASTER OMMUNICATION Selecting the PLC Type Start WindLDR on a computer. 1. From the WindLDR menu bar, select Configuration > PLC Type. The PLC Selection dialog box appears. 2. Select FC5A‐D16RX1. 3. Click OK to save changes and return to the ladder editing screen. Function Area Settings Use of the AS‐Interface master module must be selected in the Function Area Settings dialog box. 1. From the WindLDR menu bar, select Configuration > Cartridges & Modules. The Function Area Settings dialog box for Cartridges & Modules appears. 2. Make sure of a check mark in the check box on the left of Use AS‐Interface Master Module. This check box is checked as default. If FC5A‐D12K1E or FC5A‐D12S1E is selected under PLC Selection, the check box is not displayed because this setting is permanently enabled. Since this setting relates to the user program, download the user program to the CPU module after changing any of these settings. If the ERR LED on the CPU module goes on when the AS‐Interface master module is connected, download the user pro‐ gram to the CPU module after making the above setting. 24‐8 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 281
24: AS‐I M C NTERFACE ASTER OMMUNICATION Assigning a Slave Address AS‐Interface compatible slave devices are set to address 0 at factory. Connect the slave to the AS‐Interface master mod‐ ule as shown on page 24‐6. Do not connect two or more slaves with slave address 0, otherwise the AS‐Interface master module cannot recognize slave addresses correctly. 1. Power up the MicroSmart CPU module first. Approximately 5 seconds later, turn on the AS‐Interface power supply. Note: When slave address 0 is not mounted on the AS‐Interface bus, the CPU module power supply and the AS‐Interface power supply can be turned on at the same time. See page 24‐7. 2. From the WindLDR menu bar, select Online > Configure Master to open the Configure AS‐Interface Master dialog box. Press Refresh to collect slave information and update the screen display. (When configuration in the master module is complete, you do not have to press Refresh since the screen display is updated automatically.) On the Configure AS‐Interface Master dialog box, slave address 0 is shaded with yellow. This means that the master mod‐ ule has found slave address 0 on the AS‐Interface bus. The CDI for address 0 shows 07F7 (ID: 0, I/O: 7, ID2: F, ID1: 7). 3. Click the slave address “00” to open the Change Slave Address dialog box for slave 0. To assign slave address 1 to the slave, enter 1 in the New Address field and click OK. Yellow Shade Click slave address 0 to open the Change Slave Address dialog box. CDI: Configuration Data Image PCD: Permanent Configuration Data The new address “01” is shaded with yellow to indicate that the address assignment is complete. Yellow Shade 4. When changing slave addresses on other slaves, continue from step 3 if it is possible to wire the slave with‐ out turning off power, or from step 1 ...
Page 282
24: AS‐I M C NTERFACE ASTER OMMUNICATION Configuring a Slave Next, you have to set the slave configuration in the AS‐Interface master module, either by using pushbuttons PB1 and PB2 on the AS‐Interface master module or WindLDR . Configuration Using Pushbuttons PB1 and PB2 Shut down and power up again. Press PB1 and PB2. Press PB2. Press PB1. 1. Check that PWR LED and CMO LED on the AS‐Interface master module are on (normal protected mode). 2. Press pushbuttons PB1 and PB2 together for 3 seconds. CMO LED turns off and LMO LED turns on (protected mode). 3. Press pushbutton PB2 for 3 seconds. CNF LED flashes (configuration mode). 4. About 5 seconds later, press pushbutton PB1 for 3 seconds. All I/O LEDs blink once to complete configuration. 5. Shut down the CPU module and AS‐Interface master module, and power up again. Check that FLT LED is off, which indicates that configuration is complete. 6. Use WindLDR to view slave information on the Configure AS‐Interface Master dialog box and check that all slaves are recog‐ nized correctly. 24‐10 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 283
24: AS‐I M C NTERFACE ASTER OMMUNICATION Configuration Using WindLDR Slave configuration can be set using WindLDR in two ways; using the Auto Configuration or Manual Configuration button on the Configure AS‐Interface Master dialog box. 1. Click the Auto Configuration button to store the configuration information (LDS, CDI, PI) of the connected slaves to the EEPROM (LPS, PCD, PP) in the AS‐Interface master module. For details, see page 24‐36. The auto configuration automatically stores the information of slaves found on the AS‐Interface bus to the EEPROM in the master module, and this completes configuration. Another method of configuration is manual configuration as fol‐ lows. 2. Click the PCD value “FFFF” of slave address 01 to open the Configure Slave 01A dialog box. 3. Enter the same value as CDI “07F7” in the PCD field. (Set FFFF to PCD values of all unused slaves.) 4. Select initial settings of parameters (PP) P0 through P3, if required. Yellow Shade 5. Click the Manual Configuration button to store the selected PCD and parameter values to the master module. 6. Check that the blue shade appears at slave address 01. Now, configuration is complete. Blue Shade FC5A M U ’ M FC9Y‐B1273 24‐11 ICRO MART ANUAL...
Page 284
24: AS‐I M C NTERFACE ASTER OMMUNICATION Monitoring Digital I/O, and Changing Output Status and Parameters While the MicroSmart is communicating with AS‐Interface slaves through the AS‐Interface bus, operating status of AS‐ Interface slaves can be monitored using WindLDR on a computer. Output statuses and parameter image (PI) of slaves con‐ nected to the AS‐Interface master module can also be changed using WindLDR . 1. From the WindLDR menu bar, select Online > Monitor, then select Online > Monitor Slaves. The Monitor AS‐Interface Slaves dialog box appears. Active slaves are indicated with blue shade. Next step is to change output status of the active slave. 2. Click the output of slave address 01 to open the Slave Status 01A dialog box. 3. Click the On or Off button to change the statuses of outputs O0 through O3 and parameters (PI) P0 through P3 as required. Blue Shade The selected parameters (PI) are in effect until the CPU module is shut down. When the CPU module is powered up again, the parameter values (PP) selected in the slave configuration procedure (page 24‐10) will take effect. To store the changed parameter values to the AS‐Interface master module EEPROM, execute the Copy PI to PP command by storing 0306, 0100, 0000, 0000, 0001 to data registers D1941 through D1945. See page 24‐30. 24‐12 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 285
24: AS‐I M C NTERFACE ASTER OMMUNICATION Troubles at System Start‐up The following table summarizes possible troubles at system start‐up, probable causes and actions to be taken. Trouble Cause and Action AS‐Interface power is not supplied to the AS‐Interface master module. Check that wiring is correct and AS‐Interface power is supplied. PWR LED is off. (power) Power is not supplied from the CPU module to the AS‐Interface master module. Check the connection between the CPU module and the AS‐Interface master module. Slave configuration on the bus is incorrect. Use the WindLDR slave monitor function to check that slaves are connected correctly. Perform configuration, if necessary. For the con‐ figuration method, see page 24‐34. FLT LED is on. (fault) If FLT LED remains on even though slaves are connected correctly and configuration is com‐ pleted, either disconnect and reconnect the AS‐Interface connector, or turn off and on the AS‐ Interface power supply. The CPU module fails to communicate with the AS‐Interface master module. Check the fol‐ lowing points. LMO LED is on. Is the CPU module compatible with AS‐Interface? Check the Type No. of the CPU module. (local mode) Is a check mark put in the check box “Use AS‐Interface Master Module” in WindLDR Func‐ tion Area Settings? The box is checked as default. If not, put a check mark and download the user program to the CPU module. OFF LED is on. While a slave of address 0 was connected, power was turned on. After changing the slave ...
24: AS‐I M C NTERFACE ASTER OMMUNICATION Pushbuttons and LED Indicators This section describes the operation of pushbuttons PB1 and PB2 on the AS‐Interface master module to change opera‐ tion modes, and also explains the functions of address and I/O LED indicators. Pushbutton Operation The operations performed by pushbuttons PB1 and PB2 on the front of the AS‐Interface master module depend on the duration of being pressed. A “long press” switches the operation mode, and a “short press” switches the slave being monitored on the I/O LEDs. If the duration of pressing PB1 or PB2 does not correspond to either of these, the status of the AS‐Interface master module does not change. Long Press A “long press” takes effect when you press either pushbutton PB1 or PB2 or both for 3 seconds or more. Use the long press to change the operation mode of the AS‐Interface master module or to save the configuration data to the AS‐Interface master module EEPROM. Short Press A “short press” takes effect when you press either pushbutton PB1 or PB2 for 0.5 second or less. Use the short press to change the slave address when monitoring slave I/O status on the AS‐Inter‐ face master module LED indicators. Transition of AS‐Interface Master Module Modes Using Pushbuttons Connected Mode MicroSmart Power ON Normal Protected Mode Normal Protected Data Exchange Off Store Configuration Normal Protected Offline Data to EEPROM Local Mode Note: All pushbutton operations Configuration Mode for changing modes are “long press.” Protected Mode Store Configuration Data to EEPROM *1 Pushbutton operation or execution of the ASI command Go to Normal Protected Offline. *2 Pushbutton operation or execution of the ASI command Go to Normal Protected Mode.
Page 287
24: AS‐I M C NTERFACE ASTER OMMUNICATION AS‐Interface Master Module Operation Modes The AS‐Interface master module has two modes of operation: connected mode is used for actual operation, and local mode is used for maintenance purposes. Connected Mode In connected mode, the CPU module communicates with the AS‐Interface master module to monitor and control each slave. Connected mode is comprised of the following three modes. Normal Protected Mode When the CPU module is powered up, the AS‐Interface master module initially enters normal protected mode of con‐ nected mode if no error occurs. This is the normal operation mode for the AS‐Interface master module to perform data communication with the connected slaves. If the configuration data stored in the AS‐Interface master module do not match the currently connected slave configura‐ tion, the FLT LED on the front of the AS‐Interface master module goes on. Execute configuration using the pushbuttons on the AS‐Interface master module. Configuration can also be done using WindLDR . See page 24‐36. Normal Protected Offline The AS‐Interface master module stops communication with all slaves and enables offline operation (initialization of the master module). In this mode, the CPU module cannot monitor the slave status. To enter normal protected offline from normal protected mode, either long‐press the PB2 button or execute the ASI com‐ mand Go to Normal Protected Offline. To return to normal protected mode and resume data communication, either long‐ press the PB2 button again or execute the ASI command Go to Normal Protected Mode. For details about the ASI com‐ mands, see page 24‐30. Normal Protected Data Exchange Off Data communication with all slaves is prohibited. To enter this mode, execute the ASI command Prohibit Data Exchange. To return to normal protected mode and resume data communication, execute the ASI command Enable Data Exchange. For details about the ASI commands, see page 24‐30. When auto configuration or manual configuration is executed on WindLDR , the AS‐Interface master module enters this mode during configuration.
Page 288
24: AS‐I M C NTERFACE ASTER OMMUNICATION LED Indicators The LED indicators on the AS‐Interface master module consist of status LEDs, I/O LEDs, and address LEDs. Address LEDs (0x to 3x) Status LEDs Address LEDs (x0 to x9) Input LEDs Output LEDs Address LEDs (A and B) LED Indicators Description Indicates the status of the AS‐Interface power supply for the AS‐Interface mas‐ ter module. (AS‐Interface power supply) Goes on when the AS‐Interface power is supplied sufficiently. Indicates the AS‐Interface configuration status. Goes on when the permanent configuration data (PCD) stored in the AS‐Inter‐ (Fault) face master module EEPROM does not match the current slave configuration, or configuration data image (CDI). Then, configuration is not complete or an error was found on the AS‐Interface bus. Indicates the mode of the AS‐Interface master module. Status LEDs LMO (Local mode) Goes on when the AS‐Interface master module is in local mode. Goes off when the AS‐Interface master module is in connected mode. Indicates the mode of the AS‐Interface master module. CMO (Connected mode) Goes on when the AS‐Interface master module is in connected mode. Goes off when the AS‐Interface master module is in local mode. Indicates the operating status of the AS‐Interface master module. OFF (Offline) Goes on when the AS‐Interface master module is in normal protected offline.
Page 289
24: AS‐I M C NTERFACE ASTER OMMUNICATION Status LEDs The operation modes of the AS‐Interface master module can be changed by pressing the pushbuttons on the front of the AS‐Interface master module or by executing ASI commands. The operation modes can be confirmed on the six status LEDs on the AS‐Interface master module. For details about the ASI commands, see page 24‐30. Status LED Indication Status LED Normal Protected Mode ON OFF Normal Protected Offline ON Connected Mode Normal Protected ON Data Exchange Off Protected Mode ON OFF Local Mode Configuration Mode ON OFF Flash *1: Goes off when AS‐Interface power is not supplied. *2: Goes on when an error is found on the AS‐Interface bus. Address LEDs and I/O LEDs The operating status and I/O status of each slave can be monitored on the address LEDs and I/O LEDs on the front of the AS‐Interface master module. Slave Operating Status The operating status of each slave can be determined by viewing the address LEDs and I/O LEDs. Address LED I/O LED Description ON or OFF The slave at this address is active.
24: AS‐I M C NTERFACE ASTER OMMUNICATION AS‐Interface Devices This section describes AS‐Interface devices assigned in the CPU module to control and monitor the AS‐Interface master module, and describes ASI commands used to update AS‐Interface devices in the CPU module or to control the AS‐Inter‐ face master module. The FC5A MicroSmart CPU modules can be used with one or two AS‐Interface master modules. For the first AS‐Interface master module, which is mounted closer to the CPU module, the AS‐Interface objects can be accessed through the AS‐ Interface devices, such as internal relays M1300 through M1997 and data registers D1700 through D1999 as shown on page 24‐19. Details about AS‐Interface objects for AS‐Interface master module 2 are described on the following pages. AS‐Interface Power Supply 2 AS‐Interface Master Module 1 AS‐Interface Master Module 2 Note: When using two AS‐Interface master modules, two AS‐ Interface power supplies are needed. Since the AS‐Interface To two separate AS‐Interface networks cable transmits both signals and power, each network requires a separate power supply. Processing Time For AS‐Interface master module 1, AS‐Interface internal relays for digital I/O and status information, and data registers for LAS, LDS, LPF are updated in every scan. Data registers for analog I/O devices are also updated in every scan only when analog I/O are connected to the AS‐Interface bus. The processing times for these AS‐Interface devices are shown in the table on page 24‐19. Other AS‐Interface data registers are updated when an ASI command is executed in the CPU module. For the processing times of the ASI commands, see page 24‐30. For AS‐Interface master module 2, AS‐Interface objects are updated using the RUNA instruction. AS‐Interface Objects MicroSmart CPU Module IDI, ODI AS‐Interface Ladder Status Information RUNA Instruction Master Module 2 Processing...
Page 291
24: AS‐I M C NTERFACE ASTER OMMUNICATION Accessing AS‐Interface Objects for AS‐Interface Master Module 1 The I/O data and parameters of slaves on the AS‐Interface bus, the status of the AS‐Interface bus, and various list infor‐ mation of the slaves are allocated to the AS‐Interface master module EEPROM. This information is called AS‐Interface objects, which can be accessed through the AS‐Interface devices, such as internal relays M1300 through M1997 and data registers D1700 through D1999. The allocation for AS‐Interface master module 1 is shown in the table below. MicroSmart CPU Module AS‐Interface Master Module EEPROM Device Address Precessing Read/ Device Time (ms) Write Updated AS‐Interface Device AS‐Interface Object Master Module 1 M1300‐M1617 R Digital input (IDI: input data image) AS‐Interface Internal M1620‐M1937 W Digital output (ODI: output data image) Relays M1940‐M1997 Status information D1700‐D1731 Analog input Every scan D1732‐D1763 Analog output D1764‐D1767 R ...
Page 292
24: AS‐I M C NTERFACE ASTER OMMUNICATION I/O Data for AS‐Interface Master Module The AS‐Interface master module can process digital I/O data and analog I/O data. Digital I/O data can be a maximum of 4 digital inputs and 4 digital outputs per slave. Analog I/O data consists of 4 channels of 16‐bit analog input or output data per slave. Digital I/O Data of Standard Slaves and Expansion Slaves For AS‐Interface master module 1, the digital I/O data for standard slaves and A/B slaves (sensors and actuators) on the AS‐Interface bus are allocated to the AS‐Interface internal relays in the ascending order starting with slave 0. The input data image (IDI) for each slave is allocated to M1300 through M1617, and the output data image (ODI) is allocated to M1620 through M1937. For example, in the case of slave 3A, the input data is allocated to M1314 (DI0) through M1317 (DI3), and the output data is allocated to M1634 (DO0) through M1637 (DO3). For AS‐Interface master module 2, the digital I/O data can be accessed using RUNA or STPA instruction. Digital Input Data Image (IDI) Device Address Data Format AS‐Interface Master AS‐Interface Master Module 1 Module 2 * (DI3) (DI2) (DI1) (DI0) (DI3) (DI2) (DI1) (DI0) M1300 +0 (low byte) Slave 1(A) (Slave 0) M1310 +0 (high byte) Slave 3(A) Slave 2(A) M1320 +1 (low byte)
Page 294
24: AS‐I M C NTERFACE ASTER OMMUNICATION Analog I/O Data of Analog Slaves For AS‐Interface master module 1, the I/O data for a maximum of seven analog slaves (four channels for each slave) on the AS‐Interface bus is stored to AS‐Interface data registers in the CPU module. The analog slave addresses (1 to 31) are in the ascending order. The input data for each analog slave is allocated to data registers D1700 to D1731, and the output data is allocated to D1732 to D1763. For AS‐Interface master module 2, the analog I/O data can be accessed using RUNA or STPA instructions. The AS‐Interface master module is compliant with analog slave profile 7.3. The maximum number of analog slaves that can be connected to the AS‐Interface bus is seven. Do Caution not connect eight or more analog slaves to one bus, otherwise the slaves will not function correctly. When data registers D1700 through D1731 allocated to analog inputs contain 7FFF, do not use this data for programming, because this value is reserved for a special meaning as follows: Unused channel on a slave allocated to analog slave. (For a channel on a slave not allocated an analog slave, the corresponding data register holds an indefinite value.) Data overflow. Communication between the master and analog slave is out of synchronism. When using analog slaves, read the user’s manual for the analog slave to process the data properly. Analog Input Data Device Address Channel No. Data Format AS‐Interface Master Module 1 AS‐Interface Master Module 2 * D1700 Channel 1 D1701 Channel 2 1st data (AI0) D1702 Channel 3 D1703 Channel 4...
Page 295
24: AS‐I M C NTERFACE ASTER OMMUNICATION Analog Output Data Device Address Channel No. Data Format AS‐Interface Master Module 1 AS‐Interface Master Module 2 * D1732 Channel 1 D1733 Channel 2 1st data (AO0) D1734 Channel 3 D1735 Channel 4 D1736 Channel 1 D1737 Channel 2 2nd data (AO1) D1738 Channel 3 D1739 Channel 4 D1740 Channel 1 D1741 Channel 2 3rd data (AO2) D1742 Channel 3 D1743 Channel 4...
Page 296
24: AS‐I M C NTERFACE ASTER OMMUNICATION Status Information For AS‐Interface master module 1, the status information is allocated to AS‐Interface internal relays M1940 through M1997. These internal relays are used to monitor the status of the AS‐Interface bus. If an error occurs on the bus, you can also confirm the error with the status LEDs on the front of the AS‐Interface master module in addition to these status internal relays. For AS‐Interface master module 2, the status information can be accessed using RUNA or STPA instructions. Status Information Internal Relays Device Address Description AS‐Interface AS‐Interface Status Master Master Module 1 Module 2 * M1940 Config_OK Configuration is complete. Configuration is incomplete. Slave address 0 is not Slave address 0 is detected M1941 LDS.0 detected on the AS‐Interface on the AS‐Interface bus. bus. M1942 Auto_Address_Assign Auto addressing is enabled. Auto addressing is disabled. M1943 Auto_Address_Available Auto addressing is ready.
Page 297
24: AS‐I M C NTERFACE ASTER OMMUNICATION M1942 Auto_Address_Assign M1942 indicates that the auto addressing function is enabled. The default setting is “enabled,” and M1942 is normally on. This setting can be changed using the ASI commands Enable Auto Addressing and Disable Auto Addressing. Note: When the auto addressing function is enabled at the AS‐Interface master module and a slave fails, you can replace the slave with a new slave which has the same identification codes without stopping the AS‐Interface bus. If the replacement slave is assigned the same address and has the same identification codes as the failed slave, the replacement slave is automatically added to the LDS (list of detected slaves) to continue operation. If the assigned address or the identification codes of the replacement slave are different from the failed slave, the FLT LED will go on. When replacing a failed slave with a new slave which is assigned address 0 (factory setting) and has the same identification codes, the new slave will be assigned the address of the failed slave and added to the LDS and LAS (list of active slaves). If the identification codes of the replacement slave are different from the failed slave, the FLT LED will go on. The auto addressing function for a replacement slave works only when one slave has failed. This function cannot be used to replace multiple slaves. M1943 Auto_Address_Available M1943 indicates whether or not the conditions for the auto addressing function are satisfied. M1943 goes on when the auto addressing function is enabled and there is one faulty slave (a slave which cannot be recognized by the AS‐Interface master module) on the AS‐Interface bus. M1944 Configuration M1944 indicates whether the AS‐Interface master module is in configuration mode (on) or other mode (off). While con‐ figuration mode is enabled, M1944 remains on, and the CNF LED flashes. M1945 Normal_Operation_Active M1945 remains on while the AS‐Interface master module is in normal protected mode. M1945 is off while in other modes. When M1945 turns on, the CPU module starts to exchange data communication with the connected slaves. M1946 APF/not APO M1946 goes on when the AS‐Interface power supply has failed, then the PWR LED goes off. M1947 Offline_Ready M1947 indicates that the AS‐Interface master module is in normal protected offline. While in normal protected offline, ...
Page 298
24: AS‐I M C NTERFACE ASTER OMMUNICATION Slave List Information For AS‐Interface master module 1, data registers D1764 through D1779 are assigned to slave list information to deter‐ mine the operating status of the slaves. The slave list information is grouped into four lists. List of active slaves (LAS) shows the slaves currently in operation. List of detected slaves (LDS) the slaves detected on the AS‐Interface bus. List of peripheral fault slaves (LPF) the faulty slaves. List of projected slaves (LPS) the slave configuration stored in the AS‐Inter‐ face master module. For AS‐Interface master module 2, the slave list information can be accessed using RUNA or STPA instructions. List of Active Slaves (LAS) For AS‐Interface master module 1, data registers D1764 through D1767 are allocated to read the LAS. You can check the register bits to determine the operating status of each slave. When a bit is on, it indicates that the corresponding slave is active. Device Address Data Format AS‐Interface Master Module 1 AS‐Interface Master Module 2 * Bits 15 to 8 Bits 7 to 0 D1764 Slaves 15(A) to 8(A) Slaves 7(A) to 0 D1765 Slaves 31(A) to 24(A) Slaves 23(A) to 16(A) D1766 Slaves 15B to 8B Slaves 7B to (0B) D1767 Slaves 31B to 24B Slaves 23B to 16B List of Detected Slaves (LDS) For AS‐Interface master module 1, data registers D1768 through D1771 are allocated to read the LDS. You can check the register bits to determine the detection status of each slave. When a bit is on, it indicates that the corresponding slave has been detected by the master. Device Address Data Format AS‐Interface Master Module 1 AS‐Interface Master Module 2 *...
Page 299
24: AS‐I M C NTERFACE ASTER OMMUNICATION List of Projected Slaves (LPS) For AS‐Interface master module 1, D1776 through D1779 are allocated to read and write the LPS. The LPS settings are stored to the AS‐Interface master module when either Auto Configuration or Manual Configuration is executed on . The ASI command Read LPS can be used to read the LPS data to data registers D1776 through D1779. Then, you WindLDR can check the register bits to determine the slave projection. When a bit is on, it indicates that the corresponding slave is set as a projected slave. After changing the LPS settings, execute the ASI command Read LPS, then you can use the updated data for program execution. For AS‐Interface master module 2, the list of projected slaves cannot be accessed using the RUNA or STPA instruction. Device Address Data Format AS‐Interface Master Module 1 AS‐Interface Master Module 2 Bits 15 to 8 Bits 7 to 0 D1776 — Slaves 15(A) to 8(A) Slaves 7(A) to 0 D1777 — Slaves 31(A) to 24(A) Slaves 23(A) to 16(A) D1778 — Slaves 15B to 8B Slaves 7B to (0B) D1779 — Slaves 31B to 24B Slaves 23B to 16B Slave Identification Information (Slave Profile) For AS‐Interface master module 1, data registers D1780 through D1940 are assigned to the slave identification informa‐ tion, or the slave profile. The slave profile includes configuration data and parameters to indicate the slave type and slave operation, respectively.
Page 300
24: AS‐I M C NTERFACE ASTER OMMUNICATION Permanent Configuration Data (PCD) For AS‐Interface master module 1, data registers D1844 through D1907 are allocated to read and write the PCD of each slave. Like the CDI, the PCD is made up of four codes: the ID code, I/O code, ID2 code, and ID1 code. When auto configuration is executed, the CDI is copied to the PCD and stored in the ROM of the AS‐Interface master module. When you execute manual configuration, you can set the PCD using the Configure Slave dialog box on WindLDR . Set the PCD of each slave to the same value as its CDI. If the PCD is different from the CDI for a slave, then that slave does not function correctly. Set FFFFh to the PCD of vacant slave numbers. The ASI command Read PCD can be used to read the PCD data to data registers D1844 through D1907. Execute the ASI command Read PCD before using the PCD data for program execution. Device Address Data Format AS‐Interface Master AS‐Interface Master Bits 15 to 12 Bits 11 to 8 Bits 7 to 4 Bits 3 to 0 Module 1 Module 2 ID Code I/O Code ID2 Code ID1 Code D1844 — Slave 0 D1845 — Slave 1(A) D1846 — Slave 2(A) D(1844+N) —...
Page 301
24: AS‐I M C NTERFACE ASTER OMMUNICATION Permanent Parameter (PP) For AS‐Interface master module 1, data registers D1924 through D1939 are allocated to read and write the PP of each slave. Like the PI, the PP is made up of four parameters: the P3, P2, P1, and P0. When auto configuration is executed, the PI is copied to the PP and stored in the ROM of the AS‐Interface master module. When you execute manual configura‐ tion, you can set the PP using the Configure Slave dialog box on WindLDR . The ASI command Read PP can be used to read PP data to data registers D1924 through D1939. After changing the PP set‐ tings, execute the ASI command Read PP, then you can use the updated PP data for program execution. Device Address Data Format AS‐Interface Master AS‐Interface Master Bits 15 to 12 Bits 11 to 8 Bits 7 to 4 Bits 3 to 0 Module 1 Module 2 P3/P2/P1/P0 P3/P2/P1/P0 P3/P2/P1/P0 P3/P2/P1/P0 D1924 — Slave 3(A) Slave 2(A) Slave 1(A) Slave 0 D1925 — Slave 7(A) Slave 6(A) Slave 5(A) Slave 4(A) D1926 —...
Page 302
24: AS‐I M C NTERFACE ASTER OMMUNICATION ASI Commands (AS‐Interface Master Module 1) The ASI commands are used to update AS‐Interface devices in the CPU module or to control the AS‐Interface master module 1. Data registers D1941 through D1944 are used to store command data. D1945 is used to store a request code before executing the command. While the command is executed, D1945 stores status and result codes. ASI Command Format Command Part (8 bytes) Request/Result D1941 D1942 D1943 D1944 D1945 ASI Command Data To execute an ASI command, store required values to data resisters D1941 through D1945 as listed in the table below: Command Data (Hexadecimal) Processing ASI Command Description Time (ms) D1941 D1942 D1943 D1944 D1945 1.0 Read LPS Reads LPS to D1776‐D1779 010B 084C 0000 0000 0001 10.4 Read CDI Reads CDI to D1780‐D1843 010C 4050...
Page 303
24: AS‐I M C NTERFACE ASTER OMMUNICATION Request and Result Codes D1945 Value Low Byte Description Note Initial value at power up Request Processing ASI command While D1945 lower byte stores 01h, 02h, or 08h, do not Completed normally write any value to D1945, otherwise the ASI command is not executed correctly. (Executing configuration) The CPU module stores all values automatically, except Peripheral device failure for 01h. ASI command error Impossible to execute Execution resulting in error Sample Program: Change Slave PI This sample program changes the PI value of slave 1A to 3. To use the ASI command Change Slave PI, store new parame‐ ter value 3 to D1943 and 1 to D1944 to designate the slave address using the MACRO instruction on WindLDR . Command Data (Hexadecimal) Program D1941 D1942 D1943 D1944 D1945 Write PI parameter “3” to slave 1A 0306 0102 0003 0001 0001 To designate slave 31A, set 001F to D1944. For slave 1B, set 0021.
24: AS‐I M C NTERFACE ASTER OMMUNICATION Using Two AS‐Interface Master Modules The FC5A MicroSmart CPU modules can be used with one or two AS‐Interface master modules. For the first AS‐Interface master module, which is mounted closer to the CPU module, the AS‐Interface objects can be accessed through the AS‐ Interface devices, such as internal relays M1300 through M1997 and data registers D1700 through D1999 as shown on page 24‐19. While performing master configuration or slave monitoring for AS‐Interface master module 2 using Caution WindLDR , RUNA and STPA instructions for AS‐Interface master module 2 cannot be executed. ASI commands cannot be used for AS‐Interface master module 2. Use pushbuttons PB1 and PB2 on the AS‐Interface master module to go to Normal Protected Mode, Normal Protected Offline, and Normal Protected Data Exchange Off. AS‐Interface master module 2 does not have the function to change ID1 code of slave 1 and enable/disable auto addressing. Auto addressing is always enabled. Accessing AS‐Interface Objects for AS‐Interface Master Module 2 The I/O data and parameters of slaves on the AS‐Interface bus, the status of the AS‐Interface bus, and various list infor‐ mation of the slaves are allocated to the AS‐Interface master module EEPROM. This information is called AS‐Interface objects. The AS‐Interface objects for the second AS‐Interface master module can be assigned to any internal relays and data registers and accessed using RUNA or STPA instructions. The data addresses for AS‐Interface master module 2 are shown in the table below. AS‐Interface Master Module 2 AS‐Interface Master Module EEPROM Precessing Read/Write Data Size Time (ms) Device Address AS‐Interface Object (bytes) Digital input (IDI: input data image) Digital output (ODI: output data image) Status information Analog input...
Page 305
24: AS‐I M C NTERFACE ASTER OMMUNICATION WindLDR Program to Access AS‐Interface Objects for AS‐Interface Master Module 2 The following example demonstrates to assign AS‐Interface objects to internal relays using the RUNA instruction. Digital inputs (IDI), digital outputs (ODI), and status information are read to and written from internal relays. Although not included in the sample program, analog inputs and analog outputs can also be assigned to data registers using RUNA or STPA instructions. Like AS‐Interface master module 1, other AS‐Interface objects can be accessed using the Configure AS‐Interface Master dialog box on WindLDR , such as the list of active slaves (LAS), list of detected slaves (LDS), list of peripheral fault slaves (LPF), list of projected slaves (LPS), configuration data image (CDI), permanent configuration data (PCD), parameter image (PI), and permanent parameter (PP). Programming Procedure 1. Determine the AS‐Interface objects to access and the MicroSmart devices to assign the AS‐Interface objects. AS‐Interface Master Module 2 AS‐Interface Master Module EEPROM Read/Write MicroSmart Device Device Address Data Size (bytes) AS‐Interface Object M200 to M517 Digital input (IDI) M520 to M837 Digital output (ODI) M840 to M897 Status information 2. Confirm the slot number where AS‐Interface module 2 is mounted. For the system setup of this sample program, see page 24‐18. Slots are numbered from 1, in the order of increasing distance from the CPU module. All expansion modules are included in numbering the slots, such as digital I/O modules, analog I/O modules, and AS‐Interface modules. When I0 is turned on, RUNA instructions are exe‐ RUNA(W) DATA ‐...
24: AS‐I M C NTERFACE ASTER OMMUNICATION Using WindLDR This section describes the procedures to use WindLDR for the AS‐Interface system. WindLDR contains the Configure AS‐ Interface Master dialog box to configure slaves and to change slave addresses, and the Monitor AS‐Interface Slave dialog box to monitor the slave operation. For the procedures to select the PLC type and Function Area Settings, see page 24‐8. Configure AS‐Interface Master AS‐Interface compatible slave devices are set to address 0 at factory and must be assigned a unique slave address so that the master can communicate with the slave correctly. From the WindLDR menu bar, select Online > Configure Master . The Configure AS‐Interface Master dialog box appears. Click the slave address to open the Change Slave Address dialog box. Click a PCD value to open the Configure Slave dialog box. Dialog Box Button Description Writes the currently connected AS‐Interface slave configuration (LDS, Auto Configuration CDI, PI) information to the AS‐Interface master module ROM (LPS, PCD, PP). Writes the slave PCD and parameters configured by the user to the AS‐ Manual Configuration Interface master module ROM (LPS, PCD, PP).
Page 307
24: AS‐I M C NTERFACE ASTER OMMUNICATION Slave Address Shading Colors Operating status of the slave can be confirmed by viewing the shading color at the slave address on the Configure AS‐ Interface Master dialog box. The screen display can be updated by clicking the Refresh button. List of List of List of Address Shading Description List of active detected peripheral projected slaves slaves fault slaves slaves No Shade The slave is not recognized by the master. ON/OFF Blue Shade The slave is active. Yellow Shade The slave is recognized but not enabled to operate. Red Shade An error was found in the slave. ON/OFF ON/OFF ON/OFF Change Slave Address When a slave is connected to the AS‐Interface master module, the slave address can be changed using WindLDR . ...
Page 308
24: AS‐I M C NTERFACE ASTER OMMUNICATION Configuration Before commissioning the AS‐Interface master module, configuration must be done using either WindLDR or the push‐ buttons on the front of the AS‐Interface master module. This section describes the method of configuration using . For configuration using the pushbuttons, see page 24‐10. Configuration is the procedure to store the following WindLDR information to the AS‐Interface master module ROM. A list of slave addresses to be used Configuration data to specify slave types, or identification codes (ID, I/O, ID2, ID1) Parameters (P3, P2, P1, P0) to designate the slave operation at power‐up provides two options for configuration: auto configuration to execute automatic configuration and manual con‐ WindLDR figuration to execute configuration according to the data selected by the user. Auto Configuration Auto configuration stores the current slave configuration data (LDS, CDI, PI) to the AS‐Interface master module ROM (LPS, PCD, PP). To execute auto configuration, press Auto Configuration in the Configure AS‐Interface Master dialog box. Auto configuration has the same effect as the configuration using the pushbuttons on the AS‐Interface master module. Slave Configuration Data AS‐Interface Master Module ROM List of detected slaves (LDS) List of projected slaves (LPS) Configuration data image (CDI) Permanent configuration data (PCD) Configuration Parameter image (PI) Permanent parameter (PP) Manual Configuration Manual configuration is the procedure ...
Page 309
24: AS‐I M C NTERFACE ASTER OMMUNICATION Monitor AS‐Interface Slave While the MicroSmart is communicating with AS‐Interface slaves through the AS‐Interface bus, operating status of AS‐ Interface slaves can be monitored using WindLDR on a computer. Output statuses and parameter image (PI) can also be changed using WindLDR . To open the Monitor AS‐Interface Slaves dialog box, from the WindLDR menu bar, select Online > Monitor , then select > Monitor Slaves . Online Parameter Image (PI) Dialog Box Button Description Switch Slaves Switches between Slave A screen and Slave B screen. Monitor AS‐Interface Slaves Close Closes the window. Help Displays explanations for functions on the screen. Store Stores output statuses and parameters to the slave. Slave Status Close Closes the window.
Page 310
24: AS‐I M C NTERFACE ASTER OMMUNICATION Error Messages When an error is returned from the AS‐Interface master module, WindLDR will display an error message. The error codes and their meanings are given below. Error Code Description An error was found on the expansion I/O bus. While the AS‐Interface master module was in offline mode, attempt was made to perform auto config‐ uration or manual configuration. An incorrect command was sent. While slave address 0 existed on the bus, attempt was made to perform auto configuration or manual configuration. The AS‐Interface master module is in local mode. The slave you are trying to change does not exist. A slave of the designated new address already exists. While a standard slave was set at A address, attempt was made to set an A/B slave at B address of the same number. While an A/B slave was set at B address, attempt was made to set a standard slave at A address of the same number. Attempt was made to change the parameters of a slave which did not exist. When a reply message is not returned from the AS‐Interface master module, the following error message will be dis‐ played. 24‐38 FC5A M U ’...
24: AS‐I M C NTERFACE ASTER OMMUNICATION SwitchNet Data I/O Port (AS‐Interface Master Module 1) SwitchNet control units can be used as slaves in the AS‐Interface network and are available in ø16mm L6 series and ø22mm HW series. Input signals to the MicroSmart AS‐Interface master module are read to internal relays allocated to each input point designated by a slave number and a DI number. Similarly, output signals from the MicroSmart AS‐Inter‐ face master module are written to internal relays allocated to each output point designated by a slave number and a DO number. When programming a ladder diagram for the MicroSmart, use internal relays allocated to input signals and out‐ put signals of SwitchNet control units. L6 series and HW series SwitchNet control units have slightly different digital I/O data allocations. L6 Series Digital I/O Data Allocation Input data is sent from slaves to the AS‐Interface master. Output data is sent from the AS‐Interface master to slaves. Input Data Output Data SwitchNet L6 Series (slave send data) (slave receive data) Used I/O Slave Unit Pushbutton 1 in — — — Pilot light 1 out — — Illuminated pushbutton 1 in/1 out — — Selector, Key selector, Lever: 2‐position 1 in — — —...
Page 312
24: AS‐I M C NTERFACE ASTER OMMUNICATION HW Series Digital I/O Data Allocation Input data is sent from slaves to the AS‐Interface master. Output data is sent from the AS‐Interface master to slaves. Input Data Output Data Communication SwitchNet HW Series (slave send data) (slave receive data) Used I/O Block Mounting Slave Unit Position Pushbutton 1 in — — — Pilot light 1 out — — Illuminated pushbutton 1 in/1 out — — Selector, Key selector: 2‐position 1 in — — — 1 in — — — Selector, Key selector: 3‐position 1 in —...
25: E RS232C/RS485 C XPANSION OMMUNICATION Introduction This chapter describes communication examples using the FC5A‐SIF2 expansion RS232C communication module and FC5A‐SIF4 expansion RS485 communication module. For specifications of the expansion RS232C/RS485 communication modules, see page 2‐86 (Basic Vol.). Applicable CPU Modules FC5A‐C16R2/C/D FC5A‐C10R2/C/D FC5A‐C24R2/C FC5A‐D16RK1/RS1 FC5A‐D32K3/S3 FC5A‐D12K1E/S1E FC5A‐C24R2D — — 3 (Note) CPU module system program version 110 or higher is required to use the FC5A‐SIF2 expansion RS232C communication module. CPU module system program version 220 or higher is required to use the FC5A‐SIF4 expansion RS485 communication module. The system (Basic Vol.) program version can be confirmed using WindLDR. See page 13‐2 When the CPU module system program version is lower than the required version, you can download the latest system program using (Basic Vol.) WindLDR. See page A‐9 Note: The all‐in‐one 24‐I/O type CPU module cannot use the expansion RS232C/RS485 communication module in combination with function modules listed below. When using the expansion RS232C/RS485 communication module and these function modules, use the slim type CPU module. Function Module Type No. FC4A‐L03A1, FC4A‐L03AP1, FC4A‐J2A1, FC4A‐J4CN1, FC4A‐J8C1, FC4A‐J8AT1, FC4A‐K1A1, FC4A‐K2C1, Analog I/O Module FC4A‐K4A1 AS‐Interface Master Module FC4A‐AS62M Allocating Communication Port Number When expansion communication modules are mounted, port number starts with port 3 and ends with port RS232C/RS485 7 when a maximum of five expansion communication modules are mounted.
25: E RS232C/RS485 C XPANSION OMMUNICATION Computer Link Communication The computer link communication can be used with WindLDR on a PC connected to the CPU module to perform mainte‐ nance operations, such as download/upload user programs, start/stop the PLC, monitor the PLC status, and read/write device values. When the expansion communication module is mounted to the CPU module in a computer RS232C/RS485 link system, the computer link communication functions can be performed, except for Run‐Time Program Download. For details about the computer link communication, see pages 4‐1 (Basic Vol.) and 21‐1. System Setup Example Expansion RS232C Communication Module CPU Module FC5A‐SIF2 RS232C To Port 1 (RS232C) Computer Link Cable 4C FC2A‐KC4C 3m (9.84 ft.) long 24VDC Ð To Port 3 (RS232C) The communication cable is prepared by the user refer‐ ring to the diagram shown below. For the wiring precautions, see page 2‐89 (Basic Vol.). Note: Run‐Time Program Download cannot be used through the expansion RS232C/RS485 communication module. Note: When expansion RS485 communication module is used, connect a PC and the CPU module using a USB/RS485 converter from third party. Cable Connection and Pinouts (FC5A‐SIF2 Expansion RS232C Communication Module) FC5A‐SIF2 Computer (D‐sub 9‐pin) Terminal Description RS (RTS) ER (DTR) SD (TXD) RD (RXD) DR (DSR) SG (SG) Cover Shield...
Page 319
25: E RS232C/RS485 C XPANSION OMMUNICATION Cable Connection and Pinouts (FC5A‐SIF4 Expansion RS485 Communication Module) FC5A‐SIF4 Computer Terminal Description Shield Expansion RS232C/RS485 Communication Module Communication Parameter Range Parameter Optional Range Default Communication Mode Maintenance communication Baud Rate (bps) 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 (Note) 9600 Data Bits 7 or 8 Parity Even, Odd, None Even Stop Bits 1 or 2 10 to 2550 (10‐ms increments) Receive Timeout (ms) (Receive timeout is disabled when 0 is selected.) Network Number 0 to 31 Mode Selection Input Any input number Disabled Note: To use 57600 or 115200 bps, the CPU modules with system program version 220 or higher and FC5A‐SIF2 (version 200 or higher) or FC5A‐SIF4 are required. Notes: When downloading or uploading the user program, set the transfer mode to ASCII. To download or upload the user program, CPU modules with system program version 220 or higher and FC5A‐SIF4 are required.
Page 320
25: E RS232C/RS485 C XPANSION OMMUNICATION Computer Link Communication through the Expansion RS232C/RS485 Communication Module To perform the computer link communication using the expansion RS232C/RS485 communication module, a user pro‐ gram has to be downloaded through port 1 or 2 in the 1:1 computer link system as shown on page 25‐2. After download‐ ing the user program to the CPU module, the operating statuses of the CPU module can be monitored using WindLDR on the PC connected to the expansion RS232C/RS485 communication module. The operating procedures for computer link communication using expansion RS232C/RS485 communication module are as follows: 1. Connect the PC to communication port 1 or 2 (RS232C) on the CPU module using the computer link cable 4C (FC2A‐KC4C). 2. From the WindLDR menu bar, select Configuration > Comm. Ports. The Function Area Settings dialog box for Communication Ports appears. 3. In the Communication Mode pull‐down list for Port 3 through Port 7, select Maintenance Protocol. 4. The Communication Parameters dialog box appears. Change settings, if required. 1200, 2400, 4800, 9600, 19200, 38400, Baud Rate (bps) 57600, 115200 Data Bits 7 or 8 Parity Even, Odd, None Stop Bits 1 or 2 10 to 2550 (10‐ms increments) Receive Timeout (ms) (Receive timeout is disabled when 0 is selected.) Network Number 0 to 31 Mode Selection Input Any input number Note: When a mode selection input has been designated and the mode selection input is turned on, the selected communication parameters are enabled. When communication parameters are changed without designating a mode selection input, the changed communication parameters take effect immediately when the user program is downloaded. 5.
Page 321
25: E RS232C/RS485 C XPANSION OMMUNICATION 6. Click the OK button to save changes to the Function Area Settings. The Function Area Settings dialog box closes and the ladder editing screen becomes active. Next, download the user program through port 1 or 2 to the CPU module. 7. From the WindLDR menu bar, select Online > Download. The Download dialog box appears, 8. Click the OK button. The user program is downloaded to the CPU module. CPU Note: When downloading a user program, all values and selections in the Function Area Settings are also downloaded to the module 9. Connect the PC to communication port 3 through port 7 on the expansion RS232C/RS485 communication module. For terminal arrangement and wiring diagram, see page 2‐89 and 2‐90 (Basic Vol.). 10. Start WindLDR on the PC connected to the expansion RS232C/RS485 communication module. > Monitor. 11. From the WindLDR menu bar, select Online > Monitor The monitor screen appears, and you can monitor the MicroSmart operating statuses and change device values. FC5A M U ’ M FC9Y‐B1273 25‐5 ICRO MART ANUAL...
Page 322
25: E RS232C/RS485 C XPANSION OMMUNICATION Operator Interface Communication Using the expansion RS232C/RS485 communication module, the MicroSmart can communicate with IDEC’s HG series operator interfaces. To connect the HG series operator interface to the expansion RS232C/RS485 communication mod‐ ule, use a communication cable prepared by the user. For details about the communication settings and specifications, see the HG series operator interface user’s manual. System Setup Example Expansion RS232C Communication Module CPU Module FC5A‐SIF2 RS232C To Port 1 (RS232C) Computer Link Cable 4C FC2A‐KC4C 3m (9.84 ft.) long HG series Operator Interface 24VDC Ð To Port 3 (RS232C) The communication cable is prepared by the user refer‐ ring to the diagram shown below. For the wiring precautions, see page 2‐89 (Basic Vol.) Note: Run‐User programs cannot be downloaded and uploaded through the expansion RS232C communication module. HG2G, HG1F, HG2F, HG3F, HG4F, HG2S Applicable Operator Interfaces (HG series operator interfaces applicable to port 1 through port 7 can be used.) Cable Connection and Pinouts (RS232C) HG series Operator Interface FC5A‐SIF2 Description HG3G HG2G/HG3G HG2F/ Terminal HG1F HG2S (Connector) (Terminal Block)
Page 324
25: E RS232C/RS485 C XPANSION OMMUNICATION Operator Interface Communication through the Expansion RS232C/RS485 Communication Module To perform the operator interface communication using the expansion RS232C/RS485 communication module, a user program has to be downloaded through port 1 or 2 in the 1:1 computer link system as shown on page 25‐6. After down‐ loading the user program to the CPU module, the CPU module can communicate with the operator interface through the expansion RS232C/RS485 communication module. The operating procedures for operator interface communication are as follows: 1. Change the Function Area Settings, if required, and download the user program through communication port 1 or 2 (RS232C) on the CPU module. See step 1 through step 8 shown on pages 25‐4 and 25‐5. 2. Connect the operator interface to communication port 3 through port 7 on the expansion RS232C/RS485 communication module. For terminal arrangement and wiring diagram, see page 2‐89 and 2‐90 (Basic Vol.). Now the CPU module can communicate with the operator interface using communication port 3 through port 7. Note: When the refreshing cycle of display data on the operator interface is slow, see “Communication response is slow” on page 25‐13. 25‐8 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 325
25: E RS232C/RS485 C XPANSION OMMUNICATION User Communication The user communication function can be used for the MicroSmart to communicate with a PC, printer, and barcode reader through the expansion RS232C/RS485 communication module. For details about the user communication function, see page 10‐1 (Basic Vol.). Expansion RS232C/RS485 Communication Module Communication Parameter Range Parameter Optional Range Default Communication Mode User communication Baud Rate (bps) 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 (Note) 9600 Data Bits 7 or 8 Parity Even, Odd, None Even Stop Bits 1 or 2 10 to 2540 (10‐ms increments) Receive Timeout (ms) (Receive timeout is disabled when 0 or 2550 is selected.) Note: To use 57600 or 115200 bps, CPU modules with system program version 220 or higher and FC5A‐SIF2 (version 200 or higher) or FC5A‐SIF4 are required. User Communication through the Expansion RS232C Communication Module This section describes an example of user communication through the expansion RS232C communication module to send data to a printer. After downloading the user program to the CPU module, the CPU module can communicate with the printer through the expansion RS232C communication module. The operating procedures for user communication are as follows: 1. Change the Function Area Settings, if required, and download the user program through communication port 1 or 2 (RS232C) on the CPU module. See step 1 through step 8 shown on pages 25‐4 and 25‐5. 2. Connect the printer to communication port 3 through port 7 on the expansion RS232C communication module. For terminal arrangement and wiring diagram, see page 2‐89 (Basic Vol.).
Page 326
25: E RS232C/RS485 C XPANSION OMMUNICATION 4. In the Communication Mode pull‐down list for Port 3 through Port 7, select User Protocol. 5. The Communication Parameters dialog box appears. Change settings to meet the communication parameters of the remote device. See the user’s manual for the remote device. 1200, 2400, 4800, 9600, 19200, 38400, Baud Rate (bps) 57600, 115200 Data Bits 7 or 8 Parity Even, Odd, None Stop Bits 1 or 2 10 to 2540 (10‐ms increments) Receive Timeout (ms) (Receive timeout is disabled when 0 or 2550 is selected.) 6. Click the OK button to save changes. The Communication Parameters dialog box closes and the Communication page becomes active. 7. Click the OK button to save changes to the Function Area Settings. The Function Area Settings dialog box closes and the ladder editing screen becomes active. 8. Download the user program through communication port 1 or 2 (RS232C) on the CPU module. For the ladder program to control the printer, see page 25‐12. 25‐10 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 327
25: E RS232C/RS485 C XPANSION OMMUNICATION System Setup for Connecting a Printer Expansion RS232C Communication Module CPU Module FC5A‐SIF2 RS232C The communication cable is prepared by the user refer‐ ring to the diagram shown below. Printer For the wiring precautions, see page 2‐89 (Basic Vol.). 24VDC Ð To Port 3 (RS232C) Cable Connection and Pinouts FC5A‐SIF2 Printer (D‐sub 9‐pin) Terminal Description RS (RTS) No Connection ER (DTR) No Connection SD (TXD) DATA Receive Data RD (RXD) No Connection DR (DSR) Ground SG (SG) No Connection No Connection BUSY Busy Signal No Connection The name of BUSY terminal differs depending on printers, such as DTR. The function of this terminal is to send a signal to local equip‐ ment whether the printer is ready to print data or not. Since the operation of this signal may differ depending on printers, confirm the operation before connecting the cable.
Page 328
25: E RS232C/RS485 C XPANSION OMMUNICATION Setting Communication Parameters Set the communication parameters to match those of the printer. See page 25‐10. For details of the communication parameters of the printer, see the user’s manual for the printer. An example is shown below: Communication Parameters: Baud rate 9600 bps Data bits Parity None Stop bits Note: The receive timeout value is used for the RXD instruction in the user communication mode. Since this example uses only the TXD instruction, the receive timeout value has no effect. Ladder Diagram The second data stored in special data register D8014 is compared with 0 using the CMP= (compare equal to) instruction. Each time the condition is met, the TXD3 instruction is executed to send the C2 and D30 data to the printer. A counting circuit for counter C2 is omitted from this sample program. M8120 is the initialize pulse special internal relay. MOV(W) S1 – D1 – D8105 M8120 24 D8105 to enable the DSR option for busy control. M8125 is the in‐operation output special internal relay. CMP=(W) S1 – S2 – D1 – D8014 M8125 CMP=(W) compares the D8014 second data with 0. When the D8014 data equals 0 second, M0 is turned on. MOV(W) S1 – D1 – Counter C2 current value is moved to D31. MOV(W) S1 –...
Page 329
25: E RS232C/RS485 C XPANSION OMMUNICATION Troubleshooting This section describes the procedures to determine the cause of trouble and actions to be taken when any trouble occurs while operating the expansion RS232C/RS485 communication module. When a problem occurred, check the points and take the actions described below. If the problem cannot be solved, call IDEC for assistance. The PWR (power) LED does not go on. Check Action Page Basic Vol. Is power supplied to the CPU module? Supply power to the CPU module. 3‐18, 3‐19 Supply the rated power voltage. Basic Vol. Is the power voltage correct? All‐in‐one type: 100‐240V AC or 24V DC 3‐18, 3‐19 Slim type: 24V DC The expansion RS232C/RS485 communication module cannot communicate with WindLDR. Check Action Page Basic Vol. Is the communication cable connected correctly? Connect the communication cable correctly. 2‐89, 25‐2 Is the PWR LED on the CPU module on? See “The PWR (power) LED does not go on.” 25‐13 Basic Vol. Is the PWR LED on the FC5A‐SIF4 module flashing? Supply the rated voltage to the CPU module. 3‐1 Are the communication settings for WindLDR and expan‐...
Page 330
25: E RS232C/RS485 C XPANSION OMMUNICATION Data is not transmitted at all in the user communication. Check Action Page Basic Vol. Is the communication cable connected correctly? Make sure of correct wiring. 2‐89, 25‐11 Are the communication settings for the remote terminal Set the same communication parameters for expan‐ and expansion RS232C/RS485 communication port the 25‐10 sion communication port as the remote terminal. same? Upgrade the CPU module system program version Is the CPU module system program version applicable to Basic Vol. to 110 or higher to use the FC5A‐SIF2 or to 220 or the expansion RS232C/RS485 communication module? A‐9 higher to use the FC5A‐SIF4. Basic Vol. Is the correct port number designated in the TXD instruc‐ Designate a correct port number in the TXD instruc‐ tion? tion. 10‐7 Is the start input for the TXD instruction on? Turn on the start input for the TXD instruction. 25‐12 Is the PWR LED on the CPU module on? See “The PWR (power) LED does not go on.” 25‐13 Basic Vol. Is the PWR LED on the FC5A‐SIF4 module flashing? Supply the rated voltage to the CPU module. 3‐1 Data is not transmitted correctly in the user communication.
Page 331
25: E RS232C/RS485 C XPANSION OMMUNICATION Data is not received correctly in the user communication. Check Action Page Are the communication settings for the external device Set the same communication parameters for expan‐ 25‐10 and expansion communication port the same? sion communication port as the external device. Is the same data register designated as destination device Change the duplicate device to another data regis‐ Basic Vol. D2 (receive status) repeatedly? ter. 10‐15 Is a start delimiter specified in the RXD instruction? Are Correct the program to make sure that inputs to Basic Vol. inputs to more than 5 RXD instructions on simultane‐ more than 5 RXD instructions do not go on simulta‐ 10‐15 ously? neously. Make sure that the receive format of the RXD Basic Vol. Did you check the format of incoming data? instruction matches that of the incoming data. 10‐16 Make sure that the receive timeout value is larger Basic Vol. Is the receive timeout value set correctly using WindLDR? than character intervals of the incoming data. 10‐5 Did you make sure of source 1 device of the RXD instruc‐ Make sure that the receive data designated as the Basic Vol. tion? source 1 device is correct.
Page 332
25: E RS232C/RS485 C XPANSION OMMUNICATION 25‐16 FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 337
NDEX LCAL 11‐3 3‐5 MOVN 24‐26 3‐5 LDS.0 24‐24 5‐1 LED indicators , multiplication 24‐14 24‐16 5‐1 line N data connection 22‐2 repeat set 3‐14 linear conversion 12‐5 search 19‐5 list 3‐13 advanced instruction 2‐1 natural logarithm 18‐1 basic instruction 1‐1 NDSRC 19‐5 of active slaves (LAS) 24‐26 network number 21‐3 of detected slaves (LDS) 24‐26 no operation...
Page 338
NDEX power MUL instruction 18‐4 5‐8 supply request 24‐7 AS‐Interface and result codes 24‐3 24‐31 wiring table 24‐7 23‐4 resetting 24‐29 preparations for using modem modem , 22‐9 22‐4 22‐6 printer retry 25‐11 process variable before conversion cycles 14‐16 22‐3 processing time , interval 24‐18 24‐30 22‐3 profile reverse 24‐27 analog slave control action 24‐22...
Page 339
NDEX expansion capability TCCST 24‐4 3‐16 identification teaching timer 24‐4 15‐3 information telephone number , 24‐27 22‐3 22‐4 list information time 24‐26 profile addition 24‐27 20‐1 analog subtraction 24‐22 20‐5 receive data , timer 24‐39 24‐40 send data , instruction using with program branching 24‐39 24‐40 11‐2 SOTU/SOTD instructions using with program or counter branching as destination device 11‐2 2‐7...
Page 340
NDEX XY format set 12‐1 XYFS 12‐1 zero return 13‐26 ZRN1 13‐26 ZRN2 13‐26 ZRN3 13‐26 viii FC5A MicroSmart User’s Manual FC9Y‐B1273...
Page 341
FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Page 342
FC5A M U ’ M FC9Y‐B1273 ICRO MART ANUAL...
Need help?
Do you have a question about the microSmart pentra FC5A Series and is the answer not in the manual?
Questions and answers