Table of Contents

Advertisement

MASTER-K
Instructions & Programming
Read this manual carefully before installing,
wiring, operating, servicing or inspecting this
equipment.
Keep this manual within easy reach for
quick reference.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MASTER-K200S and is the answer not in the manual?

Questions and answers

Summary of Contents for LSIS MASTER-K200S

  • Page 1 MASTER-K Instructions & Programming Read this manual carefully before installing, wiring, operating, servicing or inspecting this equipment. Keep this manual within easy reach for quick reference.
  • Page 2 Chapter 1 Introduction Introductions ..................1-1 Features ....................1-1...
  • Page 3 Chapter 1. Introduction 1 Introductions Introductions The chapter 1 ‘Introduction’ will provide brief information about the features, functions, and operation of MASTER-K series PLC. Features 1) Features of MASTER-K series PLC are as following ; a) various programming device for easy programming. b) editing in RUN mode is available c) supports various open network with international standard communication protocol.
  • Page 4: Table Of Contents

    Chapter 2 Functions Performance Specifications ................2-1 2.1.1 K10S1 / K10S / K30S / K60S................2-1 2.1.2 K200S / K300S / K1000S ................2-2 Memory configuration map ................2-3 2.2.1 K10S1 .......................2-3 2.2.2 K10S / K30S / K60S..................2-4 2.2.3 K200S / K300S / K1000S ................2-5 Memory devices of MASTER- K series ............2-6 2.3.1 Input / output area : P..................2-6...
  • Page 5 2.4.6 High speed counter setting .................2-15 2.4.7 Interrupt setting .....................2-15 2.4.8 The reservation of I/O number allocation..........2-15 2.4.9 The output of Debug mode .................2-16 Operation processing of CPU................2-17 2.5.1 The repetitive operation................2-17 2.5.2 The operation mode of CPU ...............2-18 Special functions of MASTER- K series ............2-20 2.6.1 Interrupt functions ..................2-20 2.6.2...
  • Page 6: Performance Specifications

    Chapter 2. Functions 2 Functions Performance Specifications 2.1.1 K10S1 / K10S / K30S / K60S Items K10S1 K10S K30S K60S Program control method Cyclic execution of stored program I/O control method Indirect (Refresh) method Basic Numbers Instructions Application 3.2 ~ 7.6 ㎲/step 1.2 ㎲/step Processing speed Program capacity...
  • Page 7: K200S / K300S / K1000S

    Chapter 2. Functions 2.1.2 K200S / K300S / K1000S Items K200S K300S K1000S Cyclic execution of stored program, Time-driven interrupt, Event-driven Program control method interrupt I/O control method Indirect , Direct by program command Basic Numbers of Instructions Application 0.5 ㎲/step 0.2 ㎲/step Processing speed Program capacity...
  • Page 8: Memory Configuration Map

    Chapter 2. Functions Memory configuration map 2.2.1 K10S1 Bit Data Area Word Data Area User Program Area 0000 FFFF D000 I/O relay Data Register Parameter setting area (32 points) “P” Word (64 words) “D” User Program Auxiliary relay D063 Area (256 points) “M”...
  • Page 9: K10S / K30S / K60S

    Chapter 2. Functions 2.2.2 K10S / K30S / K60S Bit Data Area Word Data Area User Program Area 0000 FFFF D000 I/O relay Data Register Parameter setting area (96 points) “P” Word (256 words) “D” User Program Auxiliary relay D255 Area (512 points) “M”...
  • Page 10: K200S / K300S / K1000S

    Chapter 2. Functions 2.2.3 K200S / K300S / K1000S Bit Data Area Word Data Area User Program Area 0000 FFFF D0000 I/O relay Data Register Parameter setting area (See the remark) “P” Word “D” P x x 1 D xxxx User Program M000 Reserved for special usage...
  • Page 11: Memory Devices Of Master-K Series

    Chapter 2. Functions Memory devices of MASTER-K series 2.3.1 Input / output area : P The P devices are used for data transaction between the PLC CPU and external devices. The input devices hold ON/OFF data sent from external devices (e.g. pushbuttons, se lect switches, limit switches, digital switches, etc.) to input module.
  • Page 12: Auxiliary Relay : M

    Chapter 2. Functions < Figure 2. Flow of input / output data in the refresh mode > Input P ② Read ① Read Input Data memory P0000 P0020 module P0001 P0020 P0021 ④ Write Output P ⑤ Write Output ③ Read Data memory module CPU module...
  • Page 13: Keep Relay : K

    Chapter 2. Functions 2.3.3 Keep relay : K The K area functions as same as M area. However, the operation results are retained if the PLC is switched on or turned to RUN mode. The K area can be cleared by following methods; put the initialization routine in the sequence program.
  • Page 14: Timer Relay : T

    Chapter 2. Functions 2.3.6 Timer relay : T MASTER- K series have 100msec and 10msec timer. The timing method is v arious according to the timer instructions (TON, TOFF, TMR, TMON, TRTG). The maximum timer setting value is hFFFF by hexadecimal or 65535 by decimal. The following figure shows the types and timing methods of each timer instruction.
  • Page 15: Counter Relay : C

    Chapter 2. Functions 2.3.7 Counter relay : C The counter counts the rising edges of pulses driving its input signal and counts once only when the input signal is switched from off to on. MASTER- K series have 4 counter instructions such as CTU, CTD, CTUD, and CTR.
  • Page 16: Data Register : D

    Chapter 2. Functions 2.3.8 Data register : D The D area is used to store numeric data. Each data register consists of 16 bits (1 word) which is the unit of data read and write. The data resister number designated by the double-word instruction holds the lower 16 bits and the designated data register number + 1 holds the higher 16 bits.
  • Page 17: Special Relay : F

    Chapter 2. Functions 2.3.10 Special relay : F The F area is read- only relay and user can not change the value of F area. See the F relay table at the appendix for details. 2.3.11 Special M / L relay : M / L Some M or L relays are reserved for special usage.
  • Page 18: Parameter Setting

    Chapter 2. Functions Parameter setting 2.4.1 Watch dog timer setting (Applicable to K80S / 200S / K300S / K1000S only) Setting range : 10msec ~ 6000msec Setting unit : 10msec The default value of watch dog timer is 200msec. The watch dog timer of K10S1, K10S, K30S, and K60S is fixed as 200msec.
  • Page 19: Setting The Mode Of Cpu (Run / Stop) When An Error Is Occurred

    Chapter 2. Functions 2.4.4 Setting the mode of CPU (RUN / STOP) when an error is occurred (Applicable to K80S / 200S / K300S / K1000S only) When a non-critical error such as fuse blown or operation error, the CPU will keep running or stop operation according to the parameter se tting.
  • Page 20: High Speed Counter Setting

    Chapter 2. Functions 2.4.6 High speed counter setting (Applicable for K10S1, K10S, K30S, K60S) The block type models of MASTER- K series include the high speed counter function in the main module. When the ‘HSCNT’ instruction is used, the high speed counter parameters should be set with KGL-WIN or KLD -150S.
  • Page 21 Chapter 2. Functions 4) The example of I/O reservation a) Actual status of module mounting Power Relay Special Empty Relay Empty supply module Input Input Output module slot input output output module (Analog input) 16 Pts 32 Pts 16 Pts 16 Pts 16 Pts 16 Pts...
  • Page 22: Operation Processing Of Cpu

    Chapter 2. Functions Operation processing of CPU 2.5.1 The repetitive operation The repetitive operation method repeats execution of a series of operations The CPU repeats the operation processing as followings. Fig. 2-3 Operation processing of the CPU Input refresh Step : 0000 Step : 0001 Operation 1 Scan...
  • Page 23: The Operation Mode Of Cpu

    Chapter 2. Functions 2.5.2 The operation mode of CPU MASTER- K series has 4 operation modes as shown below. The arrow indicates that mode change is available. <Figure 2-4 Operation modes of MASTER-K series> Program mode mode Debug Pause mode mode 1) The flow of RUN mode Start RUN mode...
  • Page 24 Chapter 2. Functions 2) The flow of Program (PGM) mode Start PGM mode Turn the output off Self-diagnosis I/O refresh Check mode change - Program read / write / monitor can be performed in program mode. External wiring check is also possible with the forced I/O on/off function.
  • Page 25: Special Functions Of Master-K Series

    Chapter 2. Functions Special functions of MASTER-K series 2.6.1 Interrupt functions (Applicable for K200S / K300S / K1000S ) When an interrupt occurs, the CPU module will stop the current operation and execute the corresponding interrupt routine. After finish the interrupt routine, the CPU resume the sequence program from the stopped step.
  • Page 26 Chapter 2. Functions 1) Parameter setting K80S / 200S K300S K1000S Priority Type Period Priority Type Period Priority Type Period TDI0 10msec TDI0 10msec TDI0 10msec TDI2 25msec TDI2 25msec TDI2 25msec TDI5 100msec TDI5 100msec TDI5 100msec INT7 INT7 INT15 Remark a) Period is the interval of time driven interrupt occurring.
  • Page 27 Chapter 2. Functions 2) TDI (Time driven interrupt) TDI occurs periodically with the constant interval assigned in parameter setting. The interrupt routine of TDI starts with the TDINT instruction and ends with the IRET instruction. When multiple interrupt factors occur simultaneously, interrupt routines are executed according to the priority given to the each interrupt.
  • Page 28 Chapter 2. Functions 3) PDI (Process driven interrupt) PDI occurs when the input status of interrupt module is changed from OFF to ON or from ON to OFF. (Select by DIP switch setting) Since K200S does not have interrupt module, PDI will occur when the input assigned as interrupt input by parameter setting is changed from OFF to ON.
  • Page 29: Rtc (Real Time Clock) Function

    Chapter 2. Functions 2.6.2 RTC (Real Time Clock) function Since the RTC function is optio nal function, not all MASTER-K series support this function. Please refer the Catalog and CPU manual for applicable models. Clock operation by the RTC function is continued with a battery or super capacitor when the CPU is powered off.
  • Page 30 Chapter 2. Functions b) Write RTC data There is two ways to write new RTC data to the CPU. The first one is using a handy loader (KLD-150S) or graphic loader (KGL- WIN). For detailed information, refer the user’s manual of KLD -150S or KGL-WIN. The second one is write sequence program.
  • Page 31 Chapter 2. Functions 4) K80S / 200S / K300S / K1000S To read / write RTC data of K80S / 200S / K300S / K1000S is similar as K10S / K30S / K60S. The only difference is memory address of current / preset RTC data. See the following table. The current RTC data Description Memory Area...
  • Page 32: Forced I/O Setting

    Chapter 2. Functions 2.6.3 Forced I/O setting (Applicable for K80S / 200S / K300S / K1000S) It is possible to output a designated data regardless of the result of operation. This function is useful to check operation of the output modules and wiring between the output modules and external devices.
  • Page 33: Program Edit In Run Mode

    Chapter 2. Functions Example 2) Switch On/Off the last bit of P07 word (K1000S) Write the forced I/O data (h0001) to the corresponding data word. P10 is matched to the D9807 word. <D9807 word> Write the forced I/O address (last bit = h0001) to the corresponding address word. Write h0001 to the D9707.
  • Page 34: Self-Diagnosis

    Chapter 2. Functions 2.6.5 Self-diagnosis 1) WDT (Watch dog timer) function The watch dog timer is an internal timer of a PLC to detect the error of hardware and a sequence program. The default value is set as 200msec, and it is changeable with parameter setting.
  • Page 35: Program Check

    Chapter 2. Functions Program check 2.7.1 JMP – JME 1) If the input condition of JMP n instruction is turned on, the CPU skips all instructions until JME n instruction. The skipped instructions are processed as NOP instruction. Max. 128 JMP- JME can be used.
  • Page 36: Call , Sbrt / Ret

    Chapter 2. Functions 2.7.2 CALL , SBRT / RET 1) CALL n, CALLP n : The CALL(P) instruction executes the subroutine program specified by the pointer ‘n ’. Multiple levels of nesting of the CALL(P) instruction are allowed. 2) SBRT / RET SBRT instruction shows the start of subroutine program, and RET shows the end.
  • Page 37: Mcs - Mcsclr

    Chapter 2. Functions 2.7.3 MCS – MCSCLR The MCS n instruction starts a master control sequence. Each MCS instructions are followed by a number (n) that shows the priority of the master control. The range of n is 0 ~ 7. 0 : High ⋅...
  • Page 38: For - Next

    Chapter 2. Functions 2.7.4 FOR – NEXT (Applicable for K200S / K300S / K1000S) FOR and NEXT instructions should be in pairs, and each pairs should be start by FOR instructions. The maximum nesting level of FOR-NEXT block is 5. If there is a stand- alone FOR or NEXT instruction or the nesting level exceeds 6, a program error occurs and CPU stops operation.
  • Page 39: End / Ret

    Chapter 2. Functions 2.7.5 END / RET 1) If there is no END in a sequence program, a program error occurs and CPU stops operation. LOAD P012 : Missing END 2) If there is no RET in a subroutine program, a program error occurs and CPU stops operation. SBRT LOAD P000...
  • Page 40: Error Handling

    Chapter 2. Functions Error handling 2.8.1 RUN / STOP at operation error When an operation error (indirect addressing error, BCD operation error, etc) occurs, the CPU decide to continue operation or not based on parameter setting. Refer the chapter 2.4.4 for details. 2.8.2 Error flags (F110 / F115) If an error occurs while the CPU is running, 2 error flags (F110 and F115) are switched on.
  • Page 41: Led Indication

    Chapter 2. Functions 2.8.3 LED indication 1) K10S1 / K10S / K30S / K60S / K80S LED Name Operating Status LED Indication · Serious error · Light error Flickering with 1sec period · Program or parameter error · CPU is in RUN mode Always ON ·...
  • Page 42: Error Code List

    Chapter 2. Functions 2.8.4 Error code list Code Error type Message Description Corrective action (F006) Internal The operating system ROM or other Contac t the nearest System error h0001 Stop system error H/W is defective. LG representative OS ROM OS ROM Contact the nearest h0002 Stop...
  • Page 43 Chapter 2. Functions Error Code (Continued) Code Error type Message Description Corrective action (F006) When the CPU is powered on or turned to Change parameter I/O parameter I/O parameter h0021 Stop RUN mode, I/O modules are not mounted setting or re-arrange error error as I/O reservation of parameter setting.
  • Page 44 Chapter 3 Instructions Basic instructions ..................3-1 3.1.1 Contact instructions ..............3-1 3.1.2 Connection instructions ............3-1 3.1.3 Inversion instruct i on ..............3-1 3.1.4 Master control instructions ............3-2 3.1.5 Output instructions ..............3-2 3.1.6 Step controller instructions ............3-2 3.1.7 END instruction .................3-2 3.1.8 No operation instruction............3-3 3.1.9 Timer instructions..............3-3 3.1.10 Counter instructions ..............3-4...
  • Page 45 3.2.15 Flag instructions ..............3-18 3.2.16 Special module instructions ..........3-18 3.2.17 Data link instructions ..............3-18 3.2.18 Interrupt instructions...............3-19 3.2.19 Sign inversion instructrions ...........3-19 3.2.20 Bit contact instructions ............3-20...
  • Page 46 Chapter 3. Instructions 3 Instructions Basic instructions 3.1.1 Contact instructions Mnemonic Function Ladder symbol Contents of processing Page symbol ○ LOAD NO contact operation start 4- 1 ○ LOAD NOT NC contact operation start 4- 1 ○ NO contact series connection 4- 3 ○...
  • Page 47: Output Instructions

    Chapter 3. Instructions 3.1.4 Master control instructions Mnemonic Function Page Ladder symbol Contents of processing symbol ○ Start a master control 4- 13 ○ MCSCLR End a master control 4 – 13 MCSCLR n 3.1.5 Output instructions Mnemonic Function Ladder symbol Contents of processing Page symbol...
  • Page 48: No Operation Instruction

    Chapter 3. Instructions 3.1.8 No operation instruction Mnemonic Function Page Ladder symbol Contents of processing symbol ○ No ladder symbol No operation (occupies 1 step) 4- 26 3.1.9 Timer instructions Mnemonic Function Page Ladder symbol Contents of processing symbol <On delay timer> Ti m er setti n g val u e Input TON Txxx...
  • Page 49: Counter Instructions

    Chapter 3. Instructions 3.1.10 Counter instructions Mnemonic Function Page Ladder symbol Contents of processing symbol Counter relay Reset Count ↓ Pul s e Count U C T U C xxx Pulse ○ 4- 37 Reset Current Setting R <S> value value ↑...
  • Page 50: Application Instructions

    Chapter 3. Instructions Application instructions 3.2.1 Data transfer instructions Mnemonic Function Ladder symbol Contents of processing Page symbol Move data ○ MOVP MOVP DMOV DMOV Move data ○ DMOVP + 1, + 1, DMOVP CMOV CMOV Complement data move ○ CMOVP CMOVP DCMOV...
  • Page 51: Conversion Instructions

    Chapter 3. Instructions 3.2.2 Conversion instructions Mnemonic Function Page Ladder symbol Contents of processing symbol BCD conversion ○ 5-11 Binary BCDP BCDP DBCD BCD conversion DBCD ○ 5-11 Binary DBCDP + 1, + 1, DBCDP BIN conversion ○ 5-14 Binary BINP BINP DIND...
  • Page 52 Chapter 3. Instructions Comparison instructions (Continued) Mnemonic Function Page Ladder symbol Contents of processing symbol LOAD= S1 S2 5-21 The input condition is switched on ★ 5-22 AND= S1 S2 when [S1] = [S2] 5-23 S1 S2 LOAD> > S1 S2 5-21 The input condition is switched on ★...
  • Page 53 Chapter 3. Instructions Comparison instructions (Continued) Mnemonic Function Page Ladder symbol Contents of processing symbol LOADD= S1 S2 5-21 The input condition is switched on ★ ANDD= S1 S2 5-22 when [S1+1, S1] = [S2+1, S2] 5-23 ORD= S1 S2 LOADD>...
  • Page 54: Increment / Decrement Instructions

    Chapter 3. Instructions 3.2.4 Increment / Decrement instructions Mnemonic Function Page Ladder symbol Contents of processing symbol Increment ○ 5-24 INCP ] +1 INCP DINC Increment DINC ○ 5-24 DINCP ] +1 DINCP Decrement ○ 5-26 DECP ] -1 DECP DDEC DDEC Decrement...
  • Page 55: Shift Instructions

    Chapter 3. Instructions Rotation instructions (Continued) Mnemonic Function Page Ladder symbol Contents of processing symbol Carry 0 15 DROL DROL ○ 5-28 DROLP DROLP 1 bit rotate to left Carry 0 15 DROR DROR ○ 5-30 DRORP DRORP 1 bit rotate to right Carry 0 15 DRCL...
  • Page 56: Exchange Instructions

    Chapter 3. Instructions 3.2.7 Exchange instructions Mnemonic Function Page Ladder symbol Contents of processing symbol D1 D2 ○ [ D1 ] [ D2 ] 5-42 XCHP D1 D2 XCHP DXCH D1 D2 DXCH ○ [ D1+1, D1 ] [ D2+1, D2 ] 5-42 DXCHP D1 D2...
  • Page 57 Chapter 3. Instructions BIN arithmetic instructions (Continued) Mnemonic Function Page Ladder symbol Contents of processing symbol [ S1 ]÷[ S2 ] [ D ] S1 S2 ○ [D+1] = Remainder 5-50 DIVP DIVP S1 S2 [D] = Quotient [S1+1, S1] ÷ [S2+1, S2] S1 S2 DDIV DDIV...
  • Page 58: Bcd Arithmetic Instructions

    Chapter 3. Instructions 3.2.9 BCD arithmetic instructions Mnemonic Function Page Ladder symbol Contents of processing symbol ADDB S1 S2 ADDB BCD addition ○ 5-52 ADDBP S1 S2 ADDBP [ S1 ] + [ S2 ] [ D ] S1 S2 DADDB DADDB BCD addition...
  • Page 59: Logical Opration Instructions

    Chapter 3. Instructions 3.2.10 Logical opration instructions Mnemonic Function Page Ladde r symbol Contents of processing symbol S1 S2 WAND WAND ○ [ S1 ] AND [ S2 ] [ D ] 5-60 WANDP S1 S2 WANDP S1 S2 DWAND DWAND [S1+1,S1] AND [S2+1,S2] ○...
  • Page 60: Data Processing Instructions

    Chapter 3. Instructions 3.2.11 Data processing instructions Mnemonic Function Page Ladder symbol Contents of processing symbol D Cw 7 Segment decode ○ 5-68 SEGP [ S ] [ D ] D Cw SEGP decoding D Cw Converts the data of [S] into ASCII ○...
  • Page 61 Chapter 3. Instructions Data processing instructions (Continued) Mnemonic Function Page Ladder symbol Contents of processing symbol File table write FILW FILW ○ 5-81 [S+n] FILWP FILWP File table write DFILW DFILW [S+n] ○ 5-81 [S+n+1] DFILWP DFILWP [D+1] 4bits When ○...
  • Page 62: System Instructions

    Chapter 3. Instructions 3.2.12 System instructions Mnemonic Function Page Ladder symbol Contents of processing symbol ★ 5-89 FALS FALS Stores n to specified F area Generate a clock pulse as below ○ DUTY DUTY n1 n2 5-90 n2 scans n1 scans ★...
  • Page 63 Chapter 3. Instructions 3.2.15 Flag instructions Mnemonic Function Page Ladder symbol Contents of processing symbol Set the carry flag ○ 5-102 Clear the carry flag ★ 5-103 Clear the error flag 3.2.16 Special module instructions Mnemonic Function Ladder symbol Contents of processing Page symbol Read data from shared RAM of...
  • Page 64 Chapter 3. Instructions 3.2.18 Interrupt instructions Mnemonic Function Page Ladder symbol Contents of processing symbol Enable an interrupt ★ 5-119 Disable an interrupt Enable all interrupts ★ 5-119 Disable all interrupts TDINT n TDINT Start of TDI routine 5-120 ★ Start of PDI routine 5-121 IRET...
  • Page 65 Chapter 3. Instructions 3.2.20 Bit contact instructions Mnemonic Function Page Ladder symbol Contents of processing symbol NO contact operation start with the ★ 5-124 bit of [ D ] NC contact operation start with the ★ BLDN 5-124 bit of [ D ] NO contact series connection with ★...
  • Page 66 Chapter 4 Basic instructions Contact instructions ..................4-1 4.1.1 LOAD, LOAD NOT, OUT ............4-1 4.1.2 AND, AND NOT ................4-3 4.1.3 OR, OR NOT ................4-4 Connection instructions ................4-6 4.2.1 AND LOAD .................4-6 4.2.2 OR LOAD...................4-8 4.2.3 MPUSH, MLOAD, MPOP ............4-10 Inversion instruction ..................4-12 4.3.1 NOT ...................4-12 Master control instructions ...............4-13...
  • Page 67 4.9.3 TMR ..................4-32 4.9.4 TMON ..................4-34 4.9.5 TRTG ..................4-36 4.10 Counter instructions ..................4-38 4.10.1 CTU ...................4-38 4.10.2 CTD ...................4-39 4.10.3 CTUD ..................4-40 4.10.4 CTR ...................4-42...
  • Page 68: Contact Instructions

    Chapter 4. Basic instructions 4 Basic instructions Contact instructions 4.1.1 LOAD, LOAD NOT, OUT LOAD LOAD NOT Flag Available Device Instructions Error Zero Carry D Integer (F110) (F111) (F112) LOAD LOAD NOT LOAD LOAD NOT * Available only when do not use computer link module or data link module 1) LOAD a) Functions Starts a NO contact.
  • Page 69 Chapter 4. Basic instructions 4) Program example When the input condition (P020) is switched on, the P060 and P061 will be switched on and the P062 will be switched off. [ Program ] P020 P060 P061 LOAD P020 P063 LOAD NOT [ Time chart ] P020 P060...
  • Page 70: And, And Not

    Chapter 4. Basic instructions 4.1.2 AND, AND NOT AND NOT Flag Available Device Instructions Error Zero Carry D Integer (F110) (F111) (F112) AND NOT AND NOT 1) AND a) Functions The NO contact series connection Read the on/off data of the specified device ( ), performs the AND operation of that data and the previous operation result, and use it as a new operation result.
  • Page 71: Or, Or Not

    Chapter 4. Basic instructions 4.1.3 OR, OR NOT OR NOT Flag Available Device Instructions Error Zero Carry D Integer (F110) (F111) (F112) OR NOT OR NOT 1) OR a) Functions The NO contact parallel connection Draw the on/off data of the specified device ( ), performs the OR operation of that data and the previous operation result, and use it as a new operation result.
  • Page 72 Chapter 4. Basic instructions The motor operation (Example of LOAD, AND, OR, OUT instructions) 1. Operation There are three push- button switches - PB0, PB1, and PB2. When PB1 is pushed, a motor will start to rotate with a forward (clockwise) direction. It will start to rotate with a reverse (counterclockwise) direction when the PB2 is pushed.
  • Page 73: Connection Instructions

    Chapter 4. Basic instructions Connection instructions 4.2.1 AND LOAD AND LOAD Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) AND LOAD AND LOAD Block A Block B 1) Functions Performs the AND operation of block A and block B, and uses it as an operation result. The AND LOAD instruction can be written consecutively up to 7 times.
  • Page 74 Chapter 4. Basic instructions [ NOTE ] The consecutive use of the AND LOAD instruction There are two methods to connect several blocks in serial. See the following example. [ Ladder program ] M000 M002 M004 M006 M008 ( P060 ) M001 M003 M004...
  • Page 75: Or Load

    Chapter 4. Basic instructions 4.2.2 OR LOAD OR LOAD Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) OR LOAD Block A Block A 1) Functions Performs the OR operation of block A and block B, and uses it as an operation result. The AND LOAD instruction can be written consecutively up to 7 times.
  • Page 76 Chapter 4. Basic instructions [ NOTE ] The consecutive use of the OR LOAD instruction There are two methods to connect several blocks in parallel. See the following example. [ Ladder program ] M000 M001 ( P060 ) M002 M003 M004 M005 M006...
  • Page 77: Mpush, Mload, Mpop

    Chapter 4. Basic instructions 4.2.3 MPUSH, MLOAD, MPOP MPUSH FUN (005) MPUSH MLOAD FUN (006) MLOAD MPOP FUN (007) MPOP Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) MPUSH MLOAD MPOP MPUSH MLOAD MPOP 1) Functions a) MPUSH : Stores the operation result (On/Off) immediately preceding the MPUSH instruction. b) MLOAD : Reads the operation result stored by the MPUSH instruction and resume the operation with that operation result, starting at the next step.
  • Page 78 Chapter 4. Basic instructions 2) Program example [ Ladder program ] P020 P021 P022 P023 P024 P060 00000 P025 P061 P026 P062 P027 P063 P028 P064 P029 P065 P02A P066 00027 [ Mnemonic program ] STEP INSTRUCTION 0000 LOAD P020 0001 MPUSH 0002...
  • Page 79: Inversion Instruction

    Chapter 4. Basic instructions Inversion instruction 4.3.1 Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) 1) Functions Inverts the operation result before the NOT instruction. Before NOT instruction After NOT instruction NC contact NO contact NO contact NC contact Serial (AND) connection Parallel (OR) connection...
  • Page 80: Master Control Instructions

    Chapter 4. Basic instructions Master control instructions 4.4.1 MCS, MCSCLR FUN (010) MCS MCSCLR FUN (011) MCSCLR Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) MCSCLR - n (Nesting) : up to 7 MCSCLR 1) Functions When the On/Off command of MCS instruction is switched on, the sequence program between the MCS instruction and the MCSCLR instruction that has same n of the MCS instruction is executed.
  • Page 81 Chapter 4. Basic instructions 2) Program example Use 2 master control blocks (MCS 0 and MCS 1), and they are cleared with MCSCLR 0 instruction. The MCS 1 block is cleared automatically. P030 0000 P031 P060 MCS 0 block 0002 P032 0004 P061...
  • Page 82 Chapter 4. Basic instructions The circuit with common line (Example of MCS, MCSCLR instructions) The below relay circuit can not be programmed into PLC program directly. Therefore, it should be programmed with master control. ( MCS and MCSCLR instructions ) [ Relay circuit ] Manual Automatic...
  • Page 83: Output Instructions

    Chapter 4. Basic instructions Output instructions 4.5.1 Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) O O* Device to be output the operation result * Available only when do not use computer link module or data link module 1) Functions - Outputs the operation result to the bit device specified as [ D ].
  • Page 84 Chapter 4. Basic instructions 4.5.2 FUN (017) D Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) O O* Device to be converted into pulse * Available only when do not use computer link module or data link module 1) Functions The D instruction turns on the specified device for one scan when the input condition of D instruction is turned on.
  • Page 85 Chapter 4. Basic instructions The on / off toggle control (Example of D instructions) 1. Operation When the push -button PB0 is pushed, the P060 is switched on. It is switched off when the PB0 is pushed again. The P060 will repeat on / off whenever the PB0 is pushed. 2.
  • Page 86: D Not

    Chapter 4. Basic instructions 4.5.3 D NOT D NOT FUN (018) D NOT Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) D NOT O O* Device to be converted into D NOT pulse * Available only when do not use computer link module or data link module Functions The D instruction turns on the specified device for one scan when the input condition of D instruction is turned on.
  • Page 87: Set

    Chapter 4. Basic instructions 4.5.4 Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) O O* * Available only when do not use computer link module or data link module 1) Functions When the input condition of SET instruction turns on, the specified device is switched on. The turned- on device remains on even if the input condition of SET instruction is turned off.
  • Page 88: Rst

    Chapter 4. Basic instructions 4.5.5 Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) O O* * Available only when do not use computer link module or data link module 1) Functions When the input condition of RST instruction turns on, the specified device is changed as described Device Status M, P, K, L...
  • Page 89 Chapter 4. Basic instructions The countermeasure of power failure (The difference of P area and K area) 1. The difference of I/O relay (P) and keep relay (K) with the OUT instruction The following program shows the difference of P area and K area. Both of P060 and K000 have self- locking circuit, and the operation of two contact is same.
  • Page 90: Set Sxx.xx

    Chapter 4. Basic instructions Step controller instructions 4.6.1 SET Sxx.xx SET S Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) SET S S xx.xx SET S xx.xx Step No. (00 ~ 99) * K10S1 : 0 ~ 15 K10S / K30S / K60S : 0 ~ 31 Group (00 ~ 99*)
  • Page 91 Chapter 4. Basic instructions The sequential control ( example of SET Sxx.xx instruction) 1. Operation This program shows briefly an example of sequential control by using SET Sxx.xx instruction. In this example, there are 4 processes and each process is performed in sequence. The process 2 starts after the pr ocess 1 ended, and process 3 starts after the process 2 finished.
  • Page 92: Out Sxx.xx

    Chapter 4. Basic instructions 4.6.2 OUT Sxx.xx OUT S Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) OUT S Sxx.xx S xx.xx Step No. (00 ~ 99) * K10S1 : 0 ~ 15 Group (00 ~ 99*) K10S / K30S / K60S : 0 ~ 31 K200S / K300S / K1000S...
  • Page 93: End Instructions

    Chapter 4. Basic instructions End instructions 4.7.1 FUN (001) END Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) 1) Functions The END instruction indicates the en d of sequence program. When the CPU meet the END instruction, it stops the execution of sequence program and perform the END process. All instructions after END instruction except subroutines and interrupt routine are ignored and not executed.
  • Page 94: No Operation Instruction

    Chapter 4. Basic instructions No operation instruction 4.8.1 FUN (000) NOP Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) No ladder symbol (Only available in mnemonic mode) 1) Functions This is a no operation instruction and has no effect on the previous operation result. The NOP instruction is used in the following cases ;...
  • Page 95: Timer Instructions

    Chapter 4. Basic instructions Timer instructions 4.9.1 On-delay timer Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Txxx Timer setting value Input condition Txxx Timer contact number ∴ Setting time ( t ) = Unit period (0.1 or 0.01 sec) x Setting value 1) Functions A timer consists of timer contact, current value, and setting value.
  • Page 96 Chapter 4. Basic instructions A flickering lamp (example of TON instruction) 1. Operation By using two timers, a lamp flickers periodically while the P020 is on. 2. System diagram Output module Input module Start P020 Program 3. Program [Ladder program] P020 T001 T000...
  • Page 97: Toff

    Chapter 4. Basic instructions 4.9.2 TOFF TOFF Off-delay timer Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Txxx TOFF Timer setting value Input condition TOFF Txxx Timer contact number ∴ Setting time ( t ) = Unit period (0.1 or 0.01 sec) x Setting value Functions A timer consists of timer contact, current value, and setting value.
  • Page 98 Chapter 4. Basic instructions A conveyer control (example of TOFF instruction) 1. Operation Operate three conveyers (A, B, C) in sequence by using TOFF timers. (Start : A – B – C, Stop : C – B – A) 2. System diagram Input module Output module On/Off...
  • Page 99: Tmr

    Chapter 4. Basic instructions 4.9.3 Integrati n g timer Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Txxx Timer setting value Input condition Txxx Timer contact number ∴ Setting time ( t ) = Unit period (0.1 or 0.01 sec) x Setting value 1) Functions The current value will increase by 1 while the input condition is on.
  • Page 100 Chapter 4. Basic instructions An alarm of drill replacement (example of TMR instruction) 1. Operation The total usage time of the drill of a machining center is counted by PLC. If the total usage time exceeds the lifetime of drill (100 hours), the PLC outputs an alarm signal to notice that a replacement of drill is required.
  • Page 101: Tmon

    Chapter 4. Basic instructions 4.9.4 TMON TMON Monostable timer Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Txxx TMON Timer setting value Input condition TMON Txxx Timer contact number ∴ Setting time ( t ) = Unit period (0.1 or 0.01 sec) x Setting value Functions When the input condition turns on, the current value will be set as the setting value and starts to decrease.
  • Page 102 Chapter 4. Basic instructions A chattering prevention circuit (example of TMON instruction) 1. Operation A input signal from limit switch has chattering noise. By using TMON instruction, a stabilized signal can be obtained from a noisy input signal. 2. System diagram Input module The limit switch output with low speed of cart...
  • Page 103: Trtg

    Chapter 4. Basic instructions 4.9.5 TRTG TRTG Retrigerrable timer Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Txxx TRTG Timer setting value Input condition TRTG Txxx Timer contact number ∴ Setting time ( t ) = Unit period (0.1 or 0.01 sec) x Setting value Funct i ons When the input condition turns on, the current value will be set as the setting value and starts to decrease.
  • Page 104 Chapter 4. Basic instructions The fault of conveyer detecting circuit (example of TRTG instruction) 1. Operation Detect the fault of conveyer by check that a product is passed within a specified period or not. 2. System diagram Input module Supplier Detector Conveyer 3.
  • Page 105: Counter Instructions

    Chapter 4. Basic instructions 4.10 Counter instructions 4.10.1 CTU Up counter Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Cxxx Counter contact number Count pulse U C T U C xxx Reset signal R <S> Setting value 1) Functions Whenever a rising edged is detected at the count pulse input, the current value is increased by 1 The initial current value is 0 and when the current value is reached to the setti ng value, the counter...
  • Page 106: Ctd

    Chapter 4. Basic instructions 4.10.2 CTD Down counter Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Cxxx Counter contact number Count pulse U C T D C xxx Reset signal R <S> Setting value 1) Functions Whenever the rising edge is detected from counter pulse input, the current value is decreased by 1. The initial current value is the setting value, and when the current value reached to 0, the counter contact is switched on.
  • Page 107: Ctud

    Chapter 4. Basic instructions 4.10.3 CTUD CTUD Up-down counter Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Cxxx CTUD Counter contact number Up count U CTUD C xxx Down count Reset signal R <S> Setting value 1) Functions Whenever a rising edged is detected from up count input, the current value is increased by 1.
  • Page 108 Chapter 4. Basic instructions A control circuit for motor operation (example of CTUD instruction) 1. Operation There are 4 motors controlled by PLC. Whenever the push - button PB1 is pressed, the numbers of operating motor is increased by 1. The PB2 decreases the numbers of operating motor whenever it is pressed.
  • Page 109: Ctr

    Chapter 4. Basic instructions 4.10.4 CTR Ring counter Available Device Flag Instructions Error Zero Carry Integer (F110) (F111) (F112) Cxxx Counter contact number Count pulse U C T R C xxx Reset signal R <S> Setting value 1) Functions Whenever a rising edge is detected at the count pulse input, the current value is increased by 1. If the current value is reached to t h e setting value, the counter contact is switched on.
  • Page 110 Chapter 5 Application instructions 5.1 Data transfer instructions ............5-1 5.1.1 MOV, MOVP, DMOV, DMOVP............5-1 5.1.2 CMOV, CMOVP, DCMOV, DCMOVP..........5-3 5.1.3 GMOV, GMOVP..................5-5 5.1.4 FMOV, FMOVP...................5-7 5.1.5 BMOV, BMOVP...................5-9 5.2 Conversion instructions ............5-11 5.2.1 BCD, BCDP, DBCD, DBCDP............5-11 5.2.2 BIN, BINP, DBIN, DBINP..............5-14 5.3 Comparison instructions ............5-16 5.3.1...
  • Page 111 5.7.1 XCHG, XCHGP, DXCHG, DXCHGP..........5-42 5.8 BIN arithmetic instructions...........5-44 5.8.1 ADD, ADDP, DADD, DADDP............5-44 5.8.2 SUB, SUBP, DSUB, DSUBP............5-46 5.8.3 MUL, MULP, DMUL, DMULP............5-48 5.8.4 MUL, MULP, DMUL, DMULP............5-50 5.8.5 DIV, DIVP, DDIV, DDIVP ..............5-52 5.8.6 DIVS, DIVSP, DDIVS, DDIVSP ............5-54 5.9 BCD arithmetic instructions ..........
  • Page 112 5.14 Loop instructions............5-104 5.14.1 FOR, NEXT ..................5-104 5.14.2 BREAK.....................5-105 5.15 Flag instructions............5-106 5.15.1 STC, CLC ..................5-106 5.15.2 CLE....................5-107 5.16 Special module instructions..........5-108 5.16.1 GET, GETP..................5-108 5.16.2 PUT, PUTP..................5-110 5.17 Data link instructions ............. 5-112 5.17.1 READ....................5-112 5.17.2 WRITE....................5-115 5.17.3 RGET ....................5-117 5.17.4 RPUT....................5-120...
  • Page 113: Data Transfer Instructions

    Chapter 5. Application instructions 5 Application Instructions Data transfer instructions 5.1.1 MOV, MOVP, DMOV, DMOVP FUN(80) MOV FUN(82) DMOV Applicable All CPUs (Move) FUN(81) MOVP FUN(83) DMOCP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) MOV(P) O O O O* O O DMOV(P)
  • Page 114 Chapter 5. Application instructions Execution condition Input condition MOV, DMOV Executed per scan Executed per scan MOVP, DMOVP Executed only once Executed only once 2) Program example Whenever a rising edge is detected at the P020, the ‘h00F3’ is moved to the P04 word. P020 MOVP h70F3...
  • Page 115: Cmov, Cmovp, Dcmov, Dcmovp

    Chapter 5. Application instructions 5.1.2 CMOV, CMOVP, DCMOV, DCMOVP CMOV FUN(84) CMOV FUN(86) D CMOV Applicable All CPUs (Complement move) FUN(85) CMOVP FUN(87) D CMOCP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) CMOV(P) O O O O* O O DCMOV(P) O O O O Operand setting...
  • Page 116 Chapter 5. Application instructions Execution conditions Input condition CMOV, DCMOV Executed per scan Executed per scan CMOVP, DCMOVP Executed only once Executed only once 2) Program example While the M020 is on, reverse the data of P02 word and transfer the result to P06 word. M020 CMOV 16 bits...
  • Page 117: Gmov, Gmovp

    Chapter 5. Application instructions 5.1.3 GMOV, GMOVP GMOV FUN(90) GMOV Applicable All CPUs (Group move) FUN(91) GMOVP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* O O GMOV O O O O* GMOVP Operand setting The start address of source...
  • Page 118 Chapter 5. Application instructions Execution conditions Input condition GMOV Executed per scan Executed per scan GMOVP Executed only once Executed only once 2) Program example While the P020 is on, move the data of D000, D001, and D002 to P04, P05, and P06 area. P020 GMOV D0000...
  • Page 119: Fmov, Fmovp

    Chapter 5. Application instructions 5.1.4 FMOV, FMOVP FMOV FUN(92) FMOV Applicable All CPUs (File move) FUN(93) FMOVP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* O O FMOV O O O O* FMOVP Operand setting The device at which source...
  • Page 120 Chapter 5. Application instructions Execution condition Input condition FMOV Executed per scan Executed per scan FMOVP Executed only once Executed only once 2) Program example Whenever a rising edge is detected at P030, transfer the content of P02 word to the block of P04, P05, and P06.
  • Page 121: Bmov, Bmovp

    Chapter 5. Application instructions 5.1.5 BMOV, BMOVP BMOV FUN(100) BMOV Applicable All CPUs (Bit move) FUN(101) BMOVP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* O O BMOV O O O O* BMOVP Operand setting The device at which source...
  • Page 122 Chapter 5. Application instructions Execution condition Input condition BMOV Executed per scan Executed per scan BMOVP Executed only once Executed only once 2) Program example - Whenever a rising edge is detected at the P030, transfer 4 bits from the P020 bit to the 4 bits from the P063 bit.
  • Page 123: Conversion Instructions

    Chapter 5. Application instructions Conversion instructions 5.2.1 BCD, BCDP, DBCD, DBCDP FUN(60) BCD FUN(62) DBCD Applicable All CPUs (Binary coded FUN(61) BCDP FUN(63) DBCDP decimal) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) BCD(P) O O O O* O O O O O O DBCD(P) Operand setting...
  • Page 124 Chapter 5. Application instructions Execution conditions Input condition BCD, DBCD Executed per scan Executed per scan BCDP, DBCDP Executed only once Executed only once Operation Error In the following cases, operation error occurs and the error flag (F110) turns on. a) When BCD(P) instruction is used The data of source [ S ] is outside the range of 0 to 9999 b) When DBCD(P) instruction is used...
  • Page 125 Chapter 5. Application instructions Displaying the current value of counter (example of BCD, BMOV instructions) 1. Operation There is a warehouse and numbers of product incoming / outgoing are counted by light switches. The current stock of inside of warehouse is displayed by a digital indicator. When the stock of inside of warehouse reaches to 30, the incoming conveyer will be stopped.
  • Page 126: Bin, Binp, Dbin, Dbinp

    Chapter 5. Application instructions 5.2.2 BIN, BINP, DBIN, DBINP FUN(64) BIN FUN(66) DBIN Applicable All CPUs (Binary) FUN(65) BINP FUN(67) DBINP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* O O BIN(P) DBIN(P) O O O O*...
  • Page 127 Chapter 5. Application instructions Execution conditions Input condition BIN, DBIN Executed per scan Executed per scan BINP, DBINP Executed only once Executed only once Operation Error In the following cases, operation error occurs and the error flag (F110) turns on. a) Each digit (4 bits) of source [ S ] is outside the range of 0 to 9 (Example : [ S ] = h78A5) Program example...
  • Page 128: Cmp, Cmpp, Dcmp, Dcmpp

    Chapter 5. Application instructions Comparison instructions 5.3.1 CMP, CMPP, DCMP, DCMPP FUN(50) CMP FUN(52) DCMP Applicable All CPUs (Compare) FUN(51) CMPP FUN(53) DCMPP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O CMP(P) 5 / 9 O O O O...
  • Page 129 Chapter 5. Application instructions Execution conditions Input condition CMP, DCMP Executed per scan Executed per scan CMPP, D CMPP Executed only once Executed only once 2) Program example While P020 is on, compare contests of D000 and D001 and set flags according to the result. D0000 h0008 D0001...
  • Page 130 Chapter 5. Application instructions Comparing circuit (example of CMP instruction) 1. Operation There is a up- down counter C000. P030 is up-count input, and P031 is down-count input. If the current value of timer is 0 ~ 9, P060 turns on. If the current value is 10 ~ 19, P061 will be on. P062 will turn on when 20 ~ 29, P063 will turn on when 30 ~ 39, and P064 will be on when the current value is 40 or larger.
  • Page 131: Tcmp, Tcmpp, Dtcmp, Dtcmpp

    Chapter 5. Application instructions 5.3.2 TCMP, TCMPP, DTCMP, DTCMPP TCMP FUN(54) TCMP FUN(56) DTCMP Applicable All CPUs (Table compare) FUN(55) TCMPP FUN(57) DTCMPP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O TCMP(P) O O O O 7 / 9...
  • Page 132 Chapter 5. Application instructions 2) Program example While P020 is on, compare the content of D0001 with 16 words from M00 (M00 ~ M15) and output the comparison result to P06 word (P060 ~ P06F). P020 TCMP D0001 M000 P06 hBCDE P060 M000...
  • Page 133 Chapter 5. Application instructions 5.3.3 LD ( =, >, <, >=, <=, <> ) FUN(28) LD= FUN(29) LDD= FUN(38) LD> FUN(39) LDD> K200S Applicable (Start NO contact FUN(48) LD< FUN(49) LDD< K300S with comparison FUN(58) LD>= FUN(59) LDD>= K1000S result) FUN(68) LD<= FUN(69) LDD<= FUN(78) LD<>...
  • Page 134: And ( =, >, <, >=, <=, <>)

    Chapter 5. Application instructions 5.3.4 AND ( =, >, <, >=, <=, <>) FUN(94) A ND= FUN(95) ANDD= FUN(96) AND> FUN(97) ANDD> K200S Applicable (Serial NO contact FUN(98) AND< FUN(99) ANDD< K300S with comparison FUN(106) AND>= FUN(107) ANDD>= K1000S result) FUN(108) AND<= FUN(109) ANDD<= FUN(118) AND<>...
  • Page 135 Chapter 5. Application instructions 5.3.5 OR ( =, >, <, >=, <=, <>) FUN(188) OR= FUN(189) ORD= FUN(196) OR> FUN(197) ORD> K200S Applicable (Parallel NO FUN(198) OR< FUN(199) ORD< K300S contact with FUN(216) OR>= FUN(217) ORD>= K1000S comparison result) FUN(218) OR<= FUN(219) ORD<= FUN(228) OR<>...
  • Page 136: Increment/Decrement Operations

    Chapter 5. Application instructions Increment/decrement operations 5.4.1 INC, INCP, DINC, DINCP FUN(20) INC FUN(22) DINC Applicable All CPUs (Increment) FUN(21) INCP FUN(23) DINCP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) INC(P) O O O O* DINC(P) Operand setting The device to be increased...
  • Page 137 Chapter 5. Application instructions Execution conditions Input condition INC, DINC Executed per scan Executed per scan INCP, DINCP Executed only once Executed only once 2) Program example Whenever a rising edge is detected at P030, the content of P06 word will be increased by 1. P030 INCP P006...
  • Page 138: Dec, Decp, Ddec, Ddecp

    Chapter 5. Application instructions 5.4.2 DEC, DECP, DDEC, DDECP FUN(24) DEC FUN(26) DDEC Applicable All CPUs (Decrement) FUN(25) DECP FUN(27) DDECP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) DEC(P) O O O O* DDEC(P) Operand setting The device to be increased by DEC instruction.
  • Page 139 Chapter 5. Application instructions Execution conditions Input condition DEC, DDEC Executed per scan Executed per scan DECP, DDECP Executed only once Executed only once Program example Whenever a rising edge is detected at P020, the content of M06 word will be decreased by 1. P020 DECP M006...
  • Page 140: Rotation Instructions

    Chapter 5. Application instructions Rotation instructions 5.5.1 ROL, ROLP, DROL, DROLP FUN(30) ROL FUN(32) DROL Applicable All CPUs (Rotate left) FUN(31) ROLP FUN(33) DROLP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) ROL(P) O O O O* DROL(P) Operand setting The device to be rotated left...
  • Page 141 Chapter 5. Application instructions Execution conditions Input condition ROL, DROL Executed per scan Executed per scan ROLP, DROLP Executed only once Executed only once 2) Program example Whenever a rising edge is detected at P030, 16- bits of D0000 word will be rotated with left direction. P030 ROLP D0000 D0000 = h78D3...
  • Page 142: Ror, Rorp, Dror, Drorp

    Chapter 5. Application instructions 5.5.2 ROR, RORP, DROR, DRORP FUN(34) ROR FUN(36) DROR Applicable All CPUs (Rotate right) FUN(35) RORP FUN(37) DRORP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) ROR(P) O O O O* DROR(P) Operand setting The device to be rotated...
  • Page 143 Chapter 5. Application instructions Execution conditions Input condition ROR, DROR Executed per scan Executed per scan RORP, DRORP Executed only once Executed only once Program example Whenever a rising edge is detected at P030, 16-bits of D0000 word will be rotated with right direction.
  • Page 144: Rcl, Rclp, Drcl, Drclp

    Chapter 5. Application instructions 5.5.3 RCL, RCLP, DRCL, DRCLP FUN(40) RCL FUN(42) DRCL Applicable All CPUs (Rotate left include FUN(41) RCLP FUN(43) DRCLP carry flag) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) RCL(P) O O O O* DRCL(P) Operand setting The device to be rotated left...
  • Page 145 Chapter 5. Application instructions Execution conditions Input condition ROL, DROL Executed per scan Executed per scan ROLP, DROLP Executed only once Executed only once Program example Whenever a rising edge is detected at P030, 16-bits of D0000 word and carry flag will be rotated with left direction.
  • Page 146: Rcr, Rcrp, Drcr, Drcrp

    Chapter 5. Application instructions 5.5.4 RCR, RCRP, DRCR, DRCRP FUN(44) RCR FUN(46) DRCR Applicable All CPUs (Rotate right FUN(45) RCRP FUN(47) DRCRP include carry flag) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) RCR(P) O O O O* DRCR(P) Operand setting The device to be rotated...
  • Page 147 Chapter 5. Application instructions Execution conditions Input condition RCR, DRCR Executed per scan Executed per scan RCRP, DRCRP Executed only once Executed only once Program example Whenever a rising edge is detected at P030, 16-bits of D0000 word and carry flag will be rotated with right direction.
  • Page 148: Shift Instructions

    Chapter 5. Application instructions Shift instructions 5.6.1 BSFT, BSFTP BSFT FUN(74) BSFT Applicable All CPUs (Bit shift) FUN(75) BSFTP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* BSFT(P) O O O O* Operand setting The start bit of block to be BSFT...
  • Page 149 Chapter 5. Application instructions Execution conditions Input condition BSFT Executed per scan Executed per scan BSFTP Executed only once Executed only once 2) Program example At every 1 second, the block from P040 to P045 is shifted in left direction by 1 bit. The 1 second clock flag (F093) is used for input condition.
  • Page 150: Wsft, Wsftp

    Chapter 5. Application instructions 5.6.2 WSFT, WSFTP WSFT FUN(70) WSFT Applicable All CPUs (Word shift) FUN(71) WSFTP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* WSFT(P) O O O O* Operand setting The start word of block to WSFT be shifted...
  • Page 151 Chapter 5. Application instructions Execution conditions Input condition WSFT Executed per scan Executed per scan WSFTP Executed only once Executed only once Program example At every 1 second, the block from D0040 to D0043 is shifted in left direction by 1 word. The 1 second clock flag (F093) is used for input condition.
  • Page 152 Chapter 5. Application instructions 5.6.3 K200S Applicable FUN(237) SR K300S (Shift register) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* BSFT(P) Input data Operand setting The start bit of block to be Shift direction shifted D (P, M, L, K)
  • Page 153 Chapter 5. Application instructions 2) Program example Shifts the block from P0013 ~ P001B (9 bits) with the configuration as following : Input data bit : M000A Shift direction but : M000B Clock : P0000 Reset signal : P0001 M000A M000B P0000 P0014...
  • Page 154: Exchange Instructions

    Chapter 5. Application instructions Exchange instructions 5.7.1 XCHG, XCHGP, DXCHG, DXCHGP XCHG FUN(102) XCHG FUN(104) DXCHG Applicable All CPUs (Word exchange) FUN(103) XCHGP FUN(105) DXCHGP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* XCHG(P) O O O O* DXCHG(P)
  • Page 155 Chapter 5. Application instructions Execution condition Input condition XCHG, DXCHG Executed per scan Executed per scan XCHGP, DXCHGP Executed only once Executed only once 2) Program example While P020 is on, exchange contents of P04 and P05 words each other. P020 XCHGP P04 P05 h5849...
  • Page 156: Bin Arithmetic Instructions

    Chapter 5. Application instructions BIN arithmetic instructions 5.8.1 ADD, ADDP, DADD, DADDP FUN(110) ADD FUN(112) DADD Applicable All CPUs (Binary addition) FUN(111) ADDP FUN(113) DADDP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O ADD(P) O O O O 7/9/11...
  • Page 157 Chapter 5. Application instructions Execution condition Input condition ADD, DADD Executed per scan Executed per scan ADDP, DAD DP Executed only once Executed only once 2) Program example When a rising edge is detected at P020, add contents of D0000 and D0001 and store the addition result to P06 word.
  • Page 158: Sub, Subp, Dsub, Dsubp

    Chapter 5. Application instructions 5.8.2 SUB, SUBP, DSUB, DSUBP FUN(114) SUB FUN(116) DSUB Applicable All CPUs (Binary subtraction) FUN(115) SUBP FUN(117) DSUBP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O SUB(P) O O O O 7/9/11 DSUB(P)
  • Page 159 Chapter 5. Application instructions Execution condition Input condition SUB, DSUB Executed per scan Executed per scan SUBP, DSUBP Executed only once Execut e d only once Program example When a rising edge is detected at P020, subtract contents of D0000 and D0001 and store the addition result to P06 word.
  • Page 160: Mul, Mulp, Dmul, Dmulp

    Chapter 5. Application instructions 5.8.3 MUL, MULP, DMUL, DMULP FUN(120) MUL FUN(122) DMUL Applicable All CPUs (Binary multiply) FUN(121) MULP FUN(123) DMULP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O MUL(P) O O O O 7/9/11 DMUL(P)
  • Page 161 Chapter 5. Application instructions 2) Program example Program which stores the multiplication result of D0001 and D0002 at D0010, D0011 while P020 is P020 MUL D0001 D0002 D0010 D0001 D0002 D0011 D0010 × h1234 h5678 h6260 h0060 Program which stores the multiplication result of D0001, D0002 and D0003,D0004 at D0010 ~ D0013 when P020 is switched on.
  • Page 162 Chapter 5. Application instructions 5.8.4 MULS, MULSP, DMULS, DMULSP MULS K200S FUN(072) MULS FUN(076) DMULS Applicable K300S (Signed binary FUN(073) MULSP FUN(077) DMULSP multiply) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O MULS(P) O O O O 7/9/11...
  • Page 163 Chapter 5. Application instructions Execution conditions Input condition MULS, DMULS Executed per scan Executed per scan MULSP, DMULSP Executed only once Executed only once Program example Program which stores the multiplication result of D0001 and D0002 at D0010, D0011 while P020 is P020 MULS D0001 D0002 D0010 D0001...
  • Page 164: Div, Divp, Ddiv, Ddivp

    Chapter 5. Application instructions 5.8.5 DIV, DIVP, DDIV, DDIVP FUN(124) DIV FUN(126) DDIV Applicable All CPUs (Binary divide) FUN(125) DIVP FUN(127) DDIVP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O DIV(P) O O O O 7/9/11 DDIV(P)
  • Page 165 Chapter 5. Application instructions Program example Program which stores the division result of D0001 and D0002 at D0010, D0011 while P020 is on. P020 DIV D0001 D0002 D0010 D0001 D0002 D0011 D0010 ÷ h78AB h0678 h017D h002D Remainder Quoti e nt Program which stores the division result of D0001, D0002 and D0003,D0004 at D0010 ~ D0013 when P020 is switched on.
  • Page 166: Divs, Divsp, Ddivs, Ddivsp

    Chapter 5. Application instructions 5.8.6 DIVS, DIVSP, DDIVS, DDIVSP DIVS K200S FUN(124) DIV FUN(126) DDIV Applicable K300S (Signed binary FUN(125) DIVP FUN(127) DDIVP divide) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O DIVS(P) O O O O 7/9/11...
  • Page 167 Chapter 5. Application instructions Execution conditions Input condition DIVS, DDIVS Executed per scan Executed per scan DIVSP, DDIVSP Executed only once Executed only once Program example Program which stores the division result of D0001 and D0002 at D0010, D0011 while P020 is on. P020 DIVS D0001 D0002 D0010 D0001...
  • Page 168: Bcd Arithmetic Instructions

    Chapter 5. Application instructions BCD arithmetic instructions 5.9.1 ADDB, ADDBP, DADDB, DADDBP ADDB FUN(130) ADDB FUN(132) DADDB Applicable All CPUs (BCD addition) FUN(131) ADDBP FUN(133) DADDBP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O ADDB(P) O O O O 7/9/11...
  • Page 169 Chapter 5. Application instructions Execution condition Input condi t ion ADDB, DADDB Executed per scan Executed per scan ADDBP, DADDBP Executed only once Executed only once Program example When a rising edge is detected at P020, add BCD data of D0000 and D0001 and store the addition result to P06 word.
  • Page 170: Subb, Subbp, Dsubb, Dsubbp

    Chapter 5. Application instructions 5.9.2 SUBB, SUBBP, DSUBB, DSUBBP SUBB FUN(134) SUBB FUN(136) DSUBB Applicable All CPUs (BCD subtraction) FUN(135) SUBBP FUN(137) DSUBBP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O SUBB(P) O O O O 7/9/11...
  • Page 171 Chapter 5. Application instructions Execution condition Input condition SUBB, DSUBB Executed per scan Executed per scan SUBBP, DSUBBP Executed only once Executed only once Program example When a rising edge is detected at P020, subtract contents of D0000 and D0001 and store the addition result to P06 word.
  • Page 172: Mulb, Mulbp, Dmulb, Dmulbp

    Chapter 5. Application instructions 5.9.3 MULB, MULBP, DMULB, DMULBP MULB FUN(140) MULB FUN(142) DMULB Applicable All CPUs (BCD multiply) FUN(141) MULBP FUN(143) DMULBP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O MULB(P) O O O O 7/9/11...
  • Page 173 Chapter 5. Application instructions Program example Program which stores the multiplication result of D0001 and D0002 at D0010, D0011 while P020 is P020 MULB D0001 D0002 D0010 D0001 D0002 D0011 D0010 × h1234 h5678 h0700 h6652 Program which stores the multiplication result of D0001, D0002 and D0003,D0004 at D0010 ~ D0013 when P020 is switched on.
  • Page 174: Divb, Divbp, Ddivb, Ddivbp

    Chapter 5. Application instructions 5.9.4 DIVB, DIVBP, DDIVB, DDIVBP DIVB FUN(144) DIVB FUN(146) DDIVB Applicable All CPUs (BCD divide) FUN(145) DIVBP FUN(147) DDIVBP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O DIVB(P) O O O O 7/9/11...
  • Page 175 Chapter 5. Application instructions Execution conditions Input condition DIVB, DDIVB Executed per scan Executed per scan DIVBP, DDIVBP Executed only once Executed only once Program example Program which stores the division result of D0001 and D0002 at D0010, D0011 while P020 is on. P020 DIVB D0001 D0002 D0010 D0001...
  • Page 176: Logical Arithmetic Instructions

    Chapter 5. Application instructions 5.10 Logical arithmetic instructions 5.10.1 WAND, WANDP, DWAND, DWANDP WAND FUN(150) WAND FUN(152) DWAND Applicable All CPUs (Word AND) FUN(151) WANDP FUN(153) DWANDP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O WAND(P) O O O O...
  • Page 177 Chapter 5. Application instructions Execution conditions Input condition WAND, DWAND Executed per scan Executed per scan WANDP, DWANDP Executed only once Executed only once 2) Program example Program which performs the logical production of the contents of P04 and P05 words, then stores the result to the P06 word when the P020 is switched on.
  • Page 178: Wor, Worp, Dwor, Dworp

    Chapter 5. Application instructions 5.10.2 WOR, WORP, DWOR, DWORP FUN(154) WOR FUN(156) DWOR Applicable All CPUs (Word OR) FUN(155) WORP FUN(157) DWORP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O WOR(P) O O O O 7/9/11 DWOR(P)
  • Page 179 Chapter 5. Application instructions Execution conditions Input condition WOR, DWOR Executed per scan Executed per scan WORP, DWORP Executed only once Executed only once Program example Program that performs the logical addition of the contents of P04 and P05 words, then stores the result to the P06 word when the P020 is switched on.
  • Page 180: Wxor, Wxorp, Dwxor, Dwxorp

    Chapter 5. Application instructions 5.10.3 WXOR, WXORP, DWXOR, DWXORP WXOR FUN(160) WXOR FUN(162) DWXOR Applicable All CPUs (Word exclusive OR) FUN(161) WXORP FUN(163) DWXORP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O WXOR(P) O O O O 7/9/11...
  • Page 181 Chapter 5. Application instructions Execution conditions Input condition WXOR, DWXOR Executed per scan Executed per scan WXORP, DWXORP Executed only once Executed only once Program example Program that performs the exclusive OR of the contents of P04 and h2345, then stores the result to the P06 word when the P020 is switched on.
  • Page 182: Wxnr, Wxnrp, Dwxnr, Dwxnrp

    Chapter 5. Application instructions 5.10.4 WXNR, WXNRP, DWXNR, DWXNRP WXOR FUN(164) WXOR FUN(166) DWXOR Applicable All CPUs (Word exclusive FUN(165) WXORP FUN(167) DWXORP NOR) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O WXNR(P) O O O O 7/9/11...
  • Page 183 Chapter 5. Application instructions Execution conditions Input condition WXNR, DWXNR Executed per scan Executed per scan WXNRP, DWXNRP Executed only once Executed only once Program example Program that performs the exclusive NOR of the contents of P04 and h2345, then stores the result to the P06 word when the P020 is switched on.
  • Page 184: Data Processing Instructions

    Chapter 5. Application instructions 5.11 Data processing instructions 5.11.1 SEG, SEGP FUN(174) SEG Applicable All CPUs (7 segment) FUN(175) SEGP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O O O O O* SEGP Operand setting The device at which source...
  • Page 185 Chapter 5. Application instructions Execution conditions Input condition Executed per scan Executed per scan SEGP Executed only once Executed only once 2) Program example Program that decodes 8- bits from the bit 2 of D0000 into 7 segment display format, and stores the result to 16-bits from the bit 3 of P06 when P030 is switched on.
  • Page 186 Chapter 5. Application instructions 3) 7 segment display data Configuration of 7 Di s pl a yed segment data Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1 1 1 1 5-74...
  • Page 187: Asc, Ascp

    Chapter 5. Application instructions 5.11.2 ASC, ASCP FUN(190) ASC Applicable All CPUs (ASCII code) FUN(191) ASCP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O O O O O* ASCP Operand setting The device at which source data is stored The device which will store...
  • Page 188 Chapter 5. Application instructions Execution conditions Input condition Executed per scan Executed per scan ASCP Executed only once Executed only once Program example Program that converts 8- bits from the bit 2 of D0010 into ASCII code data, and stores the result to 16-bits from the bit 1 of P06 while P030 is on.
  • Page 189: Bsum, Bsump, Dbsum, Dbsump

    Chapter 5. Application instructions 5.11.3 BSUM, BSUMP, DBSUM, DBSUMP BSUM FUN(170) BSUM FUN(172) DBSUM Applicable All CPUs (Bit summary) FUN(171) BSUMP FUN(173) DBSUMP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) BSUM(P) O O O O DBSUM(P) O O O O Operand setting...
  • Page 190 Chapter 5. Application instructions 2) Program example Program that count the numbers of ‘1 ’ in P020 and P021, then store the count result into D0030 when M020 is switched on. M020 DBSUMP P020 D0030 The numbers P020 of 1 = 9 The numbers P021 of 1 = 8...
  • Page 191: Enco, Encop

    Chapter 5. Application instructions 5.11.4 ENCO, ENCOP ENCO FUN(176) ENCO Applicable All CPUs (Encode) FUN(177) ENCOP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O ENCO O O O O* ENCOP Operand setting The start address of source ENCO data area...
  • Page 192 Chapter 5. Application instructions 2) Program example Program that encode the 8- bits (bit 0 ~ bit 7) of P06 word and stores the encoding result to the P06 word when P020 is switched on. P020 ENCOP P02 P06 3 The highest position ‘1’...
  • Page 193: Deco, Decop

    Chapter 5. Application instructions 5.11.5 DECO, DECOP DECO FUN(178) DECO Applicable All CPUs (Decode) FUN(179) DECOP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O DECO O O O O* DECOP Operand setting The start address of source DECO data area...
  • Page 194 Chapter 5. Application instructions Program example Program that decode lower 4 bits of p02 word and stores the decoding result to P05 word when P030 is switched on. P030 DECOP P02 P05 4 The value of last 4 bit of P02 = h9 When n = 4, 16 (=2...
  • Page 195: Filr, Filrp, Dfilr, Dfilrp

    Chapter 5. Application instructions 5.11.6 FILR, FILRP, DFILR, DFILRP FILR FUN(180) FILR FUN(182) DFILR Applicable All CPUs (File table read) FUN(181) FILRP FUN(183) DFILRP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O FILR(P) O O O O* DFILR(P)
  • Page 196 Chapter 5. Application instructions Execution conditions Input condition FILR, DFILR Executed per scan Executed per scan FILRP, DFILRP Executed only once Executed only once 2) Program example Program that transfer the content of the M03+n word to M01 word when P020 is switched on. The n is stored at D0010 word.
  • Page 197: Filw, Filwp, Dfilw, Dfilwp

    Chapter 5. Application instructions 5.11.7 FILW, FILWP, DFILW, DFILWP FILW FUN(184) FILW FUN(186) DFILW Applicable All CPUs (File table write) FUN(185) FILWP FUN(187) DFILWP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* FILW(P) O O O O DFILW(P)
  • Page 198 Chapter 5. Application instructions Execution conditions Input condition FILW, DFILW Executed per scan Executed per scan FILWP, DFILWP Executed only once Executed only once Program example Program that transfer the content of the M01 word to M03+n word when P020 is switched on. The n is stored at D0010 word.
  • Page 199: Dis, Disp

    Chapter 5. Application instructions 5.11.8 DIS, DISP FUN(194) DIS Applicable All CPUs (Data dissociation) FUN(195) DISP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O DIS(P) O O O O* Operand setting The source device The start address of destination devices.
  • Page 200 Chapter 5. Application instructions Execution conditions Input condition Executed per scan Executed per scan DISP Executed only once Executed only once 2) Program examples Program that dissociate the contents of lower 3 nibbles of P02 word to lower 4 bits of D0000 ~ D0003 when P030 is switched on.
  • Page 201: Uni, Unip

    Chapter 5. Application instructions 5.11.9 UNI, UNIP FUN(192) UNI Applicable All CPUs (Data association) FUN(193) UNIP Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O UNI(P) O O O O* Operand setting The start address of source devices.
  • Page 202 Chapter 5. Application instructions Execution conditions Input condition Executed per scan Executed per scan UNIP Executed only once Executed only once Program examples Program that associate the content of lower 4 bits of D0000 ~ D0003 to lower 3 nibbles of P02 word when P030 is switched on.
  • Page 203: Iorf, Iorfp

    Chapter 5. Application instructions 5.11.10 IORF, IORFP K200S IORF FUN(200) IORF Applicable K300S (I/O refresh) FUN(201) IORFP K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) IORF(P) Operand setting The first word of the block IORF to be refreshed The last word of the block to...
  • Page 204 Chapter 5. Application instructions 2) Program example During FOR ~ NEXT loop execution, the P060 is keep the initial status, but the P061 is switched on/off according to the status change of the P020. P020 ( P060 ) [ FOR 10000 ] F010 WDT ]...
  • Page 205: System Instructions

    Chapter 5. Application instructions 5.12 System instructions 5.12.1 FALS K200S FALS Applicable FUN(204) FALS K300S (Error display) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) FALS Operand setting The error code to be stored FALS at the F area 1) Functions...
  • Page 206: Duty

    Chapter 5. Application instructions 5.12.2 DUTY DUTY Applicable FUN(205) DUTY All CPUs (User defined pulse) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) DUTY Operand setting The contact of F device to which a pulse is output DUTY n1 n2 Number of scans during...
  • Page 207 Chapter 5. Application instructions Even if the timing pulse input turns off, the timing pulse by the DUTY instruction does not turn off. Therefore, to stop the timing pulse, execute the another DUTY instruction as shown below. DUTY Scan during which timing pulse is off Scan during which timing pulse is on.
  • Page 208: Wdt, Wdtp

    Chapter 5. Application instructions 5.12.3 WDT, WDTP K200S FUN(202) WDT Applicable K300S (Watch dog timer FUN(203) WDTP clear) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) WDTP WDTP 1) Functions Resets the watch dog timer in a sequence program Used when the period of scan time (from step 0 to END in the sequence program) exceeds the set value of watch dog timer depending on conditions.
  • Page 209 Chapter 5. Application instructions Execution conditions Input condition Executed per scan Executed per scan WDTP Executed only once Executed only once 2) Program example The program that has a long scan time because of FOR ~ NEXT loop. 50000 P020 P02F When P020 is on, the current value of WDT is reset and no WDT...
  • Page 210: Outoff

    Chapter 5. Application instructions 5.12.4 OUTOFF OUTOFF Applicable FUN(208) OUTOFF All CPUs (All output off) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) OUTOFF OUTOFF 1) Functions Stops to output the operation result of P area to the external device and turn on the OUTOFF flag (F113) when an input condition is turns on.
  • Page 211: Stop

    Chapter 5. Application instructions 5.12.5 STOP STOP K200S Applicable FUN(008) STOP K300S (Stop execution of program) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) STOP STOP 1) Functions When an input condition is switched on, stops execution of sequence program and change mode to STOP mode after finishing the current scan.
  • Page 212: Branch Instructions

    Chapter 5. Application instructions 5.13 Branch instructions 5.13.1 JMP, JME FUN(012) JMP Applicable All CPUs (Jump) FUN(013) JME Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) Operand setting K10S1/K10S/K30S/K60S : 0 ~ 63 K200S/K300S/K1000S : 0 ~ 127 1) Functions When the ‘JMP n’...
  • Page 213 Chapter 5. Application instructions Execution conditions Input condition Executed per scan Executed per scan 2) Program example - Program that skips the ring counter operation between ‘JMP 2’ and ‘JME 2’ when P020 is on. P020 P030 U CTU C002 P031 R <...
  • Page 214: Call, Callp, Sbrt, Ret

    Chapter 5. Application instructions 5.13.2 CALL, CALLP, SBRT, RET CALL / SBRT FUN(014) CALL FUN(015) CALLP Applicable All CPUs (Subroutine) FUN(016) SBRT FUN(004) RET Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) CALL(P) SBRT Operand setting CALL(P) K10S1 : 0 ~ 15...
  • Page 215 Chapter 5. Application instructions 2) Program example P020 ( P050 ) P021 P022 ( P051 ) P02F CALL 0003 SBRT 0003 F092 INCP D0000 F010 MOV D0000 P06 5-103...
  • Page 216: Loop Instructions

    Chapter 5. Application instructions 5.14 Loop instructions 5.14.1 FOR, NEXT K200S FOR / NEXT FUN(206) FOR Applicable K300S (Subroutine) FUN(207) NEXT K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) NEXT Operand setting Range : 0 ~ 32767 NEXT 1) Functions The FOR instruction is unconditionally executed.
  • Page 217: Break

    Chapter 5. Application instructions 5.14.2 BREAK BREAK K200S Applicable FUN(220) BREAK K300S (Escape from FOR ~ NEXT block) K1000S Flag Available De vice Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) BREAK BREAK 1) Function When the input condition is on, exits immediately from the current FOR ~ NEXT loop and go to the next step of the NEXT instruction.
  • Page 218: Flag Instructions

    Chapter 5. Application instructions 5.15 Flag instructions 5.15.1 STC, CLC STC, CLC FUN(002) STC Applicable All CPUs (Set / Reset the FUN(003) CLC carry flag) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) 1) Functions STC : Turns the carry flag (F112) on when the input condition is switched on.
  • Page 219: Cle

    Chapter 5. Application instructions 5.15.2 CLE K200S Applicable FUN(009) CLE K300S (Reset the latched error flag) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) 1) Functions Reset the latched error flag (F115) when the input condition turns on. ( See the 2.8.2 for detail information of F115 flag) Execution condition Input condition...
  • Page 220: Special Module Instructions

    Chapter 5. Application instructions 5.16 Special module instructions 5.16.1 GET, GETP GET, GETP K200S FUN(230) GET Applicable K300S (Read data from FUN(231) GETP special module) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) GET(P) O O O O* Operand setting Slot number of special function...
  • Page 221 Chapter 5. Application instructions In the following cases, operation error occurs; a) The slot number specified as ‘sl ’ is not a special function module b) The value of ‘n2’ is over 512, or [ D+n2 ] is exceeds the sp ecified device range. Execution conditions Input condition Executed per scan...
  • Page 222: Put, Putp

    Chapter 5. Application instructions 5.16.2 PUT, PUTP PUT, PUTP K200S FUN(234) PUT Applicable (Write data to K300S FUN(235) PUTP special function K1000S module) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) PUT(P) O O O O* Operand setting Slot number of special function module is mounted...
  • Page 223 Chapter 5. Application instructions In the following cases, operation error occurs; The slot number specified as ‘sl’ is not a special function module The value of ‘n2’ is over 512, or [ D+n2 ] is exceeds the specified device range. Execution conditions Input condition Executed per scan...
  • Page 224: Data Link Instructions

    Chapter 5. Application instructions 5.17 Data link instructions 5.17.1 READ READ K200S Applicable FUN(244) READ K300S (Read data from remote station) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O O O O O* READ O O O O O O O O*...
  • Page 225 Chapter 5. Application instructions Remote station Self-station [ S ] [ D ] ‘n2’ words ‘n2’ words FUEA FUEA module module [ SS ] Link status Station Slot No. No.=’St’ = ‘n1’ An instruction error occurs when the assress [ S+n2 ] or [ D+n2 ] is out of the range of specified device.
  • Page 226 Chapter 5. Application instructions System configuration Self-station Power 16 points 32 points FUEA FUEA supply input input module module module module module module Station Station No.h01 No.h02 slot 0 slot 1 slot 2 slot 3 Power 16 points 32 points FUEA supply input...
  • Page 227: Write

    Chapter 5. Application instructions 5.17.2 WRITE WRITE K200S Applicable FUN(245) WRITE K300S (Write data to remote station) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O O O O O* WRITE O O O O O O O O* Operand setting...
  • Page 228 Chapter 5. Application instructions Remote station Self-station [ D ] [ S ] ‘n2’ words ‘n2’ words FUEA FUEA module module [ SS ] Link status Station slot No. No.=’St’ = ‘n1’ An instruction error occurs when the assress [ S+n2 ] or [ D+n2 ] is out of the range of specified device.
  • Page 229: Rget

    Chapter 5. Application instructions 5.17.3 RGET RGET K200S Applicable FUN(232) RGET K300S (Read data from special function module of remote station) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O* RGET O O O O* Operand setting RGET...
  • Page 230 Chapter 5. Application instructions Remote station Self-station Buffer memory of special function module [ D ] [ S ] ‘n2’ words ‘n2’ words FUEA FUEA module module [ SS ] Link status Station slot No. No.=’St’ = ‘sl’ An instruction error occurs when the assress [ S+n2 ] or [ D+n2 ] is out of the range of specified device.
  • Page 231 Chapter 5. Application instructions System configuration Self-station Power 16 points 32 points FUEA FUEA supply input input module module module module module module Station Station No.h01 No.h02 slot 0 slot 1 slot 2 slot 3 Remote station 1 (K1000S) Power 16 points 32 points FUEA...
  • Page 232: Rput

    Chapter 5. Application instructions 5.17.4 RPUT RPUT K200S Applicable FUN(233) RPUT K300S (Write data to special function module of remote station) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) RPUT O O O O* O O O O* Operand setting RPUT...
  • Page 233 Chapter 5. Application instructions Remote station Self-station Buffer memory of special function module [ S ] [ D ] ‘n2’ words ‘n2’ words FUEA FUEA module module [ SS ] Link status Station slot No. No.=’St’ = ‘sl’ An instruction error occurs when the assress [ S+n2 ] or [ D+n2 ] is out of the range of specified device.
  • Page 234: Status

    Chapter 5. Application instructions 5.17.5 STATUS STATUS K200S Applicable FUN(247) STATUS K300S (Read the link information of FUEA module of remote station) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O STATUS O O O O* O O O O*...
  • Page 235: Inturrupt Instructions

    Chapter 5. Application instructions 5.18 Inturrupt instructions 5.18.1 EI, DI K200S EI / DI FUN(238) EI Applicable K300S (Enable / Disable interrupt) FUN(239) DI K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) Operand setting 0 ~ 7 (K200S) 0 ~ 13...
  • Page 236: Tdint, Iret

    Chapter 5. Application instructions 5.18.2 TDINT, IRET K200S TDINT / IRET FUN(226) TDINT Applicable K300S (Time driven interrupt) FUN(225) IRET K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) TDINT Operand setting 0 ~ 5 (K200S) TDINT 0 ~ 7...
  • Page 237: Int, Iret

    Chapter 5. Application instructions 5.18.3 INT, IRET INT / IRET K200S FUN(227) INT Applicable K300S (Process driven FUN(225) IRET interrupt) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) Operand setting 0 ~ 5 (K200S) 0 ~ 7 (K300S) 0 ~ 15...
  • Page 238: Sign Inversion Instruction

    Chapter 5. Application instructions 5.19 Sign inversion instruction 5.19.1 NEG, NEGP, DNEG, DNEGP K200S FUN(240) NEG FUN(242) DNEG Applicable K300S (Sign inverse) FUN(241) NEGP FUN(243) DNEGP K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) NEG(P) O O O O* DNEG(P)
  • Page 239 Chapter 5. Application instructions Execution conditions Input condition NEG, DNEG Executed per scan Executed per scan NEGP, DNEGP Executed only once Executed only once 2) Program example Program that get an absolute value of D0000 when the value of D0000 is negative. ( M001A ) <...
  • Page 240: Bit Contact Instructions

    Chapter 5. Application instructions 5.20 Bit contact instructions 5.20.1 BLD, BLDN K200S FUN(248) BLD Applicable K300S (Bit load) FUN(249) BLDN K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) BLDN Operand setting The start address of source data Offset from the bit 0 to the destination bit...
  • Page 241 Chapter 5. Application instructions 5.20.2 BAND, BANDN K200S BAND FUN(250) BAND Applicable K300S (Bit AND) FUN(251) BANDN K1000S Available Device Flag Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) BAND BANDN Operand setting The start address of source data Offset from the bit 0 to the destination bit...
  • Page 242: Band, Bandn

    Chapter 5. Application instructions 5.20.3 BAND, BANDN K200S FUN(252) BOR Applicable K300S (Bit OR) FUN(253) BORN K1000S Available Device Flag Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) BORN Operand setting The start address of source data Offset from the bit 0 to the destination bit 1) Functions BOR : A parallel connection of a NO contact.
  • Page 243: Bout

    Chapter 5. Application instructions 5.20.4 BOUT K200S BOUT Applicable FUN(236) BOUT K300S (Bit output) K1000S Available Device Flag Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) BOUT Operand setting BOUT The start address of source data Offset from the bit 0 to the destination bit 1) Function Outputs the current operation result to the the n...
  • Page 244: Bset, Brst

    Chapter 5. Application instructions 5.20.5 BSET, BRST K200S BSET / BRST FUN(232) BSET Applicable K300S (Bit set / reset) FUN(224) BRST K1000S Available Device Flag Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) BSET BRST Operand setting BSET The start address of source data Offset from the bit 0 to the...
  • Page 245: Computer Link Module Instructions

    Chapter 5. Application instructions 5.21 Computer link module instructions 5.21.1 SND K200S Applicable FUN(169) SND K300S (Send data and frame name to Cnet module) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) Fnam O O O O O O O O O Operand setting...
  • Page 246: Rcv

    Chapter 5. Application instructions 5.21.2 RCV K200S Applicable FUN(168) RCV K300S (Receive data and frame name from Cnet module) K1000S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) Fnam O O O O O O O O O Operand setting Fnam...
  • Page 247 Chapter 5. Application instructions 5.22 High speed counter instructions 5.22.1 HSCNT HSCNT Applicable K10S1 / K10S FUN(210) HSCNT (Enable high K30S / K60S speed counter) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) HSCNT HSCNT 1) Functions Enable a high speed counter when the input condition turns on.
  • Page 248: Hscnt

    Chapter 5. Application instructions 2) Program example Program that output the high speed counter output to P002 word. HSCNT MOV F07 P02 < Parameter setting with KGL-WIN> a) When the input condition turns on, the current value is stored to F14 and setting value of step 0 is stored to F15.
  • Page 249: Hsc

    Chapter 5. Application instructions 5.22.2 HSC Applicable K10S1 / K10S FUN(215) HSC (High speed K30S / K60S counter) Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O 7/9/11 O O O O Operand setting Preset value PV <...
  • Page 250 Chapter 5. Application instructions 2) Program example M1 : HSC reset, M2 : U /D input (0 = up, 1 = down), M3 : Change current value as PV If the current value is same or greater than SV, the F070 bit turns on. M003 MOV 100 D010 M001...
  • Page 251: Communication Instructions

    Chapter 5. Application instructions 5.23 RS-485 communication instructions 5.23.1 RECV RECV Applicable K10S1 / K10S FUN(158) RECV (Receive data) K30S / K60S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O O O O O O O O O RECV...
  • Page 252 Chapter 5. Application instructions 2) Program example Program that read 5 words from M010 of the slave station (station number = h1A), and stores the data to D0000 ~ D0004 of the master station while the M0000 turns on. M0000 RECV h1A D0000 M010 h05 Master station Slave station...
  • Page 253: Send

    Chapter 5. Application instructions 5.23.2 SEND SEND Applicable K10S1 / K10S FUN(159) SEND (Send data) K30S / K60S Flag Available Device Instructions Steps Error Zero Carry #D Integer (F110) (F111) (F112) O O O O O O O O O O O O SEND O O O O...
  • Page 254 Chapter 5. Application instructions Program example Program that send 5 words from D0010 of the master station, and stores the data to M0000 ~ M0004 of the slave station (station number = h0A) while the M0000 turns on. M0000 SEND h0A D0010 M000 h05 Master station Slave station M000...
  • Page 255 Appendix A.1 Memory configuration..................1 A.2 Special relay ....................3 A.2 Instruction list....................12...
  • Page 256 Appendix Appendix A.1 Memory configuration A.1.1 Bit memory device The bit memory device is the memory area that can be read / write by bit. The P, M, L, K, F areas are bit memory devices. However, the bit memory device can be used as word device area. <...
  • Page 257 Appendix A.1.2 Bit / Word memory device ( timer & counter ) The timer and counter memory area consist of 3 parts - the output bit, current value word, and setting value word. When the T or C device is used as a operand of bit instruction, the instruction takes effect to the output bit of timer or counter.
  • Page 258 Appendix A.2 Special relay A.2.1 K10S1 / K10S / K30S / K60S 1) F device Relay Name Description F000 Run flag Set while PLC is on RUN mode F001 PGM flag Set while PLC is on PGM mode F002 Pause flag Set while PLC is on Pause mode F007 EPROM mode...
  • Page 259 Appendix Relay Name Description F090 20msec period clock These relays re peat On/Off wi t h fi x ed ti m e i n terval , F091 100msec period clock and are generated i n RUN mode onl y . F092 200msec period clock F093...
  • Page 260 Appendix 2) Other special relays Area Description Remarks When M310 is On, the Data of RTC is changed M310 RTC User Write Enable As the data of D249~D252 L12~ RTC Data D240 Data of A/D Ch.0 Input Analog Unit D241 Data of A/D Ch.1 Input D242 Data of D/A Output...
  • Page 261 Appendix A.2.2 K200S / K300S / K1000S 1) F relay Contact Keyword Function Description F0000 RUN mode Turns on when the CPU in the RUN mode. F0001 Program mode Turns on when the CPU in the Program mode F0002 Pause mode Turns on when the CPU in the Pause mode F0003 Debug mode...
  • Page 262 Appendix Junction Keyword Function Description F0040 to F005F S_IO_TYER I/O error When the reserved I/O module (set by the (0 to 31) parameter) differs from the real loaded I/O module or a I/O module has been mounted or dismounted, the corresponding bit turns on. F0060 to F006F Storing error code Stores the system error code, (See Section...
  • Page 263 Appendix Junction Keyword Function Description F0126 to F012F Unused F0130 to F013F _S_AC_F_CNT AC Down Count Stores AC down counting value. F0140 to F014F _S_FALS_N FALS No. The error code generated by FALS instruction is stored to this flag. F0150 to F015F PUT/GET error When a common RAM access error of special flag...
  • Page 264 Appendix High speed link flag list x : K1000S = 9, K300S / K200S = 4, n = 0 ~ 7 (Slot No.) Keyword Type Address Name Description Indicates the number which is set on communications module station switch. _CnSTNOL Dx500 Communications Enet/Mnet : MAC station No.
  • Page 265 Appendix Slot No. & Flag List Slot No. D area address Remark The address of the flag which is loaded onto the slot n is Dx511 to Dx521 calculated as shown below. Dx522 to Dx532 Dx533 to Dx543 ∗ Address of D area = Address shown in the [TABLE1] + 1 1 ×...
  • Page 266 Appendix Detailed High Speed Link Information Flag List (when m= 1 to 3) High Speed Link D area Remark Type Address High Speed Link 2 Dx620 to Compared to the D area addresses shown in the (m=1) Dx633 [TABLE 3], where m = 0, they are calculated as shown High Speed Link 3 Dx640 to below where m = 1 to 3.
  • Page 267 Appendix A.3 Instruction list Function MPUSH MLOAD MPOP STOP MCSCLR CALL CALLP SBRT DNOT INCP DINC DINCP DECP DDEC DDECP LDD= ROLP DROL DROLP RORP DRDR DRDRP LD> LDD> CMPP DRCL DRCLP RCRP DRCR DRCRP LD< LDD< BCDP DCMP DCMPPP TCMP TCMPP DTCMP...

Table of Contents