Home

Instructions & Programming

image

Contents

1. 4 9 5 TRTG TRTG Retrigerrable timer Available Device 2 Flag Instructions 2 Error Zero Carry MiP IK JL IF T C S D D Integer F110 F111 F112 Txxx O TRIG 3 O O Input condition x Timer setting value A TRTG F Tox O Timer contact number x Setting time t Unit period 0 1 or 0 01 sec x Setting value 1 Functions When the input condition turns on the current value will be set as the setting value and starts to decrease The timer contact turns on when the input condition is switched on The current value will decrease by 1 at every 0 1 or 0 01sec until it reaches to 0 and the timer contact will be switched off when the current value reaches to 0 If the input condition turns on again during timer operation the current value will reset as the setting value and re start to decreasing from the setting value When the RST instruction is executed the timer contact will turn off and the current value will be cleared as O 2 Program example Program Time chart P020 TRTG T096 50 TO96 gt _ _ ogg P023 L RsT T096 t 5sec P020 P065 4 36 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
2. Program Error occurred F110 F115 Remarks ADD DO 10 M20 No OFF OFF MOV DO D10 Yes ON ON D10 hFFFF LOAD P0000 N A ON ON INC DO No OFF ON LOAD P0001 N A OFF ON WAND P01 M10 D400 Yes ON ON D400 hFF00 LOAD P0002 N A ON ON WAND P01 M10 D300 No OFF ON CLE N A OFF OFF Clear F115 LOAD P0003 N A OFF OFF WAND P01 M10 D500 No OFF OFF BCD hFFFF D20 Yes ON ON 2 35 Chapter 2 Functions 2 8 3 LED indication 1 K10S1 KIOS K30S K60S LED Name Operating Status LED Indication Serious error ERR Light error Flickering with 1sec period Program or parameter error CPU is in RUN mode Always ON 2 K200S K300S K1000S LED Name Operating Status LED Indication CPU is in Stop Remote mode Always ON Serious error Flickering with 200ms period STOP Light error Flickering with 600ms period Program or parameter error Flickering with 1sec period RUN CPU is in RUN mode Always ON 2 36 Chapter 2 Functions 2 8 0 Error code list Code m Error type Message F006 CPU Description Corrective action Internal The operating system ROM or other Contact the nearest system error Systemerror 50001 Stop H W is defective LG representative De ROM OS ROM h0002 Stop The internal system ROM is defective Contact the nearest error error LG repre
3. E HE sent 4 1 Functions Enable a high speed counter when the input condition turns on After the high speed counter is enabled it operates according to the parameter setting When the input condition is switched off the high speed counter is reset The HSCNT instruction can not be used with HSC instruction in a sequence program simultaneously The specification of high speed counter Items Contents Counting speed 1 point Phase 1 phase Count speed 8kpps Count range 0 hFFFF 16 bits Parameter setting Level Max 20 level can be set up 0 19 Data Setting data 16 bits SET Bits to be switched on 8 bits RESET Bits to be switched off 8 bits Current value F140 F14F 16 bits Setting value F150 F15F 16 bits Output device F070 F077 8 bits 5 135 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 gt a When the input condition turns on the current value is stored to F14 and setting value of step 0 is stored to F15 b When the current value reaches to setting value 0 F070 F077 is set reset according to the parameter setting and F15 is updated as setting value of step 1 c When the current value reaches to the setting value of
4. OR A 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 2 OR NOT a Functions The NC 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 3 Program example The P061 contact will switched on when the one of P020 and P021 is on P020 P061 P021 m ree 4 4 Chapter 4 Basic instructions The motor operation Example of LOAD AND OR OUT instructions Operation There are three push button switches PBO 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 The PBO is emergency stop switch and the motor will stop operation when the PBO is pushed 2 System structure Digital input Digital output module module P03 P06 lt Stop gt PBO 0 lt Forward gt PB1 2 lt Reverse gt PB2 Reverse rotation Forward rotation 3 Program P031 P030 P032 P061 Forward operation Set an interlock 0000 P060 with reverse operation P032 P061 P060 P032 P061 0006 P061 Rever
5. mm 00 UNI pe Operand setting The start address of source devices e The destination device The ieu ot nibble to be associated Available only when do not use computer link module or data link module 4 1 Functions Transfers lowest 4 bits of the block specified as S n 1 S into the lower n nibbles of the device specified as D The higher bits bit 2 bit F of the device specified as D are cleared as 0 When n 0 no processing is performed Whenn gt 4 the error flag is set and no processing is performed F 4 3 0 O O Os EY DORE When n 4 i a Chapter 5 Application instructions Execution conditions Input condition A Re es i UNI Executed per scan Executed per scan UNIP Executed only once i Executed only once ate 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 P030 I A HL une D0000 P06 3 4 D0000 F 4 3 0 0000 0000 0000 0001 D0001 0000 0000 0000 0010 D0002 0000 0000 0000 0011 F E D C B A 9 8 7 6 5 4 3 2 1 0 IE EB EUA EEE EXICHERES Chapter 5 Application instructions 5 11 10 IORF IORFP K200S IORF FUN 200 IORF Applicable K300S 1 0 refresh FUN 201 IORFP CPU K1000S A Available Device Flag Instructions Steps Erro
6. DIVS K200S FUN 124 DIV FUN 126 DDIV Applicable Signed binar K300S et d FUN 125 DIVP FUN 127 DDIVP CPU divide K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 Edlololo olololo O00 DIVS P OJOI O OO 0 O olol o zen O O DDIVS P olololo Olo O0 Operand setting DDIVS A DIVSP DDIVSP Available only when do not use computer link module or data link module The device storing dividend The device storing divider The device at which the division result is stored 1 Functions DIVS P Performs the division of the signed BIN data specified as S1 and the signed BIN data specified as S2 and stores the division result into the device specified as D 1 D The quotient is stored at D and the remainder is stored at D 1 DDIVS P Performs the division of the signed BIN data specified as S141 S and the signed BIN data specified as S2 1 S2 and stores the division result into the device specified as D 3 D 2 D 1 D The quotient is stored at D 1 D and the remainder is stored at D 3 D 2 If the quotient is zero the zero flag will be set lf indirect address specified by 4D format is out of device range or the content of divider is 0 the operation error occurs and the error flag F110
7. 5 133 5214 SN Dose a ae pa Sal ht ER CEA 5 133 able A EE 5 134 5 22 High speed counter instructions s 5 135 5 021 HSGN T osuere acit rr Med 5 135 500 2 HOC eo ld e gat ana 5 137 5 23 RS 485 communication instructions 5 139 e eee 5 139 DA SEND iii e e eC Dane 5 141 Chapter 5 Application instructions 5 Application Instructions 5 1 Data transfer instructions 5 1 1 MOV MOVP DMOV DMOVP MOV FUN 80 MOV FUN 82 DMOV Applicable Move FUN 81 MOVP FUN 83 DMOCP CPU All CPUs Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 MOV P lololol gt lololo OJOO O 5 7 DMOV P IOJOlO C OJO olo JH Operand setting MOV The source device at which the data to be transferred is DMOV stored The device of transfer i HI or destination MOVP DMOVP Available only when do not use computer link module or data link module 1 Functions MOV P Transfer the 16 bits data of the device specified at S to the device specified at D DMOV P Transfer the 32 bits data of the device specified at S 1 S to the device specified at D 1 D 16 bits BUE 16 bits Qi CTO E PEMEREDTIe AA EROS ERE ERU 5 1 Chapter 5 Application instructions
8. Mnemonic Function i amp p symbol No Ladder symbol 5 Contents of processing Page NOP 000 No ladder symbol No operation occupies 1 step O 4 26 3 1 9 Timer instructions Mnemonic Function Ladder symbol E Contents of processing Page symbol No 2 Timer setting value On delay timer gt Y put EE TON Po Tox o T O 4 27 va Output Timer relay No t setting value Timer setting value lt Off delay timer gt Input rore HHTOFF Too OH Gana p ai Output Timer relay No t setting value Timer setting value Accumulation timer gt y ht _ NEN ae f us Tox o ies d tT lat Output Timer relay No t settingvalue t 11 12 Timer setting value lt Monostable timer gt Inout E E TMON f H TMON Txxx Q t 4 33 uut Output Timer relay No t setting value Timer setting value Retriggerable timer Y Input Fl L1 Fl Td H TRTG Tox as Kt dE p Ont Ts Hj Timer relay No t setting value 3 3 Chapter 3 Instructions 3 1 10 Counter instructions Mnemonic Function i z symbol No Ladder symbol 5 Contents of processing 5 Page Counter relay No Reset Count Pulse Count U CTU Cxx Pulse CTU Reset Current O 4 37 R lt S gt Q m value F Setting value Output Counter relay No Reset pi Count Pulse D CID Cxx CTD Reset Current O 14 38 lue R lt S gt bis T Output Sett
9. Numbers of Pace 20 Instructions Application 226 228 Processing speed 0 5 O step 0 2 L1 step Program capacity 7k steps 15k steps 30k steps P I O relay P0000 PO15F 256 points P0000 PO31F 512points P0000 PO63F 1 024 points M Auxiliary relay M0000 M191F 3 072 points K Keep relay K0000 K031F 512 points L Link relay L0000 LO63F 1 024 points F Special relay F0000 FO63F 1 024 points T Timer relay 100msec T000 T191 192 points 10msec T192 T255 64 points The range of 100ms and 10ms timer can be changed with parameter setting C Counter relay C000 C255 256 points S Step controller 00 00 899 99 100 X 100 steps D Data register D0000 D9999 10 000 D0000 D4999 5 000 words Menta The range of integer 1 Signed instruction 16 bit 32768 32767 32 bit 2147483648 2147483647 2 Unsigned instruction 16 bit 00000 65535 32 bit 00000000 4295967295 Timer types On delay Off delay Accumulation Monostable Retriggerable 5 types Counter types Up Down Up down Ring counter 4 types Programming language Mnemonic Ladder diagram Special functions Real time clock RUN mode editing Forced I O control 2 2 P00 P01 Moo M15 KOO K07 FOO F15 LOO LO7 T000 T031 T032 T047 C000 C015 Chapter 2
10. Setting value C010 P060 4 38 Chapter 4 Basic instructions 4 10 2 CTD CTD Down counter Available Device 2i Flag Instructions o Error Zero Carry M P K L F T C S D Integer F110 F111 F112 Cxxx O CTD 3 0 O Count pulse Reset signal Setting value Counter contact number 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 When the reset signal turns on the counter contact is switched off and the current value is reset as the setting value 2 Program example Whenever the P030 is changed from off to on the current value of C010 is decreased by 1 The P031 is reset condition Program P030 Time chart P031 C010 P031 P030 C010 P060 4 39 lt S gt 00010 Setting value Chapter 4 Basic instructions 4 10 3 CTUD CTUD Up down counter Available Device 2 Flag Instructions 2 Error Zero Carry MP KE Et Gasp D Integer on F110 F111 F112 Cxxx O CTUD 3 0 O O Counter contact number Up count Down count Reset signal Setting value 1 Functions The initial
11. A 6 Appendix Junction Keyword Function Description F0040 to FOO5F 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 FOO6F Storing error code Stores the system error code See Section 2 9 F0070 to FOO8F S_FUSE_ER Storing the When a fuse has disconnected in an output disconnection module the corresponding bit to the slot turns state of fuses on F0090 p T20MS 20 ms cycle clock Turning On Off is repeated with a constant F0091 _p_T100MS 100 ms cycle clock cycle F0092 _p_T200MS 200 ms cycle clock F0093 p T1S 1 sec cycle clock F0094 p T2S 2 sec cycle clock Off F0095 p T108 10 sec cycle clock F0096 p T10S 20 sec cycle clock F0097 _p_T60S 60 sec cycle clock F0098 to F009F Unused F0100 User clock 0 Turning On Off is repeated as many times as F0101 User clock 1 the scan specified by Duty instruction F0102 User clock 2 DUTY F010xN1 F0103 User clock 3 cn F0104 User clock 4 N2 scan Off F0105 User clock 5 F0106 User clock 6 SN F0107 User clock 7 N1 scan Off F0108 to FO10f Unused F0110 p ERR Operation error Turns on when an operation error has flag occurred F0111 p ZERO Zero flag Turns on when the operation result is O F0112 p
12. mm stop rj 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 To resume the operation of CPU after the execution of STOP instruction change the mode of CPU to the STOP mode and move it to the RUN mode again by loader or mode switch 2 Program example Program that stops operation when P021 turns on P021 I m s 5 99 dej Chapter 5 Application instructions 5 13 Branch instructions 5 13 1 JMP JME JMP FUN 012 JMP Applicable All CPUs Jump FUN 013 JME CPU A Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 JMP n O 1 JME JMP n E K10S1 K10S K30S K60S 0 63 JME A TUE INPUNE 1 Functions When the JMP n instruction is executed by turn on of input condition the CPU jumps to the JME instruction that has same n and instructions between JMP n and JME n are not executed The JMP n instruction should be matched only one JME n instruction The duplication of JME n is not permitted However the duplication of JMP n instruction is possible No Error A JMP n instruction without corresponding JME n instruction stand alone JMP n will cause program error If on
13. wo003 M0000 0038 a P060 M0000 M0001 0040 yp P M0001 M0002 0043 9 _____________________ Peoe2 M0002 M0003 0046 0049 P064 0051 C000 the current value of counter Less than 10 Less than 20 Less than 30 Less than 40 0 10 10 19 20 29 30 39 40 or more 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 CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 OIOI O OO 0 O O lO 0 TCMP P lololololololo olo o ee DTCMP P O o ololo olo olo L TCMPP DTCMPP Operand setting The start address of block S2 to be compared with O The device at which the D comparison result is stored Available only when do not use computer link module or data link module 1 Functions Compares content of the device specified at S1 with each contents of 16 words from the device specified at S2 The comparison result If two words are same 1 is output If not O is output consists of 16 bits and they are stored at the device specified at D Ifall comparison result are 0 then the zero flag F111 is switched on D 0 Execution conditions Input condition
14. 0 DBCD o2 pBscD OH 2 BCD conversion E Binary BCD 5 11 BIN 064 BIN OH 2 BIN conversion m BCD Binary 5 14 BINP o5 BiNP OH SI 0 DIND 066 DBIN OH 2 BIN conversion BCD Binary 5 14 DBINP 067 DBINP OH o KS 1O 1 9 10 1 3 2 8 Compare instructions Mnemonic Function symbol No Ladder symbol 5 Contents of processing A Page CMP 050 cwe 3 a y Compare S1 and S2 O 5 16 CMPP os docweP a y Result is indicated by F120 F125 Compare S1 1 S1 and S241 DCMP o2 pcmp H a a O 5 16 DOME 053 JpcwPP Sy e Result is indicated by F120 F125 TCMP 054 tome 5 63 O i COPAS S1 and 16 words from 2 Q 5 19 o TOMER o55 tomprG G2 O Result 16bits is stored at D Compare S1 1 S1 and 32 words DTCMP ose prove G2 OH g from S2 2 O 5 19 DTCMPP 05 pTcmPPG O Result 32 bits is stored at DAH 3 6 Chapter 3 Instructions Comparison instructions Continued Mnemonic Function i 2 symbol No Ladder symbol 5 Contents of processing A Page LOAD 028 H 563r 5 21 wn 3 The input condition is switched on a E AND 094 1 5 Ole when S1 S2 dcc o we Y amp p 520 LOAD gt 038 H gt L 5 21 g The input condition is switched on AND gt os i G6L 2 when S1 S2 Signed x 5 22 comparison OR ie 5 amp 5 23 LOAD lt 0
15. 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 JMP 0 JMP 127 JME 0 JME 127 JMP 000 LOAD P0000 2 Process I OUT P001 as NOP JME 000 2 The JMP n instruction should be matched only one JME n instruction The duplication of JME is not permitted However the duplication of JMP n instructions is possible No Error 3 The JMP n instruction without corresponding JME n instruction stand alone JMP n will cause program error If only JME or JMP is inside of a loop subroutine FOR NEXT block or interrupt routine an operation error will occur when the JMP instruction is enabled JMP 005 Error Stand alone JMP 005 Error when it is enabled MOV Q FOR 50 END JME 005 NEXT 2 30 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 Those two instructions should be in pairs LOAD P000 SBRT 40 Error SBRT before END END RET Error Stand Alone LOAD P042 CALL 30 Error No SBRT END LOAD P010 CALL 30 END SB
16. Program that reads 15 words from D0200 of self station then write the data to the 15 words block which begin with the address 5 of buffer memory of the K300S A D module mounted at the slot 02 of remote station h2F through the FUEA module at the slot 02 The link status is stored at M020 word of self station I HH RPUT h8002 h022F D0200 h0005 h0015 MORO YA Remote station Self station Buffer memory of A D module at slot 02 05 15 words 15 words Eus FUEA module module Station Nn h9F System conficuration is same as that of the example of RGET instruction p115 5 121 Chapter 5 Application instructions 5 17 5 STATUS STATUS K200S Applicable Read the link information of FUN 247 STATUS CPU K300S FUEA module of remote station K1000S 7 Available Device Flag Instructions Steps Error Zero Carry M P KJ Lj F TC S D D Integer F110 F111 F112 sl O St O O O 0 0 0 0 OO STATUS 9 O oooo oo olo SS O O OJO OJO OIO Operand setting Slot number of FUEA module is mounted amp Type of special function module to be read o L H STATUS Station number of remote station to be read data amp Slot number of special function module Start address of remote station at which data to be written Device at which the link status is SS stored Available only when do not use c
17. 5 15 Flag instructions 5 15 4 STC CLC STC CLC FUN 002 STC Applicable Set Reset the All CPUs FUN 003 CLC CPU carry flag Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D Integer F110 F111 F112 STC 1 O CLC A HA STC A HA CLC 4 1 Functions STC Turns the carry flag F112 on when the input condition is switched on CLC Turns the carry flag F112 off when the input condition is switched on Execution conditions Input condition ALE STC CLC 2 Program example Executed per scan Program that set the carry flag F112 when MO000 is on LE STC H Program that reset the carry flag F112 when M0001 is on ES CLC H 5 106 Chapter 5 Application instructions 5 15 2 CLE CLE K200S Applicable Reset the latched FUN 009 CLE Ej K300S error flag K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 CLE 4 a H 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 sa et REO STC CLC Executed per scan Executed per scan 2 Program example Pro
18. Address of D area Address shown in the TABLE1 4 Dx544 to Dx554 11 x n wherenz1to7 5 Dx555 to Dx565 E le Add RERA m i xample ress for the average communications scan time 9 DX966 10 Dx976 of the communications module loaded on the slot 6 7 Dx577 to Dx587 gt Dx508 11 x 6 Dx574 Detailed High Speed Link Information Flag List when m 0 T Bit Keyword uo Addres Name Description s Indicates that all stations are normally operating complying with the parameter set in the high speed link This flag turns on under the following conditions 1 All stations set in the parameter are in the High speed link RUN mode and have no error and Dx600 normal run 2 All blocks set in the parameter normally ZHSMREINK ee 0 information RUN_LIN communicate and K 3 The parameters set in all stations which are set in the parameter normally communicate Once this flag is turned on it maintains that state as long as link disable does not make that state stopped This flag turns on when under the condition that _ HSmRLINK is turned on communications of the stations and data blocks set in the parameter is under the following conditions 1 A station set in the parameter is not in the High speed link RUN mode or PORE Bit M trouble abnormal run 2 A station set in the parameter has an error information or 3 The communications of data blocks set in the parameter does not normally operate This flag turns on if the above conditions 1 2 and 3
19. Chapter 5 Application instructions 5 19 Sign inversion instruction 5 19 1 NEG NEGP DNEG DNEGP K200S NEG FUN 240 NEG FUN 242 DNEG Applicable K300S Sign inverse FUN 241 NEGP FUN 243 DNEGP CPU K1000S 4 Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 NEG P olololo lolo olo 1 O DNEG P E D JH Operand setting The device which stores the DNEG NEGP DNEGP Available only when do not use computer link module or data link module 1 Functions NEG P Reverses the sign of the 16 bits data of device specified as D and stores the result in the device specified as D DNEG P Reversees the sign of the 32 bits data of device specified as D 1 D and stores the result in the device specified as D 1 D Used to reverse the positive sign to the negative sign or vice versa Before execution 16bits Sign inversion 2 s complement After execution 5 126 Chapter 5 Application instructions Execution conditions Input condition o Xx NEG DNEG Executed per scan Executed per scan NEGP DNEGP E B Executed only once i Executed only once 2 Program example Program that get an absolute value of D0000 when the value of D0000 is negative lt 0020 0000 M001A M
20. Time chart H RST To96 P023 P020 Setting value TO96 P061 4 32 Chapter 4 Basic instructions An alarm of drill replacement example of TMR instruction 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 2 System diagram Input module Output module P02 P06 Drill Program Sensor Alarm lamp l Motor HR Completion of replacement Description Detect of drill down Replacement completion Turn on an alarm lamp Timer for the lifetime of drill 3 Program P020 1 TMR T000 36000 T000 1 hour timer H S RST T096 T000 CTU C000 Counter C000 lt s gt 00100 1hour X 100 100hours C000 P060 4 33 Chapter 4 Basic instructions 4 9 4 TMON TMON Monostable timer Available Device 2 Flag Instructions o Error Zero Carry M P IK L IF T C S D D nteger F110 F111 F112 Txxx O TMON 3 Y O O Input condition x Timer setting value A pt Tox O Timer contact number x Setting time t Unit period 0 1 or 0 01 sec x Setting value 1 Functions When the input condition turns on the current value will be set as the setting value and starts to decrease The tim
21. data register in the program 2 12 Chapter 2 Functions 2 4 Parameter setting 2 4 1 Watch dog timer setting Applicable to K200S 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 2 4 2 Timer area setting Applicable to K200S K300S K10008 only Timing unit Setting range Default 100ms T000 T255 T000 T191 10ms T000 T255 T192 T255 By setting the 100msec timer area the 10msec timer area is automatically set as the rest of area 2 4 3 The latch non volatile area setting Applicable to K200S K300S K1000S only The latch area designated by parameter setting will hold the result of operation when the CPU is switched on or turned to RUN mode The latch area of K10S1 K10S K30S K60S is fixed and can not be changed Please refer the Chapter 2 2 for memory configuration Device Setting range Default range M M0000 M191F None L L0000 L063F T 100ms T0000 T0191 T144 191 T 10ms T0192 T0255 T240 T255 C C0000 C0255 C192 C255 K1000S D0000 D9999 D6000 D8999 D K300S D0000 D4999 D3500 D4500 K200S S S00 00 S99 99 S80 S99 The setting range of timer can be changed by 100msec 10msec timer range setting 2 13 Chapter 2 Functions 2 4 4 Setting the mode of CPU RUN STOP when an
22. 0 11 1 of o of 1 1 5 4 2 DEC DECP DDEC DDECP Chapter 5 Application instructions DEC FUN 24 DEC FUN 26 DDEC Aaaah All CPUs Decrement FUN 25 DECP FUN 27 DDECP CPU Available Device Flag Instructions Steps Error Zero Carry M PK L F T C S D D Integer F110 F111 F112 DEC P olololo lolo olo s8 0 0 0 DDEC P I HI D JH Operand setting The device to be increased DE by DEC instruction DDEC DECP DDECP Available only when do not use computer link module or data link module 1 Functions DEC P Performs the subtraction of 1 to the device 16 bits data specified at D DDEC P Performs the subtraction of 1 to the device 32 bits data D 1 D Ifthe DEC P or DDEC P is executed when the content of device is 0 the content of device will be hFFFF or hFFFFFFFF and the carry flag F112 is set The zero flag will be set when the content of device is 0 If the device specified by D is out of the range the operation error occurs and the error flag F110 will be set 16 bits Chapter 5 Application instructions Execution conditions Input condition M EU E DEC DDEC Executed per scan 4 Executed per scan 4 amp 4 DECP DDECP i i Executed only once i E Executed only once gt lt ao
23. 4 K200S K300S K1000S To read write RTC data of K200S K300S K1000S is similar as KIOS K30S K60S The only difference is memory address of current preset RTC data See the following table The current RTC data Memory Area Description Data Word Higher byte Lower byte BCD format F053 Year Month h9812 F054 Day Hour h2219 F055 Minute Second h3746 F056 Date hxx02 Example 1998 12 22 19 37 46 Tuesday The preset RTC data Memory Area Word Description Data K200S K300S K1000S Higherbyte Lowerbyte BCP format D4990 D9990 Year Month h9901 D4991 D9991 Day Hour h1711 D4992 D9992 Minute Second h5324 D4993 D9993 Date hxx00 Example 1999 1 17 11 53 24 Sunday M1904 RTC data change bit When the M1904 bit is switched on the new data in D4990 D4993 D9990 D9993 will be moved to F53 F56 After data is moved M1904 has to be switched off immediately because current data will be updated every scan while M1904 is on lt Example program for K200S K300S gt P000 MOV h9901 D4990 1999 January Start switch MOV h1711 D4991 17th 11 o clock MOV h5324 D4992 53min 24sec MOV h0000 D4993 Sunday D M1904 Changing enable Other Program 2 26 Chapter 2 Functions 2 6 3 Forced I O setting Applicable for K200S K300S K1000S It is possible to output a designated data regardless of the result of operation
24. 4 8 1 NOP NOP FUN 000 NOP Available Device 2 Flag Instructions o mip K L IF T c Is D D Integer amp Error Zero Carry F110 F111 F112 NOP 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 a To provide space for debugging of sequence programs b To delete an instruction without changing the number of steps C To delete an instruction temporarily 2 Program example Mnemonic program 0000 0001 0002 0003 0004 0005 0006 LOAD AND NOP OUT LOAD OUT END P020 P021 P060 P022 P061 Ladder program P020 P021 00000 AAA P060 P022 NOP is omitted 00004 PAA P061 00006 fEND 4 27 Chapter 4 Basic instructions 4 9 Timer instructions 4 9 1 TON TON On delay timer Available Device e Flag Instructions o Error Zero Carry MiP K LE JF T C S D D nteger F110 F111 F112 Txxx O TON 3 O O O Input condition Timer setting value A TON Pd di Timer contact number x Setting time t Unit period 0 1 or 0 01 sec x Setting value 1 Functions Atimer consists of timer contact current value and setting valu
25. Appendix A 1 2 Bit Word memory device timer amp 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 If the T or C device is used as an operand of word instruction the current value word is effected by the instruction The setting value can not be changed by user A 1 3 Word memory device The D device used by word Therefore the D device can not be used as an operand of bit instruction such as LOAD OUT etc To control the D device by bit use special instructions such as BLD BAND BOR etc A 2 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 Set when PLC is on EPROM run mode F010 Always on Used as a dummy relay or initalization in user programs Foti Always off y reay prog F012 1 scan On On during the first scan after PAM gt RUN mode F013 1 scan Off Off during the first scan after PGM RUN mode F014 Turmover per Repeat set reset during PLC is on RUN mode Each scan e Replated to SEND RECV instructions only F020 Communication e Upper byte The station No where err
26. D Integer F110 F111 F112 FALS n O 3 FALS n HH Operand setting The error code to be stored n at the F area 1 Functions When the input condition is switched on stores a number specified as n to the F14 word F140 F14F and set the FALS flag F038 Once the F14 is set by a FALS instruction it keeps the value until it is cleared by executing FALS 0000 instruction Even if other FALS instruction is executed the value of F14 word is not changed Execution condition Input condition Er c3 AE FALS E PA ure A 4 pp 84 gt 2 Program example Executed per scan FALS FALS FALS FALS h1234 hAAAA hBBBB h0000 Executed per scan Chapter 5 Application instructions 5 12 2 DUTY DUTY Applicable User defined FUN 205 DUTY EU All CPUs pulse Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D 0D Integer F110 F111 F112 O DUTY ni O 7 n2 O M bum D nt ne YA Operand setting The contact of F device to which a pulse is output Number of scans during ni 7 which the pulse is on 2 Number of scans during de which the pulse is off 1 Functions Generates an user defined timing clock specified as D to On at the scan count specif
27. F112 and the carry flag will be transferred to the LSB of D D 1 Carry flag 16 bits 16 bits Chapter 5 Application instructions Execution conditions Input condition M NEU TP MEM um ROL DROL Executed per scan 4 Executed per scan ROLP DROLP i i Executed only once i i Executed only once Ec m E 2 Program example Whenever a rising edge is detected at P030 16 bits of D0000 word and carry flag will be rotated with left direction ESF RCLP D0000 D0000 h78D3 16 bits 5 33 5 5 4 RCR RCRP DRCR DRCRP Chapter 5 Application instructions RCR FUN 44 RCR FUN 46 DRCR Applicable Rotate right CPU All CPUs FUN 45 RCRP FUN 47 DRCRP include carry flag d Available Device Flag Instructions Steps Error Zero Carry MIPIK L F T CI S D Integer F110 F111 F112 RCR P Qojlojlolo jolo O 3 O O DRCR P e Lif OH RCRP DRCRP Available only when do not use computer link module or data link module Operand setting The device to be rotated right by RCR instruction 1 Functions RCR P Rotates 16 bits of the device specified at D and the carry flag in right direction The LSB will be transferred to the carry flag F112 and the carry flag will be transferred to the MSB F E D C B A 9 8 7
28. Instructions 3 2 7 Exchange instructions Mnemenies Ipadeon Ladder symbol E Contents of processing B Page symbol No gt o XCH 102 dxoH 0 63H 2 D1 4 D2 5 42 XCHP 103 xcuP 0 DXCH 104 DXCH 63H 2 S D1 1 D1 4 gt D2 1 D2 O 542 DXCHP 105 bxcuP 5 9 3 2 8 BIN arithmetic instructions Mnemonic Function Ladder symbol E Contents of processing 2 Page symbol No 2 o ADD wo ADD 3 62 oh 2 S S1 S2 D O 5 44 ADDP 11 Jar 8 62 O DADD 112 DADD 5 63 O St 1 S1 S2 1 S2 2 O 5 44 DADDP 13 DADDP O e D 1 D SUB ma SUB E 62 oO 2 2 S1 S2 D O 5 46 SUBP 115 suBP 5 623 2 DSUB 116 Dsus 5 6 O 2 St 1 S1 S2 1 2 2 O 5 46 DSUBP 117 DsuBP 6 oH e gt D 1 D MUL 120 MUL 9 J e St x S2 D 1 D G O 5 48 MULP 121 JmuLP 3 62 O D 1 High word D Low word S1 1 S1 X S2 1 S2 DMUL 122 JpmuL 5 63 O 2 D 3 D 2 D 1 D 2 O 5 48 DMULP 123 DMULP 9 D e D 3 D 2 Higher 2 words D 1 D Lower 2 words Chapter 3 Instructions BIN arithmetic instructions Continued Mnemonic Function i 2 symbol No Ladder symbol 5 Contents of processing amp Page S1 S2 D DIV 124 DIV 63 oO 2 2 D 1 Remainde
29. MULBP DMULB DMULBP DIVB DIVP DDIVB DDIVBP 15X WAND WANDP DWAND DWAND WOR WORP DWIR DWORP RECV SEND 16X WXOR WXORP DWXOR DWXOR WxNR WXNRP DWXNR DWXNR RCV 9 SND 17X BSUM BSUMP DBUSM DBUSMP SEG SEGP ENCO ENCOP DECO DECOP 18X BSUM FILRP DFILR DFILRP Fiw FLWP DFILW DFILWP OR 9 onp 19X ASC ASCP UNI DSI DIS DISP or gt ORD gt on oRD lt 20x IORF ionrP 9 wot 9 woTP Fals 9 DUTY FOR 9 NEXT OUTOFF 21X HSONT DIN DINP pour DOUTP Hsc or gt 9 onp 9 on 9 ORD lt 22X BREAR En ni BSET 9 BRST 9 IRET roNT INT 9 on 9 orD lt gt 23X GET GETP 9 RGET 9 RPUT Pur pute pour sR ec n 24X NEG NEGP DNEG 9 puecP 9 READ 9 wnurrE 9 conn stATUS BLD BLDN 25X BAND BaNbN 9 Bon BORN e Available with K1000S K300S K200S series only m Available with K10S K10S1 K30S K60S series only
30. Na zhin Self station 10 words Chapter 5 Application instructions System configuration Self station Power 16 points 32 points FUEA FUEA supply input input module module module module module Station Station Na hat Na hN slot 1 slot 2 slot 3 Remote station 1 K1000S Power CPU 16points 4 32points FUEA supply module input channel input module module module A D module module Station Na hin slot 0 slot 1 slot 2 Remote station 2 K3008 Power 16 points 32 points 4 FUEA supply input input channel module module module module A D module Station Na h2F slot 0 slot 1 slot 2 slot 3 5 119 Chapter 5 Application instructions 5 17 4 RPUT RPUT K200S Applicable Write data to special function FUN 233 RPUT CPU K300S module of remote station K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 sl O St O O RPUT 13 O O ojojoo ojo olo n2 O O SS O OJO O OIO OJO Operand setting H erur s st O n ss Slot number of FUEA module is mounted amp Type of special function module to be read The configuration of sl Lower 8 bits CD Slot No of FUEA Station number of remote station Higher 8 bits AB Type of special to be read data amp Slot number of sp
31. O i A MCS MCSCLR n H n Nesting up to 7 TH 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 Each MCS instructions are followed by a number n that shows the priority of master control 0 is the highest priority and 7 is lowest priority The MCS instruction should be used in order of priority level The MCSCLR instruction shows the end of master control When a MCSCLR n instruction is executed all master control that has lower priority than n are ended automatically 4 13 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 0000 0002 0004 0006 0008 0010 0012 0013 P062 P063 MCSCLR 0 END MCS 0 block MCS 1 Scanning between the MCS and MCSCLR instructions is executed even when the On Off command for the MCS instruction is off Therefore scan time does not become shorter 2 When On Off command for the MCS instruction is off the operation result of MCS to MCSCLR is as indicated below TIMER The timer output contact turns off and the current value becomes 0 COUNTER The counter output co
32. Operand setting Data to be compared 1le G2 Jl 1 Functions 2 Compares contents of S1 and S2 then operates as a serial NO contact according to the comparison operation result The comparison is executed as signed operation The comparison operation result is as shown below Instruction i Comparison Instruction ne Comparison ban Condition operation bola E Condition operation y result y result S S S S lt S lt S lt S gt S gt S 2S gt S S lt gt S 4S en lt gt S S x S S S 2S gt S gt S gt S lt S Program example a Compare P0000 POOOF and D0001 If their values are equal and MOOO is on P0010 bit will be switched on M000 P000 D0001 H Poo10 b Compare 1000 and contents of D0001 and D0002 32 bits If the content of D0001 and D0002 is less than 1000 and M020 is on P0010 will turn on M020 D gt 1000 D0001 HA P0010 5 22 Chapter 5 Application instructions 5 35 OR s5 gt lt gt lt lt gt FUN 188 OR FUN 189 ORD or L_ FUN 196 OR FUN 197 ORD gt K200S Parallel NO FUN 198 OR FUN 199 ORD Applicable idus contact with FUN 216 OR FUN 217 ORD gt CPU comparison result FUN 218 OR FUN 219 ORD stone
33. The clear condition Sxx 00 can be operated at any time while the sequential process is running Chapter 2 Functions 2 3 6 Timer relay T MASTER K series have 100msec and 10msec timer The timing method is various 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 lt Figure 3 Types and timing methods of timer instructions gt 7 7 Input contact No of timer relay Setting value Timer m Timing a instiucton Description method Time chart mu MENS on Delay timer condition TON ON Delay Increment E i E t gt Timer i a output t setting value Input a i condition 7 OFF Delay timer TOFF OFF Delay Decrement A po Timer T output t setting value Input tt Accumulation iti i Accumulation condition t t1 t2 timer TMR ON Delay Increment t t2 Timer output 4A BP AN t setting value Input HEH m Monostable timer condition TE TMON Monostable Decrement peces Timer pm E output t setting value Input m B condition Ti Retriggerable timer TRTG Retriggerable Decrement oeo output t setting value 2 9 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 swit
34. b d The start bit of D c x Don t care d x Numbers of decoded nibbles range 0 F Decodes the data of z X4 bits block that start from the s bit of device specified at S into 7 segment display data and stores the result to the z X 8 bits block that starts from the s bit of device D 5 72 Chapter 5 Application instructions Execution conditions Input condition TEM EE LE NE SEG Executed per scan 3 Executed per scan 84 tc gt SEGP i i Executed only once i E Executed only once EE E 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 PO6 when P030 is switched on P030 I4 I SEGP D0000 P0O6 h2302 JA F E D C B A 9 8 7 6 5 4 3 2 1 0 P07 P06 Start from bit 3 of P06 P063 5 73 Chapter 5 Application instructions 3 7 segment display data Configuration of 7 Displayed Hex Binary segment b7 b6 bb b4 b3 b2 bi bo data 0 0000 0 0 AJ AJ AJ AJ A AA 0 1 0001 Ooi ol oloj oli ilo 1 2 0010 Mail AOS 2 3 0011 0 4 0 en AJ A A 3 4 0100 olililololililo 4 5 0101 on ME odds hae tll eg ol 5 6 0110 e bi aree rods ae Pss PAL 07 1 6 7 0111 0 0 4 0 0 AJ A 4 7 8 1000 ba B b folailili l i lilail 8 9
35. error occurs and program is NEXT stopped END 5 97 Chapter 5 Application instructions 5 12 4 OUTOFF OUTOFF Applicable FUN 208 OUTOFF All CPUs All output off CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 OUTOFF 1 HAL OUTOFF Fi 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 However the P device is updated according to the operation result When the input condition switched off the CPU restarts to output operation result of P area to external devices Useful for test operation of a PLC system Execution conditions Input condition d Lol L OUTOFF Executed per scan 4 Executed per scan 4 gt 84 gt 2 Program example Program that stop to output to external devices while P020 is on F093 INCP P05 F092 DECP P06 P020 H k OUTOFF 5 98 Chapter 5 Application instructions 5 12 5 STOP STOP K200S Applicable Stop execution of FUN 008 STOP cis K300S program K1000S Available Device Flag Instructions Steps Error Zero Carry M JP KjJ LJj F T C S D D Integer F110 F111 F112 STOP 1
36. is set The sign of quotient and remainder is as following table D 2 Quotient Remainder positive positive positive positive positive negative negative positive negative positive negative negative negative negative positive negative Chapter 5 Application instructions Execution conditions Input condition ee e dee DIVSP DDIVSP i i Executed only once i Executed only once Se ae Ecl 2 Program example Program which stores the division result of D0001 and D0002 at D0010 D0011 while P020 is on P020 HH bs Doo pooo D0010 D0001 D0002 D0011 D0010 ABO hc678 h059B hFFFE EH Bx 4728 Remainder Quotient 1435 2 Program which stores the division result of D0001 D0002 and D0003 D0004 at D0010 D0013 when P020 is switched on P020 I HL DDiVSP 0001 Dooos Dooto H D0001 D0002 D0003 D0004 hFo04 5678 hoozr h8765 c EN ECNE D0013 D0012 D0011 D0010 hFFF5 h5E61 hFFFF hFFCB Remainder Quotient 696735 53 Chapter 5 Application instructions 5 9 BCD arithmetic instructions 5 9 1 ADDB ADDBP DADDB DADDBP ADDB FUN 130 ADDB FUN 132 DADDB Applicable Amei S BCD addition FUN 131 ADDBP FUN 133 DADDBP CPU e Available Device
37. occur If normal conditions are restored it will turn off again Dx601 Overall Indicates overall communications state of every HSmSTAT Bit 0 to communications state blocks f the parametersat E k Arra information of K Data p k 0 to 63 y Dx604 Block set by the high HSmSTATE k _HSmMOD k amp 15 link parameter _HSmTRX k amp _HSmERRIK Dx605 K Data Block setting diu tas Ead 0 to stations mode Indicates the operation modes of stations set k 0 to 63 Dx608 information RUN the K data block of parameters y 15 1 others 0 Dx609 K Data Block y ME HSmTRX k Bit 0 to communications state Indicates whether communications of the K data Arra block of parameters are normally operating as k 0 to 63 Dx612 information Normal set z y 15 1 abnormal 0 i HSmERR k Bit Dx613 K Data Block setting ATA 0 to stations state Indicates whether the stations set in the K data k 0 to 63 Dx616 information Normal block of parameters have an error y 15 1 abnormal 0 A 10 Appendix Detailed High Speed Link Information Flag List when m 1 to 3 High Speed Link D area Type Address penak High n Link 2 pisces Compared to the D area addresses shown in the m x TABLE 3 where m 0 they are calculated as shown High T Pinks SAN below where m 1 to 3 High Sp
38. of source S is outside the range of 0 to 9 Example S h78A5 2 Program example While P020 is on convert the BCD data of POO word and transfer the result to the D0001 P020 HM IM BIN PO0 D0001 JH 8000 4000 2000 1000 800 400 200 100 80 40 20 10 8 4 2 1 POO 4369 32768 16384 8192 4096 2048 1024 512 256 128 64 32 cons eno Lo o Jo o o e TS rete 5 15 Chapter 5 Application instructions 5 3 Comparison instructions 5 3 1 CMP CMPP DCMP DCMPP CMP FUN 50 CMP FUN 52 DCMP Applicable All CPUs Compare FUN 51 CMPP FUN 53 DCMPP CPU e Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 cw K D ooo o0 o olo O00 5 9 O pemP P 2 ololo o ololo O HO D 2 JH Operand setting CMP Data to be compared 1 Functions Compares contents of two devices specified at S1 and S2 After comparing set corresponding flag among F120 F125 F120 F121 F122 F123 F124 F125 Flag lt lt gt 2 z GD gt G2 0 0 0 1 1 1 GD 2 1 1 0 0 0 1 GD G 0 1 1 0 1 0 Above flags indicate the result of CMP instruction executed at last The error flag F110 is set when S1 or S2 specified as D format is over device range The instruction at which erro
39. 0 0 0 0 0 0 0 1 b Write the forced I O address last bit h0001 to the corresponding address word Write h0001 to the D9707 D9707 word 0 disable forced I O 1 enable forced I O F E D C B A 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 C Switch on the forced I O request bit M1910 d Output of PO7 word P The previous result of operation F E D C B A 9 8 7 6 5 4 3 2 1 O0 PIPIP P IP P PIPIP P I P P P P PP 2 6 4 Program edit in RUN mode Applicable for K200S K300S K1000S User can insert delete or change instructions of program while the CPU is running This function is useful to debugging or test operation Please refer the user s manual of KLD 150S or KGL WIN for detail information Remark The program edit in RUN mode can not be performed for the following instructions JMP JME CALL SBRT FOR and NEXT instructions Moreover the program that has very long scan time longer than 2 seconds can not be edit while the CPU is in the RUN mode 2 28 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 i
40. 1001 0 4 AJ s AJ AJ A 4 9 A 1010 NS NES TE 0 AJ A 2g A B 1011 olilililililolo B C 1100 Bebe rege pz eo O 1 e D 1101 olilolililililo D E 1110 olililililololai E F 1111 olilililolololai F 5 74 Chapter 5 Application instructions 5 11 2 ASC ASCP ASC FUN 190 ASC Applicable All CPUs ASCII code FUN 191 ASCP CPU Available Device Flag Instructions Steps Error Zero Carry M P KLJ F T C S D Integer F110 F111 F112 0 0 0 0 0 0O O ASC O Oo oOlolo olo O me 2 ASCP Cw O a O cw ASC ms d Q o1 Operand setting Available only when do not use computer link module or data link module 9 The device at which source data is stored D The device which will store ASCII data C Information for start bit and W numbers of transferred bits 1 Functions The format of Cw etapa e s The start bit of S f d Thestart bit of D g x Don t care h x Numbers of decoded nibbles range O F Converts the data of z X 4 bits block that start from the s bit of device specified at S into ASCII code and stores the result to the z X 8 bits block that starts from the s bit of device D 5 75 Chapter 5 Application instructions Execution conditions Input condition TEM EE LE NE ASC Executed per sca
41. 21 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 PO60 and K000 have self locking circuit and the operation of two contact is same However when the power is switched off and turned on again power failure operations of P and K are different as shown below Power Power PBO PB1 i ee 4 P060 P060 PBO PB1 Kooo K000 Self locking Non volatile during power off 2 The difference of I O relay P and keep relay K with the SET RST instruction The SET instruction makes turn a specified device on and keep the on status until the RST instruction is executed However the P and K area operate differently when a power failure occurred Power Power PBO failure recovery E ES SET P060 1 SET K000 PES RST P060 RST K000 4 22 Chapter 4 Basic instructions 4 6 Step controller instructions 4 6 1 SET Sxx xx SETS Available Device e Flag Instructions o Error Zero Carry We is LE E e ES AD D nteger F110 F111 F112 SETS O 2 gt ser S wo S xx xx x Step No 00 99 K10S1 0 15 K10S K30S K60S 0 31 Group 00 99 K200S K300S
42. Chapter 5 Application instructions 5 6 3 SR K200S SR Applicable FUN 237 SR K300S Shift register CPU K1000S A Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 D olo ojo BSFT P 5 O n O O Input data Operand setting Shift direction SR Clock D P M L K N Integer D Reset Available only when do not use computer link module or data link module The start bit of block to be shifted The numbers of bit of block N to be shifted 1 Functions Whenever a rising edge is detected at the clock input shifts the block from the bit specified at D to the bit D n by 1 bit At the start bit of shift operation 0 is entered when the input data is off and 1 is entered when the input data is on The start bit of shift operation is various according to the direction of shift operation left direction shift LSB right direction shift MSB The shift direction indicates the direction of shift operation If the shift direction is off it means a left direction shift Otherwise it means a right direction shift When the reset signal is switched on all bit from D to D n is cleared as 0 Execution condition Clock ee queo ce SR Executed only once 5 40 Executed only once Chapter 5 Application i
43. D ss Read the information of remote x 5 118 station Chapter 3 Instructions 3 2 18 Interrupt instructions Mnemonic Function i a symbol No Ladder symbol 5 Contents of processing A Page EI 236 LE Ji Enable an interrupt x 5 119 DI 239 Dl n Ji Disable an interrupt EI 21 A Ji Enable all interrupts 5 119 DI 222 1 DI Ji Disable all interrupts TDINT 226 TDINT n Ji Start of TDI routine 5 120 INT 227 1 INT m Ji Start of PDI routine k 5 121 IRET 225 RET Ji End of interrupt routine 3 2 19 Sign inversion instructrions Mnemonic Function E i amp P symbol No Ladder symbol 5 Contents of processing 2 Page NEG 240 NEG Invert the sign of D 5 122 NEGP 241 NEGP DNEG 242 DNEG Invert the sign of D 1 D 5 122 DNEGP 243 3 19 Chapter 3 Instructions 3 2 20 Bit contact instructions piii ne tas Ladder symbol E Contents of processing 5 Page BLD 248 H B n ore start with the x 5 124 BLDN 249 H BN i E A DEB d start with the x 5124 BAND 250 B n e cho connection with x 5 125 BANDN 251 BN D E c a connection with x 5125 BOR 252 L B O n H T eu oT connection with 5 126 BORN 253 L BN Hl e rU on connection with 5 126 BOUT 236 Bout n H uae of operation to
44. D0000 and D0001 and store the addition result to PO6 word LH L i obP Do000 Dooo Pos 16 bits D0000 5 45 5 8 2 SUB SUBP DSUB DSUBP Chapter 5 Application instructions SUB FUN 114 SUB FUN 116 DSUB Applicable All CPUs Binary subtraction FUN 115 SUBP FUN 117 DSUBP CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 GDlololololo o o oo Oo SUB P lololololololo ololo lzm O O O DSUB P O o ololo olo olo Operand setting The device storing minuend D The device storing subtrahend The device at which the subtraction result is stored Available only when do not use computer link module or data link module 1 Functions SUB P Performs the subtraction of 16 bits BIN data specified at S1 and S2 The subtraction result is stored at the device specified at D DSUB P Performs the subtraction of 32 bits BIN data specified at S1 1 S1 and S241 S2 The subtraction result is stored at the device specified at D1 1 D1 When the minuend is less than subtrahend the LSB will underflow and the carry flag F112 will be set When the subtraction result is 0 the zero flag is set If indirect address specified by D format is out of device range the operation error occurs
45. D0001 and store the addition result to PO6 word P020 H ano D0000 Dooo Pos 16 bits D0000 n o o ojo sjopojrjo ojo ojo o o nao 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 CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 OI OI O OO 0 O O lO 0 SUBB P lololololololo olo o lzm O O O DSUBB P O o ololo olo olo L Operand setting The device storing minuend D The device storing subtrahend The device at which the subtraction result is stored Available only when do not use computer link module or data link module 1 Functions SUBB P Performs the subtraction of 16 bits BCD data specified at S1 and S2 The subtraction result is stored at the device specified at D DSUBB P Performs the subtraction of 32 bits BCD data specified at S1 1 S1 and S241 S2 The subtraction result is stored at the device specified at D1 1 D1 When the minuend is less than subtrahend the LSB will underflow and the carry flag F112 will be set When the subtraction result is O the zero flag is set f indirect address specified by 4D format is o
46. D240 Analog Data of A D Ch 0 Input D241 Unit Data of A D Ch 1 Input D242 1 Data of D A Output K30S A K60S A type D243 Analog Data of A D Ch 0 Input Onl D244 Unit Data of A D Ch 1 Input y D245 1 Data of D A Output D247 High Speed Counter Mode Set Area Dead pe Gut Malus of ete O S V1 5 or later Communications MK S Series Ver1 3 or D249 Later Used when M310 D252 RTC User Write Data Area Point is on Same format As L12 L15 D253 Current Scan Time D254 Minimum Scan Time D255 Maximum Scan Time A 5 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 Turns on when the CPU in the Debug mode F0006 Remote mode Turns on when the CPU in the Remote mode F0007 User memory Turns on when a user memory is installed installation F0008 and Unused F0009 F000A User memory Turns on when a user memory is being operation operated FOOOB to FOOOE Unused FOOOF p_STOP Execution of the Turns on when the STOP instruction is being STOP instruction operated F0010 p ON Always On Always On F0011 p OFF Always Off Always Off F0012 p 1ON 1 Scan On 1 Scan On F0013 p 1OFF 1 Scan Off 1 Scan Off F0014 p STOG Scan toggle Scan tog
47. DBCDP E a ried only once e jqExecuted only once Operation Error B B 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 The data of source S is outside the range of 0 to 99999999 2 Program example While P020 is on convert the binary data of D001 and transfer the result to the PO5 word P020 M ME BCD D0001 P05 JH 32768 16384 8192 4096 2048 1024 512 256 128 64 32 cs o oo o oe e eS TDI IS py 8000 4000 2000 1000 800 400 200 100 80 40 20 10 8 4 2 1 P05 4369 5 12 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 2 System diagram Input module Output module P031 Pos Pos P030 Light S W Light S W m gt a Outgoing Incoming gt m Light S W Conveyer motor e Counter reset S W P032 Digital indicator 3 Program P030 0000 P031 U CTUD CO000 D P032 R lt S gt 0003 C000 0006 Y P06P F010 Convert the current value of 0098 BED Cope Meo counter
48. DsuBBP E 620 6 S1 1 S1 S2 1 S2 D 1 D BCD multiplication MULB 140 MuLB 5 62 o 2 f 2 S1 x 2 D 1 D O 556 MULBP 141 MULBP Y O D 1 High word D Low word BCD multiplication S1 1 S1 X S2 1 S2 DMULB 142 pmuLs 6 2 O 2 D 3 D 2 D 1 D O 5 56 DMULBP 143 DMULBP D 1 O SO D 3 D 2 Higher 2 words D 1 D Lower 2 words BCD division DIVB 144 pive E 63 OH 2 S1 S2 gt D 2 O 5 58 DIVBP i45 DIvBP 6 amp OH D 1 Remainder D Quotient BCD division S1 1 S1 S2 1 S2 DDIVB 146 pove 5 62 2 E D 3 D 2 D 1 D 5 58 DDIVBP 147 DDIVBP Ji eo af e e D 3 D 2 Remainder D 1 D Quotient Chapter 3 Instructions 3 2 10 Logical opration instructions pines joe s Ladder symbol E Contents of processing B Page WAND 130 WAND 5 62 O g a S1 AND S2 D O 5 60 WANDP 1 31 WANDPG 62 O DWAND 132 pwann QO g S1 1 51 AND S2 1 S2 5 O 5 60 DWANDP 133 JDWANDP S 20 9 gt D 1 D WOR 154 WAND 62 2 S S OR S2 D O 562 WORP 155 WANDP 63 O DWOR 156 DWAND S QO a S1 1 51 OR S2 1 S2 5 O 5 62 DWORP 157 bwANDP S SO D gt D 1 D WXOR 160 wor E 2 2 S1 XOR S2 D 5 64 WXORP 1681 wxorP 5 6250 DWXOR 162 pwxor QO g S1 1 S1
49. Executed only once Executed only once gt gt e 2 Program example Program which stores the multiplication result of D0001 and D0002 at D0010 D0011 while P020 is on P020 HA H MULS D0001 D0002 D0010 TA D0001 D0002 D0011 D0010 ho4D2 hE9D2 hFF95 mes 21234 5678 7006652 Program which stores the multiplication result of D0001 D0002 and D0003 D0004 at D0010 D0013 when P020 is switched on P020 A H DMULSP D0001 D0003 poo10 KH ECC EOM Er E CHEN 6 eee AN 798 D0013 D0012 D0011 D0010 h0071 h26FC h794F hC210 5 8 5 DIV DIVP DDIV DDIVP Chapter 5 Application instructions DIV FUN 124 DIV FUN 126 DDIV Applicable All CPUs Binary divide FUN 125 DIVP FUN 127 DDIVP CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T CY S D D Integer F110 F111 F112 GDlololololo o o oo Oo DIV P lololololololo ololo 7911 O O DDIV P O o ololo olo olo Operand setting The device storing dividend The device storing divider The device at which the division result is stored Available only when do not use computer link module or data link module 1 Functions DIV P Performs the division of BIN data specified as S1 and the BIN data specified as S2 and stores the division result into the device s
50. F112 GD o ololololo o O0 0 WOR P G2 o ololololo o olo o lem O O DWOR P lolololo olo O0 j D 2 JH Operand setting Sp Data for which logical addition will be performed The device at which the result of logical addition is stored Available only when do not use computer link module or data link module 1 Functions WOR P Performs the logical addition of the 16 bit data of device specified at S1 and S2 per bit Then stores the result of logical addition into the device specified at D DWOR P S2 1 S2 per bit and stores the result into the device specified at D 1 D 16 bits If the result of logical addition is O the zero flag F111 is set Performs the logical addition of the 32 bit data of device specified as S1 1 S1 and fthe indirect address specified by D format is out of device range the operation error occurs and the error flag F110 is set Chapter 5 Application instructions Execution conditions Input condition TEM IMEEM NEU EN WOR DWOR Executed per scan Executed per scan WORP DWORP AE Executed only once i d Executed only once 2 Program example Program that performs the logical addition of the contents of P04 and P05 words then stores the result to the PO6 word when the P020 is switched on P020 FSE WORP P04 PO05 P06 H 16 bits WOR 5 67 5 10 3 WXOR WXORP DWXOR DWXORP Chapt
51. Input condition ee eX GET J Executed per scan Executed per scan GETP Executed only once Executed only once 2 Program example Program that reads 4 words from the address 0 of buffer memory of A D module and stores them to the 4 words from D0010 of CPU module Power i i 4 2 supply input input channel channel module module module A D D A module module slot 0 slot 1 slot 2 slot 3 A HA GET h0002 h0000 D0010 h0004 A The buffer memory of the A D module CPU module 0 h1122 4 words D0910 4 words 5 109 Chapter 5 Application instructions 5 16 2 PUT PUTP PUT PUTP FUN 234 PUT i Kents Write data to cay Applicable K3008 special function FUN 235 PUTP CPU K1000S module Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 sl O D O PUT P 9 O o ololo olo olo n2 O Operand setting Slot number of special function n1 module is mounted PUT sl D 6 n2 Start address of data to be stored Start address of source data Numbers of word to be written Available only when do not use computer link module or data link module 1 Functions Writes the data of n2 words which start at the address specified as S of CPU and transfer the data into the block starting at the address
52. LOAD AND LOAD LOAD AND LOAD OR AND LOAD AND LOAD AND LOAD OUT OUT END END The AND LOAD instruction can be used consecutively up to 7 times 8 block When connect more than 9 blocks in serial write a mnemonic program such as the example A If you use KGL WIN software and write program in ladder mode the KGL WIN software will convert the ladder program into mnemonic program A automatically 4 7 Chapter 4 Basic instructions 4 2 OR LOAD OR LOAD Available Device e Flag Instructions o Error Zero Carry MiP K L F T C S D D Integer F110 F111 F112 OR LOAD 1 Block A TT 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 2 Program example Program P020 P023 P025 BOE P060 P021 P061 P023 P024 OR LOAD Time chart P020 P024 P025 P060 P061 4 8 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 Poso _ M002 M003 M004 M005 M006 M007 Moos M009 END Mnemonic program A Don t use OR LOAD instructions B Use OR LOAD instructions consecutively consecutively LOAD LOAD AND
53. MET IEEE NEP EE CEN TCMP TCMPP Executed per scan i Executed only once o if i i Executed only once ert 3 Executed per scan Chapter 5 Application instructions 2 Program example While P020 is on compare the content of D0001 with 16 words from MOO MOO M15 and output the comparison result to PO6 word P060 PO6F P020 Home D0001 M000 Pos D0001 hBCDE M000 1 PO60 h1234 0 P061 hBCDE M002 1 P062 h0000 0 P063 hBCDE MO04 1 P064 A c em ae Ma A Ng hBCDE M012 1 POGC hOOFF M013 0 PO6D hBCDE MO14 1 PO6E h0000 M015 0 PO6F Chapter 5 Application instructions 5 3 3 LD gt lt gt lt lt gt FUN 28 LD FUN 29 LDD Lo FUN 38 LD gt FUN 39 LDD gt K200S Start NO contact FUN 48 LD FUN 49 LDD Applicable K3008 with comparison FUN 58 LD gt FUN 59 LDD CPU result FUN 68 LD FUN 69 LDD lt K10008 FUN 78 LD lt gt FUN 79 LDD lt gt Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 LoL GD ololo ololo olo o 5 9 O LoL gt o ololololo o olo o Operand setting 0 O E 1 Data to be compared 1 Functions Compares contents of S1 and S2 then operates as NO contact according to the comparison oper
54. S D D nteger F110 F111 F112 Cxxx O CTR 3 O O O Counter contact number Count pulse Reset signal Setting value 1 Functions Whenever a rising edge is detected at the count pulse input the current value is increased by 1 f the current value is reached to the setting value the counter contact is switched on Then the counter contact and current value will be cleared as 0 when the next rising edge is applied to the count pulse input When the reset signal turns on the counter contact and current value will be cleared as O 2 Program example The P030 is count pulse input and when the current value is same as the setting value the counter contact is switched on When the P030 is switched on 11 time the counter contact P060 is off and the current value is cleared as O Program P030 lt S gt 00010 Time chart pos P030 C005 P060 4 42 Chapter 5 Application instructions 5 1 Data transfer instructions 5 1 5 1 1 MOV MOVP DMOV DMOVP ccscssessesesseseseeseeeseeseeteseenees 5 1 5 1 2 CMOV CMOVP DCMOV DCMOVP cs csceeeseeseeseeseees 5 3 5 1 3 GMOV MOV Picci raid da 5 5 514 EMOV FMOVP sasananing eag dali 5 7 51 5 BMOV BMOVP ii asa ag tes cerca shite gena nd naga gana be stu Dus 5 9 5 2 Conversion instructions asana aaa a eaaa aana anan anana nana an
55. T010 00100 H Set the off delay time of conveyer A TO10 10sec 0004 AMIA P060 P020 Set the on delay time of conveyer B 0006 TON T000 00050 bsec y T000 0010 L TOFF TO11 00050 Set the off delay time of conveyer B TO11 5sec 0014 P062 T011 P020 0017 H TON T001 00100 4 Set the on delay time of conveyer C T001 P020 EBE 0021 HA pL P062 0024 END Time chart B P061 C P062 4 31 Chapter 4 Basic instructions 4 9 3 TMR TMR Integrating timer Available Device 2 Flag Instructions 2 Error Zero Carry MiP IK JL IF T C S D D Integer F110 F111 F112 Txxx O TMR 3 O O Input condition Timer setting value A TMR e ra Timer contact number x 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 When the current value reached to the setting value the timer contact turns on Even if the input condition is off the current value is not cleared If uses a timer of retentive data area the timer will keep the current value while the CPU is powered off When the RST instruction is executed the timer contact and current value will be cleared as O 2 Program example Program P020 H TMR T7096 300 T096 PO P023
56. Timer relay 100ms Step Controller 96 points 32x 100 steps T095 1096 S00 00 S31 99 Timer relay 10ms 32 points 1127 C000 Counter relay 128 points Retentive area C127 None Tarea 1072 T095 10msec K000 K15F T120 T127 100msec LOO L15F C area C096 C127 D192 D255 Sarea 24 00 831 99 2 4 Chapter 2 Functions 2 2 3 K200S K300S K1000S Bit Data Area Word Data Area User Program Area 0 E F 0000 FFFF POO D0000 1 WO relay Data Register Parameter setting area See the remark Word P kk 1 D sk akak M000 Auxiliary relay D xke i User Program Area 3 040 points M189 M190 T000 i l Special auxiliary relay Timer Setting Value 2 point 256 words M191 S apa T255 MK1000S 30k steps KOO T000 MK300S 15k steps Keep relay Timer Elapsed Value BRS C k steps 512 points 256 words K31 T255 FOO C000 Counter Setting Value 256 words F63 C255 L00 C000 Counter Elapsed Value L63 C255 256 words T000 Timer relay 100ms Step Controller 192points 100x 100 steps 1191 S00 00 S99 99 T192 Timer relay 10ms 64 points 2 T255 Remark C000 Counter relay Pe Dette Dkakakak 256 points MK1000S P63 1 024 pts D9500 D9999 MK300S P31 512 pts MK200S P15 256 pts C255 D4500 D4999 2 5 Chapter 2 Functions 2 3 Memory devices of MASTER K series 2 3 1 Input output area P The P devices are used for data transaction be
57. XOR S2 1 S2 0 5 64 DWXORP 163 owxorP SO gt gt D 1 D WXNR 164 wxwR 5 62 oO S1 XNR S2 gt D 5 66 wxwRP 165 HWxNnR DWXNR 166 pwxnr QO 8121 81 XNR S2 1 S2 5 66 DWXNRP 167 pwxNRP DY gt D 1 D Chapter 3 Instructions 3 2 11 Data processing instructions i i E pides joe a Ladder symbol 5 Contents of processing A Page SEG 174 H SEG cw g 7 Segment decode 2 0 5 68 SEGP 175 HsecP 00 cw A T D Asc 00 cw ASC 139 H Converts the data of S into ASCII O 5 71 code format and stores it at D ASCP 191 Hasce cw BSUM 170 DBiN OH o 15 S o d at TT aaa O 978 uantity BSUMP 171 _ DBINP OH Ll ahh DBSUM 172 DBIN OH a 15 S 1 os S o D 1 DI a Quantity AE DBSUMP 173 bBiNP OH e l Aa ENCO 178 i amp ENco O nH ges I o IB m O 5 75 ENCOP 177 J encor D nH A Encode DECO 178 DECO D nH P S 0 D alb O 5 77 DECOP 179 Decor nH n bits Decode File table read S FILR 180 J FILA oH E z Sen 5 79 FILRP 181 FiLRP 00 2 2 D File table read DFILR 182 DFLR nj E S n em S n 1 O 5 79 DFILRP 183 DFR nH e D D 1 Chapter 3 Instructions Data processing instructions Continued Mnemonic Function symbol No Ladder symbol 5 Contents of pro
58. capacity 800 steps 2 048 steps P I O relay P0000 P001F 32 points P0000 P005F 96 points M Auxiliary relay M0000 M015F 256 points M0000 M031F 512 points K Keep relay K0000 K007F 128 points K0000 K015F 256 points L Link relay L0000 LOO7F 128 points L0000 LO15F 256 points F Special relay F0000 F015F 256 points F0000 K015F 256 points 100ms DEDE T000 T095 96 points T Timer relay L A B2 points EE S 10ms T032 S TOR T096 T127 32 points 16 points C Counter relay kanan C000 C127 128 points S Step controller d es 00 00 S31 99 32 x 100 steps D Data register ovo D0000 D0255 256 words The range of integer 16 bit 32768 32767 32 bit 2147483648 2147483647 Timer types On delay Off delay Accumulation Monostable Retriggerable 5 types Counter types Up Down Up down Ring counter 4 types Programming language Mnemonic Ladder diagram Special functions Real time clock High speed counter RS 485 communication 2 1 Chapter 2 Functions 2 12 K2008 K300S K1000S Items K200S K300S K1000S Program control method Cyclic execution of stored program Time driven interrupt Event driven interrupt 1 0 control method Indirect Direct by program command
59. error is occurred Applicable to K200S 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 setting See the following table for details K10S1 K10S K30S K60S is set as the default setting of K200S 300S 1000S Default setting RUN Error type Description Mode Error flag LED The fuse of output or hybrid module is RUN ON Fuse blown F035 blown STOP OFF BCD error The result of BCD conversion is exceeds the specified range 9999 or Operation RUN ON F110 99999999 Error STOP OFF F115 Over range error One or more operands exceed the specified device range The F110 bit is updated after each instruction is completed Therefore even an operation error was occurred the F110 will be cleared if the next instruction is completed normally In other hand the F115 will be set when an operation error occurs and keep the on status until user cleared the F115 with CLE instruction 2 4 5 Station number Baud rate setting Applicable for K10S1 K10S K30S K60S K2005 PLC type Protocol Station number Baud rate Descriptions K10S1 K10S 0 31 300 600 1200 2400 4800 RS 485 K30S h00 h1F 9600 19200 bps K60S K200S A RS 232 N A 9600 19200 38400 bps K200S B C RS 422 0 31 K3P 07AS 3 K3P 07BS K3P 07CS 2 14 Chapte
60. into the device specified as D 1 D DMULB P Performs the multiplication of BCD data specified as S1 1 S and the BCD data specified as S21 S2 and stores the multiplication result into the device specified as D 3 D 2 DAH D If the multiplication result is zero the zero flag will be set f indirect address specified by 4D format is out of device range or contents of S1 and S2 is invalid BCD format out of 0 9 the operation error occurs and the error flag F110 is set Execution conditions Input condition ee E RE 84 amp gt gt MULBP DMULBP ee Executed only once d E Executed only once te Chapter 5 Application instructions 2 Program example Program which stores the multiplication result of D0001 and D0002 at D0010 D0011 while P020 is on P020 H mue Dooo1 D0002 D0010 YA D0001 D0002 D0011 D0010 h1234 x h5678 h0700 h6652 Program which stores the multiplication result of D0001 D0002 and D0003 D0004 at D0010 D0013 when P020 is switched on P020 H p DMULBP Doo D0003 D0010 D0001 D0002 D0003 D0004 h1234 h5678 x h4321 h8765 D0013 D0012 D0011 D0010 h0533 h5649 h5624 h7670 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 CPU Available Device Flag Instructions Steps E
61. is contents of A 1 A e SV Setting value If the SV is specified as device A the SV is contents of A 1 A 5 137 Chapter 5 Application instructions 2 Program example M1 HSC reset M2 U D input 0 up 1 down M3 Change current value as PV fthe current value is same or greater than SV the F070 bit turns on M003 4 __ MOV 100 D010 HSC EN U D PV D010 SV 100 5 138 Chapter 5 Application instructions 5 23 RS 485 communication instructions 5 23 1 RECV RECV Applicable K1081 KAOS FUN 158 RECV Receive data CPU K30S K60S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 t OJOJOJ O O O O O 0 0 lololololololo O0 RECV 9 O Jolololo olo O n 0O 0 0 0 0 0 0 QUO Operand setting Station number of slave station to St beread LY REC st D 9n The start address of device of master station at which the received data is stored be sent Numbers of word to be read N n h00 h1F Start address of device of slave 9 station that stores source data to 1 Functions Read n words from the device specified as S of slave station Station number st and stores the read data into the block which begin with the device specified as D of mas
62. only once i Executed only once it 2 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 P020 HA WXORP P04 h2345 Pos HA 16 bits WXOR P06 5 69 5 10 4 WXNR WXNRP DWXNR DWXNRP Chapter 5 Application instructions WXOR FUN 164 WXOR FUN 166 DWXOR Applicable Word exclusive CPU All CPUs FUN 165 WXORP FUN 167 DWXORP NOR Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 lololololololo ololo WXNR P oljolololololo olol o zs1 O O DWXNR P D 0 0 0 o olo Olo WXNR DWXNR WXNRP DWXNRP Operand setting Data for which exclusive NOR will be performed The device at which the result of exclusive NOR is stored Available only when do not use computer link module or data link module 1 Functions WXNR P Performs the exclusive NOR of the 16 bit data of device specified at S1 and S2 per bit Then stores the result of logical production into the device specified at D 16 bits WXNR CE EA tae ple ses y DWXNR P Performs the exclusive NOR of the 32 bit data of device specified as S1 1 S1 and 8241 S2 per bit and stores the result into the device specifie
63. period or not 2 System diagram Input module Supplier P02 Detector 3 Program P020 TRTG T005 00200 If there is no product passing during 20 T005 seconds the timer turns off and M100 is ______________________ M100 switched off the M100 During normal operation keeps on state Detecting P020 signal Timer contact Operating indicator 4 37 Chapter 4 Basic instructions 4 10 Counter instructions 4 10 1 CTU CTU Up counter Available Device e Flag Instructions o Error Zero Carry M P IK JL F T C S D D nteger F110 F111 F112 Cxxx O CTU 3 O O O Counter contact number Count pulse Reset signal Setting value 1 Functions Whenever a rising edged is detected at the count pulse input the current value is increased by 1 Theinitial current value is O and when the current value is reached to the setting value the counter contact turns on After the counter contact turns on the current value keeps increasing until its maximum value 65535 When the reset signal is switched on the counter contact and current value is cleared as 0 2 Program example Whenever the P030 is changed from off to on the current value of C010 is increased by 1 The P031 is reset condition Program P030 P031 lt S gt 00010 C ja Time chart P031 P030
64. process 2 e A SET so End of process 3 Start process 3 SET S01 04 Start process 4 End of process 4 e SET 01 00 Initialize step controller Process 1 End of process 1 1 Process 2 End of process 2 Process 3 End of process 3 _ H Process 4 End of process 4 4 24 Perform the process 1 and turn on End of process 1 when the process 1 is finished Perform the process 2 and turn on End of process 2 when the process 2 is finished Perform the process 3 and turn on End of process 3 when the process 3 is finished Perform the process 4 and turn on End of process 4 when the process 4 is finished Chapter 4 Basic instructions 4 6 2 OUT Sxx xx OUT S Available Device al Flag Instructions o Error Zero Carry M P K L F T C S ID D Integer F110 F111 F112 OUT S O O 2 L3 Sxx xx S xx xx K1081 07 15 K10S K30S K60S 0 31 K200S K300S K1000S_ 0 99 Step No 00 99 Group 00 99 1 Function Lastin priority control When the input condition turns on the specified step controller is switched on and keep the on status until other step controller of same group turns on Only one step controller turns on even if multiple input conditions turn on At this time the last turned on step controller has the
65. routine 1 2 Interrupt 1 occurs higher priority E Stop routine 2 and run routine 1 Interrupt routine 2 MB IUS E Finish routine 1 and return to routine2 Finish routine 2 and return to main program 2 20 1 Parameter setting Chapter 2 Functions K200S K300S K1000S Priority Type Period Priority Type Period Priority Type Period 0 TDIO 10msec 0 TDIO 10msec 0 TDIO 10msec 1 TDI2 25msec 1 TDI2 25msec 1 TDI2 25msec 2 TDI5 100msec 2 TDI5 100msec 2 TDI5 100msec 7 INT7 13 INT7 29 INT15 a Period is the interval of time driven interrupt occurring It is variable from 10msec to 60000msec 60sec by 100msec unit b The priority is also used as the number of interrupt To enable disable the TDI5 interrupt with priority level 2 for example use EI DI instruction as El 5 DIS 2 21 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 If an interrupt factor has higher priority occurs while other interrupt has lower priority are executing the interrupt routine of lower priority will be stopped and the interrupt of higher priority will be execut
66. specified as S of buffer memory inside the special function module mounted at the slot specified as sl The buffer memory of the special function module CPU module mounted at slot sl S D n2 words n2 words 5 110 Chapter 5 Application instructions Inthe 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 specified device range Execution conditions Input condition EM AE PUT J Executed per scan Executed per scan PUTP Executed only once Executed only once 2 Program example Program that write 4 words from D0010 of CPU module and stores them to the 4 words from the address 0 of buffer memory of D A module Power i i 4 2 supply input input channel channel module module module A D D A module module slot 0 slot 1 slot 2 slot 3 HA HA GET h0008 h0000 D0010 h0004 A The buffer memory of the D A module CPU module 0 h1122 4 words D0010 4 words 5 111 Chapter 5 Application instructions 5 17 Data link instructions 5 17 1 READ READ K200S Applicable Read data from FUN 244 READ at K300S remote station K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 sl O s OJO O O O OJO O
67. the BIN data specified as S2 1 S2 and stores the multiplication result into the device specified as D 3 D 2 D 1 D fthe multiplication result is zero the zero flag will be set f indirect address specified by D format is out of device range the operation error occurs and the error flag F110 is set Execution conditions Input condition ee eS PE MUL DMUL Executed per scan lt gt lt lt MULP DMULP d E Executed only once te Executed only once 5 48 Chapter 5 Application instructions 2 Program example Program which stores the multiplication result of D0001 and D0002 at D0010 D0011 while P020 is on P020 HA H MUL D0001 D0002 D0010 D0001 D0002 D0011 D0010 h1234 x h5678 h6260 h0060 Program which stores the multiplication result of D0001 D0002 and D0003 D0004 at D0010 D0013 when P020 is switched on P020 I bmutP 0001 Dooos D0010 D0001 D0002 D0003 D0004 h1234 h5678 x h4321 h8765 D0013 D0012 D0011 D0010 h04C6 h1501 h55B7 h6558 5 49 5 8 4 MULS MULSP DMULS DMULSP Chapter 5 Application instructions MULS K200S FUN 072 MULS FUN 076 DMULS Applicable Signed binar K300S E d FUN 073 MULSP FUN 077 DMULSP CPU multiply K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 Edlololo olololo O
68. 00 MULS P OJO O O O OJO olol o zen O O DMULS P olololo Olo O0 E Available only when do not use computer link module or data link module Operand setting The device storing multiplicand The device storing multiplier The device at which the multiplication stored result is Functions 1 MULS P Performs the multiplication of the signed BIN data specified as S1 and the signed BIN data specified as S2 and stores the multiplication result into the device specified as D 1 D DMULS P Performs the multiplication of signed BIN data specified as S141 S and the signed BIN data specified as 5241 S2 and stores the multiplication result into the device specified as D 3 D 2 DH D fthe multiplication result is zero the zero flag will be set f indirect address specified by D format is out of device range the operation error occurs and the error flag F110 is set The sign of multiplication result is as following table ED G2 positive positive positive positive negative negative negative positive negative negative negative positive Chapter 5 Application instructions Execution conditions Input condition eee ee ee MULS DMULS SER oc ee eee ee MULSP DMULSP i i
69. 001A NEG D0020 5 127 Chapter 5 Application instructions 5 20 Bit contact instructions 5 20 1 BLD BLDN K200S BLD FUN 248 BLD Applicable K300S Bit load FUN 249 BLDN CPU K1000S Available Device Flag Instructions Steps Error Zero Carry M PJK L F T CS D HD Integer F110 F111 F112 BLD 5 olo 5 O BLDN n O Operand setting B O n The start address of source data Offset from the bit 0 to the BN D n J destination bit 1 Functions BLD Start a NO contact Draw the on off status of the n bit from the bit O of D and use the data as an operation result BLDN Start a NC contact Draw the on off status of the n bit from the bit O of D and use the data as an operation result bit n bit4 bit3 bit2 bit1 bitO 2 Program example Program that turns PO1E on when the 5 bit of the D0001 word is on MOOOA MOV h0010 D0001 BN 0001 0005 4 PootE 5 128 Chapter 5 Application instructions 5 20 2 BAND BANDN K200S BAND FUN 250 BAND Applicable K300S Bit AND FUN 251 BANDN CPU K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 BAND D Olo 5 O BANDN n O Operand s
70. 10 F111 F112 WDT 1 WDTP m WDT KH Li wore H 1 Functions Resets the watch dog timer in a sequence program Used when the period of scan time from step O to END in the sequence program exceeds the set value of watch dog timer depending on conditions If the scan time exceeds the set value of watch dog timer at every scan change the set value of watch dog timer by the parameter setting Set the set value of the watch dog timer so that t1 from step 0 to WDT P instruction and t2 from the WDT P to END instruction do not exceed the set value See the diagram below Step 0 WDTP t t2 END The WDT P instruction can be user two or more times during one scan However please be careful when use WDT P instruction because if an error occurs the outputs cannot be turned off immediately Values of scan time stored in special resisters F device are not cleared though the WDT P instruction is executed 5 96 Chapter 5 Application instructions Execution conditions Input condition A cc WOR ope a n eins e lt gt 4 Executed per scan WDTP Executed only once i E Executed only once 4 2 Program example The program that has a long scan time because of FOR NEXT loop FOR 50000 P020 WDT PO2F When P020 is on the current P060 value of WDT is reset and no WDT error occurs Otherwise a WDT
71. 2 Functions lt Figure 2 Flow of input output data in the refresh mode gt Input P Data memory P0001 P0020 P0021 Eus Output P Data memory CPU module Input refresh Input data is read L1 in batch from the input module before execution of step O and stored in the input data memory When an input contact command is executed Input data is read L1 from the input data memory and used for execution of the sequence program When an output contact command is executed Output data is read L1 from the output data memory and used for execution of the sequence program When an output OUT instruction is executed The operation result L1 is stored in the output data memory Output refresh Data L1 in the output data memory is output in batch to the output module after execution of the END instruction 2 3 2 Auxiliary relay M The M area is internal relay used in the PLC CPU and can not be connected directly with external devices All M area except designated as latched area will be cleared as 0 when the PLC is switched on or turned to RUN mode With K200S K300S K1000S a user can change the latched area by parameter setting 2 7 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
72. 2 XCHG FUN 104 DXCHG Applicable All CPUs Word exchange FUN 103 XCHGP FUN 105 DXCHGP CPU e Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 XCHG P olololo olo olo E 5 DXCHG P olololo olo OO Operand setting Two words that their contents are exchanged each other Available only when do not use computer link module or data link module 1 Functions XCHG P Exchanges 16 bits contents of two devices specified at D1 and D2 D1 1 D1 D2 1 D2 aM h5849 hFOB4 hA006 h9201 aM h5849 h9201 hA006 hFOB4 aM D1 1 D1 D2 1 D2 DXCHG P Exchanges 32 bits contents of two devices specified as D1 1 D1 and D2 1 D2 D1 1 D2 1 D1 D2 EA h5849 hFoB4 hA006 h9201 Lo L L gt EN hAO06 h9201 Ld h5849 hFOB4 icu D1 1 D1 D2 1 D2 5 42 Chapter 5 Application instructions Execution condition Input condition e EP E 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 AE XCHGP P04 PO05 H P05 P04 P05 P04 5 43 Chapter 5 Application instructions 5 8 BIN arithmetic instructions 5 8 1 ADD ADDP DADD DADDP ADD FUN 110 ADD FUN 112 DADD Ap
73. 48 H lt 655 OH 5 21 The input condition is switched on AND lt 098 J lt 623 H 5 when S1 S2 Signed x 5 22 comparison OR is lt H 5 23 LOAD gt 058 H gt 8 63 5 21 The input condition is switched on AND gt 106 gt 5 G3 9 when st gt S2 Signed x 522 comparison OR gt 216 gt 8 ey 5 23 LOAD lt 068 H lt Pp 5 21 The input condition is switched on AND lt 108 lt G G3 2 when S1 lt S2 Signed x 522 comparison one zs Lo OH 5 23 LOAD lt gt 078 H gt 5 6 J 5 21 eo 3 The input condition is switched on a E ANDS nm le amp 6 5 when S1 lt gt S2 Not equal ES one 28 o Gp 5 23 3 7 Chapter 3 Instructions Comparison instructions Continued Mnemonic Function gt e i n symbol No Ladder symbol 5 Contents of processing amp Page LOADD 029 H OOA 5 21 3 The input condition is switched on Es z a E ANDHE o5 d Sy cy when S1 1 S1 S2 1 S2 ai ies ORD 99 H GG 5 23 pono De 039 H 8 E e 7 The input condition is switched on ved HDD o d GGL 5 when S1 1 S1 gt S2 1 S2 Paneer co t ORD gt 467 X E H Signed comparison 5 23 KADES 949 H 5 E 6 amp 2 y The input condition is switched on AI 1 lt S2 1 S2 ANDDZ T F e X 5 when S1 1 S1 lt S2 1 S2 522 co i ORD 188 n H Signed comparison
74. 5 23 KADES s H m Ole ds The input condition is switched on S ANDDs 107 1 6 63 3 when S1 1 S1 gt S2 1 S2 522 co 5 ORD gt 217 n S H Signed comparison 5 23 LOADD 069 H DE 62 The input condition is switched on el 2 1 lt S2 1 S2 ANDDe 109 J v ea 5 when S1 1 S1 lt S2 1 S2 5 22 co ORD 219 Ps H Signed comparison 5 23 LOADD lt gt 079 H o amp 9 6L 5 21 7 3 The input condition is switched on a A ANDOS 119 de 606 23 when St 1 S1 lt gt S2 1 S2 Ki eee ORD lt gt 229 gt H 5 23 3 8 Chapter 3 Instructions 3 2 4 Increment Decrement instructions Mnemonic Function symbol No Ladder symbol 5 Contents of processing D Page INC 020 inc D H Increment m 5 24 INCP 021 iNcP O H Bie 10 DINC 022 DING D H 2 Increment 0 5 24 DINCP 023 Joc H O a0 gt 10 10 DEC 024 DEC H 2 Decrement 5 26 DECP 025 DECP D H ID gt 0 DDEC 026 DDEC H Decrement 5 26 DDECP oz ppecp H gt O 0 Pi 0 101 3 2 5 Rotation instructions Mnemonic Function a symbol No Ladder symbol 5 Contents of processing 3 Page C Bob oen ROL O H arry 15 0 j DERI lo ROLP 021 ROLP H x2 M 1 bit rotate to left C ROR 034 J ROR H 2 15 0 arry 2 5 30 RORP os rorR OH 1 bit rotate to right
75. 50 5 8 5 DIN DIVE DDIV DDIVP 4 sen att tee battere 5 52 5 86 DIVS DIVSP DDIVS DDIVSP sssssseeees 5 54 5 9 BCD arithmetic instructions oooccccnnccnnnnccnoccccnnncconananann cnn 5 56 5 9 1 ADDB ADDBP DADDB DADDBP sssseee 5 56 5 9 2 SUBB SUBBP DSUBB DSUBBP ssssseeee 5 58 5 9 3 MULB MULBP DMULB DMULBP sees 5 60 5 9 4 JDIVB DIVBPDBDIVB DDIVBP cocaina 5 62 5 10 Logical arithmetic instructions ssssssss 5 64 5 10 1 WAND WANDP DWAND DWANDP sssseeteees 5 64 5 10 2 WOR WORP DWOR DWORP c csseeseeseeseeseeseeeeeeeeeteees 5 66 5 10 3 WXOR WXORP DWXOR DWXORP sssseeeees 5 68 5 10 4 WXNR WXNRP DWXNR DWXNRP ssssseeeees 5 70 5 11 Data processing instructions eesseeseeesessse 5 72 5411 SEG SEGP A A 5 72 5 112 A na 5 75 5 11 3 BSUM BSUMP DBSUM DBSUMP csseees 5 77 5414 SENGCOCENGOP d eet hariaren eea 5 79 51155 DECO DECOR rre ea eta LEE 5 81 5 11 6 FILER FIERA DEIDRESDPIEBP ear ica 5 83 5 11 7 FILW FILWP DFILW DFILWP aaaaaaaaaaaa anaa n anane nenen 5 85 A tet metet obtutu 5 87 5 11 9 UNI UNIP ssssseeeetetn tette tentent nnne 5 89 EAT Q IOBRECTOHED uto ou toti a ust kits 5 91 5 12 System instructiONS ccomnnoocccnnnnnnccnnnnnnccnncnnnnnnnnnnnannnnnos 5 93 AO FALS dale 5 93 5122 DUTY aote e A 5 94 542 87 WDT DU tae ad
76. 6 4 3 2 1 Carry flag DRCR P Rotates 32 bits of the device specified as D 1 D and the carry flag in right direction TheLSB of D will be transferred to the carry flag and the carry flag will be transferred to the MSB of D 1 D 1 4 16bits 9 16 bits Carry flag Chapter 5 Application instructions Execution conditions Input condition M REUS IE um RCR DRCR Executed per scan 4 Executed per scan RCRP DRCRP i i Executed only once i i Executed only once ce ea 2 Program example Whenever a rising edge is detected at P030 16 bits of D0000 word and carry flag will be rotated with right direction LE RCRP D0000 L D0000 h78D2 16 bits 5 35 Chapter 5 Application instructions 5 6 Shiftinstructions 5 6 1 BSFT BSFTP BSFT FUN 74 BSFT Applicable All CPUs Bit shift FUN 75 BSFTP CPU e Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D Integer F110 F111 F112 GD O 0 O O BSFT P 5 O E o ol olo mm G G 1 I cse mm amp amp 1 I s Available only when do not use computer link module or data link module Operand setting ED The start bit of block to be shifted 2 The end bit of block to be shifted 1 Functions Shifts the b
77. AND LOAD LOAD AND AND OR LOAD LOAD LOAD AND AND LOAD OR LOAD AND LOAD LOAD AND AND OR LOAD OR LOAD LOAD OR LOAD AND OR LOAD OR LOAD OR LOAD OUT OUT END END The OR LOAD instruction can be used consecutively up to 7 times 8 block When connect more than 9 blocks in parallel write a mnemonic program such as the example A If you use KGL WIN software and write program in ladder mode the KGL WIN software will convert the ladder program into mnemonic program A automatically 4 9 Chapter 4 Basic instructions 4 2 3 MPUSH MLOAD MPOP MPUSH FUN 005 MPUSH MLOAD FUN 006 MLOAD MPOP FUN 007 MPOP Available Device ge Flag Instructions o Error Zero Carry M P K L F T C S D D nteger F110 F111 F112 MPUSH MLOAD 1 MPOP MPUSH a nm unus MPOP Ki 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 c MPOP Reads the operation result stored by the MPUSH instruction and resumes the operation with that operation result starting at the next step Then clears the operation result stored by the MPUSH instruction d The MPUSH instruction can be used up to 8 times consecutively If a MLOAD instruction
78. CARRY Carry flag Turns on when a carry occurs due to the operation F0113 p OUT OFF All outputs off Turns on when an output instruction is executed F0114 Common RAM Turns on when a memory access error of the R W error special module has occurred F0115 Operation error Turns on when an operation error has flag Latch occurred Latch F0116 to FO11F Unused F0120 _p_LT LT flag Turns on if S lt S when using the CMP instruction F0121 p LTE LTE flag Turns on if S lt S when using the CMP instruction F0122 _p EQU EQU flag Turns on if S S when using the CMP instruction F0123 p GT GT flag Turns on if S S when using the CMP instruction F0124 _p GTE GTE flag Turns on if S 2 S when using the CMP instruction F0125 p NEG NEQ flag Turns on if S S when using the CMP instruction A 7 Appendix Junction Keyword Function Description F0126 to F012F Unused F0130 to FO13F S AC F CONT AC Down Count Stores AC down counting value F0140 to FO14F 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 modules has occurred an output module the corresponding bit to the slot turns on F0160 to FO49F Unused F0500 to FO50F S SCAN MAX Maximum scan Stores the maximum scan time time F0510 to FO51F S SCAN MIN Minimum scan Stores the minimum scan ti
79. CMOVP DCMOVP Executed only once d i Executed only once 2 Program example While the M020 is on reverse the data of P02 word and transfer the result to PO6 word M020 4 c evov Po2 P06 16 bits P02 5 4 Chapter 5 Application instructions 5 4 3 GMOV GMOVP GMOV FUN 90 GMOV Hesse All CPUs Group move FUN 91 GMOVP CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 S Olololojolo GMOV 9010 O ololo o O O olo 7 O GMOVP n O O a HI Don Operand setting The start address of source GMOV data area The start address destination area will a I E 9 n transferred data Numbers of transferred GMOVP words Available only when do not use computer link module or data link module 1 Functions Transfers the content of n words which begin with the device specified at S in blocks to n words which begin with the device specified at D 000 OOO 333 NY 5 5 Chapter 5 Application instructions Execution conditions Input condition f demo m GMOVP a i Executed only once i d Executed only once DE 2 Program example While the P020 is on move the data of D000 D001 and D002 to P04 P05 and PO6 area P020 4 _ Gmov Doo00 Po4 s JA D D0000
80. Carry RCL o40 RCL H 2 EC E RCLP 041 RoiP D H T 1 bit rotate to left include carry Carry aon o j OH S ia 5 34 16 bits RCRP 045 RCRP H 1 bit rotate to right include carry 3 9 Chapter 3 Instructions Rotation instructions Continued Mnemonic Function E symbol No Ladder symbol 5 Contents of processing A Page 1 DROL 022 DROL D H E Carry i5 D 015 0 Kel Q 5 28 DROLP o d bRoP H D 1 bit rotate to left 1 C DROR 036 pRoR O H Dos amy 5 30 DRORP o7 pRoRP H S 1 bit rotate to right C 1 DRCL 042 orci H 2 arry 150 015 D 0 9 O 5 32 DRCLP o3 JorciP H 9 1 bit rotate to left include carry 15 D 1015 o Carry DRCR 046 DRcCR H 2 O O 2 O 5 34 DRCRP 04 dpRcRP H S 1 bit rotate to right include carry 3 2 6 Shift instructions Mnemonic Function i amp Pp symbol No Ladder symbol 5 Contents of processing amp Page gt 62 a g o IIIIIIIILl BSFT oz lesrr 6 Edy 5 gt SH ia lis BSFTP DH 4 BSFTP om J 5 gt E 0 lt a 1 bit shift from S1 to S2 gt 62 o o ITIIIIIIILl WSFT 070 wsrr 5 SH S Q 5 38 N WSFTP 071 wsFTP 6 H 2 53 gt a T 0 1 word shift from S1 to S2 D n D SR il SR D Ji 5 Erfurt 5 40 gt Bit shift See 4 For details Chapter 3
81. E LO lojojo o Olo O0 READ 13 O jolololojololo olo n2 O O SS OJ O O O OJO OIO Operand setting Slot number of FUEA module is Sl mounted L EE READ s St 9 Station number of remote station St to be read data Start address of master station at which read data is stored s Start address of remote station at which data to be read Numbersofwordtoberead of word to be read ENTE at which the link status is SS stored Available only when do not use computer link module or data link module 1 Functions Reads n2 words which begin with the address S of the remote station that has station number St through the FUEA module mounted at the slot sl and store the read data to the block which begin with the address D of the master station The link status is stored at the address SS of the master station 5 112 Chapter 5 Application instructions Remote station Self station n2 words Sy FUEA module n2 words j FUEA module Station Na SP An instruction error occurs when the assress S n2 or D n2 is out of the range of specified device Execution conditions Input condition SE MEM ee M READ Executed only once Executed only once 4 2 Program example Program that read 20 words which begin with D0200 of remote station Station No of FUEA module h1D through the F
82. Execution condition Input condition a ELSE MOV DMOV Executed per scan Executed per scan amp 4 gt MOVP DMOVP EN i Executed only once d i Executed only once e 2 Program example Whenever a rising edge is detected at the P020 the hOOF3 is moved to the P04 word P020 I move h70F3 P04 H 5 2 Chapter 5 Application instructions 5 1 2 CMOV CMOVP DCMOV DCMOVP CMOV FUN 84 CMOV FUN 86 DCMOV Applicable All CPUs Complement move FUN 85 CMOVP FUN 87 DCMOCP CPU Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 cvovP Jololol lololo 00 0 E 5 7 DCMOV P lololol OJO Ojo Operand setting HH HH The source device at which the data to be transferred is stored Available only when do not use computer link module or data link module 1 Functions CMOV P Reverses the 16 bits data of S per bit and transfers the result to D 16 bits DCMOV P Reverses the 32 bits data of S 1 S per bit and transfers the result to D 1 D BUE 16 bits TC 16 bits Reverse mr Reverse EXE ESSENCE CI KARAS ER CREER ERE 5 3 Chapter 5 Application instructions Execution conditions Input condition SEE HLS NEN gt gt 4 gt
83. Execution conditions Input condition M REUS IEEE m ROR DROR Executed per scan 1 Executed per scan RORP DRORP i i Executed only once i i Executed only once ce ea 2 Program example Whenever a rising edge is detected at P030 16 bits of D0000 word will be rotated with right direction SFE RORP D0000 D0000 h78D2 16 bits i flag Carry flag 5 31 5 5 3 RCL RCLP DRCL DRCLP Chapter 5 Application instructions ROL FUN 40 RCL FUN 42 DRCL Applicable Rotate left include CPU All CPUs FUN 41 RCLP FUN 43 DRCLP carry flag Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D Integer F110 F111 F112 RCL P O lo jojolo olo O 3 O O DRCL P e c OH RCLP DRCLP Available only when do not use computer link module or data link module Operand setting The device to be rotated left by RCL instruction 1 Functions RCL P Rotates 16 bits of the device specified at D and carry flag F112 in left direction The MSB will be transferred to the carry flag F112 and the carry flag will be transferred to the LSB Carry flag E E D C B A 9 7 6 5 4 3 2 1 0 DRCL P Rotates 32 bits of the device specified as D 1 D and carry flag in left direction The MSB of D 1 will be transferred to the carry flag
84. FUN 20 INC FUN 22 DINC Applicable All CPUs Increment FUN 21 INCP FUN 23 DINCP CPU e Available Device Flag Instructions Steps Error Zero Carry M P EKA PEH PEH T C S D Integer F110 F111 F112 INC P Qiololoo lolo O s 0ojoo DINC P Jj Operand setting The device to be increased ING by ING instruction DING Available only when do not use computer link module or data link module 1 Functions INC P Performs the addition of 1 to the device 16 bits data specified at D DINC P Performs the addition of 1 to the device 32 bits data D 1 D f the INC P or DINC P is executed when the content of device is hFFFF or hFFFFFFFF the content of device will be 0 At the same time the zero flag F111 and the carry flag F112 are set If the device specified by D is out of the range the operation error occurs and the error flag F110 will be set Chapter 5 Application instructions Execution conditions Input condition M EU E INC DINC Executed per scan 4 Executed per scan Se i lt lt INCP DINCP i i Executed only once i E Executed only once gt i e 2 Program example Whenever a rising edge is detected at P030 the content of PO6 word will be increased by 1 E INCP P006 h00C6 va h00C7 o P006 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 PO0O6 9 0 0 0 0 0 0
85. Flag Instructions Steps Error Zero Carry M JPIK L F T C S D D Integer F110 F111 F112 GD o ololololo o O00 ADDB P OJ O O O O OJO olol 0 ves O O O DADDB P 0 0 0 o olo OO HI ED 2 D Operand setting ADDB DADDB mm SEO DADDB DADDBP The device storing augend The device storing addend The device at which the addition result is stored Available only when do not use computer link module or data link module 1 Functions ADDB P Performs the addition of 16 bits BCD data specified at S1 and S2 The addition result is stored at the device specified at D DADDB P Performs the addition of 32 bits BIN data specified at S1 1 S1 and S2 1 S2 The addition result is stored at the device specified at D1 1 D1 When the addition result is over h9999 ADD ADDP or h99999999 DADD DADDP the carry flag F112 is set When the addition result is O the zero flag is set f indirect address specified by 4D format is out of device range or contents of S1 and S2 are invalid BCD format out of 0 9 the operation error occur and the error flag F110 is set Chapter 5 Application instructions Execution condition Input condition d Ll L aoBDADOB euntem E aan ADDBP DADDBP Executed only once i E Executed only once 2 Program example When a rising edge is detected at P020 add BCD data of D0000 and
86. Functions 2 2 Memory configuration map 2 2 1 K10S1 Bit Data Area I O relay 32 points Auxiliary relay 256 points Keep relay 128 points Special relay 256 points Link relay 128 points Timer relay 100ms 32 points Timer relay 10ms 16 points Counter relay 16 points D000 D063 T000 T047 T000 T047 C000 C015 C000 C015 Word Data Area User Program Area 0000 FFFF Data Register Parameter setting area 64 words User Program Area 800 steps Timer Setting Value 48 words Timer Elapsed Value 48 words Counter Setting Value 16 words Counter Elapsed Value 16 words Step Controller 16x100steps S00 00 S15 99 Retentive area None Tarea T024 T031 10msec K000 KO7F T044 T047 100msec LOO LO7F Carea C012 C015 D048 D063 Sarea 12 00 15 99 2 3 Chapter 2 Functions 2 2 2 K10S K30S K60S Bit Data Area Word Data Area User Program Area 0000 x FFFF POO D000 I O relay Data Register Parameter setting area 96 points P05 256 words M00 Auxiliary relay D255 User Program Area 512 points M31 2 048 steps KOO T000 Timer Setting Value Keep relay 256 points Mus 128 words IIS T000 FOO Special relay Timer Elapsed Value 256 points 128 words F15 1127 LOO C000 Link relay Counter Setting Value 256 points 128 words L15 C127 C000 Counter Elapsed Value C127 128 words T000
87. K1000S_ 0 99 1 Functions The Sxx xx contact will turn on when the previous step of same group and the input condition is on Once a Sxx xx is switched on it keeps on state until the next step turns on or the step controller group is initialized The Sxx 00 is switched on Evenif multiple input condition turn on only one step controller is switched on The Sxx 00 is initialization step and the Sxx xx group will be initialized by switching on the Sxx 00 When the CPU is turned to RUN mode the Sxx 00 is set by default 2 Program example A sequential control by using S01 xx group Program 0000 SET 01 01 0003 ies ks SET soto2 4 0006 c SET 01 03 P033 0009 SET S01 04 Reset 0012 SET 01 00 Time chart pee P031 P032 P033 I P034 gt S01 xx reset input condition e l S01 03 i S01 04 4 23 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 process 1 ended and process 3 starts after the process 2 finished When the process 4 is completed the process 1 will start again 2 Program Start process 1 HA SET S0101 End of process 1 SET 01 02 Start process 2 End of
88. Link relay bii aisha BUDE Un e Dan ak agak aaa 2 8 2 3 5 Step control relay Sasak ante cias 2 8 2 3 6 Timer relay tT eui eene on tert dees eed 2 9 2 3 1 Gounterirelay 7G cists ae er tae tor p dp tia 2 10 2 3 0 Data register D asana a ani a aaa ana ap it 2 11 2 3 9 Indirect assignment data register D eeens 2 11 2 3 10 Special relay Picnic bit 2 12 2 3 11 Special M L relay M L ssesssssm eme 2 12 2 3 12 Special data register D 2 12 Parameter setting lt lt s000essnaeesanneena nenen nenen nnena nengna nenana nnnm nnn nnne 2 13 2 4 1 Watch dog timer setting a aaanananee anana nenen a anane anae nean anane a ee 2 13 2 442 Timer area setting eie opere EH getto 2 13 2 4 3 The latch non volatile area setting 2 13 2 4 4 Setting the mode of CPU RUN STOP when an error is occurred 2 14 2 4 5 Station number Baud rate setting oooccoinnicnncccnnncicnnnccoccccnnncninnnnns 2 14 2 5 2 6 2 7 2 8 2 4 6 High speed counter setting ooooninocccicnnncnnnnococcccccnccnnnnannccnnnncnnnnnnns 2 15 24 7 Interrupt setting er peste t rep E ia 2 15 2 4 8 The reservation of I O number allocation seeeeeessss 2 15 2 4 9 The output of Debug mode ssseem e 2 16 Operation processing of CPU eese 2 17 2 5 1 The repetitive Operations 2 17 2 5 2 The operation mode of CPU ooooconccccocccccnccccconanonccnnn
89. O O O Input condition x Timer setting value A TOFF P Tex O0 Timer contact number x Setting time t Unit period 0 1 or 0 01 sec x Setting value 1 Functions Atimer consists of timer contact current value and setting value When the input condition turns on the current value will be set as the setting value and the timer contact will turn on When the input condition turns off the current value will decrease by 1 at every 0 1 or 0 01 sec until it reaches to 0 or input condition turns off The timer contact will be switched off when the current value reaches to 0 When the input condition turns off or RST instruction is executed the timer contact will turn off and the current value will be cleared as O 2 Program example The T000 0 1 sec timer will turn off 5 seconds later until the P020 is switched off P020 Program L ToFF T097 00200 T000 LL Er P065 P022 L RsT Toto Time chart P020 TOOO Decrease 4 30 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 Output module Input module P02 P06 On Off 656 Conveyer Motor 2 Motor 1 Motor 0 3 Program P020 0000 TorF
90. O Applicable All CPUs Decode FUN 179 DECOP CPU Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 S 0 0 0 0 0 0O olo o DECO O o lo olo olo ojo amp 9 DECOP n O O The Operand setting The start address of source DECO data area start address destination area will d decoding result Effective bit length 2 1 8 Available only when do not use computer link module or data link module 1 Functions Decodes the data of lower n bits of the device specified as S and stores the decoding result to the block of 2 bits that start from the bit 0 of the device specified as D Form 1 8can be specified If the value of n is 0 no processing is performed and the contents of D is not changed If the value of n is over 8 the error flag F110 is set and no processing is performed When the value of n is larger than 4 the source data area is expanded like D 1 D 2 When n 8 the length of decoding result data is 256 bits D 15 D 14 Execution conditions Input condition NM EE MET IEEE NM DECOP Executed only once 5 81 D 1 D Executed only once Chapter 5 Application instructions 2 Program example Program that decode lower 4 bits of p02 word and stores the decoding result to PO5 word when P030 is swit
91. OR and NEXT 2 33 Chapter 2 Functions 2 5 END RET 1 If there is no END in a sequence program a program error occurs and CPU stops operation LOAD JMP JME P012 10 10 Missing END 2 If there is no RET in a subroutine program a program error occurs and CPU stops operation END SBRT LOAD OUT P000 P010 2 7 6 Dual coil Missing RET If a memory device is used as an output of operation two or more times a dual coil error occurs Because this is not a serious error it does not make the CPU stop LOAD P0000 OUT M000 OUT MOOO Dual coil error SET MOOO Dual coil error 2 34 Chapter 2 Functions 2 8 Error handling 2 8 0 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 The F110 is updated after each instruction is executed However the executed instruction is not related to any error such as the LOAD instruction it keeps the previous value In other hand the F115 keeps the on status after it was switched on at once To clear the F115 flag execute the CLE instruction The following table shows an example of F110 and F115 operation
92. P KK L F T C S D Integer F110 F111 F112 BSET olo 5 O BRST n O i BET D n YA i es D n YA Operand setting D The start address of source data Offset from the bit O to the n destination bit 1 Functions BSET When the input condition of BSET instruction turns on the n bit from the bit O of D is switched on The bit remains on state even if the input condition of BSET instruction is turned off It can be switched off by the BRST instruction BRST When the input condition of BRST instruction turns on the n bit from the bit 0 of D is switched off 2 Program example Program that set the bit 2 of D0001 when M0002 is on and reset the bit 2 of D0001 when M0003 is on M0002 L BSET Doo 2 M0003 BSET 0001 2 M0002 M0003 Lo Bit 2 of EA O ENG D0001 5 132 Chapter 5 Application instructions 5 21 Computer link module instructions 5 21 1 SND SND K200S Applicable Send data and frame name to FUN 169 SND CPU K300S Cnet module K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 sl O Fnam OJO O OJO OIO SND S Jolojo olo ojo n Jo n O O SS O OJO OJO OIO Operand setting H swo s Fnam S n ss Slot num
93. P030 transfer 4 bits from the P020 bit to the 4 bits from the P063 bit P030 I BMOVP Poz P06 h0304 JH Chapter 5 Application instructions 5 2 Conversion instructions 5 2 1 BCD BCDP DBCD DBCDP BCD FUN 60 BCD FUN 62 DBCD Applicable Binary coded CPU ICE FUN 61 BCDP FUN 63 DBCDP decimal Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 BCD P Sd o ololorlolo o OJO O 5 DBCD P O O O Q O O O O I E or Operand setting BCD The source device at which the data to be converted to DBCD BCD format is stored BCDP DBCDP Available only when do not use computer link module or data link module 1 Functions BCD Converts binary data 0 to 9999 of the device specified at S into BCD format and transfers the result to the device specified at D 32768 16384 8192 4096 2048 1024 512 256 128 64 32 BIN 9999 Be sure to set as 0 BCD conversion will be exceeded if not 8000 4000 2000 1000 800 400 200 100 80 40 20 D BCD 9999 DBCD Converts binary data 0 to 99999999 of the device specified at S into BCD format and transfers the result to the device specified at D Chapter 5 Application instructions Execution conditions Input condition UR eee iE al rea i BCDP
94. Power on I O slot error I O slot error h0010 Stop mounted improperly A Replace the I O O module or expansion cable is module or expansion defective cable Maximum 1 0 1 O points exceed the maximum limit aver Max I O over h0011 Stop points Fmm mounting numbers over Replace I O unit error Special Card Special I F Error occurred during special card Contact the nearest h0012 Stop I F error error interface LG representative Fmm 0 I F Fmm 0 I F h0013 Stop Fmm 0 VE error Contact the nearest error error LG representative Fmm 1 I F Fmm 1 I F h0014 Stop Fmm 1 I F error Contact the nearest error error LG representative Fmm 2 I F Fmm 2 I F h0015 Stop Fmm 2 I F error Contact the nearest error error LG representative Fmm 3 I F Fmm 3 I F h0016 Stop Fmm 3 I F error Contact the nearest error error LG representative Parameter Parameter When the parameter is wrong or has Change parameter h0020 Stop E error error incorrect checksum setting 2 37 Chapter 2 Functions Error Code Continued Code Error type Message F006 CPU Description Corrective action I O parameter When the CPU is powered on or turned to Change parameter p I O parameter error h0021 Stop RUN mode I O modules are not mounted setting or re arrange error as I O reservation of parameter setting IJO modules 1 0 parameter setting value or actually iis B
95. RT 30 Error No RET 2 31 Chapter 2 Functions 2 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 e t MCS 0 High MCS 7 LOW The MCSCLR n instruction ends a master control sequence If a MCSCLR instruction is executed all master controls that have lower priority are cleared automatically MCS MCS e MCSCLR MCSCLR 0 1 MCS 1 is cleared automatically Error Improper order of MCSCLR When use master control it should start from the highest priority level and end from the lowest priority level The MCS n and MCSCLR n instructions should be in pairs Otherwise a program error occurs 2 32 2 7 4 FOR NEXT Applicable for K200S K300S K10005 Chapter 2 Functions 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 LOAD P000 FOR 1 FOR 2 FOR 3 NEXT NEXT NEXT END No error 3 level nesting LOAD P001 FOR 20 NEXT NEXT END Error Stand alone NEXT LOAD P002 FOR 20 NEXT END END Error No END instruction is permitted between F
96. The range of pointer n is various according to the type of CPU See the above picture If a CALL P n instruction has no corresponding SBRT instruction that has same pointer n with the CALL P n instruction an instruction error occurs Execution conditions Input condition Executed per scan 3 Executed per scan i d E Executed only once to CALL CALLP Executed only once 5 102 Chapter 5 Application instructions 2 Program example P020 j C P050 P021 P022 4 P051 PO2F P 9 GAL 0003 enn SBRT 0003 F092 H ncp Doooo F010 l mov Do000 Pos ARE 5 103 Chapter 5 Application instructions 5 14 Loop instructions 5 14 4 FOR NEXT K200S FOR NEXT FUN 206 FOR Applicable K300S Subroutine FUN 207 NEXT CPU K1000S A Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 FOR n O 3 NEXT 1 __ FOR n KH H wer ps Operand setting Range 0 32767 1 Functions The FOR instruction is unconditionally executed The CPU repeats the FOR NEXT block n times and then performs the processing of the next step of the NEXT instruction The range of n is 0 32767 If the value of n is out of range an instruction error occurs Upto fi
97. There is two ways to write new RTC data to the CPU The first one is using a handy loader KLD 1505 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 By switching a special bit on user can replace the current RTC data with the preset data stored in a specified memory area The followings are the memory address of preset data and an example program RTC preset data is stored as following table Memory Area Description Example data Word Higher byte Lower byte BCD format D249 Year h99xx D250 Day Month h1701 D251 Hour Date h1100 D252 Second Minute h2453 Example 1999 1 17 11 53 24 Sunday M310 RTC data change bit When the M310 bit is switched on the new data in D249 D252 will be moved to L12 L15 After data is moved M310 has to be switched off immediately because current data will be updated every scan while M310 is on Example program P000 MOV h9900 D0249 1999 MOV h1701 D0250 January 17th h1100 D0251 11h Sunday h2453 D0252 53m 24s D M310 Changing enable Start switch Other Program a The RTC data has not been set by factory default Before using RTC function write a correct RTC data to the CPU module b If unreasonable RTC data is written to the CPU the RTC operation can not be executed normally Example 13 month 32 day 2 25 Chapter 2 Functions
98. This function is useful to check operation of the output modules and wiring between the output modules and external devices K200S K300S K1000S Forced I O request bit M1910 The forced I O address D4700 D9700 The forced I O data D4800 D9800 Example 1 Output h8721 to the P10 word by force K200S K300S a Write the forced I O data h8721 to the corresponding data word P10 is matched to the D4810 word lt D4810 word F E D C B A 9 8 7 6 5 4 3 2 1 0 10 0 0 0 1 1 1 0 0 1 0 0 0 0 1 b Write the forced I O address All bit hFFFF to the corresponding address word Write hFFFF to the D4710 D4710 word 0 disable forced I O 1 enable forced I O F E D C B A 9 8 7 6 5 4 3 2 1 0 11 1 1 1 1 1 1 1 101 110 11 1 1 C Switch on the forced I O request bit M1910 d Output of P10 word P The previous result of operation F E D C B A 9 8 7 6 5 4 3 2 1 0 PIPIP P IP P PIPIP P I P P P P PP 2 27 Chapter 2 Functions Example 2 Switch On Off the last bit of PO7 word K1000S a Write the forced I O data h0001 to the corresponding data word P10 is matched to the D9807 word D9807 word F E D C B A 9 8 7 6 5 4 3 2 1 0 0 0 10 0 0 0 0 0
99. UEA module of slot number 2 and store the read data to the block which begin with DO300 The link status is stored at the M020 word L s A READ h0002 h001D D0300 D0200 h0020 M020 A Remote station Self station 20 words Sy FUEA module 20 words FUEA module at slot No no Station No h1n 5 113 System configuration Self station Power supply module 16 points 32 points input input module module slot 1 CPU module Power supply module Power supply module 5 114 Chapter 5 Application instructions FUEA module FUEA module Station Na hno Station Na hn slot 2 slot 3 16 points 32 points input input module module 16 points 32 points input module input module slot 0 slot 1 4 channel 4 channel A D module slot 2 FUEA module Station Na hin FUEA module Station Na h2F slot 3 Chapter 5 Application instructions 5 17 2 WRITE WRITE K200S Applicable Write data to FUN 245 WRITE B K300S remote station K1000S 4 Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 sl O Ss O O O O 0O 0 0 oloo ololojo lolo olo WRITE 13 O lolololololojo olo n2 O O SS O O OJO OJO OO Hwe a s Operand setting Slot number of FUEA module is Sl mount
100. User s Manual LG Programmable Logic Controller MASTER K Instructions amp Programming LG Industrial Systems Chapter 1 Introduction 1 1 Introductions a a Ek PE KE AN NE a Ki 1 1 1 2 Feat tes iii tic rece eerte eive dace doe co cb enterado a cis 1 1 Chapter 1 Introduction 1 Introductions 1 1 Introductions The chapter 1 Introduction will provide brief information about the features functions and operation of MASTER K series PLC 1 2 Features 1 Features of MASTER K series PLC are as following 8 various programming device for easy programming b editing in RUN mode is available C supports various open network with international standard communication protocol d realization of high processing speed with the dedicated arithmetic processor e various special function modules for PLC application fields 2 Features of MASTER K 200S 300S 1000S are as following a The fast processing speed Realize the lightning processing speed at 0 2 O with dedicate arithmetic processor b Enhanced self diagnostic functions With detailed self diagnostic error codes the cause of error can be identified easily c Debugging operation The MASTER K 200S 300S 1000S provides various debugging methods as following and it enable on line debugging execution with command by command execute with the break point designation execution according to the status of device execution with d
101. 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 ANS A P063 R Sawer OUT Time chart P020 P060 P061 P063 4 2 Chapter 4 Basic instructions 4 1 2 AND AND NOT AND AND NOT Flag Error Zero Carry F110 F111 F112 Available Device M P K L FT C S D D Integer Steps Instructions AND ANDNoT lolololololololo 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 2 AND NOT a Functions The NC contact series connection Read the on off data of the specified device O performs the AND operation of that data and the previous operation result and use it as a new operation result 3 Program example The P061 contact will be switched on when the P020 and P021 are on and the P022 is off P020 P021 P022 P061 AND AND NOT 4 8 Chapter 4 Basic instructions 4 4 8 OR OR NOT OR OR NOT Flag Error Zero Carry F110 F111 F112 Available Device M P K L FT C S D D Integer Steps Instructions OR lolololololololo
102. a aie toda S Lex 5 96 5 122 o IUD LU 5 98 5 12 8 STOP Gus ct ttre tte A 5 99 5 13 Branch instructions soda Pepe decet e serene Pun 5 100 5 43 T IMR JME aaa aan Re Ut tu DE 5 100 5 13 2 CALL CALLP SBRT RET sese 5 102 5 14 Loop InstructlODS uscar ph ee tao Ete oct teet 5 104 843 SEDECINEXTO e oso Seit a 5 104 5142 LIS qu naga a et gana an sa paia aga a saa ms agan teat 5 105 b 15 A inp ED oerte sedeo nrbe fors 5 106 IS 5 106 515 2 e os e eee 5 107 5 16 Special module instructions ooonccnnoccccccnnnnnccnnnccnnns 5 108 co etd aM cep 5 108 A enata setatis ttd bien 5 110 5 17 Data link instructions sseeeeeeeeeese 5 112 5A7 EAD ttes tiae taut cd ue dtes utr 5 112 A a UM CU See nener 5 115 517 3 RGET ae ane caQo cd HIA UR Uo ath cera ate 5 117 NE ME QUU PT EE 5 120 5 STATUS cm 5 122 516 Inturrupt instructions ee eic e eee ed eden 5 123 5481 SEDI sa o oe 5 123 5162 DINE IRET iere e a 5 124 5 18 37 INT BIBT caen eni ded Ceo N 5 125 5 19 Sign inversion instruction eeeussese 5 126 5491 NEG NEGP DNEG DNEGP et Ds 5 126 5 20 Bit contact instructions oooooccccnnnnnnnnconocccnnnnccnnnnann cnc 5 128 5 20 17 BED BIDN Actuated ae ntt tap a aan te ate 5 128 A auteni ceste 5 129 5 20 3 BAND BANDING ista ts caido 5 130 5204 BOLT exutus agak DUR AD SQ cL Ead t 5 131 5 20 55 BSE IBS Pace O A eres 5 132 5 21 Computer link module instructions
103. al device or not when the CPU is in DEBUG mode 2 4 10 The slot No for external interrupt Applicable for K200S only The K200S series has no interrupt module Therefore user can assign an input module as interrupt input module and input signals applied to this module will be handled as external interrupt input 2 16 Chapter 2 Functions 2 5 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 7 MEN END Self diagnosis Output refresh The CPU refreshes input data then executes the sequence program stored in the internal memory beginning with step O to the END instruction After executing the END instruction the CPU performs self diagnosis and refreshes output data and then returns to input refresh Remark Scan The series of steps from step O to the next step 0 is called a scan Therefore a scan time of the CPU is calculated as a total of the processing time of the sequence program step O to END and the internal processing time self diagnosis and I O refresh of the CPU 2 17 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 Operatio
104. and the error flag F110 is set 5 46 Chapter 5 Application instructions Execution condition Input condition IE LE SUB DSUB Executed per scan Executed per scan SUBP DSUBP Executed only once i E Executed only once gt lt 2 Program example When a rising edge is detected at P020 subtract contents of D0000 and D0001 and store the addition result to PO6 word P020 I H sus D0000 D0001 Pos JA 16 bits D0000 5 47 5 8 3 MUL MULP DMUL DMULP Chapter 5 Application instructions MUL FUN 120 MUL FUN 122 DMUL E All CPUs Binary multiply FUN 121 MULP FUN 123 DMULP CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 GD olololololojo Ololo MUL P Elololo 0 0 0 0 0 0 O zen O O DMUL P 0 0 0 o olo olo Operand setting SD The device storing multiplicand The device storing multiplier The device at which the result is multiplication stored Available only when do not use computer link module or data link module 1 Functions MUL P Performs the multiplication of BIN data specified as S1 and the BIN data specified as S2 and stores the multiplication result into the device specified as D 1 D DMUL P Performs the multiplication of BIN data specified as S1 1 S and
105. ane 5 11 5243 BCD BCDP DBCD DBCDP ica dia 5 11 5 2 2 BIN BINP DBIN DBINP atit tete P i db 5 14 5 3 Comparison instructions usina Pe pere ose be 5 16 5 3 1 CMP CMPP DCMP DCMPP c ccssesssseseseesessesceseeseseeneese 5 16 5 3 2 TCMP TCMPP DTCMP DTCMPP ccsssscssesseseesesseseeneese 5 19 Ds ein meet e Road pata A 5 21 534 AND sig eere es Lap sdb A 5 22 535 ORGS TE E Ra eae Nee tose 5 23 5 4 Increment decrement operations esssssss 5 24 5942 INC INGE DING DINOP ct eb rs 5 24 5 4 5 DEC DECP DDEC DDECP sees ttene tenens 5 26 5 5 FOLIO DOT ESC ost rtl iata eua anana aana anana aana aana 5 28 5 5 1 ROL ROLP DROL DROLR a s osi da adc eee 5 28 5 5 2 ROR ROPP DROR DRORP c ccsssssssssessesessesesseseeseeseseens 5 30 553 RCL RCLP DACL DROP t dete d 5 32 5 5 4 RCR RCRP DRCR DRCRP ccsccscssessesessessessesessesseseeseess 5 34 5 6 Shift insiructions ee er See I i Based ee ioc odi ci 5 36 56 gt BSFT BSRID a aa donas 5 36 55 2 A A me ccn 5 38 563 SEL oca disti UT nm LE MEE 5 40 5 7 1 XCHG XCHGP DXCHG DXCHGP sse 5 42 5 8 BIN arithmetic instructions sseseeeeeeeeese 5 44 5 8 1 ADD ADDP DADD DADDP dece petette 5 44 5 8 2 SUB SUBP DSUB DSUBP sssssseeeeees 5 46 5 8 3 MUL MULP DMUL DMULP sce RD 5 48 5 8 4 MUL MULP DMUL DMULP sesenta 5
106. ared as 0 when the CPU is switched on or turned to RUN mode 2 3 9 Indirect assignment data register D D is used for indirect addressing of the D area The contained value of data register assigned with symbol points the real address of data register at which the result of operation is stored If D is used with a double word instruction the lower 16 bits will stored at the data resister number designated by the contained value of D and higher 16 bits will stored at the data resister number 1 Example O 1 MOV D000 D1023 No of data register Hex value D0000 ae 4 The actual data movement n mE Indirect addressing D0123 DID29 If the value of data register assigned at D exceeds the physical address range of D area the operation error flag F110 will be set and the relevant instruction will be ignored 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 See the list of special relays at the appendix and be careful when use those M or L area in the program 2 3 12 Special data register D Some data registers are reserved for special usage These registers are various according to the type of CPU See the list of special registers at the appendix and be careful when use those
107. art word of block to The end word of block to be Lee aot Available only when do not use computer link module or data link module 1 Functions Shifts the block specified as S1 S2 by 1 word The direction of shift is from S1 to S2 Therefore if S1 is lower than S2 the block is shifted in left direction Otherwise the block is shifted in right direction 9241 S2 S1 S1 1 4 n words gt When S1 is lower than S2 Erased Lum h0000 is entered 9241 S2 S1 S1 1 9141 S1 S2 S2 4 n words gt i When S1 is higher than S2 h0000 is entered S S141 S1 S2 S2 1 Erased Chapter 5 Application instructions Execution conditions Input condition dj Lol L WSFT Executed per scan Executed per scan WSFTP i Executed only once Executed only once gt i 2 Program example Al 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 D0040 is set as h1234 when the P031 is on F093 H wsFT Doo40 D0043 P031 4 mov h1234 D0040 D0044 i D0043 D0042 D0041 D0040 i D0039 h4F29 h5849 hFOB4 h7802 hA006 h9201 Erased h0000 is entered while P031 is off and h1234 is entered while P031 is on h4F29 hFOB4 h7802 hA006 F4 h9201
108. ation result The comparison is executed as signed operation The comparison operation result is as shown below Instruction i Comparison Instruction e Comparison bn Condition operation bola E Condition operation y result y result S S S S lt S lt S lt S gt S gt S 2S gt S S lt gt S 4S en lt gt S S x S S S 2S gt S gt S gt S lt S 2 Program example a Compare P0000 POOOF and D0001 If their values are equal P0010 bit will be switched on Povo Dooot JH P0010 b Compare 1000 and contents of D0001 and D0002 32 bits If the contents of D0001 and D0002 is less than 1000 P0010 will turn on gt 1000 D0001 HA P0010 534 AND 2 gt lt lt gt Chapter 5 Application instructions FUN 94 AND FUN 95 ANDD AND _ FUN 96 AND FUN 97 ANDD gt K200S Serial NO contact FUN 98 AND FUN 99 ANDD lt Applicable K3008 with comparison FUN 106 AND gt FUN 107 ANDD gt CPU result FUN 108 AND FUN 109 ANDD lt K1000S FUN 118 AND lt gt FUN 119 ANDD lt gt I Available Device Flag Instructions Steps Error Zero Carry M P K L F TC S D D Integer F110 F111 F112 AND Dd o o oOlo ololo olo o 5 9 O AND G2 0 0 0 0 0 0 0O 0 0 0
109. ber of Cnet module is The configuration of sl Slot No of Cnet Lower 8 bits CD module Higher 8 bits AB Type of channel h00 RS232C h01 RS422 mounted amp Type of channel RS232C or RS422 The name of frame 8 words Start address of device that stores source data to be sent Numbers of byte to be sent Device at which the link status is SS stored 1 Functions Sends n bytes which begin with the device specified as S to the Cnet module that mounted on the slot sl The name of frame is stored as ASCII format into 8 words which begin with the device Fnam The link status is stored at the device specified as SS The maximum size of data block to be sent is 256 bytes 2 Program example Program that send 10 words from D1234 and frame name 8 words from D0000 to the Cnet module at slot 3 channel 0 RS232C The link status is stored at K015 word pue SND h0003 D0000 D1234 h0010 K015 1 5 133 Chapter 5 Application instructions 5 21 2 RCV RCV K200S Applicable Receive data and frame name FUN 168 RCV CPU K300S from Cnet module K1000S Available Device Flag Instructions Steps Error Zero Carry M PIKL F T C S D AD Integer F110 F111 F112 sl O Fnam OJO O O O OJO RCV Jolojo olo olo 1 O n O O SS O JO O OIO OJO Operand se
110. bit 0 of D and performs the OR operation with previous result and use it as an new operation result BORN A parallel connection of a NC contact Reads the on off status of the n bit from the bit 0 of D and performs the OR operation with previous result and use it as an new operation result 2 Program example D0000 word I mov hFF00 M0001 5 130 P0010 B D0000 0001 al P0011 BN D0000 0008 Program that turns on P0010 and P0011 according to the on off status of bit 1 and bit 8 of the Chapter 5 Application instructions 5 20 4 BOUT K200S BOUT Applicable FUN 236 BOUT K300S Bit output CPU K1000S A Available Device Flag Instructions Steps Error Zero Carry M PK L F T C S D D Integer F110 F111 F112 BOUT PALO 5 O n O Operand setting zc LE data Offset from the bit O to the A destination bit 1 Function Outputs the current operation result to the the n bit from the bit 0 of D 2 Program example Program that turns on the bit 2 of D0001 when M0002 is on M0002 m BOUT D0001 7 T 5 131 5 20 5 BSET BRST Chapter 5 Application instructions K200S BSET BRST FUN 232 BSET Applicable K300S Bit set reset FUN 224 BRST CPU K1000S Available Device Flag Instructions Steps Error Zero Carry M
111. ce eere Linn 4 28 49 1 TONS ui DU he e ea 4 28 49 2 TOEE zer ect on tio ein C Eon Soc bum 4 30 4 9 3 TMEUS neret s 4 32 4 94 VIMON bka dica Dee et c tot 4 34 49 5 TRIG misto e IR TE 4 36 4 10 Counter instructions asana aana nana eaaa aana c nr nennen 4 38 AVON CTU co iim died cg ben AG Se ee E 4 38 7 10 27 CTD A ect ee A etd es 4 39 4 10 83 GTUD aida 4 40 4 104 C TR aeta ee TA NG A EN 4 42 Chapter 4 Basic instructions 4 Basic instructions 4 1 Contact instructions 4 1 1 LOAD LOAD NOT OUT LOAD LOAD NOT OUT Flag Error Zero Carry F110 F111 F112 Available Device M P K L F T C S D D Integer LOAD lojolojololololo D Instructions Steps LOAD NOT OUT LOAD NOT 8 Available only when do not use computer link module or data link module 1 LOAD a Functions Starts a NO contact A Draw the on off data of the specified device 9 and use the data as an operation result 2 LOAD NOT 5 a Functions Starts a NC contact A Draw the on off data of the specified device 9 and use the data as an operation result 3 OUT O a Functions Outputs the operation result to the specified device D Several OUT instructions can be used in parallel with one operation result 4 1 Chapter 4 Basic instructions 4 Program example
112. cessing 3 Page File table write S FILW 184 Fiw n E 2 IS O se FILWP 185 Fiwe 9 2 D File table write DFILW e DFW np 2 S n e S n 1 5 81 DFILWP 187 priwe nH e D D 1 Abits When S n 3 DIS 14 ps GO n 2 a O 5 83 DISP 15 pisP n Lalo 4bits 4bits S S41 UNI 12 iN OO nH 2 S 2 s O 5 85 UNIP 193 June np 9 When n 3 D 4bits IORF 200 ionF MEH Refreshes the memory area a 5 87 IORFP 201 ionre O EH from D1 to D2 D1 lt D2 Chapter 3 Instructions 3 2 12 System instructions Mnemonic Function i amp ip symbol No Ladder symbol 5 Contents of processing a Page FALS 204 FALS n H Stores n to specified F area x 5 89 Generate a clock pulse as below DUTY 205 DUTY ni n2 n2 scans 5 920 rs AA WDT 202 WDT Ji Clear watch dog timer x 5 92 WDTP 208 wore Ji OUTOFF 208 OUTOFF Ji Switch off all outputs O 5 94 STOP 008 1 STOP Ji Stop the operation of CPU 5 95 3 2 13 Branch instructions Mnemonic Function i a p symbol No Ladder symbol 5 Contents of processing a Page JMP o2 WP n Ji Jump O 5 96 JME 013 JME m Ji Jump end CALL 04 CALL n Ji Call the subroutine O 5 98 CALLP 015 i CALLP n Ji SBRT 016 SAA Ji Start of a subroutine O RET 004 RET Ji End of subroutine 3 2 14 L
113. ched from off to on MASTER K series have 4 counter instructions such as CTU CTD CTUD and CTR The maximum counter setting value is hFFFF 65535 The followings shows brief information for counter operation lt Figure 4 Types and counting methods of counter instructions gt r1 Count Pulse U CXX CXXX Reset signal Rising Edge OFF ON Counter Counting Input instruction Type method signal Time chart Reset signal Count Pulse CTU Up Increment 1 __ Setting Counter value Elapsed value Counter output Reset signal Count Pulse CTD dt Decrement 1 Sunes Elapsed value Counter output Ho Reset signal Increase pulse Up Down Increment UP Counter Decrement 2 Decrease pulse 71 1 1 Z4 Setting Elapsed value value Counter output Reset signal Rin Count Pulse CTR g Increment 1 counter Elapsed value Counter output 2 10 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 Example A _ omo h12345678 Doso JA High 16 bits Lower 16 bits D51 D50 h1234 h5678 The D area except latched area assigned by parameter setting will be cle
114. ched on P030 H _ Decor Po2 POS 4 JH D C B A The value of i CODO DD last bito P02 hg When n 4 16 2 bits are effective D C B A Decoding To TT Te PT TT TT TT 888 Program that decodes the current value of counter C000 and stores the decoding result to PO5 and P06 word The current value of counter is increased at every 1 second and when the current value reaches to 31 the counter C000 is reset F010 H DECO cooo P05 5 END 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 CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 0 0 0 0 0 0O FILR P CHOR X9 9 oloooc O O olo 7 O DFILR P n O O a Don IL Operand setting FILR O The origin address of the source data word DFILR The destination word at which the contents of r3 9 D n S n word FILRP The offset DFILRP Available only when do not use computer link module or data link module 1 Functions FILR P Transfers the content of S n word to the device specified as D DFILR P Transfers the contents of S n 1 S n to the device specified as D 1 D When the S n is over the range of corre
115. current value is 0 2 Program example The P032 is reset signal Program Time chart P032 P030 P031 C000 4 40 When the reset signal turns on the counter contact and current value is cleared as 0 The P030 is up count input and the P031 is down count input Whenever a rising edged is detected from up count input the current value is increased by 1 The current value is decreased by 1 whenever a rising edge is detected at the down count input The counter contact turns on when the current value is same or greater than the setting value 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 If the PB1 is pushed when 4 motors are operating all motors will stop their operation 2 System diagram Input Input module P03 module P06 3 Program 0000 C001 operate 1 motor 0006 C002 operate 2 motor 0012 C003 operate 3 motor 0018 C004 operate 4 motor 0024 C005 reset signal D UO C d UO C 3J UO C 2 UO c oc 0030 0032 0034 0036 0038 4 41 Chapter 4 Basic instructions 4 10 4 CTR CTR Ring counter Available Device 2i Flag Instructions o Error Zero Carry M P IK IL F T C
116. d at D 1 D If the result of exclusive NOR is 0 the zero flag F111 is set fthe indirect address specified by D format is out of device range the operation error occurs and the error flag F110 is set 5 70 Chapter 5 Application instructions Execution conditions Input condition d Goo XE WXNRP DWXNRP NC H Executed only once i d Executed only once 2 Program example Program that performs the exclusive NOR of the contents of P04 and h2345 then stores the result to the POG word when the P020 is switched on P020 HA WXNRP P04 h2345 Pos 16 bits WXOR 5 71 Chapter 5 Application instructions 5 11 Data processing instructions 5 11 4 SEG SEGP SEG FUN 174 SEG Applicable All CPUs 7 segment FUN 175 SEGP CPU I Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 S ololo ojolo Olo SEG Oo ololo Olo olo zi X SEGP Cw O mm Oow pl O cw Operand setting Available only when do not use computer link module or data link module The device at which source data is stored The device which will store 7 segment display data C Information for start bit and W numbers of transferred bits 1 Functions The format of Cw EEE a s The start bit of S
117. e The current value will start to increase when the input condition turns on It will increase by 1 at every 0 1 or 0 01 sec until it reaches to the setting value or input condition turns off The timer contact will be switched on when the current value reaches to the setting value The timer contact and current value is cleared when the input condition turns off or RST instruction is executed 2 Program example The T097 0 01 sec timer will turn on 20 seconds later until the P020 is switched on P020 Program STON T7097 00200 T097 iji P065 P021 AA RST T0987 Time chart P020 T097 Increase 4 28 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 Input module Output module P02 P06 Start 4 P020 O O E 7 Program 3 Program Ladder program P020 T001 YY TON Tooo 00005 Seta Off time 0 5sec T000 TON T001 00006 Set a On time 0 6 sec P065 x T000 TOO1is set as 100 msec timer END Time chart 4 29 Chapter 4 Basic instructions 4 9 2 TOFF TOFF Off delay timer Available Device 2 Flag Instructions 9 Error Zero Carry MAPA KES A GA Sap D Integer on F110 F111 F112 Txxx O TOFF 3
118. e CPU type O All CPUs K10S1 K10S K30S K60S K200S K300S K1000S 3 1 Chapter 3 Instructions 3 1 4 Master control instructions Mnemonic Function i gt symbol No Ladder symbol 5 Contents of processing amp Page MCS 010 mes n E Start a master control O 4 13 MCSCLR 011 wcscin n E End a master control O 4 13 3 1 5 Output instructions Mnemonic Function E 2 symbol No Ladder symbol 5 Contents of processing amp Page D 017 p H Generates one scan pulse on the O 4 16 rising edge of input signal D NOT iz Generates one scan pulse on the 4 DNOT 018 E A O falling edge of input signal e 58 SET Ser o H Seta device O 4 19 RST gt A RST O Reset a device 4 20 OUT 4 Output a device O 3 1 6 Step controller instructions Mnemonic Function x symbol No Ladder symbol 5 Contents of processing amp Page SETS set Sxx xx E Sequential processing control O 4 22 OUTS _ SXx xx A Last in priority control O 4 24 3 1 7 END instruction Mnemonic Function symbol No Ladder symbol 5 Contents of processing 5 Page END 001 sa END H Ends a sequence program O 4 25 3 2 Chapter 3 Instructions 3 1 8 No operation instruction
119. e ca AE h0022 Stop mounted I O points exceeds the Aeka parameter maximum I O points of CPU module 9 Fimo Fmm 0 Change parameter parameter h0023 Run Fmm 0 parameter error nge p efto parameter error setting Bram Fmm 1 Change parameter parameter h0024 Run Fmm 1 parameter error nge p parameter error setting error Fmm 2 parameter Ine h0025 Run Fmm 2 parameter error Change parameter error parameter error setting Era Fmm 3 Change parameter parameter h0026 Run Fmm 3 parameter error inge p char parameter error setting Operation Operation error h0030 Stop BCD operation error Revise program error Run Operand error Change parameter WDT error WDT over error h0031 Stop Mesa ane annie theparameter setting value or insert WDT value of watch dog timer i instruction An error occurred while editing program Program POM Change h0032 Stop in RUN mode The change is not A change error error completed Program PGM Change A code error occurred while editing h0033 Run change error error program in RUN mode Code check Code chack h0040 Stop There is an instruction connot be Revise program error error decoded in program Missing END Missing END h0041 Stop There is no END instruction in program Insert EN instruction instruction instruction at the end of program Missin Missin Insert RET instruction 9 ng h0042 Stop There is no RET instruction in subroutine at the end of RET error RET instruction subroutine Missing Mi
120. ecial function module function module Start address of self station at which source data is stored RD a Start address of remote station at which data to be written K1000S E NE BE mE EUH Numbers of word to be written ksoos_ son sin 82h 83h 84h Device at which the link status is SS stored Kos son ath een The configuration of St Lower 8 bits CD Station No of remote station Higher 8 bits AB Slot No of special function module Available only when do not use computer link module or data link module 1 Functions Reads the data of n2 words which start at the device specified as D and write the data to the block which begin with the address specified as S of buffer memory inside the special function module of remote station station number amp slot number is specified as St through the FUEA module Then stores the link status into the device specified as SS of self station 5 120 Chapter 5 Application instructions Remote station Self station Buffer memory of special function module D n2 words ES FUEA module n2 words FUEA module Station Na SP An instruction error occurs when the assress S n2 or D n2 is out of the range of specified device Execution conditions Input condition TENE x DEN ME RPUT REN i Executed only once E E Executed only once gt lt 2 Program example
121. ecified as n when input condition turns on If n is not specified all interrupts are disabled The n is assigned to each interrupt by parameter setting Execution conditions Input condition ead th EI DI Executed per scan Executed per scan 4 4 gt 2 Program example Program that enable the interrupt 5 El 5 H Program that disable all interrupts mmo jH 5 123 5 18 2 TDINT IRET Chapter 5 Application instructions K200S TDINT IRET FUN 226 TDINT Applicable K300S Time driven interrupt FUN 225 IRET CPU K1000S A Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 TDINT n O 1 r TDINT n r4 Operand setting 0 5 K200S 0 7 K300S 0 15 K1000S 1 Functions TDINT Indicates the begin of the time driven interrupt routine JRET Indicates the end of the interrupt routine Instructions between the TDINT n and the next IRET are executed only when the corresponding time driven interrupt occurs and is enabled by the El instruction The interval of interrupt can be set as 60msec 60000msec unit 10msec with parameter setting The execution time of interrupt routine should be less than the interval of interrupt The TDINT n instr
122. ed Station number of remote station St to be read data Start address of master station at which read data is stored 5 Start address of remote station at which data to be read Numbers of word to be read of word to be read A at which the link status is Available only when do not use computer link module or data link module 1 Functions Reads n2 words which begin with the address S and write the read data to the block which begin with the address D of the remote station that has a station number specified as St through the FUEA module mounted at the slot sl of self station The link status is stored at the address SS of the master station 5 115 Remote station n2 words FUEA module Station Na SP Chapter 5 Application instructions Self station n2 words FUEA module An instruction error occurs when the assress S n2 or D n2 is out of the range of specified device Execution conditions Input condition VE MENU MSS NEM WRITE 2 Program example Executed only once lt q Program that read 14 words which begin with D1234 of self station and write the read data to the block which begin with D5678 of remote station Station No of FUEA module h2F through the FUEA module at slot number 3 of self station The link status is stored at the K015 word System configuration is same as the example of READ
123. ed first Otherwise two interrupts are executed consequently The maximum numbers of TDI for K200S 3008 1000S are shown as following table See the 2 4 5 for details of parameter setting PLC type Available TDI K200S TDINT 0 7 K300S TDINT 0 13 K1000S TDINT 0 29 The following figure shows an example of TDI execution lt Figure 2 6 The example of execution of TDI gt Used TDI Interrupt routines TDI 0 occurs every 200msec A The routine corresponding to TDI O TDI 1 occurs every 100msec B The routine corresponding to TDI 1 TDI 2 occurs every 400msec C The routine corresponding to TDI 2 400msec 100msec 100msec 100msec 100msec 2 22 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 The execution order of multiple interrupts is similar as TDI The following figure shows an example of execution order of multiple PDI Figure 2 7 The execution order of multiple PDI gt Main Program PDI O PDI 1 Interrupt routine O PDI 2 Interrupt routine 1 oo 0 Interrupt routine 2 Program starts Interrupt 2 occurs Stop main program and run PDI routine 2 Int
124. eed Link 4 Dx660 to Address of D area Address shown in the TABLES m 3 Dx673 11 x m wherenz 1to3 Slave System Flag List Start Address Data Keyword Name hexadecimal Type Size Remark CPU Type Remote CPU Type h0000 Word 2 Byte VER NUM O S Version Number h0002 Word 2 Byte _SYS STATE System State h0004 Word 2 Byte FSMTXECNT TX Error Count h0006 Word 2 Byte FSMRXECNT RS Error Count h0008 Word 2 Byte _FSMSVCFCNT Service Fail Count h000A Word 2 Byte FSMScanMX Maximum Scan Time h000C Word 2 Byte _FSMScanAV Average Scan Time h000E Word 2 Byte _FSMScanMI Minimum Scan Time h0010 Word 2 Byte _MONTHSTNO Mother Station No h0012 Word 2 Byte _FSMVRCNT Variable RD Count h0014 Word 2 Byte _FSMVWCNT Variable WR Count h0016 Word 2 Byte _FSMHSTXCNT HS Link TX Count h0018 Word 2 Byte _FSMHSRXCNT HS Link RX Count h001A Word 2 Byte AC Fail CNT Power Fail Counter h001C Word 2 Byte lO TYER N Module Setting Error h0020 Word 2 Byte _CNF_ ER Representative Flag Word CPU H W defect B pe CRUSER Module Setting Error PILO b1 1O TYER E ng Bit 1 Bit information E Mounting Dismounting De 10 DEER Error hOO1E rb 2 Byte b3 FUSE ER Bit 3 Y b7 tob15 Fuse Blown Error b4 IO RWER Bit 4 reserved I O Access Error 3 pat EEN I P Access Error Bt pO ERR EDA Sub Power Error SIEG O DEER N odd Dismounting h0022 Word 2 Byte FUSE ER N Fuse Error h0024 Word 2 Byte _lO PWER_N 1 O Error h0026 Word 2 Byte _IP_IFER_N Special Module Erro
125. er 5 Application instructions WXOR FUN 160 WXOR FUN 162 DWXOR E All CPUs Word exclusive OR FUN 161 WXORP FUN 163 DWXORP CPU Available Device Flag Instructions Steps Error Zero Carry M PK L F T C S D D Integer F110 F111 F112 0O 0 0 0 0 0 0 O O O WXOR P amp 2 0 0 0 0 0 0 O 010 0 zem O O DWXOR P O olololo lolo olo WXORP DWXORP Operand setting Data for which exclusive OR will be performed The device at which the result of exclusive OR is stored Available only when do not use computer link module or data link module 1 Functions WXOR P Performs the exclusive OR of the 16 bit data of device specified at S1 and S2 per bit Then stores the result of logical production into the device specified at D 16 bits WXOR ppal CAE C C GC EE Y DWXOR P Performs the exclusive OR of the 32 bit data of device specified as S1 1 S1 and S2 1 S2 per bit and stores the result into the device specified at D 1 D If the result of exclusive OR is 0 the zero flag F111 is set fthe indirect address specified by D format is out of device range the operation error occurs and the error flag F110 is set Chapter 5 Application instructions Execution conditions Input condition d Goo XE WXORP DWXORP gt Executed
126. er contact turns on when the input condition turns on When the input condition turns off the current value will decrease by 1 at every 0 1 or 0 01 sec until it reaches to 0 and the timer contact will be switched off when the current value reaches to 0 While a timer is operating on off changed of input condition is ignored When the RST instruction is executed the timer contact will turn off and the current value will be cleared as 0 2 program example P020 Program TMO T000 00100 T000 p pee E En Time chart P023 k RST T000 i Setting value Setting time t gt P061 4 34 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 Input module The limit switch output P02 with low speed of cart Stabilized signal a fixed period 2 System diagram Moving direction L S The limit switch output with high speed of cart gt T Description Limit switch output Stabilized signal of PO20 Chattering prevention timer 3 Program P020 TMON 7000 0002 Even if P020 trembles after P020 T000 turns on in a moment M0020 _____________________ M0020 keeps its on state for 0 2 second 4 35 Chapter 4 Basic instructions
127. errupt 0 occurs higher priority Stop routine 2 and execute routine 0 Interrupt 1 occurs lower priority Finish routine 0 and execute routine 1 Finish routine 1 and resume routine 2 Finish routine 2 and back to main program 2 23 Chapter 2 Functions 2 6 2 RTC Real Time Clock function Since the RTC function is optional 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 1 Clock data Clock data is the data comprised of year month day hour minute second and date Data name Description Year The lower 2 digits of the Christian Era Month 1 to 12 Day 1 to 31 A leap year is distinguished automatically Hour 0 to 23 24 hours Minute 0 to 59 Second 0 to 59 0 Sunday 1 Monday 2 Tuesday Date 3 Wednesday 4 Thursday 5 Friday 6 Saturday 2 Precision Max 1 728 second per day general temperature 3 K10S K30S K60S a Read RTC data RTC data is stored as following table Memory Area Description Example data Word Higher byte Lower byte BCD format L012 Year h98xx L013 Day Month h2212 L014 Hour Date h1902 L015 Second Minute h4637 Example 1998 12 22 19 37 46 Tuesday 2 24 Chapter 2 Functions b Write RTC data
128. eseeneee 3 19 3 2 19 Sign inversion instructrions seseeeee 3 19 3 2 20 Bit contact instructions oooonnnncnccccconoronennnonononnnnnnnnnnnns 3 20 Chapter 3 Instructions 3 Instructions 3 1 Basic instructions 3 1 1 Contact instructions Mnemonic Function i z symbol No Ladder symbol 5 Contents of processing A Page LOAD c NO contact operation start O 4 1 LOAD NOT H NC contact operation start O 4 1 AND gt NO contact series connection O 4 3 AND NOT H NC contact series connection O 4 3 OR LL E NO contact parallel connection O 4 4 OR NOT pyp NC contact parallel connection O 4 4 3 1 2 Connection instructions Mnemonic Function i z symbol No Ladder symbol 5 Contents of processing amp Page AND LOAD A Series connection of blocks O 4 6 OR LOAD A Parallel tion of block 0 4 8 Parallel connection of blocks 7 2 MPUSH 005 Stores the operation result O 4 10 Reads the operation result from _ MLOAD 006 MPUSH O 4 10 Reads the operation result from E MESA oog MPUSH and clears the result 410 3 1 3 Inversion instruction Mnemonic Function i z symbol No Ladder symbol 5 Contents of processing 5 Page NOT o Invert the operation result O 4 12 Remark Applicabl
129. esignated numbers of scan d Execution of various program types The MASTER K 200S 300S 1000S series provides time driven interrupt process driven interrupt and subroutine programs as well as normal scan program e Supports the sampling trace and triggering functions The compatibility among MASTER K series 1 The I O P and data D registers may differ for each series Please refer the memory map of each series at the chapter 2 2 before convert a program for other MASTER K series 2 Some instructions are not supported by all series Please refer the instruction table of appendix 9 3 Please backup the original program before converting the program 1 1 2 1 2 2 2 3 2 4 Chapter 2 Functions Performance Specifications esee 2 1 2 1 1 K10S1 K10S K30S KOUS minii ang aa E ea ang a a anaa yaa 2 1 2 1 2 K200S K300S K10008S ssssssssssssssssseeeeeeeneeenennns 2 2 Memory configuration map eeeeeeeeeeneeee enne nnns 2 3 2 24 MO ui ete a ice en e E HR 2 3 2 2 2 K10S K30S K60S 0 ccecceceesccecceeeceeeceeeeeeeeeeecacecaeeeaeeeaeseneseeeeeeeeeeees 2 4 2 2 8 K200S K300S K1000S eceeceeeceeeceeeeeceeeeeeeeceeeaeeeaeseeeseeeearesseeeas 2 5 Memory devices of MASTER K series eene 2 6 2 9 1 Input output area Pasa aaa ee eee aliens 2 6 2 3 2 Auxillary relay Mission 2 7 2 3 3 Keep relay I e ntt eripe dore 2 8 2 924
130. etting B D n B The start address of source data Offset from the bit O to the BN D A 1 destination bit 1 Functions BAND A series connection of a NO contact Reads the on off status of the n bit from the bit 0 of D and performs the AND operation with previous result and use it as an new operation result BANDN A series connection of a NC contact Reads the on off status of the n bit from the bit O of D and performs the AND operation with previous result and use it as an new operation result bit n bit4 bit3 bit2 bit1 bitO 2 Program example Program that turns on P001A and P001B according to the status of bit 1 and bit 8 of the D0003 word M0000 mov hoFoF D0003 i iy AMM e Result M0001 1 PL mov hFOFO D0003 M0000 P001A P001B M0001 a B D0003 00001 P001A ji BN Dooo3 00008 P001B 5 129 5 20 3 BAND BANDN Chapter 5 Application instructions K200S BOR FUN 252 BOR Applicable K300S Bit OR FUN 253 BORN CPU K1000S Available Device Flag Instructions Steps Error Zero Carry MP K L F T C S D Integer F110 F111 F112 BOR O 5 O BORN n Offset from the bit O to the BN D A destination bit Operand setting 1 Functions BOR A parallel connection of a NO contact Reads the on off status of the n bit from the
131. gle F0015 to F001F Unused F0020 1 step run Turns on when the 1 step run is operated in the Debug mode F0021 Breakpoint run Turns on when the breakpoint run is operated in the Debug mode F0022 Scan run Turns on when the scan run is operated in the Debug mode F0023 Coincident junction Turns on when the coincident junction run is value run operated in the Debug mode F0024 Coincident word Turns on when the coincident word run is value run operated in the Debug mode F0025 to FOO2F Unused F0030 s HEAVY ER Fatal error Turns on when a fatal error has occurred F0031 s LIGHT ER Ordinary error Turns on when an ordinary error has occurred F0032 s WD ER WDT Error Turns on when a watch dog timer error has occurred F0033 s IO TYER 1 O combination Turns on when an I O error has occurred error When one or more bit s of F0040 to FOO5F turns on F0034 s BAT ER Battery voltage Turns on when the battery voltage has fallen error below the defined value F0035 s FUSE ER Fuse error Turns on when a fuse of output modules has been disconnected F0036 to F0038 Unused F0039 s D BCK OK Normal backup Turns on when the data backup is normal operation F003A s RTC ER RTC data error Turns on when the RTC data setting error has occurred F003B During program Turns on during program edit while running edit the program F003C Program edit error Turns on when a program edit error has occurred while running the program F003D to F003F Unused
132. gram that resets the latched error flag F115 when M0000 turns on A CLE H 5 107 Chapter 5 Application instructions 5 16 Special module instructions 5 16 1 GET GETP GET GETP K200S FUN 230 GET Applicable Read data from CPU K300S FUN 231 GETP special module K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 GET P sl O D n2 O Operand setting Slot number of special function Sl module is mounted GET si O n Start address of data to be read Start address of data to be stored Number of word to be read Available only when do not use computer link module or data link module 1 Functions Reads the data of n2 words which start at the address specified as S of buffer memory inside the special module specified at sl and stores the data into devices which begin with the device specified at D The buffer memory of the special function CPU module module at the slot sl S D n2 words n2 words 5 108 Chapter 5 Application instructions Inthe 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 specified device range Execution conditions
133. h0001 P04 n Dooo1 h0004 h0004 no o h0004 po5 D0002 h005F h005F P06 5 6 Chapter 5 Application instructions 5 1 4 FMOV FMOVP FMOV FUN 92 FMOV Applicable All CPUs File move FUN 93 FMOVP CPU Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 S ololo ololo FMOV S RS O O OJO C OO 7 FMOVP ao n O O a E J Dn JH Operand setting The device at which source FMOV data area is stored The start address destination area will a I m 9 n transferred data Numbers of transferred FMOVP words Available only when do not use computer link module or data link module 1 Functions Transfers the content of device specified at S in blocks to n points which begin with the device specified at D lt n words 5 7 Chapter 5 Application instructions Execution condition Input condition EE MEME SEN CES NE FMOV o E Executed per scan Executed per scan FMOVP Executed only once E i 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 P020 k c Fmove Po2 P04 3 KH P04 P05 P06 MESE 5 8 Chapter 5 Application i
134. highest priority The Sxx 00 is initialization step and the Sxx xx group will be initialized by switching on the Sxx 00 When the CPU is turned to RUN mode the Sxx 00 is set by default 2 Program example P020 Program S0201 P021 I 0223 P022 02 98 P023 o 02 04 P024 Reset 502 00 Time chart P020 i P021 P022 P023 i P024 I 1 1 ONE 02 01 i S02 23 S02 98 S02 04 4 25 gt S02 xx reset input condition 1 Chapter 4 Basic instructions 4 7 Endinstructions 4 7 1 END END FUN 001 END Flag Error Zero Carry F110 F111 F112 Available Device M P IK IL F T C S ID D Integer HH l l a END 1 Functions The END instruction indicates the end of sequence program When the CPU meet the END Steps Instructions 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 If there is no END instruction the program error will occur Input refresh 0000 LOAD P020 0001 AND P021 1scan 2550 END lt t The end of sequence program Self diagnosis Output refresh 4 26 Chapter 4 Basic instructions 4 8 No operation instruction
135. ied as n1 and to OFF at the scan count specified as n2 A Atthe initial status when the timing pulse is off the timing pulse is off When nt 20 the timing pulse is always off When n1 gt 0 and n2 0 the timing pulse is always on Input condition A 4 DUTY Timing pulse VEP GE MR EC NA i ni scans E n2 scans 5 94 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 I EY DUTY p 0 1 5 Scan during which timing pulse is off Scan during which timing pulse is on Be sure to set to 0 The F device which stops timing pulse F100 F107 2 Program example Program that generates a timing pulse of 250 scans on and 300 scans off and output it to F100 contact when P030 switched on When P031 is switched on the timing pulse is stopped P030 l DUTY F100 250 300 F100 HA P061 P031 DUTY Fio o 1 P030 ia P031 j Timing pulse NENNEN um Num E 250 scans 300 scans gt e 5 12 3 WDT WDTP Chapter 5 Application instructions WDT K200S FUN 202 WDT Applicable Watch dog timer K300S d FUN 203 WDTP CPU clear K1000S 4 Available Device Flag Instructions Steps Error Zero Carry M P KL F T C S D Integer F1
136. ing value upu Ri Counter relay No SEE U J Up Pulse Down CTUD Pulse O 4 39 Current value Setting value Output Gud Counter ii No reset Pulse Count D CIR Cxx Pulse y 4 41 CTR Reset Current S HR lt S gt Q H value Setting value Output 3 4 Chapter 3 Instructions 3 2 Application instructions 3 2 1 Data transfer instructions pic Balm Ladder symbol E Contents of processing B Page MOV oso vov H 2 Move data s O 5 1 MOVP o dwoe 9H f 0 DMOV 082 DMOV OH g Move data 5 O 54 DMOVP 083 pwove OH 8 O Om 10 1 0 CMOV 084 cov OH g Complement data move Kel E O 5 3 CMOVP o5 cwovP OH e j 10 1 DCMOV 086 DCMOV H g Complement data move a a O 53 DCMOVP 087 DCMOVP H gt 1 r 1O0 1 0 Group move GMOV 090 mov O nH 2 9 5 5 5 O n O GMOVP 091 _ amovp np gt Filling move FMOV o2 Hrwov Ji 2 9 a n 9 5 FMOVP 03 Fmovr nH C BMOV 100 Hemor cw Bit move Ke 5 9 BMOVP 101 BMOVP D cw m See the 5 9 page for detail usage 3 5 Chapter 3 Instructions 3 2 2 Conversion instructions Mnemonic Function 2 symbol No Ladder symbol 5 Contents of processing amp Page BCD 060 Bcp OH g BCD conversion Binary BCD Q 5 11 BCDP 061 BCDP 6 OH
137. instruction HM WRITE h0003 h002F D1234 D5678 h0014 K015 HH Remote station 14 words SS FUEA module Station No h1n 5 116 Self station 14 words FUEA module Slot No no Chapter 5 Application instructions 5 17 3 RGET RGET K200S Applicable Read data from special function FUN 232 RGET CPU K300S module of remote station K1000S Available Device Flag Instructions Steps Error Zero Carry M PIKL F T C S D D Integer F110 F111 F112 sl O St O O lolololol lojo olo RGET 13 O O n2 O O SS O O OJO OJO OIO Operand setting H rcer s st D n ss Slot number of FUEA module is mounted amp Type of special The configuration of sl function module to be read Lower 8 bits CD Slot No of FUEA Station number of remote station Higher 8 bits AB Type of special to be read data amp Slot number of special function module function module Start address of self station at The ID code of special function module which read data is stored Start address of remote station at K1000S Numbers of word to be read K3008 Device at which the link status is SS stored ews es em The configuration of St Lower 8 bits CD Station No of remote station Higher 8 bits AB Slot No of special function module Available only when do n
138. interrupt occurs with the status of external input Before to use interrupt function in sequence program the parameter setting should be done properly See 2 4 6 for parameter setting Then the corresponding interrupt routine should be written after END instruction Refer chapter 4 for details If interrupt routines are not matched with parameter settings an error occurs and the operation of CPU will be stopped To execute an interrupt routine use the El instruction to enable the corresponding interrupt The interrupt routine is not executed if an interrupt factor occurs before execution of an El instruction Once an interrupt is enabled with El instruction it keeps the enabled status until DI instruction is executed to disable the interrupt When a CPU is turned to RUN mode all interrupts are disabled by default When multiple interrupt factors occur simultaneously interrupt routines are executed according to the priority given to the each interrupts If an interrupt factor that has higher priority occurs while other interrupt that has lower priority are executing the interrupt routine of lower priority will be stopped and the interrupt of higher priority will be executed first The following figure shows how a CPU handle multiple interrupts Figure 2 5 The execution order of multiple interrupts gt Program starts Main Program Interrupt 2 occurs Stop main program and execute interrupt routine 2 Interrupt
139. ion and stores the read data into the block which begin with the device specified as D of slave station Station number st SEND instruction can be used with master station station number h1F only Execution condition Input condition gcc SEND Executed per scan Executed per scan 5 141 Chapter 5 Application instructions 2 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 HM SEND h0A D0010 M000 nos Master station Slave station D0010 M000 5 words 5 words Station No h1F E Station No ROA 5 142 Appendix A 1 Memory configuration esee 1 A2 Special rela voca einen Aldana 3 A2 NStructioniliSts ghd when lai aid pane ae ab ga aka aa 12 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 The notation of bit memory device gt ni Assign the bit address 0 F Hexadecimal Assign the word address Decimal Assign the device P M L K F lt The memory structure of bit memory device gt FP E D 6c B A 9 00 mue a AO ad MS TE TES gener gd NE aa 160 ese cen ea P002B A 1
140. is used in between 1 is reduced from the number of used MPS instructions 4 10 Chapter 4 Basic instructions 2 Program example Ladder program P020 P021 P022 P023 P024 P060 00000 __ P061 P062 00027 Mnemonic program INSTRUCTION 4 11 Chapter 4 Basic instructions 4 3 Inversion instruction 4 3 1 NOT NOT Available Device 2 Flag Instructions o Error Zero Carry M P IK L F T C S ID D nteger YN F110 F111 F112 NOT 1 Jy 1 Functions nverts 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 Parallel OR connection Serial AND connection 2 Program example The following two programs perform same operation Program A P020 P021 P022 P023 P024 EHHH m Program B P020 P021 P022 P023 P024 4 12 P060 Chapter 4 Basic instructions 4 4 Master control instructions 4 4 44 MCS MCSCLR MCS MCSCLR FUN 010 MCS FUN 011 MCSCLR Instructions Available Device hy Flag o Error Zero Carry M P IK L F T C S ID D Integer F110 F111 F112 MCS MCSCLR
141. last step step 5 at the this example F15 is updated as setting value of step 0 and current value F14 is cleared as 0 d If the input condition turns off current value and HSC output F070 F077 is cleared as 0 5 136 Chapter 5 Application instructions 5 22 2 HSC HSC Applicable K1081 K10S High speed FUN 215 HSC CPU EOS counter Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 PV O OJOJ OJOJO O O O 0 HSC 7 9 11 sv O O0 0O0 0 0 0 0 O O o Operand setting 1 Functions HSC instruction can not be used with HSCNT instruction in a program Only one of them can be used in a sequence program 32 bits up down high speed counter HSCNT 16 bits up counter If the current value same or greater than SV the HSC output bit F070 turns on The current value can not be changed by user The current value is stored at F14 lower word and F15 higher word When the HSC instruction is used the high speed counter parameter setting is ignored Explanation of operands a EN High speed counter enable contact b U D operates as up counter when U D is 0 and down counter when U D is 1 c PR If the PR input turns on the current value is changed as preset value PV d PV Preset value If the PV is specified as device A the PV
142. le 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 2 Program example Program that turn the P020 on when the M000 or M001 is turn on M000 P020 M001 Chapter 4 Basic instructions 45 2 D D FUN 017 D Flag Error Zero Carry F110 F111 F112 Available Device M P IK L IF T C S D D Integer Steps Instructions U O O O a N O Device to be converted into gt D O 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 Be careful when use a P area as D 2 Program example When the P032 is switched on the M002 is turned on for one scan Program The self locking circuit that shows the M002 is turned on Time chart P032 gt lt 1scan On M002 P060 The P060 keeps the on state because of the self locking circuit 4 17 Chapter 4 Basic instructions The on off toggle control Example of D instructions 1 Operation When the push button PBO is pushed the P060 is switched on It is switched off when the PBO is pushed again The P060 will repeat on off whenever the PBO is pushed 2 Sys
143. lock specified as S1 S2 by 1 bit The direction of shift is from S1 to S2 Therefore if S1 is lower than S2 the block is shifted in left direction Otherwise the block is shifted in right direction When S1 is lower than S2 When S1 is higher than S2 EXER S2 S1 n bits FE FES ETE HER ES TTT KAKA Ss ura a KAKA n bits S1 S2 0 is entered Chapter 5 Application instructions Execution conditions Input condition dj Lol L BSFT Executed per scan Executed per scan BSFTP Executed only once E i Executed only once E ni 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 P040 is set as 1 when the P031 is on F093 BSFT P040 Poss P031 H SET P040 P046 P045P044 P043 P042 P041 P040 PO3F 0 is entered while P031 is off and 1 is entered while P031 is on Erased 5 37 Chapter 5 Application instructions 5 6 0 WSFT WSFTP WSFT FUN 70 WSFT Applicable All CPUs Word shift FUN 71 WSFTP CPU Available Device Flag Instructions Steps Error Zero Carry M PK L F T C S D D Integer F110 F111 F112 GD o ojo o olo olo WSFT P 5 O olo o lo olo O0 i HI D 2 Operand setting The st
144. ly a JME or JMP is inside of a loop subroutine FOR NEXT or interrupt routine an operation error will occur when the JMP instruction is enabled Refer 2 7 1 for details 5 100 Chapter 5 Application instructions Execution conditions Input condition o Ll L JMP gt 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 s 00100 ae JME 5 101 5 13 2 CALL CALLP SBRT RET Chapter 5 Application instructions CALL SBRT FUN 014 CALL FUN 015 CALLP Applicable All CPUs Subroutine FUN 016 SBRT FUN 004 RET CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 CALL P n O 1 SBRT RET I H CALL P n zs Operand setting K10S1 0 15 K10S K30S K60S 0 63 K200S K300S K1000S 0 127 1 Functions When the input condition turns on stops the sequence program and executes the corresponding subroutine program specified by pointer n After finishing execution of subroutine resume to execute sequence program from the next step of CALL n instruction Multiple levels of nesting of the CALL P instruction are allowed as much as 64
145. me time F0520 to FO52F S SCAN AVG Present scan time Stores the present scan time F0530 to FO53F Clock data Clock data year month year month F0540 to F054F Clock data Clock data day hour day hour F0550 to F055F Clock data Clock data minute second minute second F0560 to F056F Clock data Clock data day of the week day of the week F0570 to FO58F Unused F0590 to F059F S CODE ER N Storing errorstep Stores the error step of the program F0600 to FO60F S_ERR TYP Storing FMM step If a FMM related error has occurred its occurrence information is stored F0610 to FO63F Unused A 8 Appendix High speed link flag list x K10008 9 K300S K200S 4 n 0 7 Slot No Keyword Type Address Name Description Indicates the number which is set on CnSTNOL E communications module station switch CnSTNOH Dword Dx500 Communications Enet Mnet MAC station No marked on the front Dx502 module station No of communication module Fne Fdnett Station switch No marked on the front of communications module Increments by one whenever sending error of _CnTXECN Word Dx504 Communications communications frame occurs T frame sending error Connection condition of network is evaluated by this value Increments by one whenever receiving error of _CnRXECN Word Dx505 Communications communications frame occurs T frame receiving e
146. n DIVBP DDIVBP i i Executed only once Executed only once Seas El 2 Program example Program which stores the division result of D0001 and D0002 at D0010 D0011 while P020 is on P020 H bvg pooo pooo D0010 D0001 D0002 D0011 D0010 h7806 h0078 h0006 h0100 Remainder Quotient Program which stores the division result of D0001 D0002 and D0003 D0004 at D0010 D0013 when P020 is switched on P020 I L PbiveP Doo Doo0s Dooto H D0001 D0002 D0003 D0004 h3904 h5678 h0001 h0765 D0013 D0012 D0011 D0010 h0000 h1023 h0000 h3627 Remainder Quotient Chapter 5 Application instructions 5 10 Logical arithmetic instructions 5 10 1 WAND WANDP DWAND DWANDP WAND FUN 150 WAND FUN 152 DWAND Annies All CPUs Word AND FUN 151 WANDP FUN 153 DWANDP CPU e Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 o ololololo o olol o WAND P 0 0 0 0 0 0 0O olol ole O O DWAND P o ojojo lolo o o i ED 2 D L Operand setting WAND Sp Data for which logical DWAND product will be performed LE l GD s2 D The device at which the result of logical product is stored WANDP DWANDP Available only when do not use computer link module or data link module 1 Functions WAND P Perform
147. n number to each module 2 If the reserved I O number is larger than the I O number of actual module the redundant reserved I O points are used as internal relay Otherwise the redundant actual I O points are disabled 3 Non reserved slots occupy I O points as the I O points of actual module and special modules occupy 16 I O points 2 15 Chapter 2 Functions 4 The example of I O reservation a Actual status of module mounting Power CPU AC DC Relay Special Empty DC Relay Empty TR supply module Input Input Output module slot input output output module Analog input 16 Pts 32Pts 16Pts 16 Pts 16 Pts 16 Pts 32 Pts b I O address assignment according to the I O parameter setting a NN 000 010 030 040 050 060 070 080 090 p 00F 02F 03F 04F 05F 06F 07F 08F 10F setting AC DC Relay Special Relay TR Input Input Output AD ra id AU Output ua Output Parameter 16 Pts 16 Pts 32 Pts 16 Pts 16 Pts 16 Pts setting 000 1 5 0 aa 040 050 3 060 070 00F 01F 03F 04F 05F 06F 07F 1 The upper 16 pts of module is disabled 2 The upper 16 pts P030 PO3F are used as internal relay 3 Since the slot is reserved as empty the input module is disabled 2 4 9 The output during debugging Applicable for K200S K300S K1000S With this parameter setting user can decide that the result of operation will be output to extern
148. n 3 Executed per scan 84 tc gt ASCP i i Executed only once i E Executed only once EE E 2 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 PO6 while P030 is on P030 I4 H ASC Dooto POE h2102 JH D0000 2 1 0 F E D C B A 9 8 7 6 5 4 3 2 1 0 o ojoj1jojojort r ojs ojo P07 P06 Start from bit 1 of P06 P061 5 76 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 CPU Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 BSUM P O O O O O O QOO O O 5 DBSUM P lololol OJo Ojo HH HH T are 1 Operand setting The device counted the total numbers of bits that Available only when do not use computer link module or data link module O The device at which stores the count result 1 Functions BSUM P Counts the numbers of 1 in the device specified as S then stores the result into the device specified as D in hexadecimal format DBSUM P Counts the numbers of 1 in the device specified as S 1 S then stores the result into
149. n modes of MASTER K series RUN Program a mode mode Ka Pd i mode mode 1 The flow of RUN mode Start RUN mode Clear the non latched memory area Check user program Execution of sequence program END processing 1 1 0 refresh Check mode change 1 END processing Self diagnosis Timer Counter update 2 18 Chapter 2 Functions 2 The flow of Program PGM mode Program read write monitor can be performed in program mode External wiring check is also possible with the forced I O on off function 3 The flow of Pause mode Start Pause mode Self diagnosis Check mode change Stops the operation of CPU but keep the status of output and internal memory 4 The flow of Debug mode Start Debug mode Clear non latched memory area Stop operation Execute the operation at The designated step a Self diagnosis I O refresh Check mode change 2 19 Chapter 2 Functions 2 6 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 MASTER K series provides 2 types of interrupt The TDI Time driven interrupt occurs with the constant period and PDI Process driven
150. ncnnnnnnnnnncnnnnnnnnnnns 2 18 Special functions of MASTER K series eren 2 20 2 6 1 Interrupt functions v mivan siinne eenia enne 2 20 2 6 2 RTC Real Time Clock function oooooocccnnnncccnnnoncncnnccancnonarncnnnnancnnnnns 2 24 2 0 3 Forced I O setting ener 2 27 2 6 4 Program edit in RUN MOd8 occcccccccnnnocococococinnnanonccnnnccnnnnnnnnncnnnnnnnnnns 2 28 2 6 5 Self diagnosis tetuer tentent iet ted inen denti nnn 2 29 Program check AAA 2 30 2 54 JMP JME elei RB DM RUE 2 30 2 7 2 CALL SBRT RET coin e A 2 31 2 53 MCSA MESCU R euet ndum 2 32 2 14 FOR S NEXT onn pe HOP URP e Prec ues 2 33 2 15 SEND RET iUe iui eei 2 34 27 6 Dual Colle neg Rue 2 34 Error handling eeeeeeeeeeeee eese enenatis nnn 2 35 2 8 1 RUN STOP at operation error esss nana anna nee 2 35 2 8 2 Error flag F110 FIIO erae raae aee a ar aet ias ar a o ES 2 35 2 8 3 LED indication iem Ree me e RO ARR ai 2 36 2 0 4 Ermorcode listi ii te tee Eri e Er a C et es Er TEES 2 37 2 Functions Chapter 2 Functions 2 1 2 1 1 Performance Specifications K10S1 K10S K30S K60S Items K10S1 K10S K30S K60S Program control method Cyclic execution of stored program 1 0 control method Indirect Refresh method Numbers of Basi n Instructions Application 226 Processing speed 3 2 7 6 L1 step 1 2 O step Program
151. nk module or data link module 1 Functions Transfers n nibbles that start from the bit 0 of device specified as S into the lower 4 bits of the block specified as D n 1 D The higher 12 bits bit 4 bit F of the block specified as D n 1 D are cleared as 0 When n 0 no processing is performed Whenn gt 4 the error flag is set and no processing is performed When n 4 16 4X4 bits are effective F E D C B A 9 8 7 6 5 4 3 2 1 O0 GS oa BA KA KI KAKA De F 4 3 0 o On emos 02 mas eon Os Chapter 5 Application instructions Execution conditions Input condition A Re es i DIS Executed per scan Executed per scan DISP Executed only once i Executed only once ate 2 Program examples Program that dissociate the contents of lower 3 nibbles of PO2 word to lower 4 bits of D0000 D0003 when P030 is switched on D C B A 9 EF E 8 7 6 5 4 3 2 1 0 a Mea aa oo taa 3 0 F 4 0000 0000 0000 0001 Ri m D0001 0000 0000 0000 0010 Ht D0002 0000 0000 0000 0011 Chapter 5 Application instructions 5 11 9 UNI UNIP UNI FUN 192 UNI Applicable All CPUs Data association FUN 193 UNIP CPU Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 S 0 0 0 0 0 0O ojo UNI P O Oo oOlolo olo olo E n O O
152. nstructions 2 Program example Shifts the block from P0013 PO001B 9 bits with the configuration as following Input data bit M000A Shift direction but M000B Clock P0000 Reset signal P0001 M000A MO00B P0000 P0001 The block to be shifted N Oo oa iN w Dv A E D C BA E o E E gt e gt o E o P001 Fill with O Left direction shift a After 1 clocks when M000A 0 and M000B 0 M NE aC ae WA ee Ba F E DC 2 1 poor 1 0 1 07170 Fill with 1 b After 2 clocks when MO00A 1 and M000B 0 Left direction shift E E E m T E IAE E F EDC 2 1 0 Poor 1 0 1 1 0 1 1 1 0 1 1 0 LE o 1 o0 Fill with 0 Right direction shift c After 3 clocks when M000A 0 and MO00B 1 Pete S or E uu Nr dd FEDCBA987 65 43 21 0 Po1 1 0 1 yo MON o 1 Jo Fill with 1 Right direction shift d After 4 clocks when M000A 1 and MOOOB 1 bae 00 N o t t a F E D C BA 9 poor 1 o 1 Ello e gt e gt o o 5 41 Chapter 5 Application instructions 5 7 Exchange instructions 5 7 1 XCHG XCHGP DXCHG DXCHGP XCHG FUN 10
153. nstructions 5 1 5 BMOV BMOVP BMOV FUN 100 BMOV Applicable All CPUs Bit move FUN 101 BMOVP CPU Available Device Flag Instructions Steps Error Zero Carry M P KLJ F T C S D Integer F110 F111 F112 Olololojolo O BMOV O o O olor olo O 7 qu BMOVP Cw O HH rte O ow O ew Operand setting Available only when do not use computer link module or data link module 9 The device at which source data is stored D The device which will store transferred data C Information for start bit and W numbers of transferred bits 1 Functions The format of Cw EE a s The start bit of S b d The start bit of D c zz Numbers of transferred bits Hexadecimal Transfers the content of zz bits from the s bit of the device specified at S to the zz bits from d bit of the device specified at D The maximum value of the zz is h10 16 If the value of zz is 0 or over h10 the instruction will be ignored The error flag F110 is set when the zz is over h10 5 9 Chapter 5 Application instructions Execution condition Input condition ce BMOV Executed per scan Executed per scan BMOVP Executed only once i E Executed only once c Des 2 Program example Whenever a rising edge is detected at the
154. ntact turns off but the current value holds the present value OUT All turns off SET RST Hold present value 3 If an instruction which does not need a contact instruction immediately before it FOR NEXT El DI etc is contained in the MCS MCSCLR block the CPU executes the instruction regardless of the status of the On Off command for the MCS instruction 4 14 1 block 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 operation operation P021 P024 P023 P061 e P022 P027 P029 P060 P061 PLC program with master control P020 P021 747 MCS 0 P022 M010 Manual P026 P027 circuit M011 N MCSCLR 0 P021 P020 MCS 1 P024 P023 Hg M020 Automatic P027 P029 circuit M021 MCSCLR 0 POGO P061 Common circuit END Chapter 4 Basic instructions 4 5 Output instructions 4 5 1 OUT OUT Available Device e Flag Instructions o Error Zero Carry L F T C S D D Integer F110 F111 F112 OUT llolololo 2 O Device to be output the ki operation result Availab
155. of S word to the device specified as D n DFILW P Transfers the contents of S 1 S to the device specified as D n 1 D n When the D n is over the range of corresponding device area the error flag is set and no processing is performed D 1 D D 1 Offset n Offset n D n S FILW P Chapter 5 Application instructions Execution conditions Input condition MEER c FILW DFILW Executed per scan 4 Executed per scan FILWP DFILWP i 1 Executed only once i Executed only once gt ete 2 Program example Program that transfer the content of the M01 word to MO3 n word when P020 is switched on The n is stored at D0010 word P020 M HL FILWP M03 M01 Doo10 M000 M001 M002 M003 M004 M005 M006 M007 when n 3 M000 M001 M002 M003 M004 M005 M006 M007 when n 4 Chapter 5 Application instructions 5 11 8 DIS DISP DIS FUN 194 DIS Applicable All CPUs Data dissociation FUN 195 DISP CPU Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 S 0 0 0 0 0 0O ojo ose gQi o oj o lo jojo lolo amp 9 n O O HI Don Operand setting DIS destination devices I H n H The number x nibble to be a dissociated 1 4 Available only when do not use computer li
156. omputer link module or data link module 1 Functions Read the link information 10 words from the remote station of which station number is St through the FUEA module mounted at the slot number sl and stores the information data to the block begin with the device specified as D The link status is stored into the device SS Execution conditions Input condition Ld o dh E RPUT Ly i Executed only once E E Executed only once Se 2 Program example Program that reads the information of remote station station number is stored at D0000 through the FUEA module of slot 07 and stores the data from D1234 The link status is stored into K015 word A I 4 STATUS h0007 D0000 D1234 K015 1 5 122 Chapter 5 Application instructions 5 18 Inturrupt instructions 5 18 1 El DI K200S EI DI FUN 238 EI Applicable K300S Enable Disable interrupt FUN 239 DI CPU K1000S Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 EI n O 1 DI Operand setting EA Esa a H 0 7 K2008 K300S K1000S 0 13 Lj fon 0 29 1 Functions El Enables the inturrupt TDI or PDI specified as n when input condition turns on If n is not specified all interrupts are enabled DI Disables the inturrupt TDI or PDI sp
157. oop instructions Mnemonic Function i amp Pp symbol No Ladder symbol 5 Contents of processing amp Page FOR 206 FOR oH Ji Executes the sequence program 5 100 NEXT 207 i NEXT Ji between FOR and NEXT n times BREAK 220 i BREAK Ji Escape from FOR NEXT loop 5 101 Chapter 3 Instructions 3 2 15 Flag instructions Mnemonic Function symbol No Ladder symbol 5 Contents of processing 3 Page STC 002 STC Ji Set the carry flag 5 102 CLC 003 CLC Ji Clear the carry flag CLE 009 i CLE Ji Clear the error flag x 5 103 3 2 16 Special module instructions Mnemonic Function E 2 symbol No Ladder symbol 5 Contents of processing 2 Page GET 230 leer ni n2 Read data from shared RAM of 5 104 GETP 231 GETP n1 S D n2 a special module PUT 234 Put ni D n2 Write data to shared RAM of 5 106 PUTP 235 PurP ni S n2 a special module 3 2 17 Data link instructions Mnemonic Function E symbol No Ladder symbol 5 Contents of processing amp Page READ 244 READ n1 st DO n ss Read Write data of remote 5 108 WRITE 245 WRITE nist D S n ss station 5 111 RGET 232 RGET nist D S n ss Read Write data of shared 5 113 RPUT 233 RPUT ni st D Sn ss RAM of remote special module 5 116 CONN 246 CONN n1 st ss i Establish a communication x channel STATUS 247 status ntst
158. or occurred E Error information Lower byte error code FO2F The error code of time out error h20 e No error h000 F030 Serious error Set in case of internal ROM error 24V fail error Set in case of WDT error program error I O combination error EUST Hignt error missing END RET error F03A RTC data error flag Set when an error is detected in RTC data F040 lt OGGMBINANGN error Set in case of attachment detachment of I O unit F045 During operation or improper connection F050 e h0000 No error e h0023 Code error e h0014 l O error h0024 Missing END error Error code FOSF e h0021 Parameter error e h0025 Missing RET error F060 The step No where program error occurred is 7 The step No Where stored FO6E error occurred In case of branch instruction error the destination step No is stored F070 HSC register High speed counter area F077 e K10S h0031 F080 e K60S h0036 7 Upper byte PLC station No ANM PLC model K30S h0033 Lower byte PLC model K100S h0035 A 3 Appendix Relay Name Description F090 20msec period clock These relays repeat On Off with fixed time interval F091 100msec period clock and are generated in RUN mode only F092 200msec period clock F093 1sec period clock F094 2sec period clock F094 F095 10sec period clock F096 20sec period clock F097 1minute period clock P 2sec These
159. ot use computer link module or data link module 1 Functions Reads the data of n2 words which start at the address specified as S of buffer memory inside the special function module of remote station station number amp slot number is specified as St through the FUEA module and stores the data into devices which begin with the device specified as D Then stores the link status into the device specified as SS of self station 5 117 Remote station Buffer memory of special function module S n2 words NY FUEA module Station Na SP Chapter 5 Application instructions Self station GE rura A E at slot No SS Link status el An instruction error occurs when the assress S n2 or D n2 is out of the range of specified device Execution conditions Input condition CEP ES EE le RGET Executed only once 2 Program example E E Executed only once e Program that reads 10 words through the FUEA module mounted at the slot 03 from the address 10 of the buffer memory of the K1000S A D module mounted at the slot 01 of remote station h1D and stores the read data to the 10 words which begin with DO300 of self station The link status is stored at M020 word of self station I I 4 RGET h0003 h011D D0300 h0010 h0020 M0020 1 Remote station Buffer memory of A D module at slot 01 10 words Sy FUEA module Station
160. pecified as D 1 D The quotient is stored at D and the remainder is stored at D 1 DDIV P Performs the division of BIN data specified as S1 1 S and the BIN data specified as S241 S2 and stores the division result into the device specified as D 3 D 2 D 1 D The quotient is stored at D 1 D and the remainder is stored at D 3 D 2 If the quotient is zero the zero flag will be set lf indirect address specified by D format is out of device range or the content of divider is 0 the operation error occurs and the error flag F110 is set Execution conditions Input condition se DIV DDIV SEX Er DS ee NM 4 lt lt Executed per scan DIVP DDIVP E Executed only once i i Executed only once 5 52 Chapter 5 Application instructions 2 Program example Program which stores the division result of D0001 and D0002 at D0010 D0011 while P020 is on P020 4 Div Dooo1 Dooo2 D0010 H D0001 D0002 D0011 D0010 h78AB h0678 h017D h002D Remainder Quotient Program which stores the division result of D0001 D0002 and D0003 D0004 at D0010 D0013 when P020 is switched on P020 H onr Dooi pooos Doo10 H D0001 D0002 D0003 D0004 hF904 h5678 h0021 h8765 D0013 D0012 D0011 D0010 h0009 hED77 h0000 h076D Remainder Quotient Chapter 5 Application instructions 5 8 6 DIVS DIVSP DDIVS DDIVSP
161. plicable All CPUs Binary addition FUN 111 ADDP FUN 113 DADDP CPU Available Device Flag Instructions Steps Error Zero Carry M JPIK L F T C S D D Integer F110 F111 F112 GD o ololololo o O00 ADD P ololo olololo Oo Ol zen O O 0 DADD P O lojo jo o olo Olo Operand setting The device storing augend The device storing addend The device at which the addition result is stored Available only when do not use computer link module or data link module 1 Functions ADD P Performs the addition of 16 bits BIN data specified at S1 and S2 The addition result is stored at the device specified at D DADD P Performs the addition of 32 bits BIN data specified at S1 1 S1 and S2 1 S2 The addition result is stored at the device specified at D1 1 D1 When the addition result is over hFFFF ADD ADDP or hFFFFFFFF DADD DADDP the carry flag F112 is set When the addition result is 0 the zero flag is set If indirect address specified by D format is out of device range the operation error occur and the error flag F110 is set 5 44 Chapter 5 Application instructions Execution condition Input condition IE LE ADD DADD Executed per scan 1_ Executed per scan ADDP DADDP a B Executed only once i E Executed only once 2 Program example When a rising edge is detected at P020 add contents of
162. puter link module or data link module 1 Functions Encodes the data of 2 bits which begin the bit 0 of device specified as S and stores the result to the device specified as D A For n 1 8 can be specified If the value of n is out of this range no processing is performed and the contents of D is not changed When multiple bits are 1 processing is performed for the most significant bit If the value of n is 0 the zero flag F111 will be set When the value of n is larger than 4 the source data area is expanded like S 1 S 2 When n 8 the length of source data is 256 bits S415 S414 941 8 Execution conditions Input condition Loc d ENCOP Executed only once 5 79 Executed only once Chapter 5 Application instructions 2 Program example Program that encode the 8 bits bit O bit 7 of PO6 word and stores the encoding result to the P06 word when P020 is switched on P020 I ENCOP P02 Po6 3 JH When n 3 8 2 bits are effective F E D C B A 9 8 7 6 5 4 3 2 41 0 Encoding we ojoro ojojoro o ojo oro 0 1 4 resu nator Program that encode the current value of counter C000 and stores the encoding result at the P05 word The counter C000 is increased at every 1 sec Chapter 5 Application instructions 5 11 5 DECO DECOP DECO FUN 178 DEC
163. r Zero Carry M P K L F T C S D D Integer F110 F111 F112 O IORF P 5 O O Y 02 HL Operand setting The first word of the block CIA The last word of the block to H eer DE IORFP 1 Functions Refresh I O data of the block specified as D1 D2 The D1 should be lower word than D2 If the D1 is higher than D2 the error flag is set and no processing is performed This instruction is useful when read latest input data or output the data of P area to external device immediately in a sequence program that has a long scan time Execution conditions Input condition eee c cq IORF Executed per scan Executed per scan IORFP gt Executed only once d Executed only once 5 91 Chapter 5 Application instructions 2 Program example on off according to the status change of the P020 P020 HA P060 FOR 10000 HA WD IORF P02 P02 P020 P061 B 21 IORF P06 P06 NEXT During FOR NEXT loop execution the P060 is keep the initial status but the P061 is switched FOR NEXT loop Repeats 10000 times Chapter 5 Application instructions 5 12 System instructions 5 12 1 FALS K200S FALS Applicable FUN 204 FALS K300S Error display EU K1000S Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D
164. r 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 1508S Refer the 5 22 1 HSCNT instruction part 2 4 7 Interrupt setting Applicable for K200S K300S K1000S 1 The priority of interrupts setting Each of interrupts has a priority level If two or more interrupts occur at the same time the CPU will process the interrupt that has higher priority Priority levels are described by numbers and smaller number means higher priority 2 TDI Time driven interrupt TDI is the interrupt that occurs periodically The period of interrupt can be set with parameters by 10 msec unit The longest period is 60 seconds 3 PDI Process driven interrupt PDI is the interrupt that occurs when an input of interrupt module was turned on Refer the chapter 2 6 1 for more details 2 4 8 The reservation of I O number allocation Applicable for K200S K300S K1000S The I O number is allocated automatically by CPU module according to the actual status of module However user can reserve I O number allocation with parameter setting then it makes a user keep a Sequence program in case of module fault or replacement 1 User can assign the type of module input output or special module and I O occupatio
165. r O 5 50 DIVP 125 Dive 5 623 oO D Quotient S1 1 S1 S2 1 S2 DDIV 126 pov 63 Ol g gt D 3 D 2 DH D 2 Q 5 50 DDIVP 127 Dove 3 O D 3 D 2 Remainder D 1 D Quotient Signed multiplying operation MULS 072 muus ON 2 i 2 S1 X S2 9 D 1 D O MULSP 073 MULSP Y 2 9 D 1 High word D Low word Signed multiplying operation S1 1 S1 X S2 1 S2 DMULS 076 pmuts 6 2 O 2 a D 3 D 2 D 1 D O DMULSP 077 DMULSP Ol gt 1 O D 3 D 2 Higher 2 words D 1 D Lower 2 words Signed dividing operation DIVS os Hows Ofel 1s11 182 gt D 2 O DIVSP os Howsr 5 62 O H 10 1 Remainder D Quotient Signed dividing operation S1 1 S1 S2 1 S2 DDIVS 128 ppivs 63 2 gt D 3 D 2 D 1 D O DDIVSP 129 DDIVSP Ji e T O e D 3 D 2 Remainder D 1 D Quotient Chapter 3 Instructions 3 2 9 BCD arithmetic instructions Mnemonic Function Ladder symbol Contents of processing Page symbol No 2 o ADDB 130 ADDB 62 ON 2 BCD addition 2 O 5 52 ADDBP 131 ADDBP 8 62 O S1t S2 D DADDB 132 DADDB 62 O g BCD addition a O 5 52 DADDBP 133 DADDBP D 6 S1 1 S1 S2 1 S2 D 1 D SUBB 134 suse 5 62 Oj 2 BCD subtraction S O 5 54 SUBBP 135 susr oje S1 S2 D DSUBB 136 psuBB 62 O 2 BCD subtraction S Q 5 54 DSUBBP 137
166. r h0028 Word 2 Byte _KGL_CNF DO neal connection KGL Connection Error h002A Byte 1 Byte b1 remote connection O Output Emergency Data Output Latch E DATA OPTION type h002B Byte 1 Byte 1 deck Defined Appendix A 3 Instruction list r NE 1 2 3 4 5 6 7 8 9 00x NOP END STC CLC RET MPUSH MLOAD MPOP STOP CLE 01x MCS MCSCLR JMP JME CALL CALLP SBRT D DNOT 02x INC INCP DINC DINCP DEC DECP DDEC DDECP LD 9 LDD 03x ROL ROLP DROL DROLP ROR RORP DRDR DRDRP LD gt LDD gt 04x RCL CMPP DRCL DRCLP RCR RCRP DRCR DRCRP LD lt LDD lt 05x CMP BCDP DCMP DCMPPP TCMP TCMPP DTCMP DTCMPP LD gt 9 LDD gt 06x BCD WSFTP DBCD DBCDP BIN BINP DBIN DBINP LD lt LDD lt 07x WwsFT move MuLS muLsP BSFT BSFTP DMULS DMULSP LD lt gt LDD lt gt 08x MOV GMOVP DMov DMOVP CMOV CMOVP DCMOV pcmov Divs 9 pivsp 09x GMOV BMOVP FOMV FOMvP AND 9 ANpp 9 AND gt 9 ANDD gt 9 AND lt 9 ANDD lt 10X BMOV ADDP XCHG XCHGP DXCHG DXCHGP AND 9 ANDD 9 ANDD 9 ANDD 9 11X ADD ADDP DADD DADDP SUB SUBP DSUB DSUBP AND lt gt 9 ANDD 9 12X MUL MULP DMUL DMULP DIV DIVP DDIV DDIVP DDIVS DDIVSP 13X ADDB ADDBP DADDB DADDBP SUBB SUBBP DSUBB DSUBBP 14X MULB
167. r occurred is not executed Chapter 5 Application instructions Execution conditions Input condition d ajan aji A E CMP DCMP Executed per scan 3 Executed per scan CMPP DCMPP 2 Program example Executed only once 4 E Executed only once tam While P020 is on compare contests of D000 and D001 and set flags according to the result D0000 0 0 o i 0 0 h0008 h2001 D0001 o o EE 0 0 Program CMP D0000 Dooo1 F120 vooo Moo01 4 wooo END F123 F122 Flag setting F120 F121 F122 F123 F124 F125 Flag lt gt 2 Result 1 1 0 0 0 1 5 17 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 O 9 P060 turns on If the current value is 10 19 P061 will be on PO62 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 2 Program 0000 CTUD C000 lt S gt 00050 0006 CMP C000 00010 F120 0012 c M0000 F010 0014 CMP C000 00020 F120 0020 h M000 F010 0022 CMP C000 00030 F120 0028 l M0002 F010 0030 CMP C000 00040 F120 0036 Jj
168. relays repeat On Off based on a scan time User defined clock Initial state Off F100 lt F100 clockO ror four rox e me EH F107 clock7 n1 n2 F110 Arithmetic error flag Set when an arithmetic error occurred during operation F111 Zero flag Set when the result value is zero F112 Carry flag Set when Carry or Borrow occurs as a result of operation F11A On sending flag F11C On receiving flag These relays indicate the communication status Receive completion When DIN DOUT instruction are used FI1E Flag ana eee DIN DOUT Set when time out error occurred F11F EROS SEND RECV Set when time out error occurs or NAK massage is detected F120 lt F121 lt F122 These relays are set according to the result of F123 E Compare instructions CMP CMPP DCMP DCMPP F124 gt F125 F130 Each relays show whether relevant I O modules pelle Are attached or not F135 F140 HSCNT The present value of high speed counter is stored X HSC present value HSC The low word of present value of high speed counter is F14F stored F150 HSCNT The preset value of high speed counter is stored bi HSC preset value HSC The high word of present value of high speed counter is F15F stored A 4 Appendix 2 Other special relays Area Description Remarks When M310 is On the M310 RTC User Write Enabl Data of RTC is changed Serie Enable As the data of D249 D252 L12 RTC Data L15
169. rror Connection condition of network is evaluated by this value Gommumications Increments by one whenever communications ak d Word Dx506 service processing service fails Connection condition of network and Siar overall communication quantity and program stability can be evaluated by this value CnSCANM Maximum Indicates the maximum time that is spent until T x Word Dx507 communications scan every station connected to network has the token time unit 1 ms at least one time and sends a sending frame CnSCANA Average Indicates the average time that is spent until every Sy Word Dx508 communications scan station connected to network has the token at time unit 1 ms least one time and sends a sending frame CnSCANM Minimum Indicates the minimum time that is spent until TUN Word Dx509 communications scan every station connected to network has the token time unit 1 ms at least one time and sends a sending frame Communications Indicates operation state of communications CnLINF Word Dx510 module system p i module with a word information CnCRDER Bit Dx510 0 System error error Indicates communications module hardware or 1 system O S error Insufficient common Indicates that service cannot be offered due to OnSVBSY Pit Med RAM Insufficient 1 insufficient common RAM CnIFERR Interface error error Indicates that interface with communications Bit Dx510 2 1 modules has been stopped Indica
170. rror Zero Carry M P K L F T C S D D Integer F110 F111 F112 OJO O O O OJO OO O DIVB P ololololololo olo o lzm O O DDIVB P 0 0 0 o olo O0 Operand setting L DIVBP DDIVBP Available only when do not use computer link module or data link module The device storing dividend The device storing divider The device at which the division result is stored 1 Functions DIVB P Performs the division of BCD data specified as S1 and the BCD data specified as S2 and stores the division result into the device specified as D 1 D The quotient is stored at D and the remainder is stored at D 1 DDIVB P Performs the multiplication of BCD data specified as S1 1 S and the BCD data specified as S21 S2 and stores the multiplication result into the device specified as D 3 D 2 D 1 D The quotient is stored at D 1 D and the remainder is stored at D 3 D 2 If the quotient is zero the zero flag will be set f indirect address specified by D format is out of device range or the content of divider is O or contents of S1 and S2 is invalid BCD format out of O 9 the operation error occurs and the error flag F110 is set Chapter 5 Application instructions Execution conditions Input condition AN t dee DIVB DDIVB Executed per scan 1_ Executed per sca
171. ructions 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 The device can be switched off by the RST instruction O 2 Program example When the input condition P020 turns on the PO60 and P061 is turned on by OUT and SET instruction Program P020 PARA P060 P020 gt SET P061 Time chart P020 P060 P061 4 20 Chapter 4 Basic instructions 4 5 5 RST RST Flag Error Zero Carry F110 F111 F112 Available Device L IF T C S ID D Integer RST D O O O Oo O d oH Available only when do not use computer link module or data link module Steps Instructions 1 Functions When the input condition of RST instruction turns on the specified device is changed as described Device Status M P K L The specified bit is turned off T The timer output is turned off and current value is cleared as 0 2 Program example Set the P061 with the P020 and reset the P061 with the P021 Program P020 P060 P020 H SET Poet oe P021 ___________________ RST P061 Time chart P020 P021 P060 P061 4
172. s 2 Program example Whenever a rising edge is detected at P020 the content of M06 word will be decreased by 1 E DECP M006 M006 0 0 0 0 O Oj 0 0 1 1 0 OF OF 1 1 h00C6 o h00C5 M006 ol ololo ojo ojo 11 1 0 oO of 1 0 Chapter 5 Application instructions 5 5 Rotation instructions 5 5 4 ROL ROLP DROL DROLP ROL FUN 30 ROL FUN 32 DROL Applicable All CPUs Rotate left FUN 31 ROLP FUN 33 DROLP CPU e Available Device Flag Instructions Steps Error Zero Carry M P EKA PEH PEH T C S D Integer F110 F111 F112 ROL P O olololoc olo O 3 O O DROL P ge E ROLP DROLP Available only when do not use computer link module or data link module D pp Operand setting B The device to be rotated left by ROL instruction 1 Functions ROL P Rotates 16 bits of the device specified at D in left direction The MSB will be transferred to the LSB and carry flag F112 Carry flag F E D C B A 9 8 7 6 5 4 3 2 1 0 gih DROLIP Rotates 32 bits of the device specified as D 1 D in left direction The MSB of D 1 will be transferred to the LSB of D and carry flag D 1 Carry flag 16 bits gt 16 bits gt Chapter 5 Applica
173. s FUN 228 OR lt gt FUN 229 ORD lt gt I Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 o GDdilolojolo ololo 0 0 0 5 9 O o lolololo ololo 0 0 0 Operand setting Data to be compared L t H 1 Functions Compares contents of S1 and S2 then operates as a parallel NO contact according to the comparison operation result The comparison is executed as signed operation The comparison operation result is as shown below Instruction i Comparison Instruction ne Comparison ban Condition operation bola E Condition operation y result y result S S S S lt S lt S lt S gt S gt S 2S gt S S lt gt S 4S en lt gt S S x S S S 2S gt S gt S gt S lt S 2 Program example a Compare P0000 POOOF and D0001 If their values are equal or MOOO is on P0010 bit will be switched on M000 Pooo Dooo1 Poo10 m b Compare 1000 and contents of D0001 and D0002 32 bits If the content of D0001 and D0002 is less than 1000 or M020 is on P0010 will turn on M020 p 1000 D0001 HA P0010 5 23 Chapter 5 Application instructions 5 4 Increment decrement operations 5 4 1 INC INCP DINC DINCP INC
174. s set as 200msec and it is changeable with parameter setting K200S K300S K10008 only Refer 2 4 1 for details on the parameter setting The CPU resets the watch dog timer before step 0 is executed after the END processing is finished When the END instruction has not been executed within the set value due to an error occurred in the PLC or the long scan time of a sequence program the watch dog timer will times out When a watch dog timer error is occurred all outputs of the PLC are turned OFF and the ERR LED of the CPU will flashes RUN LED will be turned OFF Therefore when use FOR NEXT or CALL instruction insert WDT instruction to reset the watch dog timer 2 l O module check function If one or more I O modules are mounted dismounted while the PLC is powered the corresponding bit F0040 FOO50 32 bits will be switched on If a module is mounted improperly the relevant bit will be switched on also P C W P R U Slot No 0 1 2 3 4 5 6 7 MSB LSB F004 word 1 1 1 gt Error occurred at slot 0 Error occurred at slot 1 Error occurred at slot 15 MSB LSB ES SE ee Error occurred at slot 31 F005 word 3 Battery check function Applicable for K200S K300S K1000S When the voltage of the battery for back up the memory IC of CPU are lower than the minimum back up voltage the BAT LED of CPU module will be turned on 2 29 Chapter 2 Functions 2 7 Program check 2 1 JMP JME
175. s the logical product of the 16 bit data of device specified at S81 and S2 bit Then stores the result of logical production into the device specified at D 16 bits apretar iis AND apar ana aaa es Y paraa atari DWAND P Performs the logical product of the 32 bit data of device specified as S1 1 S1 8241 S2 per bit and stores the result into the device specified at D 1 D If the result of logical product is 0 the zero flag F111 is set If the indirect address specified by D format is out of device range the operation error occurs the error flag F110 is set per and and Chapter 5 Application instructions Execution conditions Input condition d Goo XE WAND DWAND cues aapa WANDP DWANDP AE Executed only once i i 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 PO6 word when the P020 is switched on P020 HA WANDP P04 Pos Po6 H 16 bits AND e pases Y a Aaa 5 65 5 10 2 WOR WORP DWOR DWORP Chapter 5 Application instructions WOR FUN 154 WOR FUN 156 DWOR Applicable All CPUs Word OR FUN 155 WORP FUN 157 DWORP CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111
176. se operation Set an interlock with forward operation PO31 P062 0011 END P031 P060 Remark Self locking circuit P030 Once the P031 is switched on the P060 will be turned on and it will keep itself as the on state until the P030 is switched on 4 5 Chapter 4 Basic instructions 4 2 Connection instructions 4 2 1 AND LOAD AND LOAD Available Device 2 Flag Instructions o Error Zero Carry MIPIK IL IF IT C S D Integer F110 F111 F112 AND LOAD 1 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 2 Program example Program P023 P024 Time chart P020 P022 P026 P060 4 6 Mana aka ee AND LOAD P060 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 M007 M009 END Mnemonic program A Don t use AND LOAD B Use AND LOAD instructions instructions consecutively consecutively LOAD LOAD OR OR LOAD LOAD OR OR AND LOAD LOAD LOAD OR OR LOAD AND LOAD OR LOAD LOAD OR OR AND
177. sentative OSRAM OS RAM h0003 Stop The internal system RAM is defective contact ms nearest error error LG representative Data RAM Data RAM The RAM at which a data is stored is Contact the nearest h0004 Stop 2 Error error defective LG representative Program The RAM at which a program is Contact the nearest RAM error EUM needs Stop stored is defective LG representative Gate array f Contact the nearest TOF G A error h0006 Stop The gate array of CPU is defective LG representative Sub rack power down Sub power h0007 Stop The expansion rack is power off or Check the expansion ERG error defective rack is powered Power off and restart xu the CPU If error still OS WDT OS WDT h0008 Stop The CPU operation time not the scan occurs contact the time out error error time is too long nearest LG representative taped RAM yi Common h0009 Stop Shared RAM interface error Contact the Dealer error RAM error LG representative Fuse break oie mor h000A Run The fuse used in output module is Check the fuse and error Stop blown replace it Instruction OP code CPU meets an instruction can not be Contact the nearest h000B Stop code error error decoded during executing program LG representative Check the flash e User memory HO00C Stop CPU can not access the internal flash memory and replace it emory error error memory if necessary amp Mount or dismount a module while R Powerot 3 Remount module the PLC is powered A module is
178. sponding device area the error flag is set and no processing is performed S 1 S 941 Offset n Offset n S n D FILR P Chapter 5 Application instructions Execution conditions Input condition MEER c FILR DFILR Executed per scan 4 Executed per scan FILRP DFILRP i 1 Executed only once i Executed only once gt ete 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 P020 M HL FILRP M03 M01 Doo10 YA M000 M001 M002 M003 M004 M005 M006 M007 M000 M001 M002 M003 M004 M005 M006 M007 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 CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 D o olo olo FILW P SOA lololololololo olo 7 O DFILW P n O O HI DO n Operand setting FILW O The origin address of the destination DFILW The source data or device at which the source data is I I n stored FILWP The offset DFILWP Available only when do not use computer link module or data link module 1 Functions FILW P Transfers the content
179. ssing A subroutine is called with CALL SBRT error SBRT instruction h0043 Stop instruction but there is no corresponging Write subroutine subroutine JMP JME instruction MEME h0044 Stop ove ME HIS Helios Ale used Revise program error error improperly in program FOR NEXT i instruction FORSNET h0045 Stop FOR NE instructions sare USES Revise program GITOT error improperly in program MESS MCS MCS MCSCLR instructions are used MCSCLR h0046 Stop Revise program MUN MCSCLR error improperly in program MPUSH MPUSH h0047 Sto MPUSH MPOP instruction are used anat MPOP error MPOP error P improperly in program prog Dual Coll Dual Coil error h0048 Stop A denice is Used AS the output of Revise program error operation more than one time Syntax Syntax Wrong input conditions or too many error error nonse Stop LOAD instructons etc Revise program Battery error Battery error h0050 Run The voltege of back up battery is too low Replace baleng with new one 2 38 Chapter3 Instructions 3 1 Basic instrUctions cocina iaa 3 1 3 1 1 Contact instructions 3 1 3 1 2 Connection instructions eeeeeee 3 1 3 1 3 Inversion instruction ococononcccnnnoncnnnoncnnnnnnrnnnnnnrr cano nan nn 3 1 3 1 4 Master control instructions eeeeenee 3 2 3 1 5 Output instructions ss anaa aaa ada aaa E sa a a ga TG 3 2 3 1 6 Step controller instructions 3 2 3 1 7 END Instruc
180. tem structure Digital input Digital output module P00 module P06 PBO Program Repeat On Off 3 Program P000 0000 H D mooo P060 M000 0003 my P060 P060 M000 0009 yim END 4 Time chart P000 P060 Chapter 4 Basic instructions 4 5 3 DNOT D NOT FUN 018 D NOT Flag Error Zero Carry F110 F111 F112 Available Device M P IK IL F T C S ID D Integer D NOT D O O O Oo O Device to be converted into gt 0 NOT O pulse Available only when do not use computer link module or data link module Steps Instructions N 1 Functions The D instruction turns on the specified device for one scan when the input condition of D instruction is turned on Becareful when use a P area as D 2 Program example When the P033 is switched off the M003 is turned on for one scan Program The self locking circuit that shows the M003 is turned on Time chart P033 gt lt 1scan On M003 P060 The P060 keeps the on state because of the self locking circuit 4 19 Chapter 4 Basic instructions 4 5 4 SET SET Flag Error Zero Carry F110 F111 F112 Available Device L IF T C S ID D Integer SET D O O O Oo O wr 94 Available only when do not use computer link module or data link module Steps Inst
181. ter station REOCV instruction can be used with master station station number h1F only Execution condition Input condition oc RECV Executed per scan Executed per scan 84 e a 5 139 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 MOOO0 turns on M0000 H RECV hiA D0000 M010 nos Master station Slave station 5 words i 5 words Station No h1F E j Station No h1A 5 140 Chapter 5 Application instructions 5 23 2 SEND SEND Applicable K10S1 K10S FUN 159 SEND Send data CPU K30S K60S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 S O O0 0 0 0 0 0O O HOW o ojo olololo ojo SEND 9 O O Jojojolo olo O n O O0 0 0 0 0 0 O O O Operand setting Station number of slave station to which data to be written SEND St 9 D n The start address of device of master station at which the source data is stored stored Numbers of word to be read N n h00 h1F Start address of device of slave D station at which the sent data is 1 Functions Sends n words from the device specified as S of master stat
182. tes that the communications module can INR Bit Dx510 3 MAA communicates with other station or not Indicates that operation mode of communications dir ANG Bit Dx510 4 Operation mode module is in the normal operation mode or test RUN 1 mode Dx680 Version No of _CnVERNO Word communications O S version No of communications module module _FSMn_ST Word Dx690 ar US Sets the remote I O station number to the upper 8 NO enabled bits See REMARK given in the following page fsmn RES Bit Dx690 0 Remote I O station Initializes special modules and I O modules in the ET S W reset remote station defined by the FSMn_st_no _fsmn_lO_ Bit Dx690 1 Remote I O station Clears the output of I O modules in the remote RESET digital output reset station defined by the FSMn st no If a momentary power failure occurs in the remote m I O station the operation mode bit of high speed Initialize the high DE A fsmn lO 1 S link information turns off and link trouble has the RESET Bit xpos speed IUS Mora avon value 1 If the bit is turned on to clear that bit the of remote I O station operation mode bit turns on and link trouble is cleared with 0 A 9 Appendix Slot No amp Flag List Slot No D area address Remark 1 Dx511 to Dx521 The address of the flag which is loaded onto the slot n is 2 Dx522 to Dx532 calculated as shown below 3 Dx533 to Dx543
183. the 5 457 BSET 223 set n H Set the n bit of D x 5128 BRST 224 nsr n H Clear the n bit of D x 5 128 3 20 4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 Chapter 4 Basic instructions Contact Instructions ibo bee ilis 4 1 4 1 1 LOAD LOAD NOT OUT sssssseeeeeeeenns 4 1 4 1 2 AND AND NOT at ea aa Da aga ga abah eerte 4 3 44 3 OB OR NOT obe gan ae an a a an a edt 4 4 Connection instructions eeseseeeeeeneeeneneennns 4 6 42 1 AND LOAD us RR e ced 4 6 42 2 ORLOAD excuses nose Sd Meee ts teat cies pe Eod 4 8 4 2 3 MPUSH MLOAD MPOP sse 4 10 Inversion InSU UCtlon iiiter De EH SIDA eo Re Eso inne 4 12 43 1 NO ete ERE Lees 4 12 Master control instructions eem nnno nn 4 13 4 4 1 MCS MCSCLR qu cecccecceeccceceeeceeeceeeeeeeeeseeeeeeeeeseeetereees 4 13 Qutp t instructions diia 4 16 45 1 OUT ien be pe DR e ede 4 16 QU DU Sebo eek eec Dee auia genie ach 4 17 4 5 3 DNOQOT tent tick davies ta 4 19 454 SET eub Eu 4 20 45 5 BST usus dede eis peti 4 21 Step controller instructions eeeenem 4 23 4 65h SET SOON Ue Ga 4 23 46 2 QUISO nnb 4 25 End InStructlons iii EE n cie ates 4 26 4 END use do Bt 4 26 No operation instruction eeeeeeen ono nnnrnnnnnnnann 4 27 AiG A NOR corintio taste e nue Te da 4 27 Timer instructions ete cer eee teer tpe
184. 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 Run the data clear function of hand held loader KLD 150S Run the data clear function of graphic loader KGL WIN 2 3 4 Link relay L The L area is the internal memory for use in a data or computer link system It can be used as same as M area if no link module is mounted on the PLC system With K200S K300S K10008S it is possible to change the range of latch area by parameter setting For the detail usage of L area please refer the list of link relay at appendix and the computer link user s manual 2 39 5 Step control relay S The S area can be used for two kinds of step control according to the instruction OUT or SET If the OUT instruction is used the S area functions as last in priority Otherwise it functions as sequential control See the chapter 4 for detailed usage When the CPU is switched on or turned to RUN mode the S area will be initialized as first step Sxx 00 except the latch area designated by parameter setting OUT OUT OUT SET SET SET SET bib dd SET 00 02 00 29 00 61 00 01 00 02 00 03 00 04 00 00 In the same group the last in condition has the priority to run Sequential control means that a certain process can be executed only after the previous process is completed
185. the device specified as D in hexadecimal format If the count result is 0 the zero flag is set fthe indirect address specified by D format is out of device range the operation error occurs and the error flag F110 is set Execution conditions Input condition E eee Lee BSN DES rar sir 4 a gt Executed per scan BSUMP DBSUMP E i Executed only once it Executed only once 5 77 Chapter 5 Application instructions 2 Program example Program that count the numbers of 1 in PO20 and P021 then store the count result into D0030 when M020 is switched on M020 I __ DBSUMP P020 D0030 The numbers of 1 9 The numbers of 1 8 Total numbers D0030 TeTeTeTeToTeTeTeTe Te 3 Te Tee 61117 h0011 5 78 Chapter 5 Application instructions 5 11 4 ENCO ENCOP ENCO FUN 176 ENCO Applicable All CPUs Encode FUN 177 ENCOP CPU Available Device Flag Instructions Steps Error Zero Carry M P KJ L F T C S D D Integer F110 F111 F112 S 0 0 0 0 0 0O olo o ENCO O lololoo lolo ojo amp 9 ENCOP n O O I n JH Operand setting The start address of source ENCO data area address The start destination area will a encoding result Effective bit length 2 1 8 Available only when do not use com
186. tion n e ea ene 3 2 3 1 8 No operation instruction eseeeen 3 3 3 1 9 Timer instructions sees 3 3 3 1 10 Counter instructions eseeen 3 4 3 2 Application instructions ooonnoccconnncccnnnonccnnnnonnnnnnnrn m 3 5 3 2 1 Data transfer instructions eeeeeeee 3 5 3 2 2 Conversion instructions eeeeees 3 6 3 2 8 Compare instructions oocccinnnninnccnoncnnncccnnonnnancncnnncnnnnnnno 3 6 3 2 4 Increment Decrement instructions 3 9 3 2 5 Rotation insStructiONS oooononnccnnnoncncnnercnnnnnrancnnnnrnnn rra ocn 3 9 3 2 6 Shift instructions 3 10 3 2 7 Exchange instructions ooooncccnnnnncnnnoncnccnnanannnnanananonan cnn 3 11 3 2 8 BIN arithmetic instructions eeen 3 11 3 2 9 BCD arithmetic instructions 3 13 3 2 10 Logical opration instructions ssesessssssss 3 14 3 2 11 Data processing instructions eeeeeeeesss 3 15 3 2 12 System instructions 3 17 3 2 13 Branch inStructiONS oooocononncccnnoccncnnonancnnnonnrnnnnnrncnnnnnnos 3 17 3 2714 LOOP INSTITUCION Se o ii ci od frt AeA 3 17 3 2 15 Flag instructions 3 18 3 2 16 Special module instructions sesesssssss 3 18 3 2 17 Data link instructions ooooooncccnnonccnnnonancnononcncnnnrrnnnnnnnnos 3 18 3 2 18 Interrupt instructions
187. tion instructions Execution conditions Input condition M REUS IEEE m ROL DROL Executed per scan 4 Executed per scan ROLP DROLP i i Executed only once i i Executed only once ce ea 2 Program example Whenever a rising edge is detected at P030 16 bits of D0000 word will be rotated with left direction SL ROLP D0000 D0000 h78D3 T flag 16 bits Carry flag MSB LSB 5 29 5 5 2 ROR RORP DROR DRORP Chapter 5 Application instructions ROR FUN 34 ROR FUN 36 DROR Applicable All CPUs Rotate right FUN 35 RORP FUN 37 DRORP CPU Available Device Flag Instructions Steps Error Zero Carry MI PIKIL F T CI S D Integer F110 F111 F112 ROR P Q olo lo lo lolo O 3 O O DROR P Operand setting O The device to be rotated right by ROR instruction RORP DRORP Available only when do not use computer link module or data link module 1 Functions ROR P Rotates 16 bits of the device specified at D in right direction The LSB will be transferred to the MSB and carry flag F112 Carry flag DROR P Rotates 32 bits of the device specified as D 1 D in right direction TheLSB of D will be transferred to the MSB of D 1 and carry flag p 1 D Carry flag 16 bits o 16 bits Chapter 5 Application instructions
188. to BCD format mm BMOV M000 P04 h0008 Display only last 8bits 2 digit 0021 END Chapter 5 Application instructions 5 2 2 BIN BINP DBIN DBINP BIN FUN 64 BIN FUN 66 DBIN Applicable All CPUs Binary FUN 65 BINP FUN 67 DBINP CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 BIN P lololol lololo OIIO O 5 DBIN P o ololo o O O OO I HI 6 D JH Operand setting BN The source device at which the data to be converted to DBIN BCD format is stored BINP DBINP Available only when do not use computer link module or data link module 1 Functions A BIN Converts BCD data 0 to 9999 of the device specified at S into binary format and transfers the result to the device specified at D 8000 4000 2000 1000 800 400 200 100 80 40 20 10 8 4 2 1 9 BCD 9999 D BIN 9999 Always set as 0 DBIN Converts BCD data 0 to 99999999 of the device specified at S into binary format and transfers the result to the device specified at D Chapter 5 Application instructions Execution conditions Input condition ae NT a BUDEN nenn ajaga BINP DBINP E a e only once EC jqExecuted only once Operation Error B B In the following cases operation error occurs and the error flag F110 turns on a Each digit 4 bits
189. tting H rov sI Fnam D n ss Slot number of Cnet module is mounted amp Type of channel The configuration of sI RS232C or RS422 Lower 8 bits CD Slot No of Cnet module Higher 8 bits AB Type of channel The name of frame 8 words iod Start address of device that stores source data to be sent Numbers of Numbers of byte to be read to be read eee NA at which the link status is SS stored h00 RS232C h01 RS422 1 Functions Receives n bytes and frame name from the Cnet module that mounted on the slot sl then stores the data from the device specified as D and frame name as ASCII format into 8 words which begin with the device Fnam The link status is stored at the device specified as SS The maximum size of data block to be sent is 256 bytes 2 Program example Program that receive 20 words and frame name from Cnet module at slot 5 channel 1 RS232C and stores them to the block which begin with D0200 and D0100 The link status is stored at K016 word I HH RSV h0105 D0100 D0200 h0020 K016 5 134 Chapter 5 Application instructions 5 22 High speed counter instructions 5 22 1 HSCNT HSCNT FUN 210 HSCNT Applicable K10S1 K10S Enable high i CPU K30S K60S speed counter Available Device Flag Instructions Steps Error Zero Carry M PIKL F T C S D D Integer F110 F111 F112 HSCNT
190. tween the PLC CPU and external devices The input devices hold ON OFF data sent from external devices e g pushbuttons select Switches limit switches digital switches etc to input module Input data is used by the program as contact data NO and NC contacts and as the source data for basic and application instructions The output devices are used to output operation results of the program from the output module to external devices e g solenoids magnetic switches signal lamps digital indicators Only NO contact type is available for output devices The redundant P devices that are not connected to external devices can be used in the same way with the auxiliary relay M lt Figure 1 The example of input output configuration gt P0001 P0020 P0021 e P0002 P0023 Ea P0020 P0021 E dp M The input signals are stored in batch in the input data memory before execution of each scan The data in the input data memory is used for execution of the sequence program operation The operation results are output by each result to the output data memory The data in the output data memory is output in batch to the output modules after execution of the END instruction Please make sure that there is no conflict of input and output in the user program because the MASTER K series uses a P area for input and output in common NO Normally Open contact NC Normally Closed contact 2 6 Chapter
191. uction has to be placed after the END instruction The TDINT and IRET instructions are executed unconditionally 2 Program example TDINT n P0000 p M M l P0001 IRET 5 124 Chapter 5 Application instructions 5 18 3 INT IRET INT IRET K200S FUN 227 INT Applicable Process driven K300S FUN 225 IRET CPU interrupt K1000S Available Device Flag Instructions Steps Error Zero Carry M JP KjJ LJ F T C S D 0D Integer F110 F111 F112 INT n O 1 Operand setting 0 5 K200S 0 7 K300S 0 15 K1000S 1 2 Functions INT Indicates the begin of the process driven interrupt routine IRET Indicates the end of the interrupt routine Instructions between the INT n and the next IRET are executed only when the corresponding time driven interrupt occurs and is enabled by the El instruction To use process driven interrupts the interrupt module is required and general input module can not ube used for interrupt input However K200S can use general input module for interrupt input by parameter setting Refer 2 4 Parameter setting for details The INT n instruction has to be placed after the END instruction The INT and IRET instructions are executed unconditionally Program example AL INT n M0000 P0000 M0001 Poo AL RET 5 125
192. ut of device range or contents of S1 and S2 are invalid BCD format out of 0 9 the operation error occurs and the error flag F110 is set Chapter 5 Application instructions Execution condition Input condition d Ll L SUBBP DSUBBP Executed only once i E Executed only once gt lt 2 Program example When a rising edge is detected at P020 subtract contents of D0000 and D0001 and store the addition result to PO6 word P020 A H SUBB D0000 D0001 Pos JA 16 bits D0000 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 CPU Available Device Flag Instructions Steps Error Zero Carry M P K L F T CY S D D Integer F110 F111 F112 Ol O OJO O O O O lO 0 MULB P lololololololo ololo lzm O O 0 DMULB P O o ololo olo olo L MULBP DMULBP Operand setting D The device storing multiplicand The device storing multiplier The device at which the multiplication result is stored Available only when do not use computer link module or data link module 1 Functions MULB P Performs the multiplication of BCD data specified as S1 and the BCD data specified as S2 and stores the multiplication result
193. ve levels of the nesting of FOR is allowed Inthe following cases operation error occurs a After the execution of FOR instruction the END instruction has been executed before the NEXT instruction is executed b The NEXT instruction has been executed before the FOR instruction is executed c The number of the FOR instructions is different from that of the NEXT instructions d The JMP instruction is executed to exit from the FOR NEXT block or to enter into the FOR NEXT block 2 Program example Program the repeats 30 times the FOR NEXT block FOR 30 F d H ne m 5 104 Chapter 5 Application instructions 5 14 2 BREAK BREAK K200S Applicable Escape from FOR FUN 220 BREAK cis K300S NEXT block K1000S Available Device Flag Instructions Steps Error Zero Carry M P K L F T C S D D Integer F110 F111 F112 BREAK 3 I I BREAK KH 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 Execution condition Input condition M A NEM ENS EN BREAK Executed per scan 1_ Executed per scan 2 Program example M0006 When M000 turns on exits immediately from FOR NEXT loop and go to the step 5 105 Chapter 5 Application instructions

Download Pdf Manuals

image

Related Search

Related Contents

Lenovo ThinkPad E555  3 - generatorparts.net  Samsung GT-E1050 Hướng dẫn sử dụng  DL6000-User Manual v1.01 - Equustek offers connectivity from DH+  bbA4nakatoji [規約集]アウトライン  MPT-500B SPECIFICATIONS AND OPERATING INSTRUCTIONS  la structure des Files - Hachette  Whey ISO Burst contient 40 grammes de protéines par  A l`écoute d`une petite entreprise familiale  OPTV User Manual  

Copyright © All rights reserved.
Failed to retrieve file