Người sử dụng có thể lập trình để thực hiện một loạt trình tự các sự kiện. Các sự kiện này được kích hoạt bởi tác nhân kích thích (ngõ vào) tác động vào PLC hoặc qua các hoạt động có trễ như thời gian định thì hay các sự kiện được đếm. PLC dùng để thay thế các mạch relay (rơ le) trong thực tế. PLC hoạt động theo phương thức quét các trạng thái trên đầu ra và đầu vào. Khi có sự thay đổi ở đầu vào thì đầu ra sẽ thay đổi theo. Ngôn ngữ lập trình của PLC có thể là Ladder hay State Logic. Hiện nay có nhiều hãng sản xuất ra PLC như INVT, AllenBradley,Omron, Honeywell...
3 Basic Instructions 3.1 Basic Instructions and Step Ladder Instructions ES includes ES/EX/SS; SA includes SA/SX/SC; EH includes EH2/SV/EH3/SV2 For EH series MPU, the execution speed in the brackets ( ) refers to the execution speed of designated operand M1536 ~ M4095 Basic Instructions Instruction Function Operands Code Execution speed (us) ES SA STEP EH LD Loading in A contact X, Y, M, S, T, C 3.8 3.8 0.24 (0.56) 1~3 LDI Loading in B contact X, Y, M, S, T, C 3.88 3.88 0.24 (0.56) 1~3 AND Series connection- A contact X, Y, M, S, T, C 2.32 2.32 0.24 (0.56) 1~3 ANI Series connection- B contact X, Y, M, S, T, C 2.4 2.4 0.24 (0.56) 1~3 OR Parallel connection- A contact X, Y, M, S, T, C 2.32 2.32 0.24 (0.56) 1~3 ORI Parallel connection- B contact X, Y, M, S, T, C 2.4 2.4 0.24 (0.56) 1~3 ANB Series connection- loop blocks N/A 1.76 1.76 0.24 1~3 ORB Parallel connection- loop blocks N/A 1.76 1.76 0.24 1~3 N/A 1.68 1.68 0.24 1~3 N/A 1.6 1.6 0.24 N/A 1.6 1.6 0.24 MPS MRD MPP Store the current result of the internal PLC operations Reads the current result of the internal PLC operations Pops (recalls and removes) the currently stored result Output instructions Instruction Function Operands Code Execution speed (us) ES SA STEP EH OUT Output coil Y, M, S 5.04 5.04 0.24 (0.56) 1~3 SET Latched(On) Y, M, S 3.8 3.8 0.24 (0.56) 1~3 RST Clear the contacts or the registers Y, M, S, T, C, D, E, F 7.8 7.8 0.24 (0.56) Timers, Counters API Instruction Function Operands Code Execution speed (us) ES SA EH STEP 96 TMR 16-bit timer T-K or T-D 10.6 10.6 9.6 97 CNT 16-bit counter C-K or C-D (16 bits) 9.7 9.7 12.8 97 DCNT 32-bit counter C-K or C-D (32 bits) 10.3 10.3 14.3 DVP-PLC Application Manual 3-1 Basic Instructions Main control instructions Instruction Function Operands Code Execution speed (us) ES SA EH STEP MC Master control start N0 ~ N7 5.6 5.6 5.6 MCR Master control reset N0 ~ N7 5.7 5.7 5.7 Instructions for detecting the contacts of rising-/falling-edge API Instruction Code Function Operands Execution speed (us) ES SA EH STEP 90 LDP Rising-edge detection operation X, Y, M, S, T, C 5.1 5.1 0.56 (0.88) 91 LDF Falling-edge detection operation X, Y, M, S, T, C 5.1 5.1 0.56 (0.88) 92 ANDP Rising-edge series connection X, Y, M, S, T, C 4.9 4.9 0.56 (0.88) 93 ANDF Falling-edge series connection X, Y, M, S, T, C 4.9 4.9 0.56 (0.88) 94 ORP Rising-edge parallel connection X, Y, M, S, T, C 4.9 4.9 0.56 (0.88) 95 ORF Falling-edge parallel connection X, Y, M, S, T, C 4.9 4.9 0.56 (0.88) Rising-/falling-edge output instructions API Instruction Code Function Operands Execution speed (us) ES SA EH STEP 89 PLS Rising-edge output Y, M 7.8 7.8 9.92 99 PLF Falling-edge output Y, M 7.8 7.8 10.16 End instruction Instruction Code END Function Program ends Operands N/A Execution speed (us) ES SA EH 5 0.24 STEP Other instructions API 98 3-2 Instruction Code Function Operands Execution speed (us) ES SA EH STEP NOP No operation N/A 0.88 0.88 0.16 INV Inverting operation N/A 1.6 1.6 0.24 P Pointer P0 ~ P255 0.88 0.88 - I Interruption program marker I□□□ 0.88 0.88 - DVP-PLC Application Manual Basic Instructions Step ladder instructions Instruction Function Execution speed (us) Operands Code ES SA EH STEP STL Step transition ladder start instruction S 11.6 10.6 0.56 RET Step transition ladder return instruction N/A 7.04 6.04 0.24 Note 1: ES includes ES/EX/SS; SA includes SA/SX/SC; EH includes EH/EH2/SV Note 2: For EH series MPU, the execution speed in the brackets ( ) refers to the execution speed of designated operand M1536 ~ M4095 3.2 Explanations on Basic Instructions Mnemonic Function Program steps LD Loading in A contact X0 ~ X377 Y0 ~ Y377 Operand Controllers ES EX M0 ~ M4095 S0 ~ S1023 SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The LD instruction is used on the A contact that has its start from the left BUS or the A contact that is the start of a contact circuit The functions are to save the present contents and store the acquired contact status into the accumulative register Program Example: Ladder diagram: X0 X1 Y1 Instruction code: Operation: LD X0 Loading in contact A of X0 AND X1 Connecting to contact A of X1 in series OUT Y1 Driving Y1 coil Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands X, Y, M, and S These operands can be qualified by E or F, e.g LD X0E1 Mnemonic LDI Function Program steps Loading in B contact X0 ~ X377 Y0 ~ Y377 Operand Controllers ES M0 ~ M4095 S0 ~ S1023 EX SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The LDI instruction is used on the B contact that has its start from the left BUS or the B contact that is the start of a contact circuit The functions are to save the present contents and store the acquired contact status into the accumulative register DVP-PLC Application Manual 3-3 Basic Instructions Program Example: Ladder diagram: X0 X1 Y1 Instruction code: Operation: LDI X0 Loading in contact B of X0 AND X1 Connecting to contact A of X1 in series OUT Y1 Driving Y1 coil Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands X, Y, M, and S These operands can be qualified by E or F, e.g LDI X0E1 Mnemonic Function Program steps AND Series connection- A contact Operand X0 ~ X377 Y0 ~ Y377 Controllers ES M0 ~ M4095 S0 ~ S1023 EX SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The AND instruction is used in the series connection of A contact The functions are to read out the status of present d series connection contacts and perform the “AND” operation with the logical operation result obtained The final result will be store in the accumulative register Program Example: Ladder diagram: X1 X0 Y1 Instruction code: Operation: LDI X1 Loading in contact B of X1 AND X0 Connecting to contact A of X0 in series OUT Y1 Driving Y1 coil Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands X, Y, M, and S These operands can be qualified by E or F, e.g AND X0E1 Mnemonic Function Program steps ANI Series connection- B contact Operand X0 ~ X377 Y0 ~ Y377 Controllers ES M0 ~ M4095 S0 ~ S1023 EX SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The ANI instruction is used in the series connection of B contact The functions are to read out the status of present designated series connection contacts and perform the “AND” operation with the logical operation result obtained The final result will be store in the accumulative register 3-4 DVP-PLC Application Manual Basic Instructions Program Example: Ladder diagram: X1 X0 Y1 Instruction code: Operation: LD X1 Loading in contact A of X1 ANI X0 Connecting to contact B of X0 in series OUT Y1 Driving Y1 coil Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands X, Y, M, and S These operands can be qualified by E or F, e.g ANI X0E1 Mnemonic Function Program steps Parallel connection- A contact OR Operand X0 ~ X377 Y0 ~ Y377 Controllers ES EX M0 ~ M4095 S0 ~ S1023 SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The OR instruction is used in the parallel connection of A contact The functions are to read out the status of present designated parallel connection contacts and perform the “OR” operation with the logical operation result obtained The final result will be store in the accumulative register Program Example: Ladder diagram: X0 Y1 X1 Instruction code: Operation: LD X0 Loading in contact A of X0 OR X1 Connecting to contact A of X1 in parallel OUT Y1 Driving Y1 coil Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands X, Y, M, and S These operands can be qualified by E or F, e.g OR X1E1 Mnemonic Function Program steps ORI Parallel connection- B contact Operand Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 X0 ~ X377 Y0 ~ Y377 M0 ~ M4095 S0 ~ S1023 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The OR instruction is used in the parallel connection of B contact The functions are to read out the status of present designated parallel connection contacts and perform the “OR” operation with the logical operation result obtained The final result will be store in the accumulative register DVP-PLC Application Manual 3-5 Basic Instructions Program Example: Ladder diagram: X0 Y1 X1 Instruction code: Operation: LD X0 Loading in contact A of X0 ORI X1 Connecting to contact B of X1 in parallel OUT Y1 Driving Y1 coil Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands X, Y, M, and S These operands can be qualified by E or F, e.g ORI X1E1 Mnemonic Function Program steps Series connection- loop blocks ANB Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 N/A Operand Explanations: To perform the “AND” operation of the preserved logic results and content in the accumulative register Program Example: Ladder diagram: X0 ANB X1 Y1 X2 X3 Block A Block B Instruction code: Operation: LD X0 Loading in contact A of X0 ORI X2 Connecting to contact B of X2 in parallel LDI X1 Loading in contact B of X1 OR X3 Connecting to contact A of X3 in parallel ANB OUT Mnemonic ORB Function Connecting circuit block in series Y1 Driving Y1 coil Program steps Parallel connection- loop blocks Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 N/A Operand Explanations: To perform the “OR” operation of the preserved logic results and content in the accumulative register Program Example: Ladder diagram: X0 X1 Block A Y1 X2 X3 ORB Block B Instruction code: Operation: LD X0 Loading in contact A of X0 ANI X1 Connecting to contact B of X1 in series LDI X2 Loading in contact B of X2 AND X3 Connecting to contact A of X3 in series ORB OUT 3-6 Connecting circuit block in parallel Y1 Driving Y1 coil DVP-PLC Application Manual Basic Instructions Mnemonic Function MPS Store the current result of the internal PLC operations Program steps Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 N/A Operand Explanations: To save the content in the accumulative register into the operational result (the pointer of operational result will plus 1) Mnemonic Function MRD Reads the current result of the internal PLC operations Program steps Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 N/A Operand Explanations: To read the operational result and store it into the accumulative register (the pointer of operational result stays intact) Mnemonic Function MPP Pops (recalls and removes) the currently stored result Program steps Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 N/A Operand Explanations: To retrieve the previous preserved logical operation result and store it into the accumulative register (the pointer of operational result will minus 1) Program Example: Ladder diagram: MPS X0 X1 Y1 Operation: LD Loading in contact A of X0 X0 Saving into stack MPS AND X1 Connecting to contact A of X1 in series M0 OUT Y1 Driving Y1 coil Y2 MRD X2 MRD Instruction code: MPP END Reading from stack AND X2 Connecting to contact A of X2 in series OUT M0 Driving M0 coil Reading from stack and pop pointer MPP OUT END DVP-PLC Application Manual Y2 Driving Y2 coil Program ends 3-7 Basic Instructions Mnemonic Function Program steps Output coil OUT Operand Controllers ES X0 ~ X377 Y0 ~ Y377 - EX M0 ~ M4095 S0 ~ S1023 SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - - - Explanations: To output the logical operation result before OUT instruction into a designated device Actions of coil contact: OUT instruction Operational result Contact Coil A contact (normally open) B contact (normally closed) FALSE Off Off On TRUE On On Off Program Example: Ladder diagram: X0 X1 Y1 Instruction code: Operation: LDI X0 Loading in contact B of X0 AND X1 Connecting to contact A of X1 in series OUT Y1 Driving Y1 coil Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands Y, M, and S These operands can be qualified by E or F, e.g OUT Y1E2 Mnemonic SET Operand Function Program Steps Latched (On) Controllers ES X0 ~ X377 Y0 ~ Y377 - M0 ~ M4095 S0 ~ S1023 EX SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - - - Explanations: When the SET instruction is driven, its designated device will be “On” and keep being On both when SET instruction is still being driven or not driven Use RST instruction to set “Off” the device Program Example: Ladder diagram: X0 Y0 SET Y1 Instruction code: Operation: LD X0 Loading in contact A of X0 ANI Y0 Connecting to contact B of Y0 in series SET Y1 Y1 latched (On) Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands Y, M, and S These operands can be qualified by E or F, e.g SET Y1E2 3-8 DVP-PLC Application Manual Basic Instructions Mnemonic Function Program steps Clear the contacts or the registers RST X0 ~ X377 Y0 ~ Y377 Operand - Controllers ES M0 ~ M4095 EX SS SA SX SC S0 ~ S1023 T0 ~ T255 C0 ~ C255 EH2 EH3 SV2 D0 ~ D9999 E0 ~ E7 F0 ~ F7 SV Explanations: When the RST instruction is driven, the actions of the designated devices are: Device Status Y, M, S, Coil and contact will be set to “Off” Present values of the timer or counter will be set to “0”, and the coil and contact will be set to T, C “Off” D, E, F The content will be set to “0” If RST instruction is not being executed, the status of the designated device will stay intact Program Example: Ladder diagram: X0 RST Y5 Instruction code: Operation: LD X0 Loading in contact A of X0 RST Y5 Resetting contact Y5 Note: DVP-EH3 series PLCs whose version is 1.40 and DVP-SV2 series PLCs whose version is 1.20 support the operands Y, M, and S These operands can be qualified by E or F, e.g RST Y5E2 Mnemonic Function Program steps 16-bit timer TMR Controllers ES T-K T0 ~ T255, K0 ~ K32,767 T-D T0 ~ T255, D0 ~ D9999 EX SS SA SX SC EH2 SV EH3 SV2 Operand Explanations: When TMR instruction is executed, the designated coil of the timer will be On and the timer will start to time When the set value in the timer is reached (present ≥ set value), the contact will be: NO (Normally Open) contact Open collector NC (Normally Closed) contact Close collector Program Example: Ladder diagram: X0 TMR T5 K1000 Instruction code: Operation: LD X0 Loading in contact A of X0 T5 timer TMR T5 K1000 Set value in timer T5 as K1,000 Remarks: See the specification of each model for the range of operand T DVP-PLC Application Manual 3-9 Basic Instructions Mnemonic Function Program steps ATMR 16-bit contact type timer counter T-K T0 ~ T255,K0 ~ K32,767 T-D T0 ~ T255, D0 ~ D11999 Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 Operand Explanations: The instruction ATMR corresponds to the combination of AND and TMR If the contact preceding ATMR is ON, the timer specified will begin to count When the count value is greater than or equal to the setting value, the AND contact is ON If the contact preceding ATMR is not ON, ATMR will automatically clear the count value Program Example: Ladder diagram: X0 ATMR T5 Y0 K1000 Instruction code: Operation: LD X0 Loading in contact A of X0 ATMR T5 K100 The setting value of T5 is K100 OUT Y0 When the count value is greater than or equal to the setting value, Y0 is ON Remarks: Please refer to specifications for the model used for more information about the timers which can be used EH3 series PLCs whose version is 1.40 and SV2 series PLCs whose version is 1.20 support ATMR Mnemonic Function Program steps 16-bit counter CNT Controllers ES C-K C0 ~ C199, K0~K32,767 C-D C0 ~ C199, D0 ~ D9999 EX SS SA SX SC EH2 SV EH3 SV2 Operand Explanations: When the CNT instruction goes from Off to On, the designated counter coil will be driven, and the present value in the counter will plus When the counting reaches the set value (present value = set value), the contact will be: NO (Normally Open) contact Open collector NC (Normally Closed) contact Close collector If there are other counting pulse inputs after the counting reaches its target, the contact and present value will stay intact Use RST instruction to restart or reset the counting Program Example: Ladder diagram: X0 CNT 3-10 C20 K100 Instruction code: Operation: LD X0 Loading in contact A of X0 CNT C20 K100 Set value in counter C20 as K100 DVP-PLC Application Manual Basic Instructions Mnemonic Function Program steps 32-bit counter DCNT Controllers ES EX SS SA SX C-K C200 ~ C255, K-2,147,483,648 ~ K2,147,483,647 C-D C200 ~ C255, D0 ~ D9999 SC EH2 SV EH3 SV2 Operand Explanations: DCNT is the instruction for enabling the 32-bit high-speed counters C200 ~ C255 For general purpose addition/subtraction counters C200 ~ C234, when DCNT goes from Off to On, the present value in the counter will pulse (counting up) or minus (counting down) according to the modes set in special M1200 ~ M1235 For high-speed addition/subtraction counters C235 ~ C255, when the high-speed counting pulse input goes from Off to On, the counting will start its execution For the input terminals (X0 ~ X17) and counting methods (counting up/down) of the high-speed counter, see Chapter 2.7 Numbering and Function of Counter [C] for more details When DCNT is Off, the counting will stop, but the existing present value in the counter will not be cleared To clear the present value and the contact, you have to use the instruction RST C2XX Use externally designated input points to clear the present values and contacts of high-speed addition/subtraction counters C235 ~ C255 Program Example: Ladder diagram: M0 DCNT C254 Mnemonic K1000 Instruction code: Operation: LD M0 Loading in contact A of M0 DCNT C254 K1000 Set value of counter C254 as K1,000 Function MC / MCR Master control Start/Reset Operand N0 ~ N7 Program steps Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 Explanations: MC is the main-control start instruction When MC instruction is executed, the execution of instructions between MC and MCR will not be interrupted When MC instruction is Off, the actions of the instructions between MC and MCR are: Explanation Instruction type General purpose timer Present value = Coil is Off, No action for the contact Accumulative timer Coil is Off, present value and contact stay intact Subroutine timer Present value = Coil is Off, No action for the contact Counter Coil is Off, present value and contact stay intact Coils driven by OUT instruction All Off DVP-PLC Application Manual 3-11 Basic Instructions Explanation Instruction type Devices driven by SET and RST instructions Stay intact All disabled The FOR-NEXT nested loop will still execute back and forth for N times Application instructions Instructions between FOR-NEXT will act as the instructions between MC and MCR MCR is the main-control end instruction that is placed in the end of the main-control program There should not be any contact instructions prior to MCR instruction MC-MCR main-control program instructions support the nested program structure (max layers) and please use the instruction in the order N0 ~ N7 Program Example: Ladder diagram: X0 MC N0 X1 Y0 X2 MC N1 X3 Y1 MCR N1 MCR N0 MC N0 X10 X11 Y10 MCR Mnemonic Operation: LD MC LD OUT : LD MC LD OUT : MCR : MCR : LD MC LD OUT : MCR X0 N0 X1 Y0 Loading in A contact of X0 Enabling N0 common series connection contact Loading in A contact of X1 Driving Y0 coil X2 N1 X3 Y1 Loading in A contact of X2 Enabling N1 common series connection contact Loading in A contact of X3 Driving Y1 coil N1 Disabling N1 common series connection contact N0 Disabling N0 common series connection contact X10 N0 X11 Y10 Loading in A contact of X10 Enabling N0 common series connection contact Loading in A contact of X11 Driving Y10 coil N0 Disabling N0 common series connection contact Function Program steps Rising-edge detection operation LDP Operand N0 Instruction code: X0 ~ X377 Y0 ~ Y377 M0 ~ M4095 S0 ~ S1023 Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The method of using LDP is the same as using LD, but the actions of the two instructions differ LDP saves the current content and store the detected status of rising-edge to the accumulative register 3-12 DVP-PLC Application Manual Basic Instructions Program Example: Ladder diagram: X0 X1 Y1 Instruction code: Operation: LDP X0 Starting X0 rising-edge detection AND X1 Series connecting A contact of X1 OUT Y1 Driving Y1 coil Remarks: See the specification of each model for the range of operands If the status of a designated rising-edge is On before the PLC is powered, the contact of the rising-edge will be TRUE after PLC is powered Mnemonic Function Program steps Falling-edge detection operation LDF Operand X0 ~ X377 Y0 ~ Y377 M0 ~ M4095 S0 ~ S1023 Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The method of using LDF is the same as using LD, but the actions of the two instructions differ LDF saves the current content and store the detected status of falling-edge to the accumulative register Program Example: Ladder diagram: X0 X1 Y1 Mnemonic Operation: LDF X0 Starting X0 falling-edge detection AND X1 Series connecting A contact of X1 OUT Y1 Driving Y1 coil Function Program steps Rising-edge series connection ANDP Operand Instruction code: X0 ~ X377 Y0 ~ Y377 Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 M0 ~ M4095 S0 ~ S1023 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: ANDP instruction is used in the series connection of the contacts’ rising-edge detection Program Example: Ladder diagram: X0 X1 Y1 DVP-PLC Application Manual Instruction code: Operation: LD X0 Loading in A contact of X0 ANDP X1 X1 rising-edge detection in series connection OUT Y1 Driving Y1 coil 3-13 Basic Instructions Mnemonic Function Falling-edge series connection ANDF Operand Program steps X0 ~ X377 Y0 ~ Y377 Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 M0 ~ M4095 S0 ~ S1023 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: ANDF instruction is used in the series connection of the contacts’ falling-edge detection Program Example: Ladder diagram: X0 X1 Y1 Mnemonic Function ORP Rising-edge parallel connection Operand Instruction code: Operation: LD X0 Loading in A contact of X0 ANDF X1 X1 falling-edge detection in series connection OUT Y1 Drive Y1 coil Program steps Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 X0 ~ X377 Y0 ~ Y377 M0 ~ M4095 S0 ~ S1023 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The ORP instructions are used in the parallel connection of the contact’s rising-edge detection Program Example: Ladder diagram: X0 Y1 X1 Instruction code: Operation: LD X0 Loading in A contact of X0 ORP X1 X1 rising-edge detection in parallel connection OUT Y1 Driving Y1 coil Mnemonic Function Program steps ORF Falling-edge parallel connection Operand X0 ~ X377 Y0 ~ Y377 Controllers ES M0 ~ M4095 S0 ~ S1023 EX SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - Explanations: The ORP instructions are used in the parallel connection of the contact’s falling-edge detection 3-14 DVP-PLC Application Manual Basic Instructions Program Example: Ladder diagram: X0 Y1 X1 Mnemonic Function Instruction code: Operation: LD X0 Loading in A contact of X0 ORF X1 X1 falling-edge detection in parallel connection OUT Y1 Driving Y1 coil Program steps Rising-edge output PLS Operand Controllers ES X0 ~ X377 Y0 ~ Y377 - EX M0 ~ M4095 S0 ~ S1023 SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - - - - Explanations: When X0 goes from Off to On (rising-edge trigger), PLS instruction will be executed and S will send out pulses for once of scan time Program Example: Ladder diagram: X0 PLS M0 SET Y0 M0 Instruction code: LD X0 Operation: PLS M0 M0 rising-edge output LD M0 Loading in contact A of M0 SET Y0 Y0 latched (On) Loading in A contact of X0 Timing Diagram: X0 scan time M0 Y0 Mnemonic PLF Operand Function Program steps Falling-edge output X0 ~ X377 Y0 ~ Y377 - Controllers ES M0 ~ M4095 S0 ~ S1023 - EX SS SA SX SC EH2 SV EH3 SV2 T0 ~ T255 C0 ~ C255 D0 ~ D9999 - - - Explanations: When X0 goes from On to Off (falling-edge trigger), PLF instruction will be executed and S will send out pulses for once of scan time DVP-PLC Application Manual 3-15 Basic Instructions Program Example: Ladder diagram: X0 PLF M0 SET Y0 M0 Instruction code: Operation: LD X0 Loading in A contact of X0 PLF M0 M0 falling-edge output LD M0 Loading in contact A of M0 SET Y0 Y0 latched (On) Timing Diagram: X0 scan time M0 Y0 Mnemonic Function Program steps Program End END Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 N/A Operand Explanations: END instruction has to be placed in the end of a ladder diagram or instruction program PLC will start to scan from address to END instruction and return to address to restart the scan Mnemonic Function Program steps No operation NOP Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 N/A Operand Explanations: NOP instruction does not conduct any operations in the program; therefore, after the execution of NOP, the existing logical operation result will be kept If you want to delete a certain instruction without altering the length of the program, you can use NOP instruction Program Example: Ladder diagram: NOP instruction will be omitted in the ladder diagram Operation: LD Loading in B contact of X0 NOP X0 NOP OUT X0 3-16 Instruction code: No operation Y1 Driving Y1 coil Y1 DVP-PLC Application Manual Basic Instructions Mnemonic INV Function Program steps Inverting Operation Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 N/A Operand Explanations: The logical operation result before INV instruction will be inverted and stored in the accumulative register Program Example: Ladder diagram: X0 Y1 Instruction code: Operation: LD Loading in A contact of X0 X0 INV Inverting the operation result OUT Mnemonic P Operand Function Y1 Driving Y1 coil Program steps Pointer Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 P0 ~ P255 Explanations: Pointer P is used in API 00 CJ and API 01 CALL instructions The use of P does not need to start from No 0, and the No of P cannot be repeated; otherwise, unexpected errors may occur Program Example: Ladder diagram: X0 CJ P10 Y1 Mnemonic I Operation: LD X0 Loading in A contact of X0 CJ P10 From instruction CJ to P10 : X1 P10 Instruction code: P10 Pointer P10 LD X1 Loading in A contact of X1 OUT Y1 Driving Y1 coil Function Interruption program marker (I) Program steps Controllers ES EX SS SA SX SC EH2 SV EH3 SV2 I00□, I10□, I20□, I30□, I40□, I50□, I6□□, I7□□, I8□□ Operand I010, I020, I030, I040, I050, I060, I110, I120, I130, I140, I150, I160, I170, I180 Explanations: A interruption program has to start with a interruption pointer (I□□□) and ends with API 03 IRET I instruction has to be used with API 03 IRET, API 04 EI, and API 05 DI See Chapter 2.9 for pointers of all DVP series PLCs DVP-PLC Application Manual 3-17 Basic Instructions Program Example: Ladder diagram: Instruction code: Operation: EI X1 EI Allowable range for interruption Y1 Enabling interruption LD X1 Loading A contact of X1 OUT Y1 Driving Y1 coil : DI DI Pointer of interruption program : FEND X2 I 001 Y2 Interruption subroutine IRET FEND Main program ends I001 Interruption pointer LD X2 Loading in A contact of X2 OUT Y2 Driving Y2 coil : IRET 3-18 Disabling interruption Interruption return DVP-PLC Application Manual ... Loading in A contact of X0 Enabling N0 common series connection contact Loading in A contact of X1 Driving Y0 coil X2 N1 X3 Y1 Loading in A contact of X2 Enabling N1 common series connection contact... in A contact of X3 Driving Y1 coil N1 Disabling N1 common series connection contact N0 Disabling N0 common series connection contact X10 N0 X11 Y10 Loading in A contact of X10 Enabling N0 common... = Coil is Off, No action for the contact Accumulative timer Coil is Off, present value and contact stay intact Subroutine timer Present value = Coil is Off, No action for the contact Counter Coil