Académique Documents
Professionnel Documents
Culture Documents
Table of Contents
Chapter 1 Working Principles of PLC Ladder Diagram
Preface-The Background and Functions of PLC ...................................................... 1-1
1.2 The Difference between Traditional Ladder Diagram and PLC Ladder Diagram ... 1-2
1.5 The Conversion of PLC Command and Each Diagram Structure ......................... 1-11
2.3 The Numbering and Function of External Input/Output Contact [X] / [Y] .............. 2-9
2.4 The Numbering and Function of Auxiliary Relay [M] ........................................... 2-11
2.5 The Numbering and Function of Step Relay [S] ................................................. 2-12
2.8 Register Number and Function [D], [E], [F] ........................................................ 2-28
2.9 Nest Level Pointer[N], Pointer[P], Interrupt Pointer [I] ........................................ 2-30
There are stronger functions in PLC with the development and application requirements of electronic technology,
such as position control, network and etc. Output/Input signals are DI (Digital Input), AI (Analog Input), PI (Pulse
Input), DO (Digital Output), AO (Analog Output) and PO (Pulse Output). Thus PLC plays an important role in the
feature industry.
Ladder diagram is an automatic control diagram language that developed during World War II. At first, it just has
basic components, such as A contact (normally open), B contact (normally close), output coil, timer counter and etc.
(The power panel is made up of these basic components) It has more functions, differential contact, latched coil and
the application commands, add, minus, multiply and divide calculation, that traditional power panel can’t make since
PLC is developed.
The working principles of the traditional Ladder Diagram and the PLC Ladder Diagram are similar to each other;
the only difference is that the symbols for the traditional ladder diagram are expressed in the format that are close to
its original substance, while those for the PLC ladder diagram employ the symbols that are more explicit when being
used in computers or data sheets. In the Ladder Diagram Logics, it could be divided into the Combination Logics
and the Sequential Logics, and is described as follows:
1. Combination Logics:
The following example is the combination logics that show in traditional diagram and PLC ladder diagram
separately.
Traditional Ladder Diagram PLC Ladder Diagram
X0 Y0 X0
Y0
X1 Y1 X1
Y1
X2 X4 Y2 X2 X4
Y2
X3 X3
Example 1: Circuit 1 utilizes one X0 (NO: Normally Open) switch, which is normally known as the “A” switch or
contact, and its characteristic is that the contact is in the OFF condition at regular time (not pressed); the
output point Y0 is thus in OFF condition. However, once the switch motion (the button is pressed) is
conducted, the contact will be ON, and the output point Y0 will be in ON condition.
Example 2: Similarly, Circuit 2 utilizes the X1 (NC: Normally Close) switch, which is normally known as the “B” switch
or contact, and its characteristic is that the contact is in the ON condition at regular time; the output point
Y0 is thus in ON condition. While the switch motion is conducted (which is in the OFF condition), the
output point Y0 is in OFF condition.
Example 3: This is an example of combination logics output, which has more than one input equipment. The output
point Y2 will be in ON condition when X2 is in OFF condition or X3 and X4 are in ON condition.
2. Sequential logics:
The sequential logics are a type of circuit that possesses the “Draw-Back” structure, which is to draw back the
circuit’s output result and has it serve as the input condition. Thus, under the same input condition, different
output results will be generated in accordance with previous conditions and motions with different orders.
The following example is the sequential logics that show in traditional diagram and PLC ladder diagram
separately.
Traditional Ladder Diagram PLC Ladder Diagram
X5 X6 Y3
X5 X6
Y3
Y3 Y3
When the above circuit is just supplied with power, although the X6 switch is ON, the X5 switch is still OFF, thus,
the output relay Y3 will be in OFF condition; output of the relay will only be ON after X5 is ON. Once the output relay
Y3 is in ON condition, there will be a feedback signal containing the ON condition from Y3 to connect in parallel with
the A contact of X5; this circuit is thus also known as the self-latched circuit. The circuit motion is showed in the
following chart:
Device status
X5 X6 Y3
Step
1 N N OFF
2 Y N ON
3 N N ON
4 N Y OFF
5 N N OFF
1.2 The Difference between Traditional Ladder Diagram and PLC Ladder Diagram
Although the working principles are in accordance with each other for the traditional ladder diagram and the PLC
ladder diagram, PLC is indeed utilizing the microcomputer chip (MCU) to simulate the motion of the traditional ladder
diagram, which is to use the scan method to look over one by one the conditions of all input devices and output coils,
and afterwards, with the conditions in consideration, to calculate and generate the same output result as that of the
traditional ladder diagram based on the logics of the combination status of the ladder diagram. However, since that
there is only one MCU, the only way to examine the circuits is to look it over one after another within the ladder
diagram program, then calculate the output result in compliance with the program and the input/output status, and
finally, output the results to the external interface; thereafter, start over with the readout of the input status, the
calculation, output, and repeatedly go over the above-mentioned motions again; the time needed to complete the
whole set of cyclic motion is called one Scan Time. The scan time will become longer in accordance with the
increment of the program. With this scan time, it will incur repeated input detections, and thus, result in delay in the
output responses; and the longer the delay time, the greater the error towards the control, and what’s worse, is that
the condition might be unqualified for the control requests. By then, PLC (with faster Scan Time) would be chosen to
do the job; the scan speed is thus an essential specification to PLC. Thanks to the advanced technique of ASIC (IC
with specific functions) within the microcomputer, PLC of the present has made greater progress in the scan speed,
and what follows is the scanning chart of the PLC Ladder Diagram Program.
X0 X1
Start Y0
Y0
Calculate the result by ladder
diagram algorithm (it doesn’t sent X10
M100 X3
to the outer output point but the Execute in cycles
Y1
inner equipment will output :
immediately.) :
X100 M505
Y126
End
In addition to the difference of scan time, PLC ladder diagram and traditional ladder diagram also has difference
in “reverse current”. In the following chart of traditional ladder diagram, if X0, X1, X4 and X6 are in ON condition and
the others are in OFF condition, output point Y0 will be in ON condition as shown as dotted line in the following
diagram. But in the PLC ladder diagram will have error in the peripheral equipment—WPLSoft due to scan method of
MCU is from up to down and from left to right.
Reverse current of traditional ladder diagram Reverse current of PLC ladder diagram
X0 X1 X2 Y0 X0 X1 X2 Y0
Y0
X3 a X4 X5 X3 a X4 X5
b b
X6 X6
Ladder diagram is a diagram language that applied on the automatic control and it is also a diagram that made
up of the symbols of electric control circuit. PLC procedures are finished after ladder diagram editor edits the ladder
diagram. It is easy to understand the control flow that indicated with diagram and also accept by technical staff of
electric control circuit. Many basic symbols and motions of ladder diagram are the same as mechanical and electrical
equipments of traditional automatic power panel, such as button, switch, relay, timer, counter and etc.
The kinds and amounts of PLC internal equipment will be different with brands. Although internal equipment has
the name of traditional electric control circuit, such as relay, coil and contact. It doesn’t have the real components in it.
In PLC, it just has a basic unit of internal memory. If this bit is 1, it means the coil is ON and if this bit is 0, it means the
coil is OFF. You should read the corresponding value of that bit when using contact (Normally Open, NO or contact a).
Otherwise, you should read the opposite sate of corresponding value of that bit when using contact (Normally Close,
NC or contact b). Many relays will need many bits, 8-bits makes up a byte. 2 bytes can make up a word. 2 words
makes up double word. When using many relays to do calculation, such as add/ subtraction or shift, you could use
byte, word or double word. Furthermore, the two equipments, timer and counter, in PLC not only have coil but also
value of counting time and times.
In conclusion, each internal storage unit occupies fixed storage unit. When using these equipments, the
corresponding content will be read by bit, byte or word.
Basic introduction of the inner equipment of PLC: (Refer to Chapter 2 for detail)
Input relay is the basic storage unit of internal memory that corresponds to external input
point (it is the terminal that used to connect to external input switch and receive external input
Input relay
signal). Input signal from external will decide it to display 0 or 1. You couldn’t change the state of
input relay by program design or forced ON/OFF via HPP. The contacts (contact a, b) can be
used unlimitedly. If there is no input signal, the corresponding input relay could be empty and
can’t be used with other functions.
Equipment indication method: X0, X1,…X7, X10, X11,…. The symbol of equipment is X
and the number uses octal. There are numeric indications of input point on MPU and
expansion unit.
Output relay is the basic storage unit of internal memory that corresponds to external output
point (it is used to connect to external load). It can be driven by input relay contact, the contact of
Output relay
other internal equipment and itself contact. It uses a normally open contact to connect to external
load and other contacts can be used unlimitedly as input contacts. It doesn’t have the
corresponding output relay, if need, it can be used as internal relay.
Equipment indication: Y0, Y1,…Y7, Y10, Y11,…. . The symbol of equipment is Y and the
number uses octal. There are numeric indications of output point on MPU and expansion
unit.
Internal relay The internal relay doesn’t connect directly to outside. It is an auxiliary relay in PLC. Its
function is the same as the auxiliary relay in electric control circuit. Each auxiliary relay has the
corresponding basic unit. It can be driven by the contact of input relay, output relay or other
internal equipment. Its contacts can be used unlimitedly. Internal auxiliary relay can’t output
directly, it should output with output point.
Equipment indication: M0, M1,…, M4, M5. The symbol of equipment is M and the number
uses decimal number system.
STEP DVP PLC provides input method for controlling program of step actions. It is very easy to
write control program by using the conversion of control step S of command STL. If there is no
step program in the program, step point S could be used as internal relay M or alarm point.
Equipment indication: S0, S1,…S1023. The symbol of equipment is S and the number
uses decimal.
Timer Timer is used to control time. There are coil, contact and timer storage. When coil is ON, its
contact will act (contact a is close, contact b is open) when attaining desired time. The time value
of timer is set by settings and each timer has its regular period. User sets the timer value and
each timer has its timing period. Once the coil is OFF, the contact won’t act (contact a is open
and contact b is close) and the timer will be set to zero.
Equipment indication: T0, T1,…,T255. The symbol of equipment is T and the number uses
decimal system. The different number range corresponds with the different timing period.
Counter Counter is used to count. It needs to set counter before using counter (i.e. the pulse of
counter). There are coil, contacts and storage unit of counter in counter. When coil is form OFF
to ON, that means input a pulse in counter and the counter should add 1. There are 16-bit, 32-bit
and high-speed counter for user to use.
Equipment indication: C0, C1,…,C255. The symbol of equipment is C and the number
uses decimal.
Data register PLC needs to handle data and operation when controlling each order, timer value and
counter value. The data register is used to store data or parameters. It stores 16-bit binary
number, i.e. a word, in each register. It uses two continuous number of data register to store
double words.
Equipment indication: D0, D1,…,D9,999. The symbol of equipment is D and the number
uses decimal.
File register The file register can be used to store data or parameter when the register that PLC needs is
not enough during handling data and parameter. It can store 16-bit binary number, i.e. a word, in
each file register. It uses two continuous number of file register to handle double word. There are
1600 file registers for EP series and 10000 file registers for EH series. There is not the real
equipment number for file register, thus it needs to execute READ/WRITE of file register via
commands API147 MEMR, API148 MEMW or the peripheral equipment HPP and WPLSoft.
Index register Index register E and F are 16-bit data register just the same as general data register. It can
be wrote and read freely and has the function of index indication to use for character device, bit
device and constants.
Equipment indication: E0~E7, F0~F7. The symbols of equipment are E, F and the number
uses decimal.
Ladder Diagram
Explanation Command Equipment
Structure
Ladder Diagram
Explanation Command Equipment
Structure
Rising-edge trigger in
ORP X, Y, M, S, T, C
parallel
Falling-edge trigger in
ORF X, Y, M, S, T, C
parallel
MPS
Multiple output MRD none
MPP
Output command of coil
OUT Y, M, S
drive
S Step ladder STL S
Block: The block is the ladder diagram that made up of the serial or parallel calculation of two or above equipments. It
will get the result of parallel block or serial block according to operation character.
Serial block
Parallel block
Divergent line and combinative line: the vertical line is usually a separation for devices. This line is combination line
for the left device (it means that there are at least two columns or above circuit at
the left connect to this vertical line) this line is the divergent line for the right
device (it means that there are at least two rows or above circuit connect to this
line.
1 2
Network: this is the complete network that made up of devices and blocks. The vertical line or continuous line and the
block or device that line can connect to is the same network.
Network2
Incomplete network:
The program edited method is from left power line to right power line. (the right power line will be omitted during
the edited of DPLSoft and WPLSoft.) After editing a row, go to editing the next row. The maximum contacts in a row
are 11 contacts. If you need more than 11 contacts, you could have the new row and start with continuous line to
continue more input devices. The continuous number will be produced automatically and the same input point can be
used repeatedly. The drawing is shown as follows.
X0 X1 X2 X3 X4 X5 X6 X7 X10 C0 C1
00000
X11 X12 X13
00000 Y1
The operation of ladder diagram is to scan from left upper corner to right lower corner. The output handling,
including the operation frame of coil and application command, at the most right side in ladder diagram.
Take the following diagram for example; we analyze the process step by step. The number at the right corner is
the explanation order.
8
7
4 6
5
3
2 5
1
X0 X1 Y1 X4
Y1
M0 T0 M3
TMR T0 K10
X3 M1
LD command
LD command
Rising-edge
Falling-edge
X0 X0
Time Time
OFF ON OFF OFF ON OFF
The structures of ANDP and ANDF are the same but the action is in rising-edge or falling-edge.
OR OR OR
command command command
The structures of ORP and ORF are the same but the action is in rising-edge or falling-edge.
ANB command
ORB
command
If there are several blocks when operate ANB or ORB, they should be combined to blocks or network from up to
down or from left to right.
6. MPS, MRD, MPP commands: Divergent memory of multi-output. It can produce many various outputs.
The command MPS is the start of divergent point. The divergent point means the connection place between
horizontal line and vertical line. We should determine to have contact memory command or not according to the
contacts status in the same vertical line. Basically, each contact could have memory command but in some places of
ladder diagram conversion will be omitted due to the PLC operation convenience and capacity limit. MPS command
can be used for 8 continuous times and you can recognize this command by the symbol “┬”.
MRD command is used to read memory of divergent point. Because the logical status is the same in the same
horizontal line, it needs to read the status of original contact to keep on analyzing other ladder diagram. You can
recognize the command MRD by the symbol “├”.
MPP command is used to read the start status of the top level and pop it out from stack. Because it is the last
item of the horizontal line, it means the status of this horizontal line is ending.
MPS
You can recognize this command by the symbol “└”.
Basically, that is all right to use the above method to
analyze but sometimes compiler will omit the same MPS
outputs as shown at the right.
MRD
MPP
MPP
7. STL command: this command is used in the syntax design for the Sequential Function Chart (SFC). This
command helps the programmer to have clearer ideas on the program procedure, and thus the procedure will
be more readable. As shown in the following diagrams, we can get clear procedure, and original step point will
have the action of “power loss” after each step point S transfer to the next step point. In this way, we could
transfer to our procedure diagram from the left diagram to the PLC structure diagram below.
M1002
M1002 SET S0
initial S0
pulse S
S0 SET S21
S21
S SET S22
S21 S22
e
S S0
S22 RET
8. RET command: you should add RET command after finishing step ladder program and RET command should
add after STL command as shown in the following.
S20
e
S
RET
S20
e
S
RET
Ladder Diagram LD X0 OR
X1 1 block
OR
LD X2
X0 X2 X1 OR M0 2 OR
Y0 block
X1 M0 C0
ORI M1
Serial
SET S0 ANB block
M1 LD M2 AND
3 block
AND Y0
M2 Y0
ORB Serial block
ANI X1 4 ANI Output state will keep on
5 handling according to
OUT Y0
S0 X10 Multiple program scan state
AND C0
S Y10 outputs
SET S0
SET S10 STL S0 Step ladder Start
7
LD X10
OUT Y10 State working item and 8
S10 X11 step point transfer
S Y11 SET S10
STL S10 9 S10 state take out
SET S11 LD X11 10 Take out X11 state
OUT Y11 11 8
SET S12
SET S11 State working item and
SET S13 SET S12 step point transfer
SET S13
S11 X12 STL S11 12 S11 state take out
S Y12 LD X12 13 Take out X12 state
14
OUT Y12 State working item and
SET S20
SET S20 step point transfer
S20 S12 S13 X13
STL S20
S S S STL S12 Simultaneous
S0 15 divergence
STL S13
RET State working item End of step ladder
LD X13
OUT S0 and step point transfer
X0
CNT C0 K10 RET Return
LD S0
17
C0 X1 CNT C0K10
M0
LD C0 18 Read C0
X1
M1 MPS
M2 AND X1
M2
OUT M0
RST C0 MRD
Multiple
ANI X1
outputs
END OUT M1
MPP
ANI M2
OUT M2
END Program End
The analytic process of correct ladder diagram should be from left to right or from up to down. But there are some
exceptions as shown in the following.
Example 1: there are two methods to use command to show the following ladder diagram but the result is the same.
X0 X2 X4
Good method Bad method
X1 X3 X5 LD X0 LD X0
OR X1 OR X1
LD X2 LD X2
OR X3 OR X3
ANB LD X4
LD X4 OR X5
OR X5 ANB
ANB ANB
The results for the above two programs to convert to ladder diagram are the same. Why one is better than the
other? That is due to operation of MPU. The operation of the program in the left side is one block merges to another
one. Although the length of the program at the right side is the same as the left one, the operation of the program in
the right side is merged at the last. (command ANB is used to merge, it can’t use more than 8 continuous times). In
this program, it just needs to use continuous two times of command ANB and MPU allows that. But when the program
needs to use more than continuous 8 times of command ANB, MPU won’t allow. So the best method is to merge once
the block is established and in this way the logic of programmer will be in order.
Example 2: there are two methods to use command to show the following ladder diagram but the result is the same.
X1 LD X0 LD X0
OR X1 LD X1
OR X2 LD X2
X2 OR X3 LD X3
ORB
X3 ORB
ORB
The difference is very clear in these two programs. In the bad method, the more program code it needs and the
operation memory of MPU also needs to increase. So that is better to decode in the order of the definition.
The error figures of ladder diagram
When editing ladder diagram, you can use all ladder symbols to make up all kinds of figures. When drawing
ladder diagram, you should start from left power line and end with the right power line (the right power line will be
omitted when using DPLSoft ladder diagram) due to the principle for PLC to handle figure program is from up to down
and from left to right (it is drew from left to right and draw the next new row after finishing drawing a row). They are the
common error figure in the following.
.
The position of Label P should be in the first row of
the complete network.
To put the block in the front of ladder diagram can omit command ANB when series block and parallel block
connect in series.
X0 X1 Command
LD X0
X2
LD X1
OR X2
ANB
X1 X0 Command
LD X1
X2 OR X2
AND X0
To put the block in the front of ladder diagram can omit command ORB when single equipment and block are
connected in parallel.
T0 Command
LD T0
X1 X2 LD X1
AND X2
ORB
X1 X2 Command
LD X1
T0
AND X2
OR T0
In figure a of ladder diagram, it does not illegal due to the reverse power flow. In figure a, the upper block is
shorter than lower block, you could make it legal by switching them.
command
X0
LD X0
X1 X2 OR X1
AND X2
X3 X4 LD X3
AND X4
Fig. a
ORB
command
X3 X4
LD X3
X1 X2 AND X4
LD X1
X0 OR X0
AND X2
Fig. b
ORB
You can omit commands MPS, MPP when the multiple outputs in the same horizontal line don’t need to operate
with other input device.
X0 command
Y1 MPS
AND X0
Y0 OUT Y1
MPP
OUT Y0
command
Y0
OUT Y0
X0 AND X0
Y1 OUT Y1
In the following examples, the figure at the left is the ladder diagram that is draw by our definition but there is
reverse flow power in it. Therefore, we correct it and show it at the right side.
Example 1:
X0 X1 X2
X0 X1 X2 X3 X4 X5
X3 X4 X5 X10
X6 X7 X10 LOOP1
X6 X7 X5
Example 2:
X0 X1 X2
X0 X1 X2
X3 X4 X5
X3 X4 X5
X6 X7 X10 LOOP1
X6
X0 X1 X2 LOOP1
X0 X1 X4 X7 X10
X3 X4 X5
LOOP 2
X6 X7 X10
In the same occasions, it needs transient close button and transient open button to be start and stop switch.
Therefore, if you want to keep the action, you should design latching circuit. There are several latching circuits in the
following:
Example 1: the latching circuit for priority of stop
The figure at the right side is latching circuit that made up Top priority of stop
Example 4: latched
X1 X3
X1
Y1
X3
Y1
X2
X2 X4 Y1 X4
Y2
Y1
Y2
Y2
X1 and X3 can start/stop Y1 separately, X2 and X4 can start/stop Y2 separately and they are all self latched
circuit. Y1 is an element for Y2 to do AND function due to the normally open contact connects to Y2 in series.
Therefore, Y1 is the input of Y2 and Y2 is also the input of Y1.
X1 X3 Y2 X1
Y1
X3
Y1
X2
X4
X2 X4 Y1 Y1
Y2 Y2
Y2
The figure above is the circuit of interlock control. Y1 and Y2 will act according to the start contact X1 and X2.
Y1 and Y2 will act not at the same time, once one of them acts and the other won’t act. (This is called interlock.)
Even if X1 and X2 are valid at the same time, Y1 and Y2 won’t act at the same time due to up-to-down scan of
ladder diagram. For this ladder diagram, Y1 has higher priority than Y2.
Example 7: Sequential Control
X1 X3 Y2
If add normally close contact Y2 into Y1 circuit to be
Y1
an input for Y1 to do AND function. (as shown in the left
Y1
side) Y1 is an input of Y2 and Y2 can stop Y1 after
X2 X4 Y1 acting. In this way, Y1 and Y2 can execute in sequential.
Y2
Y2
Y1 Y1
Y1
T T
The figure above is a very simple ladder step diagram. When starting to scan Y1 normally close contact, Y1
normally close contact is close due to the coil Y1 is OFF. Then it will scan Y1 and the coil Y1 will be ON and output 1.
In the next scan period to scan normally close contact Y1, Y1 normally close contact will be open due to Y1 is ON.
Finally, coil Y1 will be OFF and output 0. Scan repeatedly, the period of oscillating circuit is nT+ΔT.
X0 Y1
TMR T0 Kn X0
T0
Y1 Y1
nT T
The figure above uses timer T0 to control coil Y1 to be ON. After Y1 is ON, timer T0 will be closed at the next
scan period and output Y1. The oscillating circuit will be shown as above. (n is the setting of timer and it is decimal
number. T is the base of timer. (clock period))
X0 T2
TMR T1 Kn1 X0
T1 n2 T
TMR T2 Kn2
Y1
X0 T1
Y1 n1 T
The figure above is common used oscillating circuit for indication light blinks or buzzer alarms. It uses two
timers to control On/OFF time of Y1 coil. If figure, n1 and n2 are timer setting of T1 and T2. T is the base of timer
(clock period)
X0
M0 X0
M0 Y1 T
Y1 M0
M0 Y1
Y1
In figure above, the rising-edge differential command of X0 will make coil M0 to have a single pulse of ΔT (a
scan time). Y1 will be ON during this scan time. In the next scan time, coil M0 will be OFF and normally close M0
and normally close Y1 are all closed. However, coil Y1 will keep on being ON and it will make coil Y1 to be OFF once
a rising-edge comes after input X0 and coil M0 is ON for a scan time. The timing chart is as shown above. This
circuit usually executes alternate two actions with an input. From above timing: when input X0 is a square wave of a
period T, output coil Y1 is square wave of a period 2T.
Example 11: Delay Circuit
X0
TMR T10 K1000 X0
T10
Y1 Y1
When input X0 is ON, output coil Y1 will be ON at the same time due to the corresponding normally close
contact OFF makes timer T10 to be OFF. Output coil Y1 will be OFF after delay 100 seconds once input X0 is OFF
and T10 is ON. Please refer to timing chart above.
Example 12: Output delay circuit, in the following example, the circuit is made up of two timers. No matter input X0 is
ON or OFF, output Y4 will be delay.
X0
TMR T5 K50 X0
5
T5 T6 seconds
Y4 T5
Y4
Y0
Y4 X0
TMR T6 K30 T6
3
seconds
Example 15: Traffic light control (by using step ladder command)
Timing chart:
Vertical
Light
Red Y0
Yellow Y1
Green Y2
25 Sec
Horizontal 5 Sec 5 Sec
Light
Red Y10
Yellow Y11
Green Y12
25 Sec
5 Sec 5 Sec
SET S0
S20 Y0 S30 Y12 S0
S SET S20
TMR T0 K350 TMR T10 K250
T0 T10
Y2
SET S30
S21 S31 TMR T11 K50
M1013
S20
TMR T1 K250 Y12 S Y0
T1 T11
S22 TMR T2 K50 S32 Y11
TMR T0 K350
M1013
Y2 TMR T12 K50 T0
T2 T12 SET S21
S23 Y1 S33 Y10 S21
S Y2
TMR T13 K350
RET
END
LAD-0
M1002
ZRST S0 S127
SET S0
LAD-0
S0
Transferred condition 1
0
T0
TRANS*
S20 S30
1 5 S22
S21 S31
TMR T2 K50
2 6
M1013
S22 S32 Y2
3 7
T13
TRANS*
4
S0
Transferred condition 7
T12
TRANS*
EP/SA models:
Type Device Item Range Function
points
I6□□, I7□□, 2 points (□□=1~99ms,
For Time interrupt The location point of
I time base=0.1ms)
interrupt interrupt subroutine.
High-speed counter
I010, I020, I030, I040, I050, I060, 6 points
reaches interrupt
Communication interrupt I150
K-32,768 ~ K32,767 (16-bit operation)
K Decimal number system
Constant
*4: latched area is fixed, it can’t be modified. (the area marked with【】can’t be changed)
EH model:
Total Corresponds to
X External input relay X0~X377, 256 points, octal number system
is external input point
512 Corresponds to
Y External output relay Y0~Y377, 256 points, octal number system
points external output point
For general M0~M499, 500 points (*2)
Total Contacts can be
Relay bit mode
trigger )
I6□□, I7□□, I8□□, 3 points(□□=1~99ms) time
Interrupt
operation)
H0000 ~ HFFFF (16-bit operation)
H Hexadecimal system
H00000000 ~ HFFFFFFFF (32-bit operation)
There are five value types for DVP-PLC to use by the different control destination. The following is the
explanation of value types.
DW Double Word
W1 W0 Word
Bit
The numbers of external input and output terminal of DVP-PLC use octal number.
Example:
External input: X0~X7, X10~X17…(device number)
It shows a decimal number by a unit number or four bits so continuous 16 bits can use to represent the
four numbers of decimal number. BCD code is usually used to read the input value of DIP switch or output
value to 7-segment display to be display.
5. Hexadecimal Number (HEX)
Constant K:
In PLC, it is usually have K before constant to mean decimal number. For example, K100 means 100 in
decimal number.
Exception:
The value that is made up of K and bit equipment X, Y, M, S will be bit, byte, word or double word. For
example, K2Y10, K4M100. K1 means a 4-bit data and K2~K4 can be 8, 12 and 16-bit data separately.
Constant H:
In PLC, it is usually have H before constant to mean hexadecimal number. For example, H100 means 100 in
hexadecimal number.
Reference Chart:
Binary Octal Decimal BCD Hexadecimal
(BIN) (OCT) (DEC) (Binary Code Decimal) (HEX)
Constant K,
Equipment For DIP Switch and 7-segment
For PLC internal operation equipment M, S, T, C, Constant H
X, Y number display
D, E, F, P, I number
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 1 0 2 2 0 0 0 0 0 0 1 0 2
0 0 0 0 0 0 1 1 3 3 0 0 0 0 0 0 1 1 3
0 0 0 0 0 1 0 0 4 4 0 0 0 0 0 1 0 0 4
0 0 0 0 0 1 0 1 5 5 0 0 0 0 0 1 0 1 5
0 0 0 0 0 1 1 0 6 6 0 0 0 0 0 1 1 0 6
0 0 0 0 0 1 1 1 7 7 0 0 0 0 0 1 1 1 7
0 0 0 0 1 0 0 0 10 8 0 0 0 0 1 0 0 0 8
0 0 0 0 1 0 0 1 11 9 0 0 0 0 1 0 0 1 9
0 0 0 0 1 0 1 0 12 10 0 0 0 1 0 0 0 0 A
0 0 0 0 1 0 1 1 13 11 0 0 0 1 0 0 0 1 B
0 0 0 0 1 1 0 0 14 12 0 0 0 1 0 0 1 0 C
0 0 0 0 1 1 0 1 15 13 0 0 0 1 0 0 1 1 D
2.3 The Numbering and Function of External Input/Output Contact [X] / [Y]
For MPU, the number of input and output contact will be counted from X0 and Y0. The number will be changed
with points of MPU. For I/O extension unit, the number of input / output terminal is counted with the connection
sequence of MPU.
For ES, EX, SS Models:
Note: Besides DVP-60ES, the started input number of extension unit is from X20 and the started output
number of extension unit from Y20. The started input number of DVP-60ES is X50 and the started
output number of DVP-60ES is Y30. The number of extension I/O is increased by 8 times and if it is
less than 8 points, it will count with 8 points.
EP/SA model:
Note 1: All SA functions are the same as EP except function extension card. All SA extension units share
with SS series.
Note 2: The started input number of extension unit is from X20 and the started output number of extension
unit from Y20. The number of extension I/O is increased by 8 times and if it is less than 8 points, it
will count with 8 points.
EH model:
Note: Besides DVP-16EH and DVP-20EH, the started input/output number of extension unit starts with the
last number of MPU. The started input number of DVP-60EH is X20 and the started output number
of DVP-60EH is Y20. The numbers of extension I/O are sequential numbers. The input number can
be up to X377 and output number can be up to Y377.
The number of input relay (or called input terminal) uses octal number. The points of EH model can be up
to 256 points, the range as follows: X0~X7, X10~X17, ……, X370~X377.
The number of output relay (or called output terminal) uses octal number. The points of EH model can be
up to 256 points, the range as follows: Y0~Y7, Y10~Y17, ……, Y370~Y377.
The function of input contact X: input contact X reads input signal and enter PLC by connecting with input
equipment. It is unlimited usage times for A contact or B contact of each input contact X in program. The
On/Off of input contact X can be changed with the On/Off of input equipment but can’t be changed by using
peripheral equipment (HPP or WPLSoft).
(※ There is a special relay M1304 in EH model to force input contact X On/Off by peripheral equipment
HPP or WPLSoft, but PLC won’t receive any external input signal at this time.)
The mission of output contact Y is to drive the load that connects to output contact Y by sending On/Off
signal. There are two kinds of output contact: one is relay and the other is transistor. It is unlimited usage
times for A or B contact of each output contact Y in program. But there is number for output coil Y and it is
recommended to use one time in program. Otherwise, the output result will be decided by the circuit of last
output Y with PLC program scan method.
X0
Y0 1 2 , i.e.
The output of Y0 will be decided by circuit ○
decided by On/Off of X10.
Y0 is repeated
X10
Y0 2
Program read X0 state from memory executing. The new On/Off state will be read
Output:
Y output 1. When executing END command, send On/Off
state of Y in memory to output latched memory.
In fact, this memory is the coil of output relay.
2. The delay time from the change of On→Off or
Off→On of relay coil to contact On/Off.
EP/SA models:
EH models:
EP/SA Models:
EH Models:
There are 1024 points, S0~S1023, in step relay S. Like output relay Y, there are output coil and A, B contacts in
each step relay S and unlimited usage times in program. But it can’t drive external load directly. Step relay (S) can be
used as general auxiliary relay when not use with step command. There are four types divided by its characteristics.
1. Initial step relay : S0~S9, 10 points.
In Sequential Function Chart (SFC), it is the step point for initiating.
4. Latched step relay : ES, EX, SS models: S20~S127, 108 points. EP models: S512~S895,
384points. EH models: S500~S899, 400 points.
In sequential function chart (SFC), latched step relay will be saved when power
loss after running. The state of power on after power loss will be the same as
the sate before power loss.
5. Step relay for alarm : EP/SA models: S896~S1023, 128 points. EH models: S900~S1023, 124
points.
The step relay for alarm uses with alarm drive command API 46 ANS to be the
contact for alarm. It is used to record warning and eliminate external
malfunction.
EP/SA model:
100ms for general T0~T199, 200 points. (T192~T199 are the timers for subroutine.)
100ms for
T250~T255, 6 points. It is fixed to be latched area.
accumulative
Total is
10ms for general T200~T239, 40 points.
Timer T 256
10ms for points
T240~T245, 6 points. It is fixed to be latched area.
accumulative
1ms for
T246~T249, 4 points. It is fixed to be latched area.
accumulative
EH model:
Timer function:
The unit of timer is 1ms, 10ms and 100ms. The count method is count up. The output coil will be ON when the
present value of timer equals to the settings. The setting is K in decimal number. Data register D can be also used as
settings.
1. General timer:
ES/EP/SA Series General timer will count once when executing command END. Output coil will be On if
:
Models timer attains when executing command TMR.
General timer will count once when executing command TMR. Output coil will be On if
EH Series Models :
timer attains when executing command TMR.
Y0
2. Accumulative timer:
General timer will count once when executing command END. Output coil will be On if
ES/EP Series Models :
timer attains when executing command TMR.
General timer will count once when executing command TMR. Output coil will be On if
EH Series Models :
timer attains when executing command TMR.
X0 When X0=On, timer T250 is counted up with
TMR T250 K100 100ms. The output coil T0=On, when the present
value of timer equals to settings (K100).
T250
If X0=Off or power off during counting, timer
Y0 T250 pauses and keep on counting after X0=On. The
present value counts up till the present value of timer
T1 T2 T1+T2=10sec
equals to settings (K100), output coil T0=On.
X0
K100
present
T250 value
Y0
Beside timer used for subroutine, the flow chart of general timer is in the following:
Timer will start when executing TMR command.
When X0=On, If scan time is longer, same scan will count with
input reflash it starts to count. plural timing pulse automatically.
X0
contact T0 is On
TMR T0 K100 T0 counts to
10sec now,
but contact
isn’t On.
T0 contact Y0=On
Y0
1st scan 2nd scan Nth scan (N+1)th scan
From action above, the action since the coil is started to be ON in detail are in the following:
+T0
T
-α
α : 1ms timer is 0.001 second, 10ms timer is 0.01 second, 100ms timer is 0.1 second
T : Setting time of timer (second)
T0 : Scan time (second)
If contact is wrote prior to TMR command in program, it needs to add 2*T0 (two times scan time) in the worst
situation.
If timer setting is 0, output contact will be ON when TMR command is executed in the next time.
EP/SA models:
16 bits count up for
C0~C95, 96 points. It is fixed to be non-latched area.
general
16 bits count up for C96~C199, 104 points. It can be non-latched area by setting
latched parameters.
32 bits count
Counter C
up/down for C200~C215, 15 points. It is fixed to be non-latched area.
general
Total is
32 bits count
C216~C234, 19 points. It can be changed to be non-latched 250
up/down for
area by setting parameters. points
latched
1-phase input for C235~C242, C244, 9 points. It can be changed to be
latched non-latched area by setting parameters.
32 bits count up/down 1-phase 2 inputs C246, C247, C249, 3 points. It can be changed to be
High speed counters C for latched non-latched area by setting parameters.
2-phase 2 inputs C251, C252, C254, 3 points. It can be changed to be
for latched non-latched area by setting parameters.
EH models:
16-bit count up for C0~C99, 100 points. It can be changed to be latched area
general by parameters.
16-bit count up for C100~C199, 100 points. It can be changed to be
latched non-latched area by parameters.
Counter C
32-bit count up/down C200~C219, 20 points. It can be changed to be latched area
for general by parameters.
32-bit count up/down C220~C234, 15 points. It can be changed to be non-latched
Total is
for latched area by parameters.
253
Software 1-phase 1 C235~C240, 6 points. It can be changed to be non-latched
points
input area by parameters.
Hardware 1-phase 1 C241~C244, 4 points. It can be changed to be non-latched
32 bits count up/down input area by parameters.
High-speed counters C Hardware 1-phase 2 C246~C249, 4 points. It can be changed to be non-latched
inputs area by parameters.
Hardware 1-phase 2 C251~C254, 4 points. It can be changed to be non-latched
inputs area by parameters.
Features:
Functions:
When pulse input signal of counter is from OFF to ON, the present value of counter equals to settings and output
coil is ON. Settings are decimal system and data register D can also be used as settings.
1. Setting range of 16-bit counter is K0~K32,767. (K0 is the same as K1. output contact will be ON
immediately at the first count.
2. General counter will be clear when PLC is power loss. If counter is latched, it will remember the value
before power loss and keep on counting when power on after power loss.
3. If using MOV command, WPLSoft or HPP to send a value, which is large than setting to C0, register, at
the next time that X1 is from Off to On, C0 counter contact will be On and present value will be set to the
same as settings.
4. The setting of counter can use constant K or register D (not includes special data register D1000~D1999)
to be indirect setting.
5. If using constant K to be setting, it can only be positive number but if setting is data register D, it can be
positive/negative number. The next number that counter counts up from 32,767 is -32,768.
Example:
LD X0
X0
RST C0 RST C0
LD X1 X1
CNT C0 K5
CNT C0 K5
C0
LD C0 Y0
OUT Y0
Contacts Y0, C0
1. The setting range of general 32-bit counter is K-2,147,483,648~K2,147,483,647. (not for DVP ES, EX and SS
MPU)
2. Special auxiliary relay used to switch count up/down of general 32-bit addition/subtraction counters decided by
M1200~M123. For example: When M1200=Off, C200 is for addition. When M1200=On, C200 is for
subtraction.
3. Settings can be constant K or data register D (special data register D1000~D1999 is not included) and also can
be positive/negative number. If using data register D, it will occupy two continuous data register.
4. General counter will be clear when PLC is power loss. If it is latched counter, counter will save the present
value and the contacts state and keep on counting when power is on after power loss.
5. The next number will be -2,147,483,648 for counter to count up after 2,147,483,647. By the same way, once
counter counts down to -2,147,483,648 the next value will be 2,147,483,647.
Example:
LD X10 X10
OUT M1200 M1200
LD X11 X11
RST C200 RST C200
LD X12
X12
DCNT C200 K-5
CNT C200 K-5
C200
LD C200 Y0
OUT Y0
X11
2. When X11 is from Off to ON and RST
command is executed, C200 will be clear X12
to 0 and contact will be off. 5
4 4
C200 3 3
3. When X12 is from Off to On, counter present 1
2 2
1
value
0 0 0
will add one (count up) or subtract 1 (count -1
-2
down). -3 -3
-4 -4
output contact -5 -5
4. When counter C200 is from K-6 to K-5, is On before. -6 -6
-7 -7
the contact of C200 is from Off to On. contacts -8
When counter C200 is from K-5 to K-6, the Y0, C0
contact of C200 will be from On to Off.
5. If using MOV command, WPLSoft or HPP to send a value, which is large than setting to C0, register, at the
next time that X1 is from Off to On, C0 counter contact will be On and present value will be set to the same
as settings.
2. The operation of 32-bit high-speed addition/subtraction counter C235~C244 is decided by the On/Off of
special auxiliary relay M1235~M1244. For example: if M1235=Off, C235 is addition and if M1235=On,
C235 is subtraction.
3. The operation of 32-bit high-speed addition/subtraction counter C246~C254 is decided by the On/Off of
special auxiliary relay M1246~M1254. For example: if M1246=Off, C246 is addition and if M1246=On,
C246 is subtraction.
4. The settings can be positive / negative numbers by using constant K or data register D (special data
register D1000~D1999 is not included). If using data register D, the setting will occupy two continuous data
register.
5. If using DMOV command, WPLSoft or HPP to send a value which is large than setting to any high-speed
counter, at the next time that input point X of counter is from Off to On, this contact doesn’t have any
change and it will do addition and subtraction with present value.
6. The next number will be -2,147,483,648 for counter to count up after 2,147,483,647. By the same way,
once counter counts down to -2,147,483,648, the next value will be 2,147,483,647.
High-speed counter for ES / EX / SS series, 1-phase high-speed counter: 5KHz, total frequency: 40KHz.
Type 1-phase input 1-phase 2 inputs 2-phase inputs
Input C235 C236 C237 C238 C241 C242 C244 C246 C247 C249 C251 C252 C254
X0 U/D U/D U/D U U U A A A
X1 U/D R R D D D B B B
X2 U/D U/D R R R R
X3 U/D R S S S
Input points X0 and X1 can be used as high-speed counter and 1-phase can be up to 40KHz.
High-speed counter for EP/SA series, 1-phase high-speed counter: 10KHz, total frequency: 40KHz.
Type 1-phase input 1-phase 2 inputs 2-phase inputs
Input C235 C236 C237 C238 C239 C240 C241 C242 C244 C246 C247 C249 C251 C252 C254
X0 U/D U/D U/D U U U A A A
X1 U/D R R D D D B B B
X2 U/D U/D R R R R
X3 U/D R S S S
X4 U/D
X5 U/D
1. Input point X0, X1 can be used as high-speed counter and 1-phase can be up to 20KHz
C235~C240 are high-speed counters for EH series and they are program interrupted 1-phase high-speed
counter (10KHz) and total frequency is 20KHz. C241~ C254 are Hardware High Speed Counter, is called HHSC.
pulse input frequency of HHSC0 and HHSC 1 can up to 100 KHz; HHSC2 and HHSC3 can up to 30KHz (both of
single phase and AB phase).
A. There are Reset signal and Start signal of external inputs in HHSC0~3. It also can be Reset signal
by setting special M, M1272 (HHSC0), M1274 (HHSC1), M1276 (HHSC2) and M1278 (HHSC3).
And it can be Start signal by setting special M, M1273 (HHSC0), M1275 (HHSC1), M1277
(HHSC2) and M1279 (HHSC3).
B. If input external control signals of R and S aren’t used when using high-speed counter, the
function of input signal can be closed by setting M1264/ M1266/ M1268/ M1270 and M1265 /
M1267/ M1269/ M1271 to True. The corresponding external input can be used as general inputs.
Please refer following for using.
C. When using special M to be high-speed counter, control input with START and TRSET and the
action will be affected with scan time.
HHSC0 HHSC1 HHSC2 HHSC3 U/D mode setting flag HHSC0 M1246 M1251 High speed Comparison value
comparison reached operation
C241 C242 C243 C244 HHSC1 M1247 M1252 command
M1241 M1242 M1243 M1244
DHSCS SET/RESET
HHSC2 M1248 M1253
DHSCR I 010 ~ I 060 interrupt
HHSC0 HHSC1 HHSC2 HHSC3 HHSC3 M1249 M1254 counting value reset
DHSCZ
X2 X6 X12 X16
AND Reset signal R
M1264 M1266 M1268 M1270 OR
ES/EX/SS/EP high-speed counter uses special D1022 in 2-phase inputs counting mode to select
double frequency mode. D1022 content will be loaded in at the first scan time when PLC switches
from STOP to RUN. (ES/EX/SS series MPU (V5.5 and higher) supports this function.
2-phase
inputs
A-phase
2
frequency) B-phase
(double
counting down
counting up
A-phase
4 (four times
frequency)
B-phase
counting down
counting up
There are 1 to 4 times frequency for EH hardware high-speed counter (HHSC0~3) and set by Special D1225~D1228.
Facotry setting is double frequency.
Type Special
Count up (+1) Count down (-1)
D(settings)
1(normal U/D
1(normal U
1-phase 2 frequency) D
inputs 2(double U
frequency) D
1(normal A
frequency) B
2(double A
2-phase 2 frequency) B
frequency) B
4(four times A
frequency) B
M1150 Declare DHSZ command to be used for multi-group setting comparison mode
M1151 Multi-group setting comparison finishes to execute a cycle
M1152 Declare DHSZ command to be used in frequency control mode
Example:
LD X10 X10
RST C241 RST C241
LD X11 X11
OUT M1241 M1241
LD X12 X12
DCNT C241 K5 DCNT C241 K5
LD C241 C241
OUT Y0 Y0
5. C241 for ES, EX, SS, EP series has external input Reset X1 signal.
6. C241 for EH series has external input Reset signal (X2), Start signal (X3).
7. EH series external input contact of clear signal of C241 (HHSC0) is disabled by M1264. External input contact
of start signal is disabled by M1265.
8. EH series internal input contact of clear signal of C241 (HHSC0) is disabled by M1272. Internal input contact of
start signal is disabled by M1273.
9. Counting mode (normal frequency or double frequency) of C246 (HHSC0) of EH series can be set by D1225.
Factory setting is double frequency.
Example:
LD X10 X10
RST C246 RST C246
LD X11 X11
DCNT C246 K5 DCNT C246 K5
LD C246 C246
OUT Y0 Y0
X10
1. When X10=On and RST command is executed,
clear C246 to 0 and reset output contact to off. X11
X0
2. When X11=On, C246 receives count signal count up
X1
from X0 input terminal and counter will count up count down
C246
(+1) or receive count signal from X1 input present 7
value 6 6
terminal and counter will count down (-1). 5 5
4 4
3 3
3. When C246 attains settings K5, C246 will be 2 0
on. After C246 is ON, if there is counter pulse 1
0
input, C246 will keep on counting.
Y0, C246 contact
4. C246 for EH series has external input Reset signal X2 or Start signal X3.
5. C246 (HHSC0) of EH series can be normal frequency or double frequency by setting D1225. Factory setting
is double frequency.
6. EH series external input contact of clear signal ( R ) of C246 (HHSC0) is disabled by M1264. External input
contact of start signal ( S ) is disabled by M1265.
7. EH series internal input contact of clear signal ( R ) of C246 (HHSC0) is disabled by M1272. Internal input
contact of start signal ( S ) is disabled by M1273.
Example:
LD X10 X10
RST C251 RST C251
LD X11 X11
DCNT C251 K5 DCNT C251 K5
LD C251 C251
OUT Y0 Y0
1. When X11=On, RST command is executed and reset C251 to 0, output contact is reset to off.
2. C251 receives A phase counting signal of X0 input terminal and B phase counting signal of X1 input
terminal to execute add 1 (count up) or subtract 1 (count down) when X12=on. EH series can set different
frequency for counting mode.
3. When counter C251 attains settings K5, C251 contact will be ON. After C251 is On, if there is counter
pulse input, C251 will keep on counting.
4. For ES/EP/SA series, it can be set to normal frequency, double frequency or four times frequency by
D1022 (counting mode setting). Factory setting is double frequency.
5. EH series C251 has external input reset signal X2 and start signal X3.
6. The counting mode (normal frequency, double frequency, third times frequency, four times frequency) of
EH series C251 (HHSC0) can be set by D1225. Factory setting is double frequency.
7. EH series external input contact of clear signal of C246 (HHSC0) is disabled by M1264. External input
contact of start signal is disabled by M1265.
8. EH series internal input contact of clear signal of C246 (HHSC0) is disabled by M1272. Internal input
contact of start signal is disabled by M1273.
ES/EX/SS, EP/SA series:
X10
X11
A-phase X0
B-phase X1
6
C251 present value 5 5
4 4
3 3 3
2 2
1 Counting up Counting down 1
0 0
EH series:(double frequency)
X10
X11
A-phase
X0
B-phase
X1
C251 6
5 5
present 4 4
value 3 3
2 2 2
1 counting up counting down 1
0 0
It is used to store numerical data and data length is 16-bit (-32,768~+32,767). The left-most bit is sign bit. Two
16-bit registers also can be combined to a 32-bit register (The number for each 32-bit register will be (D0, D1), (D2,
D3) …..and the number for upper bit will be greater than low bit.) The left-most bit sign bit and the store range is
-2,147,483,648~+2,147,483,647.
EP/SA model:
EH model:
There are five types of register which sorts by characters in the following:
1. General register : The data in register will be cleared to 0 when PLC switches from RUN to STOP or
power is off. If M1033=On when PLC switches from Run to STOP, data won’t be
cleared but the data will be cleared to 0 when power is off.
2. Latched register : The data is the latched register won’t be cleared when PLC is power off. If you want
to clear the data in this register, you should use RST or ZRST command.
3. Special register : Each special register has the special definition and purpose. It is used to save system
status, error messages, monitor state. Please refer to chapter 2.11 for detail.
4. Index register [E], [F] : Index registers are 16-bit registers. There are 2 points, E and F, for ES/EX/SS
models. There are 8 points, E0~E3 and F0~F3, for EP models. There are 16 points,
E0~E7 and F0~F7, for EH models. If you want to use index register to be 32-bit
register, you should indicate E and at this moment F can’t be used.
5. File register : There are 1600 file registers (K0~K1599) for EP/SA MPU and 10000 file registers
(K0~K9,999) for EH MPU. There is no real device number for file register, you should
execute read/write of file register by command API 147 MEMR, API 148 MEMW,
peripheral device HPP or WPLSoft.
Index registers E, F are 16-bit data register, just the same as general
16-bit 16-bit data register. It can be wrote/read.
E0 F0 It can be used as 32-bit register. But at this time, this register should
be indicated to E and F can’t be used. Otherwise, the data will be
32-bit
error. (It is recommend to use command DMOVP K0 E and clear E
upper 16-bit lower 16-bit The combination of E and F when using as 32-bit register are:
(E0, F0) , (E1, F1) (E2, F2) ….(E7, F7)
The function of Index register is the same as general operand. It can be used to move or compare and used to
be index for byte device (KnX, KnY, KnM, KnS, T, C, D) and bit device (X, Y, M, S). For ES/EP/SA series, it can’t be
used for constant (K, H). But for EH series, it can be used for constant (K, H).
※ some commands don’t support index function, please refer to chapter 5.4 for using index register E and F.
※ When using command mode of WPLSoft to use constant (K,H) to be index register, it needs to use symbol “@”:
Example: ”MOV K10@E0 D0F0”
EP/SA/EH series will check following when PLC is power on or change from STOP→RUN.
1. M1101 (if it starts file register function)
2. D1101 (the start number of file register of EP/SA series (K0~K1599), for EH series is K0~K9999)
3. D1102 (item number for reading, EP/SA series is K0~K1600 and EH series is K0~K10000)
4. D1103 (the address to save the reading data, the start address of designated file register D
(K2000~K9999). It is used to decide if transferring file to designated register automatically.
Note:
The action which read from file register to data register D won’t be executed when D1101 for EP/SA model
is greater than 1600, D1101 for EH model is greater than 8,000 or the value of D1103 is less than 2,000 or
greater than 9,999.
When starting executing the action to read data from file register to data register, PLC will stop reading
once the address of file register or data register D exceeds usage range.
There are 1600 file registers for EP/SA models and 10000 file registers for EH models. There is no actual
number for file register, therefore it should use command API 147 MEMR, API 148 MEMW or peripheral
HPP02 and WPLSoft to execute the read/write of file register. If the address of file register for reading
exceeds useful range, the data for reading will be 0.
EP/SA models:
EH models:
Nest Level Pointer N: used with command MC and MCR. MC is master start command. When MC command is
executed, the commands between MC and MCR will be executed normally. MC-MCR master
command supports nested program structure and the maximum is 8 levels, which is
numbered from N0 to N7. Refer to chapter3.7 for detail information.
Pointer P: use with application commands API 00 CJ, API 01 CALL, API 02 SRET. Refer to chapter 5.5 commands CJ,
CALL, SRET usage method for more information.
CJ condition jump:
P**
X0 When X0=On, program will jump from 0 to N
0 CJ P1
(designated label P1) and keep on executing
P**
X0 When X0 is On, it will jump
20 CALL P2 Call subroutine P** to P2 to execute the
X1 designated subroutine as
24 Y1
executing CALL
Interrupt pointer I:
It is used with application command API 04 EI, API 05DI, API 03 IRET. Refer to chapter 5.5 for more information.
There are five functions below. Interrupt insert should be used with EI, interrupt insert enable, interrupt insert disable
and IRET interrupt insert return, etc.
1. External interrupt insert : When input signal of input terminal X0~X5 is triggered on rising-edge or
falling-edge, it will interrupt present program and jump to the designated
interrupt insert subroutine pointer I00□(X0), I10□(X1), I20□(X2), I30□(X3),
I40□(X4), I50□(X5) to execute and return to previous address to execute
when executing IRET command. That is due to special hardware circuit
design of PLC MPU and is not affected by scan period.
2. Timer interrupt insert : It is special hardware circuit design in PLC MPU. It will stop present program
and jump to the designated interrupt insert subroutine to execute
automatically every a period time (can be set to 10ms~99ms).
3. Counter attained interrupt insert : The comparison command API 53 DHSCS of high-speed counter can
designate to interrupt present program and jump to the designated interrupt
insert subroutine to execute interrupt pointer I010, I020, I030, I040, I050,
I060 when comparison attained.
4. Pulse interrupt insert : Using pulse output command API 57 PLSY to send interrupt vector
I130(corresponds to M1342) and I140(corresponds to M1343) at the same
time when pulse output the first pulse. But it should start flag M1342 and
M1343 first. And it also can set to send interrupt vector I110 (corresponds to
M1340) and I120(corresponds to M1341) once pulse finishes to output the
last pulse.
5. Communication interrupt insert : When using communication command RS, it can be set to have interrupt
request when receiving specific charcters. Interrupt number is I150 and
specific characters is set to low byte of D1168.
When PLC connects to communication device and received data length is
not the same, setting end character to D1168 and interrupt subroutine to
I150. When PLC receives this end character, it will execute interrupt
subroutine I150.
The kinds and functions of special auxiliary relay (Special M) and special registers (special D) are as shown in
the following. Please notice that some equipments with the same number will be different to the different model. In the
following chart, the meaning of column “Attribute” are: “R” means can only read. “R/W” means can read/write.
“-“ means can do nothing. “#” means system setting, user can read the detail explanation of the setting in the manual.
“*” means can refer following for explanation.
ES Off STOP RUN
Special EP Factory
Function EX EH Attribute Latched setting
M SA
SS On RUN STOP
Normally open contact (a contact). This contact
M1000* is ON when running and it is ON when the ○ ○ ○ Off On Off R NO Off
status is set to RUN.
Normally OFF contact (b contact). This contact
M1001* is OFF in running and it is OFF when the status ○ ○ ○ On Off On R NO On
is set to RUN.
ON only for 1 scan after RUN. Initial pulse is
M1002* contact a. It will get positive pulse in the RUN ○ ○ ○ Off On Off R NO Off
moment. Pulse width=scan period.
OFF only for 1 scan after RUN. Initial pulse is
M1003* contact a. It will get negative pulse in the RUN ○ ○ ○ On Off On R NO On
moment. Pulse width=scan period.
M1004* On when error occurs ○ ○ ○ Off Off - R NO Off
M1008* Monitor timer flag (ON: PLC WDT time out) ○ ○ ○ Off Off - R NO Off
M1009 System used - - - - - - - - -
ES/EX/SS and EP/SA: PLSY Y0 mode
M1010 selection. It is continuous output when it is ON. ○ ○ ○ Off Off Off R/W NO Off
EH:PULSE will be output at the END.
M1011* 10ms clock pulse, 5ms On/5ms Off ○ ○ ○ Off - - R NO Off
M1012* 100ms clock pulse, 50ms On / 50ms Off ○ ○ ○ Off - - R NO Off
M1013* 1s clock pulse, 0.5s On / 0.5s Off ○ ○ ○ Off - - R NO Off
M1014* 1min clock pulse, 30s On / 30s Off ○ ○ ○ Off - - R NO Off
M1015* High-speed connection counter ╳ ○ ○ Off Off Off R/W NO Off
When it is Off, it will display two right-most bits.
M1016* When it is On, it will display (two right-most bits ╳ ○ ○ Off - - R/W NO Off
+ 2000).
M1017* ±30 seconds adjustment ╳ ○ ╳ Off - - R/W NO Off
M1018 Flag for Radian/Degree, On for degree ╳ ○ ○ Off - - R/W NO Off
M1019* Cancle X0~X17 input delay ○ ╳ ╳ Off - - R/W NO Off
M1020 Zero flag ○ ○ ○ Off Off Off R NO Off
M1021 Barrow flag ○ ○ ○ Off Off Off R NO Off
M1174* Output pulse number attained flag ╳ ○ ╳ Off Off Off R/W NO Off
D1050
PLC will automatically convert the ASCII data
↓ ○ ○ ○ 0 - - R NO 0
saved in D1070~D1085 to HEX.
D1055
Present value of EX MPU analog input channel 0
D1056* ○ ╳ ╳ 0 - - R NO 0
(CH0) and EP/EH MPU AD card channel 0 (CH0)
Present value of EX MPU analog input channel 1
D1057* ○ ╳ ╳ 0 - - R NO 0
(CH1) and EP/EH MPU AD card channel 1(CH1)
Present value of EX MPU analog input channel 2
D1058* ○ ╳ ╳ 0 - - R NO 0
(CH2)
Present value of EX MPU analog input channel 3
D1059* ○ ╳ ╳ 0 - - R NO 0
(CH3)
D1061 System used flag - - - - - - - - -
D1065 System used flag - - - - - - - - -
D1066 System used flag - - - - - - - - -
D1067* Algorithm error code ○ ○ ○ 0 - - R NO 0
D1068* Lock the algorithm error address ○ ○ ○ 0 - - R NO 0
Step number of errors associated with flags
D1069 ○ ○ ○ 0 - - R NO 0
M1065~M1067
When the PLC built-in RS-485 communication
D1070 command receives feedback signals from
↓ receiver. The signals will be saved in the registers ○ ○ ○ 0 - - R NO 0
D1085 D1070~D1085. User can use the contents saved
in the registers to check the feedback data.
When the PLC built-in RS-485 communication
D1089 command is executed, the transmitting signals will
↓ be stored in the registers D1089~D1099. User ○ ○ ○ 0 - - R NO 0
D1099 can use the contents saved in registers to check
the feedback data.
D1101* Start address of file register ╳ ○ ○ 0 - - R/W Yes 0
D1102* Copy numbers of file register ╳ ○ ○ 1600 - - R/W Yes 1600
Set start D number for file register to store (the
D1103* ╳ ○ ○ 2000 - - R/W Yes 2000
number should be large than 2000)
Parameter index for Accel/Decel pulse output Y0
D1104* ○ ○ ╳ 0 0 - R/W NO 0
(corresponds to device D)
Average of EX series analog input channel 0 (CH
D1110* ○ ╳ ╳ 0 - - R NO 0
0) and EP/EH series DA card channel 0 (CH0)
Average of EX series analog input channel 1 (CH
D1111* ○ ╳ ╳ 0 - - R NO 0
1) and EP/EH series DA card channel 1 (CH1)
Average of EX series analog input channel 2 (CH
D1112* ○ ╳ ╳ 0 - - R NO 0
2)
Average of EX series analog input channel 3 (CH
D1113* ○ ╳ ╳ 0 - - R NO 0
3)
EX series analog output channel 0 (CH 0) and
D1116* ○ ╳ ╳ 0 - - R/W NO 0
EP/EH series DA card channel 0 (CH0)
D1205* End latched address of 100ms timer T0~T199 ╳ ╳ ○ - - - R/W Yes H’FFFF
D1206* Start latched address of 10ms timer T200~T239 ╳ ╳ ○ - - - R/W Yes H’FFFF
PLC 1. M1000: M1000 is On contact during runing, i.e. a normal open contact a. Using M1000 to
Operation
Flag drive indicated lamp during running, you can know that PLC is in RUN state. M1000
is always on when PLC is RUN.
M1000~M1003
M1000
Y0 PLC is running
M1000 is On contact
during operation always ON
2. M1001: M1001 is Off contact during running, i.e. a normal close contact b. M1001 is always
Off when PLC is RUN.
3. M1002: M1002 will be ON at the first scan when PLC starts RUN and then is Off. M1002 can
be regarded as scan initial pulse and pulse width is a scan time. It can be used to
initial, i.e. start positive pulse (it is ON once it is RUN).
4. M1003: It is Off at the first scan when PLC is RUN and then is ON later, i.e. start negative
pulse (it is Off once it is RUN).
PLC RUN
M1000
M1001
M1002
M1003
scan time
Monitor 1. Monitor timer is used to moitor PLC scan time. When scan time exceeds the setting time of
Timer moitor timer, RED ERROR LED will be light and all outputs will be Off.
2. The initial value of monitor timer is 200ms. You can use command MOV to change the
D1000 setting of monitor timer in the program when program is long or calculation is complicated.
Following example is set moinitor timer to 300ms.
M1002
0 MOV K300 D1000
Primary pulse
3. The maximum setting for monitor timer is 32,767ms. But please notice that if monitor timer
settings is too large, the detected time of calculation abnormal will be delay. Therefore, if it is
not the complicated calculateion makes scan time exceeds 200ms, it is better to set monitor
timer around 200ms.
4. Please monitor D1010~D1012 to check if scan time exceeds D1000 setting when
calculation is complicated or PLC MPU connects too many special module to cause scan
time too long. In this situation, besides modify D1000 setting, you can also use WDT
command (API 07) in PLC program. When CPU excutes WDT command, internal monitor
timer will be clear to 0 to make scan time not exceed monitor timer setting.
Grammar 1. If there is grammar error, PLC ERROR LED will blinking and special relay M1004=On.
Check 2. Time to check PLC grammar: When power is from Off→On. Other time:
3. It will happen with illegal operand (device) or grammar error. You can get the fault by
checking special register D1004 with fault code information. Fault address is saved in data
register D1137 (if it is general circuit error, D1137 will be invalid).
4. Refer to chapter 2.1 Summary of DVP-PLC device number for each device usage range.
5. Refer to chapter 2.12 Troubleshooting and Fault Information for checking grammar.
Scan Time-out 1. When scan time-out during executing, PLC ERROR LED will light and M1008=On.
Timer
2. Using WPLSoft or HPP to monitor D1008 which saves timeout STEP address as WDT timer
M1008, D1008 is ON.
Scan Time The present value, minimum value and maximum value of scan time are saved in
Monitor D1010~D1012.
1. D1010: the present scan time.
D1010~D1012
2. D1011: the minimum scan time.
3. D1012: the maximum scan time.
Internal Clock 1. There are four following clock pulses in PLC. Once PLC is power on, these four clock pulse
Pulse will act automatically.
10 ms
M1011~M1014
M1011 (10 ms) 100 Hz
100 ms
M1013 (1 sec) 1 Hz
1 min
2. When PLC is STOP, clock pulse will also act. The start timing of clock pulse and RUN are
not synchronized.
M1015, D1015 When M1015=On, it will start high-speed timer D1015 once PLC finish executing END
command of that scan period. The minimum unit of D1015 is 100us.
The range of D1015 is 0~32,767. When it counts to 32,767, it will start from 0.
2. There is high-speed timer command HST for EH series, refer command API 196 HST for
detail.
3. Example:
When X10 is On, set M1015=On to start high-speed timer and record in D1015.
X10
M1015
2. If perpetual calendar setting is error, time will reset to Jan. 1, 2000. 00:00 Saturday when
PLC is power on again.
It can use specific command TWR to adjust for EP/EH mode built-in perpetual
calendar. Refer to API 167 TWR for detail.
π(PI)
1. It uses 32-bit data register which is combined with D1019 and D1018 to save floating point
D1018, D1019
value π(PI),
Response time 1. Digital filter circuit is built-in input terminals X0~X17 can set response time of receive pulse
adjustment of
input terminal from input terminal by the content of D1020 and D1021. Unit is ms.
2. When PLC is from Off → On, the content of D1020 and D1021 will become to 10
M1019
automatically.
D1020, D1021
Terminal response time
0
X0 0ms
1
1ms
setting by D1020
(default is 10)
10 input reflash
X17 10ms
15
15ms state
memory
3. When setting X0~X17 response time to 0ms to execute following program, the faster
response time in input terminla will be 50µs due to input terminal connects to RC filter circuit
in series.
M1000
MOV K0 D1020
normally ON contact
4. It is not necessary to adjust response time when using high-speed counter, interrupt insert
or fast pulse catch (M1056~M1059) in program.
5. It is the same to use command REFF (API 51) or change the content of D1020 and D1021.
For EH MPU, M1029 will be On after Y0 and Y1 pulses complete output and M1030
will be On after Y2 and Y3 pulse complete output. When commands PLSY, PLSR are
Off, M1029 or M1030 will be Off.
3. API 63 INCD: M1029 will be On for a scan period when designated group finish comparison.
5. API 155 DABSR, API 156 ZRN, API 158 DRVI, API 158 DRVA:
M1029=On when the first output group Y0 and Y1 pulses complete sending and
M1030=On when the second output group Y2 and Y3 pulses complete sending.
M1029 or M1030 will be Off when execute this command in the next time and it will be
On after completing execution.
Output Latched When M1003 is On, the On/Off state of output will be held once PLC is from RUN to STOP. If
in STOP mode output contact load of PLC is heater, heater’s state will be held as PLC is from RUN to STOP
and RUN after program modification.
M1033
All Output Y When M1034 is drove to be On, all output Y will be Off.
are inhibited
M1034 all outputs inhibited
M1034
RUN/STOP 1. For EH series, when M1035 is drove to be On to start input point X0~X17 to be RUN/STOP
Switch switch by the content of D1035 (0~17).
M1035, D1035 2. For EP/SA series, When M1035 is drove to be On to start input point X7 to be RUN/STOP
switch.
Communication For ES/EX/SS/EP/SA series, data response delay time can be set when PLC MPU is to be
Response Delay Slave in RS-485 communication. Unit is 0.1ms.
D1038
Constant Scan 1. When M1039 is On, program scan time is determined by D1039. When program finishes
Time executing, it will execute the next scan as constant scan time attained. If D1039 is less than
program scan time, it will scan by program scan time.
M1039, D1039
M1000
M1039 Constant scan time
normally ON
contact MOV P K20 D1039
2. The relative commands of scan time are RAMP(API 67), HKY(API 71), SEGL(API 74),
ARWS(API 75) and PR(API 77). They should be used with “constant scan time” or “constant
time insert interrupt”.
3. Especial for command HKY(API 71), scan time should be set to 20ms and above when it is
used 4×4 matrix to be 16 keys to operate.
Analog 1. For EX MPU, analog input channel resolution 10 bits (±10V or ±20mA)
Function
2. For EX MPU, analog output channel resolution 8 bits (0~10V or 0~20mA)
D1056~D1059 3. It is analog digital converter filter time setting for EX series. The factory setting is 0 and unit
D1110~D1113 is 1ms. If D1118 ≦5, it will be regarded as 5ms.
D1116~D1118
4. Resolution of EP/EH analog input AD card: 12 bits (±10V or ±20mA)
Device Function
File 1. For EP/EH series, When PLC is power on or from STOP to RUN, it will check start file
Register register function from M1101, the start number of file register from D1101 (file registers for
EP/SA series: K0~K1,599; for EH series: K0~K9,999), read item number of file register from
M1101
D1102(read items of file registers for EP/SA series: K0~K1,600; for EH series: K0~K8,000),
D1101~D1103
D1103(file registers for save and read, start number of designated data register D (for
EP/SA series: K2,000~K4,999, for EH series: K2,000~K9,999) to determine to send file
register to designated data register automatically or not).
2. Please refer to commands API 148 MEMR and API 149 MEMW explantion.
Digital Switch 1. When PLC is RUN with digital switch card, 8 DIP switches correspond to M1104~M1111
Function Card separately.
Transistor When PLC is RUN with transistor output card, M1112 and M1113 correspond to 2 points
Output Card transistors output TR1 and TR2 separately.
M1112, M1113
Pulse Output
with 1. The definition of special D and special M which are used by pulse output with acceleration/
Acceleration/
Deceleration
deceleration:
index Function
3. It doesn’t need to use command, it just need to fill parameter chart and set M1115 to start.
This function can use Y0 output only, the timing is as following.
TF
SF
Pulse number
AP AP
AP is pulse number of
acceleration/deceleration
4. Note:
This function should be executed under the following conditions all exist. Once a condition
doesn’t exist, this function can’t execute.
Total number of pulse number must be greater than (accel/decel pulse number *2)
Start frequency and target frequency: the minimum is 25Hz and the maximum is
10KHz.
When M1115 is from On to Off, M1119 will be cleared and M1116, M1117 and M1118 aren
unchanged. When PLC is from STOP RUN or from RUN STOP, M1115~M1119 will be
cleared to Off. And D1104 will be cleared to 0 only when it is from Off On.
If start frequency is set to 1KHz, gap frequency is set to 1KHz, target frequency is set to
5KHz, total pulse number is 100 and accel/decel pulse number is 40, timing chart of
accel/decel area is in the following.
Frequency (Hz)
5000
4000
3000
2000
1000
Time (sec)
t1 t2 t3 t4
You can get accel/decel step = (5K – 1K) / 1K = 4 and output number of each pulse is
40 / 4 = 10. Therefore, you can get t1 = (1 / 1K) * 10 = 10ms, t2 = (1 / 2K) * 10 = 5ms, t3
= (1 / 3K) * 10 = 3.33ms and t4 = (1 / 4K) * 10 = 2.5ms from the following figure.
SET M1115
When PLC is RUN, it will save each parameter setting into the register that designated
by D1104.
Frequency (Hz)
10K
1K Pulse
number
10000 90000 100000
Special 1. For EP series, the definition of special D and special M for special high-speed pulse (50KHz)
High-speed
pulse output output function:
D1133 M1133 Special high-speed pulse (50KHz) output switch (On is start executing)
Index Function
3. Function explanation:
Output frequency and output numbers above can be modified when M1133=On and
M1135=Off. It won’t affect present output pulse once output frequency or output target number
is changed. Present output pulse number will be displayed once a scan time update. It will be
cleared to 0 when M1133 is from Off On and it will keep that last output number when M1133
is from On Off.
4. Note:
This special high-speed pulse output function can use special Y1 output point in RUN. It
can exist with PLSY Y1 at the same time and PLSY (Y0) won’t be affected. If command PLSY
(Y1) is executed prior to this function, this function can’t be used and vice versa. When
executing this function, general Y1 output will be invalid and outputs point of Y0 and Y2~Y7
can be used.
The difference between this function and command PLSY is higher than output frequency.
The maximum output can up to 50KHz.
Extension 1. D1139: connection number of BCD extension module, the maximum is 2 connections to use
Connected
Detection with KEY extension module.
2. D1140: special extension module (AD, DA, XA, PT, TC, RT, HC, PU) numbers, the maximum
D1139, D1140
is 8.
D1142, D1143
3. D1142: Digital extension input X point number.
D1145, D1146
4. D1143: Digital extension input Y point number.
5. D1145: connection number of KEY extension module, the maximum is 2connects to use with
BCD extension module.
6. D1146: connection number indication of DISP extension module, the maximum is 3
connections.
Device Function
D1139
connection number indication of BCD extension module, the
D1381~D1384 D1139
maximum is 2 connections to use with KEY extension module
D1381 Low byte of first BCD module
D1382 High byte of first BCD module
D1383 Low byte of second BCD module
D1384 High byte of second BCD module
2. Explanation:
PLC will update BCD module to read out BCD module value by each scan.
The maximum number for a MPU is 2 connections, such as 2 KEY modules, a KEY
module and a BCD extension unit or 2 BCD extension units.
DIP Switch
W8
W4
W2
W1
D7 D6 D5 D4 D3 D2 D1 D0
D7 D6 D5 D0
DIP switch group
W8
W4 it needs to connect a diode in
W2 series (1N4148 is recommended)
W1
Device Function
D1145
Connection number indication of KEY extension module, the
D1145
D1375~D1380 maximum is 2 connections to use with BCD extension module
D1375 X coordinate of the first KEY module (1~8)
D1376 Y coordinate of the first KEY module (1~8)
D1377 Button number of the first KEY module (1~64)
D1378 X coordinate of the second KEY module (1~8)
D1379 Y coordinate of the second KEY module (1~8)
D1380 Button number of the second KEY module (1~64)
2. Explanation:
KEY module uses scan method to read data to PLC, it will just care the first button once
there are two more keys are pressed at the same time.
Calculated method of button number is: H+(V-1)*8. For coordinate (5,1) button, its
number is 5.
Matrix Keypad
V1
V2
H1H2
Button coordinate(x,y)
(D1375, D1376) Button number
(D1378, D1379) (1,1) D1377(D1380)
(1,1) (2,1) (3,1) (4,1) (5,1) (6,1) (7,1) (8,1)
1
V1
V1 1 2 3 4 5 6 7 8
H1
(1,2) (2,2) (3,2) (4,2) (5,2) (6,2) (7,2) (8,2)
V2 9 10 11 12 13 14 15 16
(1,3) (2,3) (3,3) (4,3) (5,3) (6,3) (7,3) (8,3)
17 18 19 20 21 22 23 24
V3
(1,4) (2,4) (3,4) (4,4) (5,4) (6,4) (7,4) (8,4)
25 26 27 28 29 30 31 32
V4
(1,5) (2,5) (3,5) (4,5) (5,5) (6,5) (7,5) (8,5)
V5 33 34 35 36 37 38 39 40
(1,6) (2,6) (3,6) (4,6) (5,6) (6,6) (7,6) (8,6)
V6 41 42 43 44 45 46 47 48
(1,7) (2,7) (3,7) (4,7) (5,7) (6,7) (7,7) (8,7)
49 50 51 52 53 54 55 56
V7
(1,8) (2,8) (3,8) (4,8) (5,8) (6,8) (7,8) (8,8)
57 58 59 60 61 62 63 64
V8
H1 H2 H3 H4 H5 H6 H7 H8
1. For EH series, the definition of special D and special M definition of DISP module (7-segment
DISP Module
display):
2. Explanation:
The maximum DISP module extension units that a PLC can connect are 3 DISP
module extension units and each DISP module extension unit has 8 7-segment
displays.
Dot setting: there are 8 7-segment displays on a 7-segment display extension unit.
There is a dot in each 7-segment display and each dot setting can be filled in 1~8 to
display the dot of DISP1~DISP8. If the setting is out of range, no dot of 7-segment
display will light.
Pre-zero: this function is used to decide if it needs to display 0. It will check from the
left-most bit and display “0” after non-zero bit. For example: if the values of
DISP8~DISP1 are 0, 1, 2, 3, 4, 5, 6, 7, and the 0 of DISP8 won’t be displayed.
DISP number DISP4 DISP3 DISP2 DISP1 DISP8 DISP7 DISP6 DISP5 Pre- dot
zero
The value of
F F F F F F F F 0 0
STOP->RUN
D7 D6 D5 D4 D3 D2 D1 D0
P P
Short additional DC
circuit
24VDC 24VDC
24V
OV OV
a
b
c
d
e
f
g
dot
D7
D6
D5
D4
D3
D2
D1
D0
1. For EP/SA series, the definition of special D and special M of adjustable accel/decel pulse
Adjustable Acceleration/
Deceleration Pulse output function:
Output Function
Explanation
Device Function
M1144~M1149,
M1144 Start switch of accel/decel pulse output
M1154
M1145 Flag that is used in acceleration
D1032, D1033
M1146 Target frequency attained flag
D1144, D1154
M1147 Flag that is used in deceleration
D1155
M1148 Completed function flag
M1149 stop counting temporarily flag
M1154 Start designated deceleration gap time flag and frequency flag
D1032 Lower 16-bit of 32-bit of Y1 pulse accumulative output numbers
D1033 Upper 16-bit of 32-bit of Y1 pulse accumulative output numbers
D1144 Using parameter index (correspond to D component)
D1154 Recommended value of designated deceleration gap time (10~32767 ms)
D1155 Recommended value of designated acceleration gap frequency (-1~ - 32700 Hz)
2. Corresponding table of parameter D1144
Index Function
+0 Total segment number (n) (the maximum number is 10)
+1 Present execution segment (read only)
+2 Start frequency of first segment (SF1)
+3 Interval time of first segment (GT1)
+4 Interval frequency of first segment (GF1)
+5 Target frequency of first segment (TF1)
+6 Lower 16-bit of 32-bit of target number of first segment output pulse
+7 Upper 16-bit of 32-bit of target number of first segment output pulse
+8 Start frequency of second segment (SF2)
+9 Interval time of second segment (GT2)
+10 Interval frequency of second segment (GF2)
+11 Target frequency of second segment (TF2)
+12 Lower 16-bit of 32-bit of target number of second segment output pulse
+13 Upper 16-bit of 32-bit of target number of second segment output pulse
: :
+n*6+2 Start frequency of nth segment (SFn)
+n*6+3 Interval time of nth segment (GTn)
+n*6+4 Interval frequency of nth segment (GFn)
+n*6+5 Target frequency of nth segment (TFn)
+n*6+6 Lower 16-bit of 32-bit of target number of nth segment output pulse
+n*6+7 Upper 16-bit of 32-bit of target number of nth segment output pulse
3. Function Explanation:
This function can only be used for Y1 output point and the timing will be as follows. After
filling parameter table, set M1144 to start (it should be used in RUN mode)
GF
GF
Frequency(Hz)
GT
TF2
GT
SF3
SF2 TF3
TF1 SF4
TF4
SF1
Time(ms)
The minimum frequency of start frequency and target frequency should be equal to or
greater than 200Hz. If it is less than 200Hz, it means finish executing or not to execute.
After starting to execute M1144, if M1148 outputs without attaining completed function
flag and M1144 is closed, this function will start deceleration function. If designated
acceleration function flag M1154 is Off, it will reduce 200Hz per 200ms and stop output
pulse till output frequency is less than 200Hz and set M1147 to deceleration flag. But if
designated deceleration flag M1154 is On, it will be executed by interval time and
frequency that defined by user. And interval time can’t be less than or equal to 0 (if it is
less than or equal to 0, factory setting will be set to 200ms). Interval frequency can’t be
greater than or equal to 0 (factory setting will be set to -1KHz when it is equal to 0 and
factory setting will be added negative sign automatically when it is greater than 0.)
When M1148 attains completed function flag and M1144 is closed, this function won’t
start deceleration function and it will clear M1148 flag. Once M1144 is closed, it will
clear M1149 flag.
The execution segment of this function will execute by total segment number. The
maximum segment is 10 segments.
When STOP RUN, M1144~M1149 will be cleared to Off. When RUN STOP, M1144
will be cleared and M1145~M1149 won’t be cleared. D1144 will be cleared to 0 when it
is from Off On and unchanged in other case.
The usage parameter range of EP/SA series is D0~D999 and D2000~D4999. It won’t
execute this command and close M1144 if parameter is out of range (includes all
usage segment parameter).
5. Example 1: calculate output number of acceleration/deceleration of each segment and
target frequency
If setting start frequency of segment to 200Hz, segment interval time to 100ms, segment
gap frequency to 100Hz, segment target frequency to 500Hz and target number of segment
pulse is 1000 pulses. The calculation will be in the following:
M1002
MOV K200
MOV K2 D200
MOV D205
D206
K200 D212
M0
END
Y7=OFF
TF1
SF2
TF2
SF1
X0=ON
Position
SF2 TF1
Y7=On
Explanation:
Figure above is the example of position movement. When X0 contact is On, it will start
to move and it will stop when X0 contact is Off. (Y7 is for direction setting)
M1002
RST M0
RST M1
X0
SET M0
X0 M0
ALT M1
M1
Y7
M1
SET
M1
M1148
RST
M0
X0
RST
END
8. Example 4: apply acceleration and deceleration of a segment to zero point return program.
Relative flag timing chart is shown in the following.
M1144
M1148
The relation between frequency and position are shown in the following.
Frequency(Hz)
zero point
Position
Index Settings
+0 2
+2 250(Hz)
+3 100(ms)
+4 500(Hz)
+5 10000(Hz)
+6, +7 10(pulse)
+8 9750(Hz)
+9 50(ms)
+10 -500(Hz)
+11 250(Hz)
+12, +13 30000(pulse)
Program is shown in the following: (it assumes contact X7 to be start reset trigger switch)
X7
SET
SET
X0
RST
X0
SET
RST
END
Explanation:
After contact X7 is triggered, M1144 will set to start acceleration and set M1149 not to
count pulse number. And it will send 10 pulses once deceleration switch X0 is
triggered and then enter deceleration segment.
To set M1148 to end pulse output by manual and close this function once X0 is closed.
Note: This example is just an application method that user should adjust parameters settings
used in acceleration/deceleration segment according to actual machine characteristics
and limitation.
Single Step 1. The definition of special D and special M of EH series single step execution function
Execution
Function
Device Function explanation
M1170, M1171
M1170 Start flag of single step function
D1170 M1171 Single step execution flag
D1170 STEP number of present PLC execution command
2. Function Explanation:
Action Steps:
A. Start M1170 to enter single step execution mode. PLC will stay at specific
command which the STEP is saved in D1170 and execute that command one
time.
B. When Forcing M1171 to be On, PLC will execute the next command and stop at
the next command, at the same time, PLC will force M1171 to be Off. D1170 will
display present STEP value.
3. Note:
Those commands that will be affected by scan time will be incorrect due to single STEP
execution. Example: when HKY command is executed, it needs 8 scan time to get a valid input
value of a button. Thus, single step execution will have faults.
2-phase Pulse 1. For EP/SA series, the definition of special D and special M of 2-phase output function:
Output Function
2. Function Explanation:
Output frequency = 1/T as shown in the figure below. There are two output modes, k1 and
k2, k1 means A phase gets ahead of B phase and k2 means B phase gets ahead of A phase.
Output number calculation adds 1 once there is a phase difference, such as figure below, there
are 8 output pulses. When output numbers attains, M1174 will be On and if you want to clear
M1174, you should close M1172.
Y0(A)
Y1(B)
1 2 7 8
Output frequency, output target number and mode selection can be modified when
M1172=On and M1174=Off. The modification of output frequency and output target number
won’t affect present output pulse number but mode selection modification will clear present
output pulse number to 0. Present output pulse number will be updated once scan time
updates and it will clear to 0 when M1172 is from Stop Run, and keep that last output number
when M1172 is from Run Stop.
3. Note:
This function just can be used at RUN mode and can exist in program with PLSY
command. But if command PLSY is executed first, this function can’t be used, and vice versa.
1. For EH/EP/SA series, the definition of special D and special M of built-in 2 points VR volume
VR Volume
function:
This function only can be used at RUN mode. When M1178=On, the variational value of
VR 0 will be converted to digit 0~255 to save in D1178. When M1179=On, the variational value
of VR 1 will be converted to digit 0~255 to save in D1179.
Power Loss 1. For EH/EP/SA series to set latched range. The latched range will be from start address
Latched Range
Setting number to end address number.
Input Point X 1. For EP/SA series, When M1304=On, input point X (X0-X17) of MPU can force to be On-Off
can force to be
ON/OFF by using peripheral WPLSoft and HPP.
M1304 2. For EH series, When M1304=On, input point X of MPU can force to be On-Off by using
peripheral WPLSoft and HPP.
Special
Extension
For EH series, it will display extension module ID in D1320~ D1327 by order when
Module ID connecting to special extension module.
Special extension module ID of EH series:
D1320~D1327
Extension Module Extension Module
Extension Module ID Extension Module ID
Name Name
DVPEH04AD H’0400 DVPEH01PU H’0110
DVP04DA-H H’0401 DVPEH01HC H’0120
DVPEH04PT H’0402 DVPEH02HC H’0220
DVPEH04TC H’0403 DVPEH01DT H’0130
DVPEH06XA H’0604 DVPEH02DT H’0230
DVPEH06RT H’0405
Easy PLC 1. Explanation of Special D and special M explanation of EH series EASY PLC LINK ID1–ID8:
Link
MASTER PLC
SLAVE ID SLAVE ID SLAVE ID SLAVE ID SLAVE ID SLAVE ID SLAVE ID SLAVE ID
M1350-M1352 1 2 3 4 5 6 7 8
M1360-M1439 read Write read Write read Write read Write read Write read Write read Write read Write
out in out in out in out in out in out in out in out in
D1355-D1370 D1480 D1496 D1512 D1528 D1544 D1560 D1576 D1592 D1608 D1624 D1640 D1656 D1672 D1688 D1704 D1720
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
D1415-D1465
D1495 D1511 D1527 D1543 D1559 D1575 D1591 D1607 D1623 D1639 D1655 D1671 D1687 D1703 D1719 D1735
D1480-D1991
Item Item Item Item Item Item Item Item Item Item Item Item Item Item Item Item
number number number number number number number number number number number number number number number number
D1434 D1450 D1435 D1451 D1436 D1452 D1437 D1453 D1438 D1454 D1439 D1455 D1440 D1456 D1441 D1457
2. Explanation of Special D and special M explanation of EH series EASY PLC LINK ID9–ID16:
MASTER PLC
SLAVE ID SLAVE ID SLAVE ID SLAVE ID SLAVE ID SLAVE ID SLAVE ID SLAVE ID
9 10 11 12 13 14 15 16
read Write read Write read Write read Write read Write read Write read Write read Write
out in out in out in out in out in out in out in out in
D1736 D1752 D1768 D1784 D1800 D1816 D1832 D1848 D1864 D1880 D1896 D1912 D1928 D1944 D1960 D1976
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
D1751 D1767 D1783 D1799 D1815 D1831 D1847 D1863 D1879 D1895 D1911 D1927 D1943 D1959 D1975 D1991
Item Item Item Item Item Item Item Item Item Item Item Item Item Item Item Item
number number number number number number number number number number number number number number number number
D1442 D1458 D1443 D1459 D1444 D1460 D1445 D1461 D1446 D1462 D1447 D1463 D1448 D1464 D1449 D1465
3. Explanation:
All communication format used to connect to PLC should be the same (set D1120 for
PLC) and it supports ASCII and RTU mode.
The maximum slave PLCs for a master PLC to connect is 16 slave PLCs.
The ID of slave PLC should be fixed to 1~16 and each slave ID can’t be repeated.
One to one connection can connect to RS-232, RS-485 and RS-422 in series
4. Operation:
Setting read/write items of slave (the maximum is 16 items). (refer to special D for
detail)
Slave ID detection: When M1350=On, Master PLC is started and then detect slave
number to record number in D1433.
You can see if there is slave PLC by M1360-M1375 which save slave ID 1-16
separately. On means exist.
If detection of slave PLC number is 0, M1350 will be Off and stop Link at the same
time. PLC will only detect slave PLC number only at start that M1350=On.
Read/write of master and slave PLC: After finishing detecting slave, master PLC will
read/write to each slave. The slave that master can do read/write is slave ID got after
detecting slave ID. Once slave PLC is added after detecting, master can’t do read/write
to it till the next detection.
Master PLC will read first and the maximum range is 16 slave PLCs start from D100.
After reading, PLC will write and the maximum range is 16 slave PLCs start from D200.
Master PLC will read/write to slave PLC in order, i.e. it will read/write to the next slave
after finishing a slave.
Automatic mode: it should set M1351 to Off. Master PLC will read/write to slave till
M1350 is Off.
Manual mode: It needs to set times of read to D1431. One time means finish all Slave
read/write. When PLC starts Link, D1432 will start to count times of
Link. When D1431 = D1432, PLC will stop Link and force M1351 to be
Off at the same time. If M1351 is forced to be On, PLC will start to link
according to D1431 value automatically.
Note:
1. Automation mode M1351 and manual mode M1352 can’t be On at the same
time.
3. Communication time-out can be set by D1129. The setting range is from 300
to 3000. When it is out of range, it will be regarded as 300 when it is less
than 300 and regarded as 3000 when it is larger than 3000. Besides, this
setting is valid when it is set before linking.
4. PLC LINK function is only valid when baud rate is larger than 1200 bps.
When baud rate is less than 9600 bps, please set communication time-out to
more than 1 second.
If the PLC ERROR LED is flashing or special relay M1004=On after writing program in PLC, the problem may be
an invalid operand or error grammar. You can get fault code saved in special register D1004 to check in following
table to get error message and error address is saved in D1137. (D1137 will be invalid if it is general loop error)
Please refer to chapter 2.1 for each model usage range.
Fault Code Description Fault Code Description
Operand bit device S exceeds the usage
0001 0F06 SFTR misuse operand
range
Label P exceeds the usage range or
0002 0F07 SFTL misuse operand
duplicated
0003 Operand KnSm exceeds the usage range 0F08 REF misuse operand
Interrupt pointer I exceeds the usage
0102 1000 ZRST misuse operand
range or duplicated
An unrecognized command code is being
0202 Command MC exceeds the usage range C400
used
0302 Command MCR exceeds the usage range C401 Loop error
Operand bit device X exceeds the usage LD / LDI continuously use more than 9
0401 C402
range times
0403 Operand KnXm exceeds the usage range C403 MPS continuously use more than 9 times
Operand bit device Y exceeds the usage
0501 C404 FOR-NEXT exceeds 6 levels
range
STL/RET used between FOR-NEXT
0503 Operand KnYm exceeds the usage range C405
SRET/IRET used between FOR-NEXT
Operand bit device T exceeds the usage MC/MCR used between FOR-NEXT
0601
range END / FEND used between FOR-NEXT
Operand word device T register usage
0604 C407 STL continuously use more than 9 times
exceeds limit
Operand bit device M exceeds the usage Use command MC/MCR in STL
0801 C408
range Use I/P in STL
Use STL/RET in subroutine
0803 Operand KnMm exceeds the usage range C409
Use STL/RET in interrupt program
0D01 DECO misuse operand Use MC/MCR in subroutine
C40A
0D02 ENCO misuse operand Use MC/MCR in interrupt program
0D03 DHSCS misuse operand MC/MCR doesn’t start from N0 or
C40B
0D04 DHSCR misuse operand discontinuously
0D05 PLSY misuse operand MC/MCR corresponding value N is
C40C
0D06 PWM misuse operand different
0D07 FROM/TO misuse operand C40D Use I/P incorrectly
0D08 PID misuse operand IRET doesn’t follow by the last FEND
command
Operand bit device C exceeds the usage C40E
0E01 SRET doesn’t follow by the last FEND
range
command
Operand word device C register usage
0E04 The number of input/output points of I/O
exceeds limit C41C
extension unit exceeds usage range
0E05 DCNT misuse operand CXXX
0E18 BCD conversion error Special extension module exceeds usage
C41D
0E19 Division error (divisor=0) range
Component exceeds usage range (include Hardware setting of special extension
0E1A C41E
E and F error) module error
It is negative number after radical
0E1B C41F Data write in memory failure
expression
0E1C FROM/TO communication error C4FF Invalid command (no this command)
Operand word device D register usage
0F04 C4EE No END command in program
exceeds limit
0F05 DCNT misuse operand DXXX
Basic Commands
ANB Series connects the circuit block None 4.4 0.24 1~3 3-5
ORB Parallel connects the circuit block None 4.4 0.24 1~3 3-5
MPS Save the operation result None 4.64 0.24 1~3 3-6
Read the operation result (the
MRD None 4 0.24 1 3-6
pointer not moving)
MPP Read the result None 4.4 0.24 1 3-6
Output commands
Timers, Counters
End command
Other commands
Note: The value wrote in () in the column of execution speed of EH series is the execution speed of specific
operand M1536~M4095.
The LD command is used on the A contact that has its start from the left BUS or the A
Command
Explanation contact that is the start of a contact circuit. Function of the command is to save present
contents, and at the same time, save the acquired contact status into the accumulative
register.
Ladder Diagram: Command Code: Command code explanation:
Program
Example X0 X1 LD X0 Load contact A of X0
Y1 AND X1 Connect to contact A of X1 in
OUT Y1 series
Drive Y1 coil
The LDI command is used on the B contact that has its start from the left BUS or the B
Command
Explanation contact that is the start of a contact circuit. Function of the command is to save present
contents, and at the same time, save the acquired contact status into the accumulative
register.
The AND command is used in the series connection of A contact. The function of the
Command
Explanation command is to readout the status of present specific series connection contacts first,
and then to perform the “AND” calculation with the logic calculation result before the
contacts, thereafter, saving the result into the accumulative register.
The ANI command is used in the series connection of B contact. The function of the
Command
Explanation command is to readout the status of present specific series connection contacts first,
and then to perform the “AND” calculation with the logic calculation result before the
contacts, thereafter, saving the result into the accumulative register.
The OR command is used in the parallel connection of A contact. The function of the
Command
Explanation command is to readout the status of present specific series connection contacts, and
then to perform the “OR” calculation with the logic calculation result before the contacts,
thereafter, saving the result into the accumulative register.
The ORI command is used in the parallel connection of B contact. The function of the
Command
Explanation command is to readout the status of present specific series connection contacts, and
then to perform the “OR” calculation with the logic calculation result before the contacts,
thereafter, saving the result into the accumulative register.
Operand none
To perform the “AND” calculation between the previous reserved logic results and
Command
Explanation contents of the accumulative register.
Operand None
To perform the “OR” calculation between the previous reserved logic results and
Command
Explanation contents of the accumulative register.
Operand None
To save contents of the accumulative register into the operation result. (the result
Command
Explanation operation pointer pulses 1)
Operand None
Reading content of the operation result to the accumulative register. (the pointer of
Command
Explanation operation result doesn’t move)
Operand None
To retrieve the previous reserved logic calculation result from the operation result and
Command
Explanation save it into the accumulative register. (the pointer of result operation minus 1)
Output the logic calculation result before the OUT command to specific device.
Command
Explanation Motion of coil contact:
OUT command
Operation
Contact
result Coil
A contact(normal open) B contact(normal close)
FALSE OFF Non-continuity Continuity
TRUE ON Continuity Non-continuity
When the SET command is driven, its specific device is set to be “ON,” which will keep
Command
Explanation “ON” whether the SET command is still driven. You can use the RST command to set
the device to “OFF”.
When the RST command is driven, motion of its specific device is as follows:
Command
Explanation Device Status
S, Y, M Coil and contact will be set to “OFF”.
Present values of the timer or counter will be set to 0, and the coil and
T, C
contact will be set to “OFF.”
D, E, F The content value will be set to 0.
If the RST command is not executed, status of specific device will not be changed.
Clear contact Y5
When TMR command is executed, the specific coil of timer is ON and timer will start to
Command
Explanation count. When the setting value of timer is attained (counting value >= setting value), the
contact will be as following:
Please refer to the specification of every model for the operand T usage.
Footnote
When the CNT command is executed from OFF ON, which means that the counter
Command
Explanation coil is driven, and 1 should thus be added to the counter’s value; when the counter
achieved specific set value (value of counter = the setting value), motion of the contact
is as follows:
C-K C200~C254,K-2,147,483,648~K2,147,483,647
Operand
C-D C200~C254, D0~D9,999
DCNT is the startup command for the 32-bit high-speed counter that is utilized
Command
Explanation especially in counters C232 to C255.
For general addition/subtraction counter C200~C234, the present value will count up
(add 1) or count down (subtract 1) when command DCNT is from Off→On.
When specific high-speed counter pulse input of high-speed addition/subtraction
counters C235~C254 is from Off→On, it will execute counting. If counter trigger input
keeps being On or Off, the counter value will be unchanged. See chapter 2.7 timer
number and function for high-speed pulse input terminals (X0~X17) and counting
(count up (add 1) and count down (subtract 1)).
When DCNT command is OFF, the counter will stop counting, but the counting values
will not be cleared. Users can use RST C2XX command to remove the counting values
and the contacts. High-speed addition/subtraction counters C235~C254 can use
external specific input point to remove the counting values and the contacts.
LadderDiagram: Command Code: Command code
Program M0 LD M0 explanation:
Example DCNT C254 K1000 DCNT C254 K1000 Load contact A of
M0 and C254
LD M0 counter
DCNT C254 K1000 Setting is K1000
Operand N0~N7
Usage of the LDP command is the same as the LD command, but the motion is
Command
Explanation different. It is used to reserve present contents and at the same time, saving the
detection status of the acquired contact rising-edge into the accumulative register.
Ladder Diagram: Command code: Command code explanation:
Program
Example X0 X1 LDP X0 Start X0 rising-edge
Y1 AND X1 detection
OUT Y1 Series connection A contact
of X1
Drive Y1 coil
Please refer to the specification of every model for the operand usage.
Footnote If specific rising-edge contact state is On before PLC is power on, rising-dedge contact
will be True after PLC is power on.
Usage of the LDF command is the same as the LD command, but the motion is
Command
Explanation different. It is used to reserve present contents and at the same time, saving the
detection status of the acquired contact falling-edge into the accumulative register.
Ladder Diagram: Command code: Command code
Program explanation:
Example X0 X1 LDF X0
Y1 AND X1 Start X0 falling-edge
OUT Y1 detection
Series connection A
contact of X1
Drive Y1 coil
ANDP command is used in the series connection of the contacts’ rising-edge detection.
Command
Explanation
Ladder Diagram: Command Code: Command code
Program explanation:
Example X0 X1 LD X0
Y1 ANDP X1 Load A contact of X0
OUT Y1 X1 rising-edge detection in
series connection
Drive Y1 coil
ANDF command is used in the series connection of the contacts’ falling-edge detection.
Command
Explanation
Ladder Diagram: Command Code: Command code explanation:
Program
Example X0 X1 LD X0 Load A contact of X0
Y1 ANDF X1 X1 falling-edge detection in
OUT Y1 series connection
Drive Y1 coil
The ORP commands are used in the parallel connection of the contact’s rising-edge
Command
Explanation detection.
The ORP commands are used in the parallel connection of the contact’s falling-edge
Command
Explanation detection.
When X0=OFF→ON (rising-edge trigger), PLS command will be executed and M0 will
Command
Explanation send the pulse of one time which the length is a scan time.
M0 a scan time
Y0
When X0= ON→OFF (falling-edge trigger), PLF command will be executed and M0 will
Command
Explanation send the pulse of one time which the length is the time for scan one time.
Y0
Operand None
It needs to add the END command at the end of ladder diagram program or command
Command
Explanation program. PLC will scan from address o to END command, after executing it will return
to address 0 to scan again.
Operand none
Command This is a no-operation command and has no effect on the previous operation. NOP is
Explanation used in the following cases: To delete a command without changing the number of
steps. (Overwrite with NOP)
Operand None
Inverting the operation result and use the new data as an operation result.
Command
Explanation
Ladder Diagram: Command Code: Command code
Program X0 explanation:
Example Y1 LD X0 Load A contact of X0
INV Inverting the operation
OUT Y1 result
Drive Y1 coil
Operand P0~P255
Pointers are used with the jump commands (CJ, CALL) in two different ways as follows.
Command
Explanation But a number cannot be used repeatedly.
Interrupt programs should begin with interrupt pointer (I□□□)and ends with
Command
Explanation application command to be as interrupt end and return. It must use with application
commands API 03 IRET, API 04 EI, API 05 DI.
The step ladder command, STL Sn, has constituted the stepping point, and when the
Command
Explanation STL command showed up in the program, it implies that the program is now at the step
ladder diagram condition that is controlled by the step procedure. The step ladder
command RET represents the end of the step ladder diagram (from S0~S9) that is to
return to the BUS command. The SFC diagram is represented through the step ladder
diagram composed of STL/RET. The number of step point S can’t be repeated.
At the end of the step procedure, be sure to write in the RET command; the RET
Command
Explanation command indicates the end of the step procedure. Maximum is 10 step procedures
(S0~S9) for a PLC program and it should have RET command at the end of each step
procedure.
Ladder Diagram: SFC:
Program M1002
ZRST S0 S127 M1002
Example
SET S0 S0
S0 X0 X0
S SET S20
S20 S20 Y0
S Y0
X1 X1
SET S30
S30 S30 Y1
S Y1
X2
X2
SET S40 S40 Y2
S40
S Y2 X3
X3
S0
RET
S0
END
In automatic control field, it often needs to cooperate with electric control and mechanical control to reach the
goal. SFC can be divided into several serial STEP (i.e. several phases). Each STEP should finish its actions. It
usually has transition to transfer from each step to the next step. That is the design concept of Sequential Function
Chart to have transition to end the action of the previous step and start the action of the next step (the previous step
will be clear at this time).
Features:
1. You don’t need to do SFC design for constant state step. PLC will execute the
SFC:
action of interlock and double output between each state. It is only needed do
simple SFC design for each state and make machine works.
S0
2. The action is easy to understand and easy to adjust initial PLC start-up, detect
X0
and maintain.
S21
3. SFC edition theory is made by IEC1131-3. It is figure edition mode and the
X1 X2
structure looks like flow chart. Each PLC internal step relay S is used to be step
point and also equal to each step of flow chart. After finishing present step, it S22 S24
will transfer to the next step, i.e. next step point S, by setting condition. By X3
repeating this way, it can reach the result that user needs.
4. Explanation of right side SFC figure: each step has its own transition condition X4
to move from one step to the next step. In this figure, primary step point S0 will
S24
move to step point S21 once this transition condition X0 is established, and
X5
S21 can move to S22 or S24 by transition condition X1 or X2 and S25 will
S25
move to S0 to finish a whole procedure once transition condition X6 is
X6
established. By this way, it can circulate control with repeat again and again.
S0
It is used for ladder step mode. This figure means internal edition program is a general step
ladder diagram not step ladder program.
It is for primary step point. This double-frame is used for SFC primary step point and the usage
devices are S0~S9.
It is used for general step point and the usage devices are S10~S1023.
It is JUMP step point that used to move from step point to another which is not next to it. (it can
be used to disconnected jump up or jump down in the same program procedure, return to
primary step point or jump between different program procedure.
It is the transition condition of step point that used to move between each step point.
It is alternative divergence that used for a step point to move to different corresponding step
point by different transition condition.
It is alternative convergence that used for two step points and above to move to the same step
point according to transition condition.
It is simultaneous divergence that used for a step point move to two step points and above by the
same transition condition.
It is simultaneous convergence that used for two step points and above to move to the same step
point with the same transition condition when the condition is established at the same time.
STL command: this command is used in the syntax design for the Sequential Function Chart (SFC). This
command helps the program designer to have clearer ideas on the program procedure, and thus the procedure will
be more readable. As shown in the following diagrams, we could switch our procedure diagram from the left
diagram to the right PLC structure diagram.
At the end of the step procedure, be sure to write in the RET command; the RET command indicates the end of
the step procedure. Several step procedures could be written in to the same program, just make sure to write in the
RET command at the end of the step procedure. There is no limitation to the usage of the RET command, and this
command should match up with the usage of the step points (S0~S9).
If the RET command is not written in at the end of the step procedure, this error will be detected by the editing
device.
M1002 M1002
primary pulse SET S0
S0 S0
S SET S21
S21
S21 S SET S22
S22
S SET S23
S22
S23
S S0
S23
RET
The step ladder is made up of numerous step points; each step point represents one control procedure action,
and each step point needs to execute following three missions:
A. drive output coil
B. specific transition condition
C. designate what step point is to be appointed to take over the control power of the present step point
Example:
S10 S10
S Y0 S Y0
SET Y1 SET Y1
X0 X0
When X0=ON,
SET S20 SET S20
S20=On,
S20 S10=Off. S20
S Y10 S Y10
X1 X1
SET S30 SET S30
Explanation:
When S10=ON, Y0 and Y1 are ON. When X0=ON, S20=ON and Y10 is ON, too.
And when S10 is OFF, Y0 will be OFF, but Y1 is ON. (Since Y1 uses the SET command, it will keep in ON status)
2. Step ladder timing: when state contact Sn is On, circuit will be activated and circuit won’t be activated when
state contact Sn is Off. (Above action will be executed after delaying a scan time)
SET Sn and OUT Sn commands are both used to start (or to transfer to) another step point, and the occasions to
use these commands could be different: when the controlling power is transferred to another step point, the status of
the original step point S and the action of the output point would all be erased. Due to that numerous step control
procedures could exist at the same program simultaneously (take S0~S9 as the starting and ending points to lead the
step ladder diagram), the transfer of steps could thus be on the same step procedure or could be transferred to
different step procedures. And thus, the transfer commands, SET Sn and OUT Sn, of the step point might vary
somewhat in usage; please refer to the following explanations:
Within the same procedure, transfer of the simultaneous convergence point and different procedures
OUT Sn
are used to drive up separate step points, and after the status is transferred, outputs of previous action
status points will be clear.
As in the following left diagram, after the LD or LDI command is written in the second line of BUS beyond the step
point, output coil can’t be connected from BUS directly. There will be error when compiling. It is needed to modify to
following middle and left diagram to correct diagram.
BUS
Sn Sn Sn
S Y0 S Y0 S Y0
M0 M0
Y1 Y2 or Y1
M0 M1000
Y2 Y1 Y2
modify position
normally open contact
in RUN mode
7. Usage restrictions for partial commands:
Program of every step point is identical to the general ladder diagram, and every kind of series and parallel
connection circuits or application commands could all be utilized, however, part of the commands are under certain
restrictions, please refer to the following descriptions:
※ The STL command could not be used in general sub-programs and the interruption service sub-program.
※ Use of the CJ command is not prohibited within the STL command, however, it will complicate the action and
should thus be avoided.
8. Other Notice:
For general, commands (SET S□ or OUT S□) that used to transfer to next state are better to use after finishing
all relative outputs and actions.
In the following figure, they are the same after executing by PLC. If there are many conditions or actions in S10, it
is recommended to execute SET S20 after modifying from left figure to right figure and finishing all relative outputs
and actions. In this way, the procedure is clear and easy to maintain.
S10 S10
S Y0 S Y0
SET S20 Y1
Y1 SET S20
S20 S20
S Y2 S Y2
S20 X1
S S0
RET
1. The step point up front in SFC is called the primary step point, S0~S9. Utilize the primary step point to be the start
of the procedure, and use the RET command as the end to construct a complete procedure.
2. If the STL command is not in use, S could be served as general auxiliary relay.
3. The number for the step point, S, could not be used repeatedly.
4. Categories of procedures:
Single procedure: there is only a procedure in a program (the alternative diverge and converge, the simultaneous
diverge and converge aren’t included)
Complicated single procedure: there is only a procedure in a program and it includes alternative diverge,
alternative converge procedures, Simultaneous diverge and simultaneous converge procedures.
Combination procedure: there are numerous single procedures in a program and maximum is 10 (S0~S9)
procedures.
5. Procedure separation: it is allowed to write in numerous procedures within one step ladder diagram
There are two single procedures S0 and S1 at the right OUT OUT
S0 S1
diagram; procedure of the program is to write in S0 ~S30 first,
and then S1~S43.
S21 S41
Either one step point on the procedure could jump to any one
specified step point on other procedures. OUT
S42
Once the condition below S21 at the right diagram is held, it
could jump to the specified S42 step point on the S1 procedure;
this motion is called the separate step point. S30 S43
When PLC encountered power failure, the retaining step point will memorize the ON/OFF status, and go on
with the execution before the power failure after the power is turned back on. S0~S127 are currently the retaining
step points.
9. Special auxiliary relay and special register: refer to chapter 4.6 IST command for detail.
Device Description
M1040 Step transition inhibits. When M1040 is On, all movement of step point are inhibited.
M1046 STL state setting. Once there is a step point On, M1046 is On.
A. Single procedure: the basic step action is single procedure control action.
The first step point of step ladder diagram is called primary step point and the number is S0~S9. Those step points
after primary step point are called general step point and the number are S10~S1023. S10~S19 will be used as origin
reset step points once use command IST.
After finishing a procedure, transferring control power of step point to primary step point.
RET
END
OUT
S21 S21 S41
OUT
S42
S42
S41 S43
S43
At the right diagram, S50 will Reset itself and end the
S0
procedure when condition is held.
S21
RST
S50
S20 X0
S SET S21
SET S22
SET S23
SET S24
S20
The situation that transfers to individual state when individual condition of present state is held is called structure of
alternative divergence as shown in following. S20 will transfer to S30 when X0=On, S20 will transfer to S31 when
X1=On and S20 will transfer to S32 when X2=On.
S20 X0
S SET S30
X1
SET S31
X2
SET S32
S20
X0 X1 X2
The situation that transfers to next state when continuous states are held at the same time is called simultaneous
convergence.
X2
S50
The following ladder diagram is alternative convergence. That means it will transfer to S60 once one of S30, S40 and
S50 is held.
S60
M1002
ZRST S0 S127 M1002
S1
SET S1
S1 X0 X0
S SET S20
S20 Y0
S20
S Y0
X1 X1 X4 X7
SET S30 S30 Y1 S31 Y3 S32 Y5
X4
SET S31 X2 X5 X10
X7 S40 Y2 S41 Y4 S42 Y6
SET S32
X3 X6 X11
S30
S Y1
X2 S50 TMR T1 K10
SET S40 T1
S40
S Y2 S60 Y7
X3 X12
SET S50
S31 S1
S Y3
X5
SET S41
S41
S Y4
X6
SET S50
S32
S Y5
X10
SET S42
S42
S Y6
X11
SET S50
S50
S TMR T1 K10
T1
SET S60
S60
S Y7
X12
S1
RET
END
M1002
M1002
ZRST S0 S127
S3
SET S3 X0
S3 X0 S20 Y0
S SET S20
X1
S20
S Y0
S30 Y1 S31 Y3 S32 Y5
X1
SET S30 X2 X3 X4
S40 Y2 S41 Y4 S42 Y6
SET S31
X5
SET S32
S50 TMR T1 K10
S30
S Y1 T1
X2 S60 Y7
SET S40 X6
S40
S Y2 S3
S31
S Y3
X3
SET S41
S41
S Y4
S32
S Y5
X4
SET S42
S42
S Y6
S40 S41 S42 X5
S S S SET S50
S50
S TMR T1 K10
T1
SET S60
S60
S Y7
X6
S3
RET
END
M1002
M1002
ZRST S0 S127
S4
SET S4 X0
S4 X0 S20 Y0
S SET S20 X1
S20
S30 Y1 S31 Y3 S32 Y5
S Y0
X2 X4 X6
X1
S40 Y2 S41 Y4 S42 Y6
SET S30
X3 X5 X7
RET
END
Combination example 1: (includes the alternative divergence and convergence, the simultaneous divergence
and convergence)
M1002 S51
ZRST S0 S127 S Y10
X12
SET S0 SET S61
S0 S61
S Y0 S Y14
X0 S60 S61 X15
SET S20 S S SET S70
S20 S70
S Y1 S Y17
X1 X17
SET S30 S0
X2 S32
SET S31 S Y4
X3 X6
SET S32 SET S41
S30 S41
S Y2 S Y6
X4 X10
SET S40 SET S52
S31
S Y3 SET S53
X5 S52
S Y11
SET S40
X13
S40
S SET S62
Y5
X7 S62
S Y15
SET S50
S63
S Y12
SET S51
X14
S50
S SET S63
Y7
S63
X11
S Y16
SET S60
S62 S63 X16
S60 S S S0
S Y13
RET
END
M1002
S0 Y0
X0
S20 Y1
X1 X2 X3
S30 Y2 S31 Y3 S32 Y4
X4 X5 X6
S40 Y5 S41 Y6
X7 X10
X15 X16
S70 Y17
S0
X17
S0
Combination example 2: (includes the alternative divergence and convergence, the simultaneous divergence
and convergence)
M1002
ZRST S0 S127 M1002
S0
SET S0
S0 X0 X0
S SET S30
S30
S30 Y0
S Y0 X1
X1 X1
SET S31
X1 S31 Y1 S32 Y2
SET S32
X2 X3
S31
S Y1
X2 S33 Y3
SET S33
X4
S32
S Y2
X3 S34 Y4 S36 Y6
SET S33
S33 X5 X6
S Y3
X4 S35 Y5 S37 Y7
SET S34
X7
SET S36
S34
S Y4 S0
X5
SET S35
S35
S Y5
S36
S Y6
X6
SET S37
S37
S Y7
S35 S37 X7
S S S0
RET
END
X1 X2 X3 X4 X5 X6 X7 X10
S30 Y1 S31 Y2 S32 Y3 S32 Y4 S34 Y5 S35 Y6 S36 Y7 S37 Y10
Program M1000
Example IST X10 S20 S60
1
X10: Individual operation (Manual operation) X14: Continuous operation
X11: Zero point return X15: Zero point return start switch
X12: Step operation X16: Start switch
X13: One cycle operation X17: Stop switch
When the IST command is executed, the following special auxiliary relay will switch
automatically.
M1040: Movement inhibited S0: Manual operation/initial state step point
M1041: Movement start S1: Zero point return/initial state step point
M1042: Status pulse S2: Auto operation/initial state step point
M1047: STL monitor enable
When IST command is used, S10~S19 are for zero point return operation and the step
point of this state can’t be used as general step point. However, when using S0~S9 step
points, S0 initiates “manual operation”, S1 initiates “zero point return operation” and S2
initiates “auto operation”. Thus, there should be three circuits of these three initial state
step points first written in program.
When switching to S1 (zero point return mode), zero point return won’t have any actions
once one of S10~S19 is On.
When switching to S2 (auto operation mode), auto operation won’t have any actions
once one of between to is On or M1043=On
Upper-limit X4 Y3 Y2
Y1
Upper-limit X5
Big/small Big Small
sensor X0
Control panel
Power start Zero return X15 Auto start X16
X0 X1 Y4
M1044
M1000
IST X10 S20 S80
SFC figure:
S1
X15
S10 RST Y4 Release balls
Ladder Diagram:
S1 X15
S SET S10 Enter zero return operation mode
S10
S RST Y4 Release balls
Y3
X1 Shift to left and shift to
SET S12 the left-limit (X1 is On)
S12
S SET M1043 Start zero return completed flag
SFC figure:
S2
M1041
M1044
S20 Y1
X5 X5
X0 X0
S30 SET Y4 S40 SET Y4
S50 Y1
X5
S60 RST Y4
TMR T2 K30
T2
S70 Y0
X4
X1
S80 Y3
X1
S2
Ladder Diagram:
S2 M1041 M1044
S SET S20 Enter auto operation mode
S20
S Y1 Lower robot arm
X5 X0
SET S30
X5 X0
SET S40
S30
S SET Y4 Collect balls
TMR T0 K30
T0
SET S31
S31
S Y0 Raise robot arm to the
upper-limit (X4 is ON)
X4
SET S32
S32 X2
S Y2 Shift to right
X2
SET S50
S40
S SET Y4 Collect balls
TMR T1 K30
T1
SET S41
S41
S Raise robot arm to the
Y0 upper-limit (X4 is ON)
X4
SET S42
S42 X3
S Y2 Shift to right
X3
SET S50
S50
S Y1 Lower robot arm
X5
SET S60
S60
S RST Y4 Release balls
TMR T2 K30
T2
SET S70
S70
S Y0 Raise robot arm to the
upper-limit (X4 is ON)
X4
SET S80
S80 X1
S Y3 Shift to left and shift to
the left-limit (X1 is On)
X1
S2
RET
END
Note 1: Applicable models ES series above includes EX and SS series; EP includes SA series.
Note 2: Above commands for ES/EX/SS models don’t possess pulse execution command (P command).
A command usually allows one step to be used and an operand usually allows two or four steps to be used
based on the command is a 16-bit or 32-bit command.
Explanation of the format of application command:
1 2 3 4 5 6 7
Some application commands are only combined by command codes API, but most of them are combined by
command codes API and several operands.
The application commands of DVP-Series PLC are controlled by command codes API 00 to API 246. Each
command code has its own meaning, for example, API 12 stands for MOV (move data). When using ladder
diagram editor to input programs, you will need to type in the command “MOV”. If using the HPP to input the
program, we will have to enter the API command codes. Each application command has its unique operand.
X0
MOV K10 D10
command operand
Source operand: if there is more than 1 source operand, then we use , … to display.
Destination operand: if there is more than one operand, then we use , …. to display.
If the operand may only be represented as a constant K, H or register then we will use , , ,
, , to display.
The length of operand can be divided into two groups: 16-bit and 32-bit to process different length data.
A ”D” before a command separates 32-bit from 16-bit commands.
The execution type of command can be divided into two types: continuous execution command and pulse
execution command. Due to the execution time is shorter when the commands have not been executived,
please use the pulse execution command as far as possible to reduce the scan cycle of programming. A “P” to
be added directly after the command, which is pulse execution commands. Most used commands usually
use pulse execution commands for application, for example, INC, DEC and MOV etc. related commands.
Therefore, pulse execution commands are identified by the symbol ☺ on the right top of the command.
The above figures show that when X0, X1=OFF, the command will not be executed and the contents of
1. Bit device such as X, Y, M, S can be combined together and are defined as the WORD device. In
application commands, the bit device can serve as the word device (KnX, KnY, KnM, KnS) to store the
numeric values to operate.
2. Data register D, Timer T, Counter C and Index Register E, F are all assigned devices of operands.
3. A data register is usually a 16-bit register and it is also a register D. Hence, assigning a 32-bit register also
means assigning two register D with continuous numbers.
4. If the operand of 32-bit command assign D0, the 32-bit data register which is combined by D1 and D0 will
be occupied. D1 is the upper 16-bit and D0 is the lower 16-bit. The using rule of timer T and 16-bit
Counter(C0~C199) is the same.
5. When the 32-bit counter(C200~C255) is used as Data register, one point indicates 32-bit length. Only the
operand of 32-bit command can be assigned, the operand of 16-bit command can not be assigned.
1. X, Y, M, S are only be single point ON/OFF, these are defined as a bit device.
2. However, 16-bit (or 32-bit) device T, C, D, E, F are data registers and are defined as Word device.
3. We also can add Kn in front of X, Y, M and S to be defined as word device, whereas n=1 means 4-bit. So
16-bit can be described from K1 to K4, and 32-bit can be described from K1 to K8. For example, K2M0
means there are 8-bit from M0 to M7.
Specified Number of Digits (16-bit command): Specified Number of Digits (32-bit command):
K-32,768~K+32,767 K-2,147,483,648~K+2,147,483,647
16-bit command: (K1~K4) 32-bit command: (K1~K8)
K1 (4 points) 0~15 K1 (4 points) 0~15
K2 (8 points) 0~255 K2 (8 points) 0~255
K3 (12 points) 0~4,095 K3 (12 points) 0~4,095
K4 (16 points) -32,768~+32,767 K4 (16 points) 0~65,535
K5 (20 points) 0~1,048,575
K6 (24 points) 0~167,772,165
K7 (28 points) 0~268,435,455
K8 (32 points) -2,147,483,648~+2,147,483,647
Flags
1. General Flags
For the operation result of application commands, there are following flags of DVP series PLC:
Example : M1020 : Zero flag M1022 : Carry flag M1021 : Borrow flag
M1029 : Command execution completed flag
When executing the command, all flags will be turned to ON or OFF by the operation result of
application commands. However, when the command has not been executed, the ON/OFF state of
the flags will remain. Therefore, please notice that the above flags may not only be in connection with
specified commands but also many commands.
When the conditional contact is ON, the digital switch input command (DSW) will specify 4 output
points with 0.1 second frequency and circulate in order automatically to read the values of DSW.
During the intermediate period of operation, if the conditional contact is OFF, the DSW command is
suspended and the above-mentioned command will be re-executed from the beginning of the
program cycle.When the conditional contact is ON again, please refer the circuit below if you desire
to stop the interrupt.
If the combination of the application command is error and/or the assigned devices of operands are out of
range, errors will occur and the error flags and numbers in the following table will be shown during the
excution of the application commands.
M1067 When error operations occur, M1067=On, D1067 will show the error number and D1069 will
D1067 show the error address.
D1069 If other errors occur, the contents of D1067 and D1069 will be refreshed. (when the error is
resetd, M1067=Off)
M1068 When error operations occur, M1068=On, D1068 will show the error address.
D1068 If other errors occur, the contents of D1068 will not be refreshed, M1068 must use RST
command to reset to OFF, otherwise the error will remain.
Some application commands can extend the functions by using some special flags.
Example: command RS can switch transmission mode 8-bit and 16-bit by using M1161.
Some commands can be used several times in the program, but some of them only can be used twice or even
once in the program. However, these commands can be modified by index register to extend more functions of
the commands in the operands.
1. Only can be used once in the program:
5. API 53 (DHSCS) and API 54 (DHSCR), these commands only can be executed simultaneously less than four
times in the program of DVP-ES/EX/SS models.
6. API 53 (DHSCS), API 54 (DHSCR), API 55(DHSZ) these commands only can be executed simultaneously
less than six times in the program of DVP-EP/SA models.
There is no limited using time for executing the same command in the program. However, there are limited
using times for executing the commands simultaneously.
1. API 52 (MTR), API 56 (SPD), API 62 (ABSD), API 63 (INCD), API 69 (SORT), API 70 (TKY), API 71
(HKY), API 72 (DSW) (EP models), API 74 (SEGL)(EP models), API 75 (ARWS), API 80 (RS), API 100
(MODRD), API 101 (MODWR), API 102 (FWD), API 103 (REV), API 104 (STOP), API 105 (RDST), API
106 (RSTEF), API 150 (MODRW), API 151 (PWD), these commands only can be executed simultaneously
once in the program.
2. API 57 (PLSY), API 58 (PWM), API 59 (PLSR), API 72 (DSW) (EH models), these commands only can be
executed simultaneously twice in the program.
3. API 169 (HOUR) (EH models) only can be executed four times in the program.
4. API 64 (TTMR) (EH models) only can be executed eight times in the program.
5. In the program of DVP EH models, there is no limited using time for hardware high speed counter related
commands, like DHSCS, DHSCR and DHSZ. However, there are limited using times for executing the
commands simultaneously. DHSCS, DHSCR command will use one memory unit and DHSZ command will
use two memory units. When these commands are executed simultaneously, the total used memory units
can not exceed eight memory units. If exceeding eight memory units, system will totalize the used memory
units of the commands which have been scanned and executed first, the others will be ignored.
Device such as X, Y, M, S are bit devices and there are only two state, ON and OFF. However, T, C, D, E,
F are data registers and are defined as word devices. Although bit device can only be single point
ON/OFF but it can be used as numeric value in the operands of application commands if adding the
specified bit device in front. The “specified bit device” is the “specified number of digit” and it would look
like Kn where “n” can be a number from the range of 0 to 8.
16-bit can be described from K1 to K4, and 32-bit can be described from K1 to K8. For example, K2M0
means there are 8-bit from M0 to M7.
valid data
D1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
equal to
low byte
D1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1
Transmit K1M0, K2M0, K3M0 to 16-bit registers and insufficient upper bit data have not been transmitted.
It’s the same as sending K1M0, K2M0, K3M0, K4M0, K5M0, K6M0, K7M0 to 32-bit registers and the
insufficient upper bit data have not been transmitted also.
The insufficient upper bit will be defined as 0 if the content of the operand assign K1 to K3 in 16-bit
operation or assign K4 to K7 in 32-bit operation. Therefore, it means the operation result is positive.
M0
The BCD value combined by X4 to X13 will be converted to
BIN K2X4 D0
D0 as BIN value.
The numbers of Bit device can specify freely. However, it is recommended to use 0 in the lowest digit
decimal place of X and Y devices (X0, X10, X20…Y0, Y10, Y20). For M and S Series, it is recommended
to use the multiple 8 but the use of 0 is the most device efficient, like M0, M10, M20…etc.
For example , like D date register, the continuous numbers of D are D0, D1, D2, D3, D4…etc.
For the bit device, the continuous numbers are shown as follows:
The bit device numbers are all of the above. To avoiding errors, please do not skip over the continuous
numbers. Furthermore, if K4Y0 is used in 32-bit operation, the upper 16bit is defined as 0. Therefore, it is
recommended to use K8Y0 in 32bit operation.
Floating Point Operation
The internal operation of DVP series PLC usually is operated by “BIN integer” format. When performing integer
division operation, the decimal point will be discarded. For example: 40 ÷ 3 = 13, remainder is 1 and the
decimal point will be discarded. But if use floating point operation, the decimal point can be given.
The application commands related to floating point operation are shown in the following table.
API 49 (FLT), API 110 (D ECMP), API 111 (D EZCP), API 116 (D RAD),
API 117 (D DEG), API 118 (D EBCD), API 119 (D EBIN), API 120 (D EADD),
API 121 (D ESUB), API 122 (D EMUL), API 123 (D EDIV), API 124 (D EXP),
API 125 (D LN), API 126 (D LOG), API 127 (D ESQR), API 128 (D POW)
API 129 (INT) API 130 (D SIN) API 131 (D COS) API 132 (D TAN)
API 133 (D ASIN) API 134 (D ACOS) API 135 (D ATAN) API 136 (D SINH)
API 137 (D COSH) API 138 (D TANH)
DVP PLC represents floating point number with 32-bit number by IEEE754 and the format is in the following:
8-bit 23-bit
S exponent mantissa
b 31 b0
Sign bit
0: positive
1: negative
Therefore, the range of 32-bit floating is from ±2-126 to ±2+128, i.e. from ±1.1755×10-38 to ±3.4028×10+38.
Step 2: Normalizing the binary: 10111=1.0111 × 24, 0111 is mantissa and 4 is an exponent.
Step 4: We can now combine the sign, exponent, and normalized mantissa into the binary IEEE short real
representation.
0 10000011 011100000000000000000002=41B8000016
Example 2: using 32-bit floating point to represent decimal number –23
The conversion steps are the same as decimal number 23. Only need to modify sign bit from 0 to 1 to get value
1 10000011 011100000000000000000002=C1B8000016
DVP PLC also uses two registers with continuous number to store binary floating point. The following is the example
that uses register (D1, D0) to store binary floating point.
D1(b15~b0) D0(b15~b0)
7 6 5 1 0 -1 -2 -3 -17 -18 -19 -20 -21 -22 -23
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
S E7 E6 E5 E1 E0 A22 A21 A20 A6 A5 A4 A3 A2 A1 A0
b31 b30 b29 b28 b24 b23 b22 b21 b20 b6 b5 b4 b3 b2 b1 b0
Decimal floating point is stored in the register with 2 continuous numbers. The register with small number stores
constant and the register with larger number stores exponent.
For example, using register (D1, D0) to store a decimal floating point.
Decimal floating point = [constant D0] X 10 [exponent D1 ]
constant D0 = ±1,000~±9,999
exponent D1 = - 41~+35
the most significant bit of (D1, D0) is symbol bit.
Besides, constant 100 doesn’t exist in D0 due to 100 will be shown with 1,000×10-1.
The range of decimal number is from ±1175×10-41 to ±3402×10+38.
The conversion command for Binary floating point Decimal floating point (D EBCD)
The conversion command for Decimal floating point Binary floating point (D EBIN)
Zero flag (M1020), Borrow flag (M1021) and carry flag (M1022)
The index register is 16-bit register. There are 2 devices for ES/EX/SS models (E and F), 8 devices for EP
models (E0~E3, F0~F3) and 16 devices for EH models (E0~E7, F0~F7).
MOV K20E0 D10F0 according to the contents of E, F. and we name this kind of
modification as “Index”.
E0=8 F0=14 For example, E0=8 and K20E0 all represent constant
20+8=28 10+14=24 K28(20+8). If the contact is ON, constant K28 will be
K28 D24 transmit transmitted to register D24.
Devices can use Index register to modify in ES/EX/SS Series are: P, X, Y, M, S, KnX, KnY, KnM, KnS, T, C, D.
Devices can use Index register to modify in EP Series are: P, X, Y, M, S, KnX, KnY, KnM, KnS, T, C, D
Devices can use Index register to modify in EH Series are: P, I, X, Y, M, S, K, H, KnX, KnY, KnM, KnS, T, C, D
The above device can use index register E, F to modify. However, index register E, F cannot modify itself,
either Kn. (K4M0E0 is available, K0E0M0 is not available). In each application command, if the symbol “*” is
added in the table of operand, it means the device can use index register E, F to modify.
Index register E, F can be used to modify P, I, X, Y, M, S, KnX, KnY, KnM, KnS, T, C, D these devices under
certain condition. Two devices, E or F can be specified when using 16-bit register. If using index register E, F to
modify constant K, H in 32-bit command, only one device, E can be specified.
When constant (K,H) is used to be index function in WPLSoft command mode, it needs to use symbol
“@”.
There are limited using times of some commands. If using the index register E, F to modify, the final result can
be the same as the operation result of using the same command repeatedly.
Note 1: Applicable models ES series above includes EX and SS series; EP includes SA series.
Note 2: Above commands for ES/EX/SS models don’t possess pulse execution command (P command).
When X0=On, the program will skip from address 0 to N (label P1) automatically and
Program keep on executing. But the area between address 0 and N will be skipped and will not
Example be executed.
1 When X0=Off, as usual, the program will keep on executing from address 0. CJ
command will not be executed.
(CJ command) P***
X0
0 CJ P1
X1
Y1
X2
P1 N Y2
There are five situations that the CJ command can be executed between the
Program commands MC and MCR.
Example
2 1. Out of MC~MCR.
(1) This function is only provided in V4.9 (included) or higher version of ES series
models and EP/EH series models.
X0
MC N0
X2
CJ P0
X3
CJ P1
X1
MC N1
M1000
P1 Y1
MCR N1
M1000
P0 Y0
MCR N0
Note 2: When timer that subroutine used (T192~T199, for EP/EH) executes CJ command, it
will keep counting. After timer attains, output contact of timer will be On.
Note 3: When high-speed counters (C235~C255) execute CJ command, it will kekep counting
and output point will also continue act.
Y1 is double or dual coil designation. When M0=Off, it is controlled by M1. When M0=On,
it is controlled by M12.
M0
CJ P0
M1
Y1
M2
M20
M17
CJ P0
M3
S1
M4
TMR T0 K10
M5
RST T127
M6
TMR T127 K1000
M7
RST C0
M1
CNT C0 K20
M11
MOV K3 D0
M0
P0 CJ P63
M12
Y1
M13
P63 RST T127
RST C0
RST D0
END
32-bit command
- - - -
Flag: None
X0 P***
20 CALL P2 call subroutine P***
X1
24 Y1
FEND
P2 Y0
subroutine
Subroutine P2 Y0
When X10 is the rising-edge triggered CALL P10 command that goes from Off to On,
Program
Example jump to P10 and run subroutine.
2 When X11 is On, execute CALL P11, jump to P11 and run subroutine.
When X12 is On, execute CALL P12, jump to P12 and run subroutine.
When X13 is On, execute CALL P13, jump to P13 and run subroutine.
When X14 is On, execute CALL P14, jump to P14 and run subroutine. When run SRET
command, it will jump back to the last P*** subroutine and keep running.
Run SRET command in the P10 subroutine and return to the main program.
X0 X2
INC D0 P12 INC D30
Y0 Y10
X10 X13
CALL P10 CALL P13
Main subroutine
X0 Program X2
INC D1 INC D31
Y1 Y11
FEND SRET
X2 X2
P10 INC D10 P13 INC D40
Y4 Y12
X11 X14
CALL P11 CALL P14
subroutine subroutine
X2 X2
INC D11 INC D41
Y5 Y13
SRET SRET
X2 X2
P11 INC D20 P14 INC D50
Y6 Y14
X12 subroutine
CALL P12 SRET
subroutine
X2
INC D21 END
Y7
SRET
Even in the interrupt allowed range when interrupting special the auxiliary relay M1050
to M1059 in ES / EP series models and M1280 to M1294 in EH series models, the
corresponding interrupting request will not be activated.
EI
X0
Y1 Enabled interrupt
DI
Disabled interrupt
EI
Enabled interrupt
FEND
I 101 Y0
Interrupt subroutine A
IRET
I 201 Y0
Interrupt subroutine B
IRET
3. High-speed counter interrupts: I010, I020, I030, I040 4 points. (used with API 53
DHSCS command and interrupt signal occurs)
3. High-speed counter interrupts: I010, I020, I030, I040 4 points. (used with API 53
DHSCS command and interrupt signal occurs)
4. The interrupt, start and end of pulse output interrupt should be used with API 57
PLSY command. I130, I140 are triggered at the beginning of the pulse output by
the start-arranged flag of pulse output command M1342, M1343. Then, M1340,
M1341 will trigger I110, I120 at the end of pulse output command to interrupt the
executing program and jump to the assigned interrupt subroutine to execute .
5. Communication interrupt for specific characters received (I150)
6. The order of the interrupt pointer I : External interrupts, time interrupts, high-speed
counter interrupts, and pulse output interrupts.
Interrupt Inhibit Flag of ES series models:
Flag Function
M1050 External interrupt, I 001 masked
M1051 External interrupt, I 101 masked
M1052 External interrupt, I 201 masked
M1053 External interrupt, I 301 masked
Flag Function
M1050 External interrupt, I 001 masked
M1051 External interrupt, I 101 masked
M1052 External interrupt, I 201 masked
M1053 External interrupt, I 301 masked
M1054 External interrupt, I 401 masked
M1055 External interrupt, I 501 masked
M1056 Time interrupt, I6□□ masked
M1057 Time interrupt, I7□□ masked
M1059 High-speed counter interrupt, I010~I040 masked
Flag Function
M1280 External interrupt, I00□masked
M1281 External interrupt, I10□masked
M1282 External interrupt, I20□masked
M1283 External interrupt, I30□masked
M1284 External interrupt, I40□masked
M1285 External interrupt, I50□masked
M1286 Time interrupt, I60□masked
M1287 Time interrupt, I70□masked
M1288 Time interrupt, I80□masked
M1289 High-speed counter interrupt, I010 masked
M1290 High-speed counter interrupt, I020 masked
M1291 High-speed counter interrupt, I030 masked
M1292 High-speed counter interrupt, I040 masked
M1293 High-speed counter interrupt, I050 masked
M1294 High-speed counter interrupt, I060 masked
M1295 Pulse output interrupt insert I110 masked
M1296 Pulse output interrupt insert I120 masked
M1297 Pulse output interrupt insert I130 masked
M1298 Pulse output interrupt insert I140 masked
M1299 Pulse output interrupt insert I150 masked
M1340 After CH0 pulse is transmitted, I110 interrupt occur
M1341 After CH1 pulse is transmitted, I120 interrupt occur
M1342 CH0 pulse is transmitted; meanwhile, I130 interrupt occur simultaneously
M1343 CH1 pulse is transmitted; meanwhile, I140 interrupt occur simultaneously
This command denotes the end of the main routine program. It has the same function
Command
Explanation as END command during PLC operation.
CALL must follow right after FEND command and add SRET command at the end of
the subroutine. Interrupt commands also have to follow after FEND command and add
IRET command at the end of the service program.
If using several FEND commands, please place the subroutine and interrupt service
programs between the last FEND and END command.
After CALL command is executed, the program error will occur when execute the FEND
command before SRET command is executed.
After FOR command is executed, the program error will occur when execute the FEND
command before NEXT command is executed.
The program flow The program flow when X0=On
CJ Command when X0=off, 0 program jumps to P0
ProgramFlow X1=off
main
program
X0
CJ P0
X1
CALL P63
main
program
main
P0 program
command CALL
P63 subroutine
interrupt
I301
subroutine
main
P0 program
command CALL
P63
subroutine
I301 interrupt
subroutine
Flag: None
WDT (Watch Dog Timer) is used to monitor the PLC operation in the DVP series PLC
Command
system.
Explanation
The WDT command can be used to reset the Watch Dog Timer. If the PLC scanning
time (from step 0 to END or FEND command) is more than 200ms, the ERROR LED will
flash. The user will have to turn the PLC off and then back ON to clear the fault. PLC will
determine the status of RUN/STOP according to RUN/STOP switch. If there is no
RUN/STOP switch, PLC will return to STOP automatically.
T1 t2
Use the set value of D1000 (default is 200ms) to change the watchdog time.
If the program scanning time is over 300ms, users can divide the program into 2 parts.
Program
Insert the Watchdog Timer in between, so both programs’ scanning time will be less
Example
than 200ms.
300ms program
END
Dividing the program to two parts
so that both parts’ scan time are
less than 200ms.
150ms program
X0
WDT Watchdog timer reset
150ms program
END
FOR and NEXT commands are used when “n” nested loops are needed.
Command
“N” may be within the range of K1 to K32767. If the range N≦K1, N will always be K1.
Explanation
When it is not desired to execute the FOR to NEXT commands, use the CJ command.
Error will occur in the following conditions:
NEXT command is before FOR command.
With FOR command, without NEXT command.
There is a NEXT command after the FEND or END command.
The numbers of FOR to NEXT commands are different.
The FOR to NEXT loop can be nested for five levels but please notice that if there are
too many loops, the PLC scanning time will increase and it may cause the watchdog
timer to be activated and result in error. User can use WDT command to modify.
After loop A operate 3 times, the program after the NEXT command will resume. For
Program
Example every completed cycle of loop A, loop B will completely executed for 4 times, therefore,
1 the total number of times that loop B operate will be 3 ×4=12 times.
FOR K3
FOR K4
B A
NEXT
NEXT
Program which executes the FOR to NEXT commands when X7 is off. It does not
Program
Example execute the FOR to NEXT commands when X7 is on and CJ command jump to P6.
2
X7
CJ P6
M0
MOV K0 D0
FOR K3
M0
MOV D0 D1
INC D0
MEXT
X10
P6 Y10
When the FOR to NEXT command are not executed, CJ command can be used to
Program
Example jump. When the most internal loop of FOR to NEXT, X1 will be ON and CJ command
3 will jump to P0 and not be executed.
X0
TMR T0 K10
FOR K4X100
X0
INC D0
FOR K2
X0
INC D1
FOR K3
X0
INC D2
FOR K4
X0
WDT
INC D3
X1
CJ P0
FOR K5
X0
INC D4
NEXT
P0 NEXT
NEXT
NEXT
NEXT
END
Y2
If K10<D10, Y2= On
X10 X10
RST M0 ZRST M0 M2
RST M1
RST M2
RST M1
RST M2
X1
MOV T0 D10
X2
DMOV D20 D30
D10(BIN 16bit)
Auto conversion
3 2 1 0
10 10 10 10 D10(BCD 4 digits)
No variation Shift move
No variation
2
10
3
10 10
1
10
0
D20(BCD 4 digits)
Auto conversion
D20(BIN 16bit)
If D10=H1234,D20=H5678 before executing, D10 won’t change and D20=H5128 after
finishing execution.
When M1168=On, if use SMOV command, the D10 and D20 do not move data in BCD
Program
Example format. However the data is moved as a 4 digit BIN number.
2
M1000
M1168
X0
SMOV D10 K4 K2 D20 K3
Shift move
D20(BIN 16bit)
Digit 4 Digit 3 Digit 2 Digit 1
No variation No variation
Digit switch connected to the interrupted number inputs can use SMOV command to
Program
Example combine.
3 Move the right second digit switch to the right second digit of D2 and move the left first
digit switch to the right first digit of D1.
Use SMOV command to move the first digit to the third digit of D2 and combine these
two digit switches into one group.
2 1 0
10 10 10
6 4 2
8 8
8
X13~X10 X27~X20
PLC
M1001
M1168
M1000
(X20~X27)BCD
BIN K2X20 D2 2 digits D2(BIN)
D1 (X10~X13)BCD
BIN K1X10
1 digit D1(BIN)
SMOV D1 K1 K1 D2 K3
b 15 b3 b2 b1 b0
D1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Symbol bit (0=positive, 1=negative)
0 1 0 1
M4
M5
n=3
M6
M7
M8 Y10
M9 Y11
M10 Y12
M11 Y13
The BMOV command has built the automatic movement as the program example below
Program
Example to prevent overwriting errors from occurring when the specified numbers of and
3 coincide.
When > , the BMOV command is processed in the order as 1→2→3
When < , the BMOV command is processed in the order as 3→2→1.
But, be sure to avoid the specified number being continuous when < in
ES series models. Otherwise, the execution result will be the same value. For
example, when the BMOV command is processed in the order as 3→2→1, the
content value of D11 to D13 will all be the content value of D10.
X10 1
BMOV D20 D19 K3 D20 D19
2
D21 D20
3
D22 D21
X11 3
BMOV D10 D11 K3 D10 D11
2
D11
1
D12 D13
When X0=ON, move Constant K10 to the continuous five registers (D10~D14) starting
Program
from D10.
Example
X10
FMOV K10 D10 K5
K10 D11
K10 D13
K10 D14
Before After
execution execution
D20 120 40 D20
When X0=Off→On, the contents of D20 and D40 exchange with each other.
Program X0
Example D100 D200
2
Before After
execution execution
D100 D100
D101 20 40 D101
D200 D200
D201 40 20 D201
In 16-bit command, when the devices specified by and are the same and
Footnote M1303=On, the upper and lower 8-bit contents of that specified devices will exchange.
In 32-bit command, when the devices specified by and are the same and
M1303=On, the upper and lower 8-bit contents of that 32-bit devices will exchange.
When X0=On and M1303=On, the upper and lower 8-bit contents of D100, D0101 will
exchange.
Before After
X0 execution execution
M1303
D100L 9 20 D100L
Converts BIN data (0 to 9999) of the source device into BCD and transfers the
Command
result to the device .
Explanation
If the BCD conversion result is outside the range of 0 to 9999, an operation error occurs,
the error flag M1067, M1068 will be On and D1067 record error code “0E18”
(hexadecimal number).
If the DBCD conversion result is outside the range of 0 to 99,999,999, an operation error
occurs, the error flag M1067, M1068 will be On and D1067 record error code “0E18”
(hexadecimal number).
The operation value of four fundamental operations (+, −, ×, ÷), INC and DEC command
in PLC are executed in BIN format. This command can be used to output BIN format
data in BCD format value directly to a seven segment display.
When X0=ON, the binary data D10 is converted into BCD number, and stored at K4Y0
Program
(Y0~Y3).
Example
X0
BCD D10 K1Y0
8 8 8 8
X17 X0
4 digit BCD value
Y37 Y20
1. If the operation result is “0”, then the Zero flag, M1020 is set to ON.
2. If the operation result exceeds -2,147,483,648, the borrow flag, M1021 is set to ON.
3. If the operation result exceeds 2,147,483,647, the carry flag, M1022 is set to ON.
16-bit command:
Program
When X0 is ON, the data contained within the augend D0 and addend D10 is combined
Example and the total is stored in the result device D20.
1 X0
ADD D0 D10 D20
(D0) + (D10) = (D20)
32-bit command:
Program
Example When X0 is ON, the data contained within the augend (D31, D30) and addend (D41, D40)
2 is combined and the total is stored in the result device (D51, D50). (D30, D40, D50 is the
lower 16-bit data, and D31, D41, D51 is the higher 16-bit data)
X10
DADD D30 D40 D50
(D31, D30) + (D41, D40) = (D51, D50)
Flag operations:
16-bit command: Zero flag Zero flag Zero flag
Footnote
The flag operations of SUB command please refer to the flag operations of ADD
command on the previous page.
16-bit command:
When X0 is ON, the data contained within the subtrahend D10 is subtracted from the data
Program
Example contained within the minuend D0 and the result of this calculation is stored in the result
1 device D20.
X0
SUB D0 D10 D20
(D0) − (D10) = (D20)
32-bit command:
Program
Example When X0 is ON, the data contained within the subtrahend (D41, D40) is subtracted from
2
the data contained within the minuend (D31, D30) and the result of this calculation is
stored in the result device (D51, D50). (D30, D40, D50 is the lower 16-bit data, and D31,
D41, D51 is the higher 16-bit data)
X10
DSUB D30 D40 D50
(D31, D30) − (D41, D40) = (D51, D50)
+1
When is bit device, it can specify K1~K4 and produce a 16-bit result. Then, the flag
M1067, M1068 will be On and D1067 record error code “0E19”.
32-bit command:
+1 +1 +3 +2 +1
b31.. b16 b15.. b00 b31.. b16 b15.. b00 b63. b48 b47. b32 b31. b16 b15. b00
X =
b31 is a symbol bit b31 is a symbol bit b63 is a symbol bit (b15 of D+1 )
b31=0,S 1 (S 1 +1) are positive value b31=0,S 2 (S 2 +1) are positive value b63=0, D1(D1+1) (D1+2) (D1+3) are positive value
b31=1,S 1 (S 1 +1) are negative value b31=1,S 2 (S 2 +1) are negative value b63=1, D1(D1+1) (D1+2) (D1+3) are negative value
When is bit device, it can specify K1~K8 and produce a 32-bit result. The
destination device is used to store low 32-bit data only.
16-bit command:
Program
A 16-bit data source, D10 is multiplied by another 16-bit data source, D0 and the total is a
Example 32-bit result, D20. The upper 16-bit data is stored in D21 and the lower one is stored in
D20. The polarity of the result is indicated by the OFF/ON of the most significant bit. OFF
indicates the value of positive 0 and ON indicates the value of negative 1.
X0
MUL D0 D10 D20
/ =
When D
is bit device, it can specify K1~K4 to produce a 16-bit result and occupies 2
continuous groups. In regards to the operation result, the quotient and remainder are
stored.
32-bit command:
Quotient Remainder
+1 +1 +1 +3 +2
/ =
When D
is bit device, it can specify K1~K8 and produce a 32-bit result. In regards to
the operation result, only the quotient is stored.
When X0 is ON, the primary source D0 (divisor) is divided by the second source D10
Program
(dividend). The quotient is specified to be stored in D20 and the remainder is specified to
Example
be stored in D21. The polarity of the result is indicated by the OFF/ON of the most
significant bit. OFF indicates the value of positive and ON indicates the value of
negative.
X0
DIV D0 D10 D20
: Destination device
Command
If the command is not the pulse execution command, “1” is added to the value of
Explanation
destination device on every execution of the command.
This command is usually pulse execution (INCP, DINCP).
In 16-bit command, when +32,767 is reached, “1” is added and it will write a value
of –32,768 to the destination device. In 32-bit command, when +2,147,483,647 is
reached, “1” is added and it will write a value of -2,147,483,648 to the destination device.
Flag M1020~M1022 won’t be influenced by the operation result of this command.
When X0 is ON, the content of D0 will perform the addition of 1.
Program X0
Example INCP D0
: Destination device
Command
If the command is not the pulse execution command, “1” is subtracted to the value of
Explanation
destination device on every execution of the command.
This command is usually pulse execution (INCP, DINCP).
In 16-bit command, when –32,768 is reached, “1” is subtracted and it will write a value of
+32,767 to the destination device. In 32-bit command, when -2,147,483,648 is reached,
“1” is subtracted and it will write a value of +2,147,483,647 to the destination device.
After
execution D4 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0
When X1 is ON, the 32-bit data source device (D11, D10) and (D21, D20) are analyzed
Program
Example and the operation result of the logical DAND command is stored in the device (D41,
2 D40).
X1
DAND D10 D20 D40
b31 b15 b0
1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1
Before
D11 D10 DAND
execution
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
D21 D20
After
execution 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0
D41 D40
After
execution D4 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
When X1 is ON, the 32-bit data source device (D11, D10) and (D21, D20) are analyzed
Program
Example and the operation result of the logical DOR command is stored in the device (D41, D40).
2 X1
DOR D10 D20 D40
b
b31 b15 b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before
execution D11 D10 DOR
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
D21 D20
After
execution 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
D41 D40
b15 b00
D0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before
execution WOR
D2 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
After
execution D4 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0
When X1 is ON, the 32-bit data source device (D11, D10) and (D21, D20) are analyzed
Program
Example and the operation result of the logical DXOR command is stored in the device (D41,
2 D40).
X1
DXOR D10 D20 D40
b
b31 b15 b0
1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1
Before
execution D11 D10 DXOR
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
D21 D20
After
execution 1 1 1 0 1 1 0 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 0 1 0 0 1 1 1 0 1 1
D41 D40
When X goes from OFF → ON, every bit of the D10 contents will be countered (0→1,
Program
Example 1→0) and be added with 1, and will then be saved in the original register, D10.
1 X0
NEGP D10
M0
NEGP D0
M2
SUB D2 D0 D4
(D0=2)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
(D0=1)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
(D0=0)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(D0=-1) (D0)+1=1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
(D0=-2) (D0)+1=2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
(D0=-3) (D0)+1=3
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
(D0=-4) (D0)+1=4
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
(D0=-5) (D0)+1=5
1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
(D0=-32,765) (D0)+1=32,765
1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
(D0=-32,766) (D0)+1=32,766
1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
(D0=-32,767) (D0)+1=32,767
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
(D0=-32,768) (D0)+1=32,768
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
When X0 goes from OFF to ON, the 16 bit data of D10 will rotate 4 bits to the right, as
Program shown in the diagram, and b3 that located at D10 originally will then be moved to the
Example
carry flag (CY) M1022.
X0
RORP D10 K4
: Rotation device (destination device) : Bit places after one time rotation
Command
The bit pattern of device with the attached carry flag (M1022) is rotated
Explanation
bit places to the right on every operation of the command.
This command is usually pulse execution (RCRP, DRCRP).
When X0 goes from OFF to ON, the 16 bit data of D10, including the attached carry
Program flag (M1022), will rotate 4 bits to the right, as shown in the diagram, and b3 that
Example
located at D10 originally will then be moved to the carry flag M1022, and that the
original contents of the carry flag M1022 will be moved to the bit of b12.
X0
D10 K4
: Rotation device (destination device) : Bit places after one time rotation
Command
The bit pattern of device with the attached carry flag (M1022) is rotated
Explanation
bit places to the left on every operation of the command.
This command is usually pulse execution (RCLP, DRCLP).
When X0 goes from OFF to ON, the 16 bit data of D10, including the attached carry
Program flag (M1022), will rotate 4 bits to the left, as shown in the diagram, and b12 that
Example
located at D10 originally will then be moved to the carry flag M1022, and that the
original contents of the carry flag M1022 will be moved to the bit of b3.
X0
RCLP D10 K4
4 3 2 1
X0
SFTR X0 M0 K16 K4
1 2 3 4
X0
WSFRP D10 D20 K16 K4
D13 D12 D11 D10 4 registers in one group shift to the right
5
D35 D34 D33 D32 D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20 Carry
4 3 2 1
When X0 goes from OFF to ON, the word register data of Y10~Y27 are paralleled a
Program
shift area and shift 2 digits to the right.
Example
2 Please refer to the following ~ steps to perform WSFR command of one time shift.
Y17~Y10 → carry
Y27~Y20 → Y17~Y10
X27~X20 → Y27~Y20 complete
When using Kn device, the specified value must be equal
X0
WSFRP K1X20 K1Y10 K4 K2
X27 X26 X25 X24 X23 X22 X21 X20 2 digits shift to the right
3
Y27 Y26 Y25 Y24 Y23 Y22 Y21 Y20 Y17 Y16 Y15 Y14 Y13 Y12 Y11 Y10 Carry
2 1
When X0 goes from OFF to ON, the 16 register data of D20~D35 are paralleled a shift area
Program and shift 4 register to the right.
Example
Please refer to the following ~ steps to perform WSFL command of one time shift.
D35~D32 → carry
D31~D28 → D35~D32
D27~D24 → D31~D28
D23~D20 → D27~D24
D13~D10 → D23~D20 complete
X0
WSFLP D10 D20 K16 K4
4 registers in one group shift to the left D13 D12 D11 D10
5
Carry D35 D34 D33 D32 D31 D30 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20
1 2 3 4
X0
SFWRP D20 D0 -K10
n = 10 points
D20 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
pointer
D0 = 3 2 1
This API 38 SFWR command can be used with the API 39 SFRD command to execute
Footnote the Write-in/Read Control of the First-in/First-OUT stack.
When X1 goes from OFF to ON, D9~D2 are all shifted one register to the right and the
Program content of D0 is substracted by 1 when the content of D1 is read and moved to D21.
Example
Please refer to the following ~ steps to perform SFRD command.
The content of D1 is read and moved to D21.
D9~D2 are all shifted one register to the right.
The content of D0 is substracted by 1.
X0
SFRDP D0 D21 K10
n = 10 points
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D21
pointer
data read
This API 38 SFWR command can be used with the API 39 SFRD command to execute
Footnote the Write-in/Read Control of the First-in/First-OUT stack.
The RST command can be independently used in the bit device, i.e. Y, M, S and in
Footnote word device, i.e. T, C, D.
API 16 FMOV command can also be used to transmit the data of K0 to word device,
i.e. T, C, D or to bit register, i.e. KnY, KnM, KnS, just as RST command.
X0
RST M0
RST T0
RST Y0
FMOV K0 D10 K5
: Decode source device : Destination device for storing the encode result
Command
: Decode data length
Explanation
Decodes the data of lower “n” bit of source device and stores the result of “2 n”
bit at device .
This command is usually pulse execution (DECOP).
is used in case of a bit device, 0<n≦8. But if n=0 or n>8, the calculation error
Program
Example will occur.
1 When n=8, the maxium decoded data is 2 8, equal 256 points. (Must notice the range
of the stored device after decoding. Please do not use repeatly.)
When X10 goes from Off → On, the data of X0~X2 will be decoded to M100~M107.
If data source is 1+2=3, M103 at the third position from M100 turns ON and is set to 1.
After the execution is completed, X10 is changed to OFF. The device which have been
decoded is still action.
X10
DECOP X0 M100 K3
X2 X1 X0
0 1 1
4 2 1
3
7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0
M107 M106 M105 M104 M103 M102 M101 M100
is used in case of a bit device, 0<n≦4, but if n=0 or n>4, the calculation error will
Program
Example occur.
2 When n=4, the maxium decoded data is 2 4, equal 16 points.
When X10 goes from Off → On, the data in D10 (b2 to b0) will be decoded and stored
at D20 (b7 to b0). The unused bits in D20 (b15 to b8) will be all set to 0.
Decodes three lower bits in D10 and stores at eight lower bits in D20 (one bit will be 1)
and the content of eight upper bits are all 0.
After the execution is completed, X10 is changed to OFF. The device which have been
decoded is still action.
X10
DECOP D10 D20 K3
D10
b15 b0
0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 When 3 is specified
at b2 to b0 of D10
4 2 1
all be 0 (zero)
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 result after decoding
b15 b0
D20
When 3 is specified as effective
b3 at the third position from bits, 8 points are occupied.
b0 turns ON and is set to 1
is used in case of a bit device, 0<n≦8. But if n=0 or n>8, the calculation error
Program
Example will occur.
1 When n=8, the maxium decoded data is 2 8, equal 256 points.
When X0 goes from Off → On, the data of 2 3 (M0 to M7) will be decoded and stored
at three lower bits of D0 (b2 to b0). The unused bits in D0 (b15 to b3) will be all set to
0.
After the execution is completed, X10 is changed to OFF and the data in
remain unchanged.
X0
ENCOP M0 D0 K3
all be 0 (zero)
4 2 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 result after encoding
b15 D0 b0
is used in case of a word device, 0<n≦4. But if n=0 or n>4, the calculation error
Program
Example will occur.
2 When n=4, the maxium decoded data is 2 4, equal 16 points.
When X0 goes from Off → On, the data of 2 3 (b0 to b7) in D10 will be decoded and
stored at three lower bits (b2 to b0) at D20. The unused bits in D20 (b15 to b3) will be
all set to 0. (b8 to b15 in D10 is not available)
After the execution is completed, X10 is changed to OFF and the data in
remain unchanged.
X0
ENCOP D10 D20 K3
Data inactivated
b0
0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 0
6 5 4 3 2 1 0
b15 D10
7
all be 0 (zero)
When X10 is ON, all the bits that with “1” as its content within D0 will be counted and
Program have this counted number stored in D2.
Example X10
SUM D0 D2
0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 3
D0 D2
When X0 is ON, and if the 15th bit of D0 is “1”, M0 is ON. But if the 15th bit of D0 is “0”,
Program
M0 is OFF.
Example
Once X0 is switched to OFF, M0 will stay at its previous ON/OFF status.
b15 b0
0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 M0=Off
D0
b15 b0
1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 M0=On
. D0
: Starting device for taking mean value : Destination device for storing
Command
the mean value : Device number for taking mean value
Explanation
Add the contents of registers specified by , and have the sum divided by
to take a mean value. To save this mean value in the designated .
If there is remainder in this calculation, ignore the remainder.
If the specified device number exceeds the normal usable range, only those that within
the range could be processed.
If the value of is out of the stated range (1~64), an “operation error” will be
generated.
When X10 is ON, add up the contents of the three registers starting from D0 (specified
Program
by this command), and divide the sum by three to take the mean vlaue. Then store this
Example
mean value in the specified device D10 and ignore the remainder.
X10
MEAN D0 D10 K3
(D0+D1+D2)/D3 D10
D0 K100
reminder = 3, be ignored
D2 K125
When X10 and X11 are simultaneously ON more than 2 seconds, the alarm device
Program
S910 is ON. Then even if X10 and X11 are changed to OFF, the alarm device S910
Example
will still remain ON. (But T10 will reset to OFF, present value is 0.)
When X10 and X11 are simultaneously ON less than 2 seconds, the present value of
T10 is reset to 0.
X3
ANRP
Flag:
Footnote 1. M1048 (Alarm device is activated): When M1049 is driven to be ON, if any one alarm
device of S899~S1023 (in EP series)/ S899~S1023 (in EH series) outputs, M1048 is
ON.
X1 X3
Y1
Y1
M1048
Y2
X4
ANRP
D0 D12
M1002
RST M1081
X10
FLT D0 D12
X11
DFLT D0 D20
When M1081 is On, the source data is converted from binary floating point to BIN
Program
Example integer. (ignore the decimal)
2 When X10 is ON, D0 and D1(binary floating point) are converted to D12 (BIN integer).
If D0(D1)=H47C35000, the floating point is 100,000. The execution result will be
D12=K32,767, M1022=On due to the value exceeds max. value of 16-bit register D12.
When X11 is ON, D1, D0 (binary floating point) are converted to D21, D20 (BIN
integer). If D0(D1)=H47C35000, the floating point is 100,000. The result will be saved
in 32-bit register D20(D21).
M1002
SET M1081
X10
FLT D0 D12
X11
DFLT D0 D20
7
1 2 5 4 (D31,D30)
decimal floating point (for monitor)
(D101,D100) (D200) BIN (D301,D300) 8
(D41,D40)
binary floating point binary floating point
3 32 bit integer
(D203,D202)
binary floating point
(D401,D400)
binary floating point
4. Save the result of K615 ÷ K10 to D301, D300 (binary floating point).
Save the result of of (D101, D100) ÷ (D203, D202) to D401, D400 (binary floating
point).
Save the result of (D401, D400) × (D301, D300) to D21, D20 (binary floating point).
7. Covert binary floating point (D21, D20) to decimal floating point (D31, D30).
8. Covert binary floating point (D21, D20) to BIN integer (D41, D40).
When X0 = ON, the output signal Y0~Y7 (8 points) are sent to output terminal
Program
Example immediately and refreshed. It desn’t need to output till END command.
2 X0
REF Y0 K8
For ES and EP series models, the input and output points processed by this command
Footnote are the I/O points of MPU: X0~X17, Y0~Y17 and n=K8 or K16.
During the program, the setting value can be moved to D1020 and D1021by using
MOV command.
The response time can be changed by using REFF command in the execution of
the program. At this time, the response time specified by REFF command will be
moved into D1020, D1021and it will be adjusted again in the next scan.
When the power of PLC turns from Off to On, the X20
Program REFF K5
Example response time of X0~X17 inputs is decided by the
X0
content value of D1020 and D1021. Y1
When X20=On, REFF K5 command is executed, X20
respone time is changed to 5 ms and and it will REFF K20
be adjusted again in the next scan. X1
Y2
When X20=Off, the REFF command will not be
executed, the response time is changed to 20ms
and it will be adjusted again in the next scan. END
When using the interrupt parameters, or high-speed counter, or SPD command (API
Footnote 56), the response time of corresponding input terminals won’t delay and its action has
no ralation with this command.
The figure below is an example wiring diagram for the operation of MTR command.
The external 2 banks consist of X40~47 and Y40~41 and total 16 devices correspond
to the internal relay M10~M17, M20~M27 are used with MTR command. For a general
precaution to aid successful operation, diodes should be placed after each input
devices. These diodes should have a rating of 0.1A, 50V.
Diode
0.1A/50V
M20 M21 M22 M23 M24 M25 M26 M27
When output Y40 is ON, only those inputs in the first bank are read. These result are
stored in auxiliary coils M10~M17. The second step involves Y40 going OFF and Y41
coming ON and this time only inputs in the second bank are read. These results are
stored in M20~M27.
Read input signal in the first bank
Y40 1 3
Read input signal in the second bank
Y41 2 4
25ms
Processing time of each bank is about 25ms
M1000
DCNT C251 K1000
FEND
M1000
I010 Y1
IRET
END
The ouput contact of high-speed counter and the compare output of DHSCS (API 53)
command, DHSCR (API 54) command and DHSZ(API 55) command are all activated
Footnote
when there are counted inputs. If using data operation command, such as DADD,
DMOV…etc. commands to change the present value of high-speed counter equal to
the setting value, there is comparsion will be set or output because there is no counted
inputs.
High-speed counter provided in ES series models: total counting frequency is 30 KHz.
Type 1-phase 1 input 1-phase 2 inputs 2-phase inputs
C235 C236 C237 C238 C241 C242 C244 C246 C247 C249 C251 C252 C254
Input
X0 U/D U/D U/D U U U A A A
X1 U/D R R D D D B B B
X2 U/D U/D R R R R
X3 U/D R S S S
1. Input point X0 and X1 can plan to be higher speed counter and 1-phase can be up
to 30KHz. But total counting frequency of these input points should be less than or
equal to total frequency 30KHz. If counting input is A/B phase signal, frequency will
be four times of counting frequency. Therefore, counting frequency of A/B phase is
almost 7KHz.
2. In ES series models, DHSCS and DHSCR command can not be used more than 4
times.
3. Please refer to the following table for the available high-speed counters:
Counter Program interrupt type
Type Hardware high-speed counter
1-phase high-speed counter
Type 1-phase 1 input 1-phase 1 input 1-phase 2 inputs 2-phase input
Input C235 C236 C237 C238 C239 C240 C241 C242 C243 C244 C246 C247 C248 C249 C251 C252 C253 C254
X0 U/D U/D U A
X1 U/D D B
X2 U/D R R R
X3 U/D S S S
X4 U/D U/D U A
X5 U/D D B
X6 R R R
X7 S S S
X10 U/D U A
X11 D B
X12 R R R
X13 S S S
X14 U/D U A
X15 D B
X16 R R R
X17 S S S
HHSC0 HHSC1 HHSC2 HHSC3 U/D mode setting flag HHSC0 M1246 M1251 High speed Comparison value
comparison reached operation
C241 C242 C243 C244 HHSC1 M1247 M1252 command
M1241 M1242 M1243 M1244
DHSCS SET/RESET
HHSC2 M1248 M1253
DHSCR I 010 ~ I 060 interrupt
HHSC0 HHSC1 HHSC2 HHSC3 HHSC3 M1249 M1254 counting value reset
DHSCZ
X2 X6 X12 X16
AND Reset signal R
M1264 M1266 M1268 M1270 OR
6. HHSC0~3 all have reset and start signal of external input. Reset signal (R) can be
set by M1272/M1274/M1276/M1278 (belong to HHSC0 ~3) and start signal can be
set by M1273/M1275/M1277/M1279 (belong to HHSC0 ~3). When using
high-speed counter, if do not use the external signal input of R and S, you can set
M1264/M1266/M1268/M1270 and M1265/M1267/M1269 /M1271 as TRUE. Close
the operation of the input signal and the corresponding external inputs can be used
as general inputs. Please refer to the above example figure for usage.
(normal frequency)
B-phase
2 A-phase
(double frequency)
2-phase 2 inputs
B-phase
4
A-phase
(four times frequency)
B-phase
According to the different type of counter modes, HHSC 0~3 of EH series models can set
normal, double, thriple and four times these four frequency modes by using special
device D1225 to D1228:
0 U
(normal
frequency) D
1-phase
2 inputs 1 U
(double
frequency) D
1 A
(double
2-phase frequenc) B
2 inputs 2 A
(thriple
frequenc) B
3 A
(four times
frequenc) B
U/D FLAG are special M device, M1241~M1244 and each indicates the setting flag of
C241~C244 counting up and down.
Related flags and special register of high-speed counter:
Flag Function Explanation
Announce that DHSZ command is used as multi groups setting
M1150
value compare mode
DHSZ command multi groups setting value compare mode
M1151
execution completed
Announce that DHSZ command is used as frequency control
M1152
mode
M1153 Frequency control mode execution completed
Specify counting direction of C235 ~ C244 high-speed counter
M1235 ~ M1244 When M12□□=Off, C2□□ counting up
When M12□□=On, C2□□ counting down
Monitor counting direction of C246~C249, C251~C254
M1246 ~ M1249 high-speed counter
M1251 ~ M1254 When C2□□ counting up, M12□□=Off.
C2□□ counting down, M12□□=On.
M1260 X5 is the reset input signal of all high-speed counters
M1261 High-speed compare flag of DHSCR command
HHSC0 reset signal end (R) external control signal input contact
M1264
disable
Special
Function Explanation
register
D1022 Double frequency selection of AB phase counter in ES/EP series models
DHSZ command for table counting register of multi-group setting
D1150
comparison mode
D1151 DHSZ command for table counting register of frequency control mode
D1152
(lower-bit) DHSZ command saves table counting register value that read in sequence
D1153 from pulse output frequency of each group in D1153 and D1152.
(upper-bit)
D1225 First counter counting method setting, C241, C246, C251 counter mode
D1226 Second counter counting method setting, C242, C247, C252 counter mode
D1227 Third counter counting method setting, C243, C248, C253 counter mode
D1228 Forth counter counting method setting, C244, C249, C254 counter mode
Counter mode of Hardware high-speed counter, HHSC0~HHSC3 of EH
series model
D1225 ~ When setting value is 0, it is normal frequency counter mode.
D1228 When setting value is 1, it is double frequency counter mode.
When setting value is 2, it is triple frequency counter mode.
When setting value is 3, it is four times frequency counter mode.
If the devices specified as the device are Y0~Y17, when the compare value
and the present value of high-speed counter are equal, the compare result will
immediately output to the external inputs Y0~Y17 (specified Y output will be reset),
and other Y devices will be affected by the scan cycle. However, M, S devices are
immediate output, not being affected by the scan cycle.
When M0=On and C251’s present value stepped from 99→100 or 101→100, Y10 will
Program
Example be set Off.
1 When C251’s present value change from 199 to 200, the contact C251 will be On and
force Y0=On, but there will still be a program scan time delay output.
Y10 is status immediately reset device when specified counter reach. It also can be
used to specify the same number high-speed counter. Please refer to the program
example 2.
M1000
DCNT C251 K200
M0
DHSCR K100 C251 Y10
C251
SET Y0
When specifing the same number high-speed counter, the current value of high-speed
Program
Example counter C251 will change from 999 1000 or 1001 1000 and C251 contact will be
2 reset to Off.
M1000
DCNT C251 K200
200
The function limit of M1261: Only can be used in hardware high-speed counters
C241~C254.
The followings are the using example:
The input point of external reset of C251 is X2.
If Y10=On.
When M1261=Off, X2=On, the current value of C251 is reset to 0 and its contact
turns Off. When DHSCR command has been executed, there is no counter input
and the compared result does not output. Therefore, Y10=On will remain
unchaged.
When M1261=On, X2=On, the current value of C251 is reset to 0 and its contact
turns Off. When DHSCR command has been executed, although there is no
counter input, but compared result will still output. Therefore, the content of Y10
will be reset.
M1000
DCNT C251 K1000
When using DHSZ command to control and stop high/low speed, C251 is AB phase
Program high-speed counter. There will be comparison value output of DHSZ command only
Example when counting pulse is stored in C251. Therefore, even the counting current value is
2
0, Y10 will not be On.
When X10=On, DHSZ command force Y10=On when counting current value ≦
K2,000. In order to improve this problem, use DZCPP command to compare C251
against and K2,000 when the program RUN at the beginning. When counting current
value ≦ K2,000, Y10=On and DZCPP command is Pulse execution command.
Command DZCPP only can be executed ONCE in program and Y10 will be still be On.
When drive contact X10=Off, Y10~Y12 will be reset to Off.
X20
RST C251
Timing diagram
Speed of variable
speed rotational
equipment
0
X10
high speed
forward Y10
low speed
forward Y11
Stop Y12
2400
current value of 2000
C251 counter
0
When using the multi groups setting value comparison mode of DHSZ command, if
Program of DHSZ command is specified as special auxiliary relay M1150, it can execte a
Example current value of high-speed counter and has the function which can compare and
3
output multi groups setting value.
Under this mode, is defined as starting device of comparison table. It only can
be data register D and can be modified by index register E, F. But the number modified
by index register E, F is unchanged after the command has been executed. is
defined as the data groups of comparison data. It only can be K1~K128 or H1~H80
and also can be can be modified by index register E, F. After the command has been
executed, it is disabled to change this value. is defined as the number of
high-speed counter and it should be C235~C254. is defined as mode setting. It
only can be M1150 and can be modified by index register E, F. But if it is not M1150,
then will be disabled.
The comparison table of high-speed counter consists of the head number of register
specified by and bank numbers (groups number) specified by .
Please input the setting value of each register before the command being executed.
When current value of C251 high-speed counter specified by is equal to the
setting value of (D1, D0), output Y specified by D2 will be reset to Off (D3=K0) or On
(D3=K1) and latched. All of output Y use interrupt operation.
When the current value of C251 is equal to the setting value of the first groups in the
comparison table, D1150=K1. If the current value of C251 is equal to the setting value
of the second groups, D1150=K2. Then the comparison will continute to execute in the
above described order. After the comparison operation of all groups are completed,
M1151=On for one scan cycle and D1150 will be reset to 0, then jump back to the first
groups to execute.
When the drive contact X10 turns Off, the operation of the command will be
interruptted and the content of table counting register D1150 will be reset to 0. But the
ON/OFF state is unchanged at that time.
When this command command has been executed and first scan to END command,
all setting value inside of the diagram are valid.
This function of this command only can be used ONCE in program. In EP series
models, this function does not provided.
This function of this command only can be used in hard ware high-speed counter
C241~C254.
X10
DHSZ D0 K4 C251 M1150
Comparison table
32-bit comparison data Number of output On/Off Table counting
High word Low word Y indication register D1150
D1 (K0) D0 (K100) D2 (K10) D3 (K1) 0
D5 (K0) D4 (K200) D6 (K11) D7 (K1) 1
D9 (K0) D8 (K300) D10 (K10) D11 (K0) 2
D13 (K0) D12 (K400) D14 (K11) D15 (K0) 3
K10:Y10 K0:Off 0→1→2→3→0
K11:Y11 K1:On Cyclic scan
C251
current value
400
300
200
100
Y10
Y11
M1151
3
2
1
D1050 0 0
X10
DHSZ D0 K5 C251 M1152
PLS M0
M0
DPLSY D1152 K0 Y0
Comparison table
32-bit comparison data Pulse output frequency Table counting
High word Low word 0~250KHz register D1151
D1 (K0) D0 (K100) D3, D2 (K5,000) 0
D5 (K0) D4 (K200) D7, D6 (K10,000) 1
D9 (K0) D8 (K300) D11, D10 (K15,000) 2
D13 (K0) D12 (K400) D15, D14 (K6,000) 3
D17 (K0) D16 (K0) D19, D18 (K0) 4
0→1→2→3→4
Cyclic scan
C251 500
current value
400
300
200
pulse output frequency
100
0
(Hz)
15000
10000
5000
0
M1153
4
3
2
1
D1051 0 0
Related flags and special register of high-speed counter:
Flag Function Explanation
Announce that DHSZ command is used as frequency control
M1152
mode
For DHSZ command, frequency control mode execution
M1153
completed
DMOVP K10000 D6
DMOVP K0 D18
DMOVP K100 D0
DMOVP K200 D4
DMOVP K300 D8
DMOVP K0 D16
PLS M0
M0
DPLSY D1152 K0 Y0
When SPD command has been executed and M1100 (SPD command sampling one
time flag)=On, SPD command will execute sampling one time. SPD command will
collect data one time when the movement of M1100 turning from Off to On, then stop.
If desiring to continue the collection, be sure to turn M1100 Off and execute SPD
command again.
When X7=On, D2 will count the high-speed pulse input from X1. After 1,000ms, it will
Program
stop counting automatically and store the result in D0.
Example
After 1000ms counting completed, the content of D2 will be reset to 0. When X7 turns
On again, D2 will recount.
X7
SPD X1 K1000 D0
X7
X1
D2: current
value D0: detection
value
D2: content
value
1000ms 1000ms
1000
D4: content
D4:remaining time (ms)
value
In ES series models (V5.7 and above), if X1 or X2 is used in SPD command, then the
Footnote related high-speed counters or external interrupts I101, I201 can not be used.
The actual output pulse numbers are stored in special registers D1336~D1339 when
the program is executed to the command PLSY. Refer to the footnote for details.
The special register D and M which are allowed to be changed during the execution of
the command. Refer to the footnote for details.
When X0=On, the pulse of 1KHz for 200 times is generated from output Y0, after the
Program
pulse has been completed, M1029=On trigger Y10=On.
Example
When X0=Off, pulse output Y0 immediately stop. When X0 turns On again, the first
pulse start to output.
X0
PLSY K1000 K200 Y0
M1029
Y100
0.5ms
Output Y0 1 2 3 200
1ms
Flags description:
Footnote M1010: In EH series MPU, when M1010= On, Y0, Y1 and Y2, Y3 will output pulse
while END command is executed. When output starts, M1010 will
automatically turn Off.
In EP/ES series MPU, when M1010=On, Y0 can output limitless continuous
pulses. When M1010=Off, the pulse output numbers of Y0 are decided by
.
M1023: In EP/ES series MPU, when M1023=On, Y1 can output limitless continuous
pulses. When M1023=Off, the pulse output numbers of Y1 are decided by
.
M1029: In EH series MPU, M1029= On after Y0, Y1 pulse output complete.
In EP/ES series MPU, M1029= On after Y0 pulse output complete.
M1030: In EH series MPU, M1030= On after Y2, Y3 pulse output complete.
In EP/ES series MPU, M1030= On after Y1 pulse output complete.
M1078: In EP/ES series, Y0 pulse output stop.
M1079: In EP/ES series, Y1 pulse output stop.
M1258: In EH series MPU, (PWM command) Y0, Y1 pulse output signal exchange.
M1259: In EH series MPU, (PWM command) Y2, Y3 pulse output signal exchange.
M1334: In EH series MPU, CH0 pulse output stop.
M1335: In EH series MPU, CH1 pulse output stop.
M1336: In EH series MPU, CH0 pulse output indication flag.
M1337: In EH series MPU, CH1 pulse output indication flag.
M1338: In EH series MPU, CH0 offset pulse start flag.
M1339: In EH series MPU, CH1 offset pulse start flag.
M1340: In EH series MPU, the interrupt (I110) occur after CH0 pulse output complete.
M1341: In EH series MPU, the interrupt (I120) occur after CH1 pulse output complete.
In EH series MPU, the interrupt (I130) occur simultaneously when CH0 pulse
M1342:
transmit.
In EH series MPU, the interrupt (I140) occur simultaneously when CH1 pulse
M1343:
transmit.
M1344: In EH series MPU, CH0 compensation pulse start flag.
M1345: In EH series MPU, CH1 compensation pulse start flag.
M1339 R/W OFFSET start flag of the second pulse group D1330, D1331
Interrupt occur after the first pulse group output
M1340 R/W I110
complete.
Interrupt occur after the first pulse group output
M1341 R/W I120
complete.
Interrupt occur after the first pulse group output
M1342 R/W I130
complete.
Interrupt occur after the first pulse group output
M1343 R/W I140
complete.
M1344 R/W Compensation start flag of the first pulse group D1344, D1345
M1345 R/W Compensation start flag of the second pulse group D1346, D1347
M1347 R/W Auto interrupt reset flag of the first pulse group
M1348 R/W Auto interrupt reset flag of the second pulse group
Output Y1
T=2000ms
Flags description:
Footnote M1010: In EH series MPU, when M1010= On, Y0, Y1 and Y2, Y3 will output pulse
while END command is executed. When output starts, M1010 will
automatically turn Off.
M1067: In EH series MPU, when operand is error, M1067=On.
M1070: In EP/ES series MPU, When PWM command output Y1, the pulse unit will
exchange. When M1070=On, the pulse unit is 100µs, when M1070=Off, the
pulse unit is 1ms.
In EH series MPU, when the first pulse output group of PWM command
output Y0, the pulse unit will exchange. When M1070=On, the pulse unit is
100µs, when M1070=Off, the pulse unit is 1ms.
M1071: In EH series MPU, when the first pulse output group of PWM command
output Y2, the pulse unit will exchange. When M1071=On, the pulse unit is
100µs, when M1071=Off, the pulse unit is 1ms.
M1258: In EH series MPU, (PWM command) Y0, Y1 pulse output signal exchange.
M1259: In EH series MPU, (PWM command) Y2, Y3 pulse output signal exchange.
M1334: In EH series MPU, CH0 pulse output stop.
M1335: In EH series MPU, CH1 pulse output stop.
M1336: In EH series MPU, CH0 pulse output indication flag.
M1337: In EH series MPU, CH1 pulse output indication flag.
When several high-speed pulse output commands (PLSY, PWM, PLSR) use Y0 to
output pulse in one program and simultaneously been executed in the same scanning
cycle, PLC will perform the command which has fewest step numbers.
If the setting is smaller than the result of the above-mentioned equation, the
acceleration/deceleration time will be greater, and if the setting is smaller than the
9000/ , the result value of 9000/ will be treated as its regular setting.
3. Maximum setting of the accel/decel time could be obtained from the following
equation.
818
4. Number of the accel/decel speed variation steps is fixed to be 10. If the input
acceleration/deceleration time is greater than the maximum setting, the maximum
setting will be treated as its regular setting. If the setting is smaller than the
minimum setting, the minimum setting will be treated as its regular setting.
PLSR command is the pulse output command with the accel/decel speed function.
The acceleration is conducted when the pulse wave goes from the static status to
reaching its targeted speed, and getting faster when the targeted speed is to be
reached. The pulse wave will stop its output once the targeted distance is reached.
When PLSR command has been executed, after set the maximum frequency ,a
quantity of total pulse numbers and accel/decel time , then output them through
pulse output device . The output frequency is first raised up in 1/10 of the
maximum frequency /10 and the time of each output frequency is fixed as 1/9 of
.
Even user change , or when PLSR command has been executed,
the output will not be affected.
After the pulse numbers of the first output pulse group (Y0, Y1) set by has been
completely output, M1029=On. After the pulse numbers of the second output pulse
group (Y0, Y1) set by has been completely output, , M1030=On. When the
command PLSR is activated again, M1029 or M1030 will turn to 0, then turn to 1 after
the PLSR command has been completed.
The output pulse of the first output group (Y0, Y1) and the cueent value of he second
output group (Y2, Y3) are stored in the special regisers D1336~D1339.
During the acceleration of each step, the pulse numbers (each frequency x time) may
not all be integer, but the output operation of PLC is conducted in whole integer
number. Therefore, the time of each interval may not be the same and has some
deviation. The offset is determined by the frequency value and the discarding decimal
point value. In order to ensure the output pulse numbers are correct, PLC will fill the
insufficiency pulse numbers to the last interval.
When X0=On, the maximum frequency of command PLSR is 1,000Hz. The quantity of
Program
total pulse numbers D10, accel/decel time is 3,000ms and pulses output from output
Example
Y0. The pulses are output and the output frequency is 1,000/10 Hz every time. The
time of output pulse of each frequency is fixed as 3,000/9.
When X10 is OFF, output will be interrupted, and when turned ON again, counting of
the pulse will be counted from 0.
X0
PLSR K1000 D10 K3000 Y0
Pulse speed(Hz)
The output cannot be the same as the output of API 57 PLSY, API 58 PWM command
Footnote while PLSR command is used in program.
When several high-speed pulse output commands (PLSY, PWM, PLSR) use Y0 to
output pulse in one program and simultaneously been executed in the same scanning
cycle, PLC will perform the command which has fewest step numbers.
F0
16-bit command: 110~32,767PLS
Start
frequency 16-bit command: 110~2,147,483,647PLS
1~5000ms 1~5000ms
F0
Time T
Program M1000
Example IST X10 S20 S60
1
X10: Individual operation (Manual operation) X14: Continuous operation
X11: Zero point return X15: Zero point return start switch
X12: Step operation X16: Start switch
X13: One cycle operation X17: Stop switch
When the IST command is executed, the following special auxiliary relay will switch
automatically.
M1040: Movement inhibited S0: Manual operation/initial state step point
M1041: Movement start S1: Zero point return/initial state step point
M1042: Status pulse S2: Auto operation/initial state step point
M1047: STL monitor enable
When IST command is used, S10~S19 are for zero point return operation and the step
point of this state can’t be used as general step point. However, when using S0~S9
step points, S0 initiates “manual operation”, S1 initiates “zero point return operation”
and S2 initiates “auto operation”. Thus, there should be three circuits of these three
initial state step points first written in program.
When switching to S1 (zero point return mode), zero point return won’t have any
actions once one of S10~S19 is On.
When switching to S2 (auto operation mode), auto operation won’t have any actions
once one of between to is On or M1043=On
Example: the Robot arm control (use IST command):
Program
Motion request: In the example, two kinds of balls (big and small) are separated and
Example moved to different boxes. Distribute the control panel for the control.
2 Motion of the Robot arm: lower robot arm, collect balls, raise robot arm, shift to right,
lower robot arm, release balls, raise robot arm, shift to left to finish motion in order.
I/O Device:
Right-limit X2 Right-limit X3
Left-limit X1 (big balls) (small balls)
Y0
Upper-limit X4 Y3 Y2
Y1
Upper-limit X5
Big/small Big Small
sensor X0
Control panel
Power start Zero return X15 Auto start X16
X0 X1 Y4
M1044
M1000
IST X10 S20 S80
S1
X15
S10 RST Y4 Release balls
Ladder Diagram:
S1 X15
S SET S10 Enter zero return operation mode
S10
S RST Y4 Release balls
Y3
X1 Shift to left and shift to
SET S12 the left-limit (X1 is On)
S12
S SET M1043 Start zero return completed flag
SFC figure:
S2
M1041
M1044
S20 Y1
X5 X5
X0 X0
S30 SET Y4 S40 SET Y4
S50 Y1
X5
S60 RST Y4
TMR T2 K30
T2
S70 Y0
X4
X1
S80 Y3
X1
S2
Ladder Diagram:
S2 M1041 M1044
S SET S20 Enter auto operation mode
S20
S Y1 Lower robot arm
X5 X0
SET S30
X5 X0
SET S40
S30
S SET Y4 Collect balls
TMR T0 K30
T0
SET S31
S31
S Y0 Raise robot arm to the
upper-limit (X4 is ON)
X4
SET S32
S32 X2
S Y2 Shift to right
X2
SET S50
S40
S SET Y4 Collect balls
TMR T1 K30
T1
SET S41
S41
S Raise robot arm to the
Y0 upper-limit (X4 is ON)
X4
SET S42
S42 X3
S Y2 Shift to right
X3
SET S50
S50
S Y1 Lower robot arm
X5
SET S60
S60
S RST Y4 Release balls
TMR T2 K30
T2
SET S70
S70
S Y0 Raise robot arm to the
upper-limit (X4 is ON)
X4
SET S80
S80 X1
S Y3 Shift to left and shift to
the left-limit (X1 is On)
X1
S2
RET
END
Flag explanation:
Footnote M1040: step point movement inhibited. When M1040=ON, all movements of the step point
are inhibited.
1. Manual operation mode: M1040 keeps being ON.
2. Zero point return mode/one cycle operation mode: During the time of pressing
STOP button and pressing START button again, M1040 will keep being ON.
3. Step operation mode: M1040 keeps being ON, and will only be OFF when the
START button is pressed.
4. Continuous operation mode: When PLC goes from STOP→RUN, M1040 keeps
being ON, and will be OFF when the START button is pressed.
M1041: Step point movement start: the special auxiliary relay that reflects the movement of
the primary step point (S2) to the next step point.
1. Manual operation mode/Zero point return mode: M1041 keeps being OFF.
2. Step operation mode/One cycle operation mode: M1041 will only be OFF when
the START button is pressed.
3. Continuous operation mode: Keeps being ON when the START button is pressed,
and keeps being OFF when the STOP button is pressed.
M1042: START pulse: Only one pulse will be sent out when the button is pressed.
M1043: Zero point return complete: Once M1043 =ON is driven, it means that the RESET
motion has been executed.
M1044: Conditions of the origin: Under the continuous operation mode, conditions of the
origin, M1044, have to be driven to ON to execute the motion of initial step point (S2)
moving to the next step point.
M1045: All output reset inhibit.
If executing conditions: A. from manual control S0 to zero point return S1
B. from auto operation S2 to manual operation S0
C. from auto operation S2 to zero point return S1
1. When M1045=Off and one of S of D1~D2 is ON, step point of SET Y output and
actions will be cleared to Off.
2. When M1045 =On, SET Y output will be reserved and step point during action will
be cleared to Off.
3. If executing from zero point return S1 to manual operation S0, no matter
M1045=On or M1045=Off, SET Y output will be reserved and step point action will
be cleared to Off.
M1046: Setting STL state to On: If one of step point S is On, M1046=On. After M1047 forces
to be On, M1046 will be On once one of S is On. Besides, 8 points numbers before S
is on will be recorded in D1040~D1047.
M1047: STL monitor enabled. When IST command starts executing, M1047 will be forced to
be On and it will be forced to On for each scan time once IST command is still On.
This flag is used to monitor all S.
D1040~D1047: ON state number 1-8 of step point S.
Command : Starting device of data stack for multiple devices comparison : Value
Explanation data for comparison : Starting device for storing compared result : Data
stack length for comparison
specify the numbers of compared registers and specify the compared
numbers. The specified data is compared against the data specified by and the
compared result is stored in several registers specified by .
When using 32-bit command to designate registers, , , and
specify 32-bit register.
When X0=On, the data stack consist of D10~D19 are compared against D0 and the
Program
Example result is stored in D50~D54. If the equal value does not exist, the content of D50~D52
will all be 0.
The data is compared in algebra formate. (-10<2)
The largest value of all compared data will be record in D53 and the samllest value of
all compared data will be record in D54. When the numbers of largest value and
smallest are more than one, only the numbers of largest value will be recorded.
X0
SER D10 D0 D50 K10
M10~ M13 will be On when the current value of C10 is equal to or higher than the
lower-limit value and equal to or lower than the upper-limit value.
Lower-limit value Upper-limit value Current value of C10 Output
When the lower-limit value is higher than the upper-limit value, if the current value of
C10 is higher than the lower-limit value and lower than the upper-limit value
(C10>140), M12=On.
Lower-limit value Upper-limit value Current value of C10 Output
M1
60 140
M2
150 390
M3
0 200 400
M10
M11
M12
M13
M14
M1029
: Device number for storing the On duration of the button switch : Multiple
Command
setting
Explanation
The On duration of external button switch is measured and stored in the number of
+1, the measured unit is 100ms periods. The content of +1 in seconds is
multiplied by and stored in .
When multiple setting n=0, the measured unit of is in seconds. When n=1, the
measured unit of is 100ms periods (is multiplied by 10). When n=2, the
measured unit of is 10ms periods (is multiplied by 100).
The time that the button switch X0 is pushed (On duration of X0) will be stored in D1, n
Program
Example is used to specify the multiple of the time and the total bit time is stored in D0. Then the
1 button switch can be used to adjust the setting value of timer.
When X0 turns Off, the content of D1 will be reset to 0 but the content of D0 is
unchanged.
X0
TTMR D0 K0
X0
D1
D0
D1
D0
T T
pushed time (sec) pushed time (sec)
If On duration of X0 is T seconds, the relation between D0, D1 and n are shown as the
table below.
n D0 D1(unit: 100 ms)
K0 (unit: s) 1×T D1=D0×10
K1 (unit: 100 ms) 10×T D1=D0
K2 (unit: 10 ms) 100×T D1=D0/10
M19
TMR T9 D109
M1000
BIN K1X0 E
X10
TTMR D200 K0
X10
PLF M0
M0
MOV D100 D200E
For EP series models, it can only use TTMR command eight times in program. If used
Footnote in subroutine or interrupt subroutine, it only can use ONCE.
For EH series models, the maximum TTMR command groups it can only use at the
same time is eight groups.
X10
Y0 5 sec 5 sec
Y1 5 sec 5 sec
Y2 5 sec
Y3 5 sec
Add a b contact of Y3 after the drive contact X10, ans then Y1, Y2 can be used as the
output of flash loop. When X10 turns Off, Y0, Y1 and Y3 will be Off and the content of
T10 will be reset to 0.
X10 Y3
STMR T10 K50 Y0
X10
Y1
Y2 5 sec 5 sec
: Dentisation device
Command
This command is usually pulse execution command (ALTP).
Explanation
When X0 turns from Off to On for the first time, Y0=ON. When X0 turns from Off to On
Program
Example for the second time, Y0=OFF.
1 X0
ALTP Y0
X0
Y0
The ALT command is a command, which use one switch to control start and stop mode.
Program
Example In the beginning, M0=Off, so Y0=On, Y1=Off. When X10 is activated for the first time,
2 M0=ON, Y1=ON and Y0=OFF. When X10 is activated for the second time, M0=OFF,
Y0=ON, Y1=OFF.
X10
ALT M0
M0
Y0
M0
Y1
Output Y will flash. When X10= On, T0 will generate a pulse every two seconds and
Program
Example output Y0 will be switching between On and Off mode depending on the pulse of T0.
3 X10 T0
TMR T0 K20
T0
ALTP Y0
The scan time can be fixed if set M1039=On in the program previously. Then, using
MOV command to write the setting value of the fixed scan time into special register
D1039. Take the above program as an example, if the setting value is 30ms and
n=K100, the time between D10 and D11 is 3 second (D3: 30ms×100).
During the execution of this command, when starting signal X10 turns Off, this
command will stop the operation. When X10 turns On again, the content value of D12
will be reset to 0(zero) and calculated again.
After the execution of this command has been completed, M1029= On and the
content value of D12 will be reset to the setting value of D10.
Using this command with analog signal output can execute the operation of Sort
Start/Stop.
If start PLC from STOP to RUN when X10= On, please reset the content value of D12
to 0(zero) in the beginning of the program. (If D12 is a latched area.)
X10
RAMP D10 D11 D12 K100
D11
D10
D12
D12
D11
D10
M1026=ON M1026=OFF
D11
D11
D12 D12
D10 D10
M1029 M1029
: Head input device : Destination device for storing key input value
Command
: Key input signal
Explanation
This command can specify ten external input devices from and these ten
external input devices is identified as decimal value of 0 to 9. These ten external input
devices are connected to ten keys respectively. When one of the ten keys is pressed,
the value of decimal numbers from 0 to 9,999 (max. 4 digits in 16-bit command) or from
0 to 99,999,999 (max. 8 digits in 32-bit command) can be inputted and stored in
destination device . The device is used to store the condition of that key
has been pressed.
Using this command can specify ten input terminals from X0 to connect to ten keys
Program
which number is from 0 to 9. When X20=On, the command is executed and it will store
Example
the BIN value which is inputted by keys into D0 and M10~M19 is used to store the
condition of that key has been pressed.
X20
TKY X0 D0 M10
0 1 2 3 4 5 6 7 8 9
PLC
0 1 2 3 4 5 6 7 8 9 number key
3 2 1 0
overflow 10 10 10 10
BCD value
BIN value D0
As the time chart shown below, the four keys are connected to X5, X3, X0, X1 of
number keyboard. After pressing the four keys in that order of 1234 and the number
5,301 will be entered into D0. The max. number which can be entered in D0 is 9,999 i.e.
4 digits. If the entered number exceeds the above allowable range, the highest digits will
overflow.
After X2 is pressed, M12=On untill other keys are pressed. The situation of other press
keys are the same.
When any key of X0~X11 is pressed, one device of M10~M19 will be On.
If any key is pressed, M20=On.
When the drive contact X20 turns Off, the previous value do not change but M10~M20
all turns Off.
X0 l
X1 m
X3 k
X5 j
M10
M11
M13
M15
Key output
signal
M20 j k l m
Command : Head scan input device : Head scan output device : Destination
Explanation device for storing key input value : Key input signal
This command can create a 16-key keyboard which is a multiplex of 4 continuous
external input devices from and 4 continuous external output devices from
by matrix scan. The key input value will be stored in and is used to
store the condition of that key has been pressed.
When this command is executed every time, the execution completed flag M1029 will
be On for the duration of that key pressed (one scan cycle).
If two or more keys are pressed at the same time, only the key activated first is
effective.
When HKY command is used in 16-bit command, can store numbers from 0 to
9,999 (max. 4 digits). When DHKY command is used in 32-bit command, can
store numbers from 0 to 99,999,999 (max. 8 digits). If the entered number exceeds the
above allowable range, the highest digits will overflow.
Using this command to create a 16-key keyboard which is a multiplex of 4 continuous
Program
Example external input devices X10~X13 and 4 continuous external output devices Y10~Y13.
When X4=On, the command is executed and it will store the BIN value which is
inputted by keys into D0 and M0~M7 is used to store the condition of that key has been
pressed.
X4
HKY X10 Y10 D0 M0
Number input:
0 1 2 3 4 5 6 7 8 9 number key
3 2 1 0
overflow 10 10 10 10
BCD value
BIN value D0
M5 M4 M3 M2 M1 M0
External wiring:
C D E F
8 9 A B
4 5 6 7
0 1 2 3
When this command is executed, 8 times scan cycles is required to read the input
Footnote value of keys sucessfully. If the scan cycle is too long or too short, it may cause the key
to input incorrectly. Therefore, user can use the following command to avoid it.
When the scan cycle is too short, the I/O may not response in time and can not
read the key input correctly. At this time, user can fix the scan time to avoid it.
When the cycle is too long, the response of key may become slow. User can avoid
this by writing this command in a time interrupt subroutine and executing this
command in the fix time.
The function of flag M1167:
When M1167=On, HKY command can input hexadecimal value of 0~F.
Command : Head input device : Head output device : Destination device for
Explanation storing the setting value : Number of digits
This command is used to read one or two groups of 4 digits switch through 4 or 8
continuous external input devices from and 4 continuous external devices from
and store the setting value in destination device . When is 1, only
one group of digital switches is read. When is 2, two groups of digital switches
are read.
The first group of switches consists of X20~X23 and Y20~Y23. The second group of
Program
Example switches consists of X24~X27 and Y20~Y23. When X10=On, the command starts to
execute. The setting value of the first group of switches are read and converted to BIN
value and stored in D20. The setting value of the second group of switches are read
and converted to BIN value and stored in D21.
X10
DSW X20 Y20 D20 K2
When X10=On, Y20~Y23 will be On and scan in circles automatically. After the
completion of each circle scan, execution completed falg M1029=ON is a scan period
after a circle scan.
Outputs Y20~Y23 please use transistor output. Besides, please make sure that every
1, 2, 4, 8 terminal should connect a diode (0.1A/50V) to the inputs of PLC in serial as
shown in the example below.
X10
operation start
Y21 0.1s
interrupt
Y22 0.1s
Y23 0.1s
0 1 2 3
BCD digital 10 10 10 10
switches
should connect
a diode (1N4148)
in serial
1 2 4 8 1 2 4 8
0V +24V S/S X20 X21 X22 X23 X24 X25 X26 X27
PLC
C Y20 Y21 Y22 Y23
0 1 2 3
10 10 10 10
When the scan terminals are relay outputs, the following program technique is used
Footnote with this command to operate successfully:
When X10=On, DSW command is executed. When X10 turns Off, M10 will be On
until the scan terminals of DSW command complete one output scan cycle. Then,
M10 will turn Off.
If the drive contact X10 use button switch, every time when X10 is pushed, M10,
the scan terminals specified by DSW command, will be reset to Off after the
completion of one output scan cycle. Then, the command will stop executing, the
data of digital switch will be read completely and the scan terminals will be activated
while the button switch is pushed. Therefore, even relay output is used in this
situation, the relay can be used for long because the operation of relay is not
frequent.
X10
SET M10
M10
DSW X20 Y20 D20 K2
M1029
RST M10
Note: Refer to each model specification for usage range. 32-bit command
ES series models do not support pulse execution command - - - -
(SEGDP) Flag: None
When X10=On, contents (0~F: 16 bits) of the lower 4 bits (b0~b3) of D10 will be
Program
Example decoded as readable in the 7-segment display panel for output. The decoding results
will be stored in Y10~Y17.
X10
SEGD D10 K2Y10
0 0000 ON ON ON ON ON ON OFF
6 0110 a ON OFF ON ON ON ON ON
8 1000 c ON ON ON ON ON ON ON
d
9 1001 ON ON ON ON OFF ON ON
A 1010 ON ON ON OFF ON ON ON
will decide the numbers of groups of 4 digits of 7-segment display and also
indicate the polaritys of PLC output terminal and 7-segment display input terminal.
The points number of 7-segment display output command that a group of 4 digits use
is 8 points and 2 groups of 4 digits use are 12 points.
Scan output terminal will circulate in sequence when this command executes. The
drive contact will be changed from Off to On and scan output execute again.
When X10=ON, command will start to execute. 7-segment display scan loop is
Program
Example composed of Y10~Y17. The value of D10 will be converted to BCD code and send to
the first group of 7-segment display to display. The value of D11 will be converted to
BCD code and send to the second group of 7-segment display to display. If any value
of D10 or D11 is greater than 9999, operation error will occur.
X10
SEGL D10 Y10 K4
When X10=ON, Y14~Y17 will scan in circles automatically. Each circle scan needs 12
scan time. M1029=ON is a scan period after a circle scan.
4 digits of a group, n=0~3.
After the terminal of 1, 2, 4, 8 of decoded 7-segment display connects itself in
parallet, they should connect to Y10~Y13 of PLC. Latch terminal of each number
connects to Y14~Y17 of PLC individually.
When X10=ON, the content of D10 will be transmitted to 7-segment display to
display in sequently according to Y14~Y17 circulates in sequence
4 digits of 2 groups, n=4~7.
After the terminal of 1, 2, 4, 8 of decoded 7-segment display connects itself in
parallet, they should connect to Y20~Y23 of PLC. Latch terminal of each number
and the first group share Y14~Y17 of PLC.
The content of D10 will be transmitted to the first group of 7-segment display and
the content of D11 will be transmitted to the second group of 7-segment display to
display. If D10=K1234 and D11=K4321, the first group will display 1234 and
the second group will display will display 4321.
7-segment display scan output wiring
COM Y10 Y11 Y12 Y13 COM Y14 Y15 Y16 Y17 COM Y20 Y21 Y22 Y23
0 1 2 3
1 2 4 8
10 10 10 10
3 2 1 0 3 2 1 0
10 10 10 10 10 10 10 10
1 1
2 V+ 2
V+
4 4
8 8
Y drive
Y
signal output
On
PLC
Output loop of PNP transistor: when inner signal is “1”, it will output high potential.
This logic is called positive polarity.
+24V
positive On
HIGH
Logic 1
Step down
resistor
PLC
Parameter n settings:
groups number of
A group Two groups
7-segment display
Y of BCD code outputs + - + -
Display scan latch signal + - + - + - + -
n 0 1 2 3 4 5 6 7
’+’: Positive logic (Negative polarity) output
‘-’: Negative logic (Positive polarity) output
The combination of output polarity of PLC transistor and input polaity of 7-segment
display can be set by settings of n.
b15 b0
D0 42H (B) 41H (A)
b15 b0
D0 00 H 41H (A)
D1 00 H 42H (B)
D2 00 H 43H (C)
D3 00 H 44H (D)
D4 00 H 45H (E)
D5 00 H 46H (F)
D6 00 H 47H (G)
D7 00 H 48H (H)
: The device for storing ASCII code : The external output device which
Command
outputs ASC II code.
Explanation
This command will output ASCII codes stored in 4 registers from device in
order of the output devices specified by .
First, using API 76 ASC command convert A~H to ASCII code and store them in
Program
Example D0~D3. Then, using this command output them in the order of A~H.
1 When M1027=Off, X10 turns from Off to On, the command is executed, Y10(low byte)
to Y17(high byte) is specified as the data output devices, Y20 is specified as scan
signal and Y21 is specified as the monitor signal while the command being executed.
This mode can execute 8 character string output operation.
If X10 turns from Off to On while the command being executed, the data output will be
interrupt. When X10 is On once more, the data will be sent again.
X10
PR D0 Y10
Y10~Y17 data A B C D H
T : scan time (ms)
T T T
T T T T : scan time or
interrupt time
M1029 execution
is completed
This command should only use transistor output.
Footnote When using this command, please fix the scan time or execute this command in a time
interrupt subroutine.
D0 CR #5 D0 CR #5
D1 CR #6 D1 CR #6
D2 CR #7 D2 CR #7
D3 CR #8 D3 CR #8
D4 CR #9 D4 CR #9
D5 CR #10 D5 CR #10
The function of the flag M1083 (FROM/TO mode exchange) provided in EP/EH series
models:
1. When M1083=Off, FROM/TO command is executed, all interrupts (including external
or internal interrupt subroutines) will be disabled. All interrupts will be executed after
FROM/TO command is completed. Besides, FROM/TO command also can be
executed in the interrupt subroutine.
M1002
TO K0 K1 H0 K1
TO K0 K33 H0 K1
X0
TO K0 K18 K0 K1
TO K0 K24 K2000 K1
1. Write H0 to CR#1 of analog input mode No. 0 and set CH1 to mode 0 (voltage
input : -10V to +10V).
3. When X0 turns from OFF to ON, K0LSB of OFFSET value will be wrote in CR#18
and K2000LSB of GAIN value will be wrote in CR#24.
M1002
TO K0 K1 H18 K1
TO K0 K33 H0 K1
X0
TO K0 K19 K400 K1
TO K0 K25 K3600 K1
1. Write H18 to CR#1 of analog input mode No. 0 and set CH2 to mode 3 (current
input : -20mA to +20mA).
3. When X0 turns from OFF to ON, K400LSB of OFFSET value will be wrote in
CR#19 and K3600LSB of GAIN value will be wrote in CR#25.
TO K1 K33 H0 K1
X0
TO K1 K22 K0 K1
TO K1 K28 K1000 K1
1. Write H18 to CR#1 of analog input mode No. 1 and set CH2 to mode 3
(current input : 0mA to +20mA).
2. Write H0 to CR#33 and allow to adjust characteristics of CH1 and CH2.
3. When X0 turns from OFF to ON, K0LSB of OFFSET value will be wrote in
CR#22 and K1000LSB of GAIN value will be wrote in CR#28.
Example 4: Adjust D/A conversion characteristic curve of DVP-02DA by setting
OFFSET value of CH2 to 2mA(=K400LSB) and GAIN value of CH2 to
18mA(=K3600LSB).
M1002
TO K1 K1 H10 K1
TO K1 K33 H0 K1
X0
TO K1 K23 K400 K1
TO K1 K29 K3600 K1
1. Write H10 to CR#1 of analog input mode No. 1 and set CH2 to mode 2
(current input : +4mA to +20mA).
3. When X0 turns from OFF to ON, K400LSB of OFFSET value will be wrote in
CR#23 and K3600LSB of GAIN value will be wrote in CR#29.
Example 5: Program example when DVP-04AD and DVP-02DA module are used
together
M1000
FROM K0 K0 D0 K1
TO K0 K2 K32 K2
FROM K0 K6 D20 K4
M1000
FROM K1 K0 D0 K1
CMP H49 D0 M0
M1013
INC D100
M1
TO K1 K10 D100 K2
END
1. Read the data of model type from extension module K0 and distinguish if the data is
H88 (DVP-04AD model type).
2. If the model type is DVP-04AD, the drive contact M1 is on and set input mode CR#1:
(CH1, CH3)= mode 0, (CH2, CH4)= mode 3.
3. Set the mode of CR#2 and CR#3. The average times of CH1 and CH2 is K32.
4. Read the input signal average value of CH1~CH4 (4 data) from CR#6~CR#9 and
store them in D20 to D23.
5. Read the data of model type from extension module K1 and distinguish if the data is
H49 (DVP-02DA model type).
6. D100 will increase K1 and D101 will increase K5 every second.
7. When value of D100 and D101 attain to K4000, they will be reset to 0.
8. If the model type is DVP-04AD, the drive contact M1 is on and set input mode CR#1:
CH1 mode to 0, CH2 mode to 2.
9. Write output setting CR#10 and CR#11 to D100 and D101. Analog output will change
with D100 and D101 value.
When receiving data complete, M1123 will be set to ON. (Program will set M1123 to
OFF when receiving data complete and in the state of waiting for transmitting and
receiving data. Please do use not PLC program to execute RST M1123 continuously.
M1002 Setting communication
MOV H86 D1120 protocol 9600, 7, E, 1
When M1161=ON, the conversion mode will be 8-bit. 16-bit data will be divided into high
byte and low byte. High byte will be ignored and low byte will be received and
transmitted.
M1000
M1161
X0
RS D100 K4 D120 K7
Head source data register will start from Tail code Tail code
code low byte of D100 1 2
length = 4
Head receive data register will start from Tail code Tail code
code low byte of D120 1 2
length = 7
PLC will receive all data that transmitted from external equipment, including head code
and tail code. Please pay attention on setting length .
《16-bit mode》:
Head code and tail code of PLC transmitting data is set by using M1126 and M1130 with
D1124~D1126. After complete the setting, PLC will send head code and tail code set by
user automatically when executing RS command.
When M1161=OFF, the conversion mode will be 16-bit. 16-bit data will be divided into high
byte and low byte for data transmitting and receiving.
M1001
M1161
X0
RS D100 K4 D120 K7
Head source data register will start from Tail code Tail code
code low byte of D100 1 2
length = 4
Head receive data register will start from Tail code Tail code
code low byte of D120 1 2
length = 7
PLC will receive all data that transmitted from external equipment, including head code
and tail code. Please pay attention on setting length .
When PLC connects to VFD-B series AC drives (ASCII Mode, M1143=OFF), (16-bit
Program
Example Mode, M1161=OFF), it will transmit data to read 6 continuous data that start from
3 VFD-B parameter address H2101.
M1002 Setting communication
MOV H86 D1120 protocol 9600, 7, E, 1
Register DATA
D125 low byte ‘0’ 30 H
D125 high byte ‘1’ 31 H
D126 low byte ‘7’ 37 H
Content of address 2102 H
D126 high byte ‘6’ 36 H
D127 low byte ‘6’ 36 H
D127 high byte ‘0’ 30 H
D128 low byte ‘0’ 30 H
Content of address 2103 H
D128 high byte ‘0’ 30 H
D129 low byte ‘0’ 30 H
D129 high byte ‘0’ 30 H
D130 low byte ‘0’ 30 H
Content of address 2104 H
D130 high byte ‘0’ 30 H
D131 low byte ‘0’ 30 H
D131 high byte ‘0’ 30 H
D132 low byte ‘1’ 31 H
Content of address 2105 H
D132 high byte ‘3’ 33 H
D133 low byte ‘6’ 36 H
D133 high byte ‘0’ 30 H
D134 low byte ‘0’ 30 H
Content of address 2106 H
D134 high byte ‘0’ 30 H
D135 low byte ‘0’ 30 H
D135 high byte ‘3’ 33 H LRC CHK 1
D136 low byte ‘B’ 42 H LRC CHK 0
D136 high byte CR AH
END
D137 low byte LF DH
When PLC connects to VFD-B AC drive (RTU Mode, M1143=ON), (16-bit Mode,
Program M1161=ON), writing transmitting data, H12, in advance into VFD-B parameter address
Example H2000.
4
M1002 Setting communication
MOV H86 D1120 protocol 9600, 7, E, 1
Communication
SET M1120
protocol latched
Setting communication
MOV K100 D1129
time out 100ms
X10
RS D100 K8 D120 K8
receiving
completed
Process of receiving data
M1123
RST M1123 receiving completed
and flag reset
Register DATA
D120 low byte 01 H Address
D121 low byte 06 H Function
D122 low byte 20 H
Data address
D123 low byte 00 H
D124 low byte 00 H
Data content
D125 low byte 12 H
D126 low byte 02 H CRC CHK Low
D127 low byte 07 H CRC CHK High
D1120: RS-485 communication protocol. For the settings, please refer to following
table:
Content 0 1
b0 Data length 7 8
00 : None
b1
Parity bits 01 : Odd
b2
11 : Even
b3 Stop bits 1 bit 2 bit
b4 0001 (H1) : 110
b5 0010 (H2) : 150
b6 0011 (H3) : 300
b7
0100 (H4) : 600
0101 (H5) : 1200
0110 (H6) : 2400
0111 (H7) : 4800
1000 (H8) : 9600
1001 (H9) : 19200
1010 (HA) : 38400
1011 (HB) : 57600 (only in EH/EP series models)
1100 (HC) : 115200 (only in EH/EP series models)
Start word
b8 None D1124
selection
First end word
b9 None D1125
selection
Second end word
b10 None D1126
selection
b15~b11 No definition
Start word and end word of control characters will be defined in the communication
format of peripheral equipment when using RS command. Start word and end word
can be set in D1124~D1125 by user or defined by machine/equipment. When using
M1126, M1130, D1124~D1125 to set start and end word, b8~b9 of D1120 of RS485
communication protocol should be set to 1. For the settings, please refer to the
following table:
M1130
0 1
D1124: user define D1124: H 0002
0 D1125: user define D1125: H 0003
D1126: user define D1126: H 0000(no setting)
M1126
You can get the communication format H788 via check with table and write into D1120.
b15 b0
D1120 0 0 0 0 0 1 1 1 1 0 0 0 1 0 0 0
0
7 8 8
Don t care
M1002
MOV H788 D1120
When using STX, EXT1 and EXT2 should pay attention to the On/Off relationship
between special auxiliary relay M1126 and M1130.
M1143: ASCII / RTU mode selection. ON is RTU mode and OFF is ASCII mode.
Take standard MODBUS format to explanation:
ASCII mode (M1143=Off):
STX Start word = ‘: ’ (3AH)
Address Hi Communication address:
Address Lo 8-bit address consists of 2 ASCII codes
Function Hi Function code:
Function Lo 8-bit function code consists of 2 ASCII codes
DATA (n-1) Data content:
n × 8-bit data content consists of 2n ASCll codes
…….
DATA 0
LRC CHK Hi LRC check sum:
LRC CHK Lo 8-bit check sum consists of 2 ASCll code
END Hi End word:
END Hi = CR (0DH), END Lo = LF(0AH)
END Lo
Communication protocol is made of MODBUS ASCII (American Standard Code for
Information Interchange). Each byte consists of 2 ASCII characters. For example: a
1-byte data 64 Hex shown as ‘64’ in ASCII, consists of ‘6’ (36Hex) and ‘4’ (34Hex). The
table below identifies the usable hexadecimal characters and their associated ASCII
codes.
Character ‘0’ ‘1’ ‘2’ ‘3’ ‘4’ ‘5’ ‘6’ ‘7’
ASCII code 30H 31H 32H 33H 34H 35H 36H 37H
Data content:
The content of transmitting data send by user
LRC check:
LRC check is the added sum from “Address” to “Data contents”. For example, the 01H +
03H + 21H + 02H + 00H + 02H = 29H, then take the complementary of 2, D7H.
End word: END Hi = CR (0DH), END Lo = LF(0AH)
For example: when the address of the drive is set as 01H, read 2 data contents that exist
successively within the register, as shown follows: the address of the start register is
2102H.
Inquiry message: Response message:
STX ‘: ’ STX ‘: ’
‘0’ ‘0’
Address Address
‘1’ ‘1’
‘0’ ‘0’
Function Function
‘3’ ‘3’
‘2’ Number of data ‘0’
‘1’ (count by byte) ‘4’
Start address ‘0’ ‘1’
‘2’ Content of start address ‘7’
‘0’ 2102H ‘7’
Number of data ‘0’ ‘0’
(count by word) ‘0’ ‘0’
‘2’ Content of address ‘0’
‘D’ 2103H ‘0’
LRC Check
‘7’ ‘0’
CR ‘7’
END LRC Check
LF ‘1’
CR
END
LF
START:
ES / EP series: keep none input signal to be greater or equal to 10 ms
EH series:
Baud Rate(bps) RTU Timeout Timer(ms) Baud Rate(bps) RTU Timeout Timer(ms)
300 40 9600 2
600 21 19200 1
1200 10 38400 1
2400 5 57600 1
4800 3 115200 1
Data content:
CRC check:
CRC check starts from “Address” and ends in “Data content”. Its calculation is as
follows:
Step 1: Load the 16-bit register (the CRC register) with FFFFH.
Step 2: Exclusive OR the first 8-bit byte message command with the 16-bit CRC
register of the low byte, then store the result into the CRC register.
Step 3: Shift the CRC register one bit to the right and fill 0 in the higher bit.
Step 4: Check the value that shifts to the right. If it is 0, store the new value from
step 3 into the CRC register, otherwise, Exclusive OR A001H and the CRC
register, then store the result into the CRC register.
Step 5: Repeat step 3 and 4 and calculates the 8-bit.
Step 6: Repeat Steps 2~5 for the next 8-bit message command, till all the message
commands are processed. And finally, the obtained CRC register value is
the CRC check value. What should be noticed is that the CRC check must
be placed interchangeably in the check sum of the message command.
END:
ES / EP series: keep none input signal to be greater or equal to 10 ms
EH series:
Baud Rate(bps) RTU Timeout Timer(ms) Baud Rate(bps) RTU Timeout Timer(ms)
300 40 9600 2
600 21 19200 1
1200 10 38400 1
2400 5 57600 1
4800 3 115200 1
For example: when the address of the drive is set as 01H, read 2 continuous data of the
register shown follows: the address of the start register is 2102H
Inquiry message: Response message:
Address 01 H Address 01 H
Function 03 H Function 03 H
21 H Number of data 04 H
Start data address
02 H (count by byte)
Number of data 00 H Content of data address 17 H
(count by word) 02 H 8102H 70 H
CRC CHK Low 6F H Content of data address 00 H
CRC CHK High F7 H 8103H 00 H
CRC CHK Low FE H
CRC CHK High 5C H
Timing chart of RS-485 communication program flag:
Communication
SET M1120 protocol latched
Setting communication
MOV K100 D1129
transmission time out 100ms
request
write transmitting data
in advance
pulse
SET M1122 sending request
X10
RS D100 K2 D120 K8
receiving
completed
Process of receiving data
Timing chart:
SET M1122 X0
Receiving time out M1129 It will be activated when receiving time out message
Receive time out Stop to count time after
timer set by D1129 receiving data completed
Covert MODRD/RDST M1131 Conversion data
/MODRW to hexadecimal 3
2
Residual words of 1
transmitting data D1122 0
8
7
6
5
4
3
Residual words of 2
receiving data D1123 1
0
When X3=On, transmit the content of K4X10 to K4M10 in octal number system
Program
Example format.
1 X3
PRUN K4X10 K4M10
X27 X26 X25 X24 X23 X22 X21 X20 X17 X16 X15 X14 X13 X12 X11 X10
M27 M26 M25 M24 M23 M22 M21 M20 M19 M18 M17 M16 M15 M14 M13 M12 M11 M10
NO CHANGE
When X2=On, transmit the content of K4M10 to K4Y10 in octal number system format.
Program X2
Example PRUN K4M10 K4Y10
2
These two devices won’t be transmitted
M27 M26 M25 M24 M23 M22 M21 M20 M19 M18 M17 M16 M15 M14 M13 M12 M11 M10
X27 X26 X25 X24 X23 X22 X21 X20 X17 X16 X15 X14 X13 X12 X11 X10
: Start device of source data : Start device for storing converted result
Command
: Converted digits
Explanation
16-bit conversion mode: When M1161=Off, read hexadecimal data characters
from the source devcie and convert the data into the ASCII code. Then, store
the result into high and low byte of device .
8-bit conversion mode: When M1161=On, read hexadecimal data characters
from the source devcie and convert the data into the ASCII code. Then, store
the result into low byte of device (high byte of device are all set to 0).
Supposed condition:
(D10) = 0123 H ‘0’ = 30H ‘4’ = 34H ‘8’ = 38H
(D11) = 4567 H ‘1’ = 31H ‘5’ = 35H ‘9’ = 39H
(D12) = 89AB H ‘2’ = 32H ‘6’ = 36H ‘A’ = 41H
(D13) = CDEFH ‘3’ = 33H ‘7’ = 37H ‘B’ = 42H
3 33H 2 32H
b15 D21 b0
0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0
1 H 31 0 H 30
b15 D22 b0
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0
3 H 33 2 H 32
When n = 1 to 16:
n
K1 K2 K3 K4 K5 K6 K7 K8
D
D20 low byte “3” “2” “1” “0” “7” “6” “5” “4”
D20 high byte “3” “2” “1” “0” “7” “6” “5”
D21 low byte “3” “2” “1” “0” “7” “6”
D21 high byte “3” “2” “1” “0” “7”
D22 low byte “3” “2” “1” “0”
D22 high byte “3” “2” “1”
D23 low byte “3” “2”
D23 high byte “3”
D24 low byte
D24 high byte no
D25 low byte change
D25 high byte
D26 low byte
D26 high byte
D27 low byte
D27 high byte
n
K9 K10 K11 K12 K13 K14 K15 K16
D
D20 low byte “B” “A” “9” “8” “F” “E” “D” “C”
D20 high byte “4” “B” “A” “9” “8” “F” “E” “D”
D21 low byte “5” “4” “B” “A” “9” “8” “F” “E”
D21 high byte “6” “5” “4” “B” “A” “9” “8” “F”
D22 low byte “7” “6” “5” “4” “B” “A” “9” “8”
D22 high byte “0” “7” “6” “5” “4” “B” “A” “9”
D23 low byte “1” “0” “7” “6” “5” “4” “B” “A”
D23 high byte “2” “1” “0” “7” “6” “5” “4” “B”
D24 low byte “3” “2” “1” “0” “7” “6” “5” “4”
D24 high byte “3” “2” “1” “0” “7” “6” “5”
D25 low byte “3” “2” “1” “0” “7” “6”
D25 high byte “3” “2” “1” “0” “7”
D26 low byte “3” “2” “1” “0”
no
D26 high byte “3” “2” “1”
change
D27 low byte “3” “2”
D27 high byte “3”
Supposed condition:
(D10) = 0123 H ‘0’ = 30H ‘4’ = 34H ‘8’ = 38H
(D11) = 4567 H ‘1’ = 31H ‘5’ = 35H ‘9’ = 39H
(D12) = 89AB H ‘2’ = 32H ‘6’ = 36H ‘A’ = 41H
(D13) = CDEFH ‘3’ = 33H ‘7’ = 37H ‘B’ = 42H
When n is 2, the bit structure is:
D10=0123 H
0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1
0 1 2 3
Convert to
b15 D20 b0
0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0
0 H 30
b15 D21 b0
0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1
1 H 31
b15 D22 b0
0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0
2 H 32
b15 D23 b0
0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1
3 H 33
When n = 1 to 16:
n
K1 K2 K3 K4 K5 K6 K7 K8
D
D20 “3” “2” “1” “0” “7” “6” “5” “4”
D21 “3” “2” “1” “0” “7” “6” “5”
D22 “3” “2” “1” “0” “7” “6”
D23 “3” “2” “1” “0” “7”
D24 “3” “2” “1” “0”
D25 “3” “2” “1”
D26 “3” “2”
D27 “3”
D28
D29 no
D30 change
D31
D32
D33
D34
D35
n
K9 K10 K11 K12 K13 K14 K15 K16
D
D20 “B” “A” “9” “8” “F” “E” “D” “C”
D21 “4” “B” “A” “9” “8” “F” “E” “D”
D22 “5” “4” “B” “A” “9” “8” “F” “E”
D23 “6” “5” “4” “B” “A” “9” “8” “F”
D24 “7” “6” “5” “4” “B” “A” “9” “8”
D25 “0” “7” “6” “5” “4” “B” “A” “9”
D26 “1” “0” “7” “6” “5” “4” “B” “A”
D27 “2” “1” “0” “7” “6” “5” “4” “B”
D28 “3” “2” “1” “0” “7” “6” “5” “4”
D29 “3” “2” “1” “0” “7” “6” “5”
D30 “3” “2” “1” “0” “7” “6”
D31 “3” “2” “1” “0” “7”
D32 “3” “2” “1” “0”
no
D33 “3” “2” “1”
change
D34 “3” “2”
D35 “3”
Supposed condition:
S HEX S HEX
ASCII code ASCII code
conversion conversion
D20 low byte H 43 “C” D24 low byte H 34 “4”
D20 high byte H 44 “D” D24 high byte H 35 “5”
D21 low byte H 45 “E” D25 low byte H 36 “6”
D21 high byte H 46 “F” D25 high byte H 37 “7”
D22 low byte H 38 “8” D26 low byte H 30 “0”
D22 high byte H 39 “9” D26 high byte H 31 “1”
D23 low byte H 41 “A” D27 low byte H 32 “2”
D23 high byte H 42 “B” D27 high byte H 33 “3”
When n is 4, the bit structure is:
D20 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0
41H A 30H 0
D21 0 1 0 0 0 0 1 1 0 1 0 0 0 0 1 0
43H C 42H B
D10 0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0
0 A B C
When n = 1 to 16:
Supposed condition:
HEX HEX
ASCII code ASCII code
conversion conversion
D20 H 43 “C” D28 H 34 “4”
D21 H 44 “D” D29 H 35 “5”
D22 H 45 “E” D30 H 36 “6”
D23 H 46 “F” D31 H 37 “7”
D24 H 38 “8” D32 H 30 “0”
D25 H 39 “9” D33 H 31 “1”
D26 H 41 “A” D34 H 32 “2”
D27 H 42 “B” D35 H 33 “3”
When n is 2, the bit structure is
D20 0 0 1 1 0 0 0 0
3 0
D21 0 1 0 0 0 0 0 1
4 1
D10 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
0 A
When n = 1 to 16:
: Start device of source data : Result device for storing check sum
Command
: Number of data
Explanation
This command is used to check sum of words to ensure the truth of transmission data
during communication.
16-bit conversion mode: When M1161=Off, it is 16-bit conversion mode. Check the
sum of words (8-bit in one byte) from the register specified by source devcie
and store the sum to the register specified by device while the parity bits
are stored in +1.
8-bit conversion mode : When M1161=On, it is 8-bit conversion mode. Check the sum
of words (8-bit in one byte, only low byte are available) from the register
specified by source devcie and store the sum to the register specified by device
while the parity bits are stored in +1.
D100 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 1
D101 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 Parity
When M1161=Off, it is 16-bit conversion mode.
Program
Example When X0=On, check sum of 6 words from the register specified by D0 (8-bit in one
2 byte, n=10 means to specify D0~D4) and store the sum in the register specified by
D100 while the parity bits are stored in D101.
M1000
M1161
X0
CCD D0 D100 K6
Volume read in order: S=K0 to K7 corresponding to the 8 volumes, No.0 to No.7. The
Program
Example following program example use E (E=0~7) to modify, K0E=K0 to K7.
2 The loop of timer convert the volume scale 0~10 to 0~255. The time unit of T0 to T7 is
0.1 second, therefore, the setting value is 0 to 25.5 seconds.
M1000
RST E
FOR K8
M1000
VRRD K 0E D100E
INC E
NEXT
X10
TMR T0 D100
T0
Y000
X11
TMR T1 D101
T7
Y007
END
2. Between FOR~NEXT command (INC E), the content of E will be 0, 1, 2…7 and
increased by 1(one). Therefore, 8 volume scale will also show as VR0→D100,
VR1→D101, VR2→D102…VR7→D107 in order and be read into the specified
register.
Regrad as digital switch: Correspond volume scale 0 to 10. Only one contact is On
Program
Example between M10 to M20. Using DECO command (API 41) can decode the volume scale
2 into M0~M15.
When X0=On, store the volume scale value (0 to 10) of specified No. 1 volume to D1.
When X1=On, use DECO command (API 41) to decode the volume scale into
M10~M25.
X0
VRSC K1 D1
X1
DECO D1 M10 K4
M10
On when volume scale is 0
M11
On when volume scale is 1
M20
On when volume scale is 10
: Target value (SV), : Present measured value (PV), for 16-bit command:
~ +14, for 32-bit command: ~ +20: PID command will start to
execute after completing all parameters setting and the result will be stored in .
Please give no latch register area for content. (if you want to give
content a latch register, please reset latch to 0 when program runs.)
Please complete the parameter settings before executing PID command.
Program
Example This command will be executed when X0=ON and the result will be stored in D150.
The command will not be executed when X0=OFF and the previous data won’t have
any change.
X0
PID D0 D1 D100 D150
PID command is only available in V5.7 and above of ES series models and it is not
Footnote available for other version.
There is no time limit for using PID command but the register number specified by
cannot be repeated.
For 16-bit commands, uses 15 registers. In above program, the parameter
setting area of PID command that indicates are D100~D114. You should use
MOV command to transmit settings to the indication register to set before PID
command executes. If the registers that parameters indicate are latch area, please
use MOVP to execute transmitting.
Parameter table of 16-bit :
Device No. Function Setting range Explanation
+14:
When parameter setting is out of setting range, it will be set to upper bound or lower
bound. But if operation method is out of range, it will be set to 0.
PID commands can be used in interrupt subroutine, step point and CJ command.
Max. range of sampling error time TS is (
- a scan time+1ms)~+(a scan time). If error
value has influence on output, please keep the scan time fixable or execute PID
command in interrupt subroutine of timer.
If the settings of sampling time TS ≦ a scan time, CPU will have error code K6740
(PID operation error). At this time, CPU will reset TS = a scan time to execute PID
operand. In this situation, please execute PID command in time interrupt subroutine
(I6□□~I8□□).
The present measured value (PV) must be a stable value before the execution of PID
command. If using input value of DVP-04AD / DVP-04XA / DVP-04PT / DVP-04TC
these modules to perform the PID calculation, please pay attention to the A/D
conversion time of the above-mentioned modules.
32-bit command occupies 21 registers. If parameter setting area of PID
command that designated by is D100~D120, it needs to use MOV command to
send setting to designated registers before executing PID command.
+20:
Explanation of 32-bit and 16-bit are almost the same. The different is
that capacity of +5 ~ +20.
This command executes PID calculation according to speed and differential type of
PID
Equations measured value.
PID operation has three control methods: normal, forward and inverse controls. The
control method is set by +4. Besides, the settings that have relation to PID
operation is set by ~ +5.
PID equations:
1
MV = K P * E (t ) + K I * E (t ) + K D * PV (t )S
S
Control Method PID Equations
Inverse control
E (t ) = PV − SV
1
Besides, PV (t )S means the differential value of PV (t ) and E (t ) means the
S
integral value of E (t ) .
You can know that this command is different from general PID command from above
equation. The difference is the change on differential usage. To avoid transient
differential value is too large when executing general PID command at the first time, this
command willl lower output (MV) value once the change of present measured value (PV)
is too large by monitoring differential value of present measured value (PV).
Symbols explanation:
MV : Output value
KP : Porprotional gain
Error value. Forward control E (t ) = SV − PV , Inverse control
E (t ) :
E (t ) = PV − SV
PV : Present measured value
SV : Target value
KD : Differential gain
PV (t )S : Differential value of PV (t )
KI : Integral gain
1
E (t ) : Integral value of E (t )
S
Control diagram:
1/S KI
+
+ +
KP G(s)
+
KD
1. When adjusting three major parameters, KP, KI and KD, please adjust KP first (set
by experience) and set 0 to KI and KD. When adjusting to control, adjust KI (order
from small to big) and KD (order from small to big). Refer to example 4 for adjusting.
If KP=100, it means 100%. When KP is less than 100%, error value will attenuate
and when KP is more than 100%, error value will amplify.
2. This command should be controlled with many parameters. Please follow setting
rule to avoid error occurs.
Example 1: block diagram for using PID command to control position (control method
S3+4 should be set to 0)
Position command MV
(SV) PID Plant
Encoder
PV
Example 2: block diagram for using PID command to control speed (control method
S3+4 should be set to 0)
Accel/Decel
output (MV)
speed
Accel/Decel detection
PID equipment (P)
command (SV)
actual accel/decel
speed (PV=S-P)
Example 3: block diagram for using PID command to control temperature (action
direction S3+4 should be set to 1)
add temperature
(MV) heater
temperature PID equipment
command (SV)
temperature
detection
actual temperature(PV) equipment
Step1: set KI and KD to 0 first, then set KP to 5, 10, 20 and 40 in order and record (SV)
and (PV) state. The result will be shown as following figure.
1.5
K P =40 SV=1
K P =20 K P =10
1
KP =5
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (sec)
Step 2: In above figure, we will choose the situation when KP is 10. The reason is in the
following:
When KP is 40, response has overshoot situation. So we won’t use it.
When KP is 20, PV response is close to SV and won’t have overshoot but transient MV
will be great due to start-up too fast. We also won’t use it.
When KP is 10, PV response is close to SV and is smooth. So we consider to use it.
When KP is 5, the response is too slow. So we won’t use it.
Example 3: When deciding to use the curve KP=10, arrange KI in order from small to big
(such as 1, 2, 4, 8) and not to large than KP. Then arrange KD in order from small to big
(such as 0.01, 0.05, 0.1 and 0.2) and not to exceed 10% KP. Finally, you can get
following PV and SV relation figure.
1.5
PV=SV
0.5
KP =10,KI =8,KD =0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (sec)
Note: This example is only for reference. Therefore, user should adjust suitable control
parameters by himself according to real control system.
Application 1: using PID command in pressure control system. (use block diagram of
example 1)
Applications
Control destination: make control system reach pressure target value.
Control characteristics: this system should reach to control destination step by step,
therefore, it may cause system out of control or overload if reaching control destination
too fast.
Recommend solve method:
Method 1: reach by using long sampling time.
Method 2: reach by using delay command and its control block diagram is shown in the
following.
0 0rpm
0 0V
0 0rpm
0 0V
511 3000
rpm 255 5V
pressure
pressure MV speed
command SV MV convert convert
AC
command delay PID
value (D0)
D1 D5 to to Drive
PV speed voltage D1116
A voltage
B convert
wave
wave D1110 to pressure
command meter
value
0 0V
511 10V
command command
value value
280 280
250
200 D2 is command interval value
150 D3 is command interval time
100 user can adjust by require
50
0 t t
0
A wave B wave
M1002
MOV K10 D3
M0
TMR T0 D3
T0
RST T0
= D0 D1 MOV K0 D2
ADD D2 D1 D1
CMP D2 K0 M10
M10
< D1 D0 MOV D0 D1
M12
> D1 D0 MOV D0 D1
M0
PID D1 D1116 D10 D5
Application 2: speed control and pressure control system is controlled separately. (use
block diagram of example 2)
Control destination: Adding pressure control system (PID command) after using open
loop to control speed for a period time to reach pressure control.
Control characteristics: This architecture should use open loop to reach speed control
and then reach control target by close loop pressure control due to there is no relation
between speed and pressure of these two systems. Besides, you can add command
delay function of application 1 to avoid control command of pressure control system
changes too fast. Control block diagram is shown in the following.
0
255
M3 M2=ON
D40 speed
Speed + D32 convert D1116 AC
command D30 to drive
+ voltage
D31
0rpm
3000rpm MV
convert to
accel/decel
D0 M0=ON D5 MV
delay SV PV D1110 pressure
pressure D1
function PID
command meter
(optional)
M1=ON
M1002
MOV K1000 D40
M0
MOV D0 D1
M1
MOV K0 D5
M3
MOV D40 D30
M2
ADD D30 D31 D32
M1
PID D1 D1110 D10 D5
Register DATA
D1070 low ‘0’ 30 H ADR 1
D1070 high ‘1’ 31 H ADR 0
D1071 low ‘0’ 30 H CMD 1
D1071 high ‘3’ 33 H CMD 0
D1072 low ‘0’ 30 H
Number of data (count by byte)
D1072 high ‘C’ 43 H
D1073 low ‘0’ 30 H PLC automatically convert
D1073 high ‘1’ 31 H Content of ASCII codes to value and
D1074 low ‘0’ 30 H address 2101 H store the converted value in
D1074 high ‘0’ 30 H D1050 = 0100 H
D1075 low ‘1’ 31 H PLC automatically convert
D1075 high ‘7’ 37 H Content of ASCII codes to value and
D1076 low ‘6’ 36 H address 2102 H store the converted value in
D1076 high ‘6’ 36 H D1051 = 1766 H
D1077 low ‘0’ 30 H PLC automatically convert
D1077 high ‘0’ 30 H Content of ASCII codes to value and
D1078 low ‘0’ 30 H address 2103 H store the converted value in
D1078 high ‘0’ 30 H D1052 = 0000 H
D1079 low ‘0’ 30 H PLC automatically convert
D1079 high ‘0’ 30 H Content of ASCII codes to value and
D1080 low ‘0’ 30 H address 2104 H store the converted value in
D1080 high ‘0’ 30 H D1053 = 0000 H
D1081 low ‘0’ 30 H PLC automatically convert
D1081 high ‘1’ 31 H Content of ASCII codes to value and
D1082 low ‘3’ 33 H address 2105 H store the converted value in
D1082 high ‘6’ 36 H D1054 = 0136 H
D1083 low ‘0’ 30 H PLC automatically convert
D1083 high ‘0’ 30 H Content of ASCII codes to value and
D1084 low ‘0’ 30 H address 2106 H store the converted value in
D1084 high ‘0’ 30 H D1055 = 0000 H
D1085 low ‘3’ 33 H LRC CHK 1
D1085 high ‘B’ 42 H LRC CHK 0
Communication between PLC and VFD-S series AC drives (RTU Mode, M1143=On)
Program
M1002
Example Setting communication
MOV H83 D1120 protocol 9600, 8, E, 1
2
SET M1120 Communication
protocol latched
Setting communication
MOV K100 D1129 time out 100ms
Flag M1129 will be On when communication is time-out and program will send request
from M1129 and ask M1122 to read again.
Flag M1140 will be On when receive error and program will send request from M1140
and ask M1122 to read again.
Flag M1141 will be On when received address error and program will send request from
M1141 and ask M1122 to read again.
M1002
Setting communication protocol
MOV H87 D1120
to 9600, 8, E, 1
Setting communication
MOV K100 D1129 time-out to 100ms
X0 Setting communication command:
MODRW K1 H2100 K6 device address 01,
data address H2101
X0 data length 6 words
SET M1122 Setting transmission request
M1129
Communication time-out Retry
M1140
data receive error Retry
M1141
sending address error Retry
The receiving data in ASCII
receiving completed format stored in D1070-D1085.
M1127 PLC will convert to numeral
handle received data and save into D1050-D1055
automatically.
RST M1127 receiving completed and
flag reset
Rising-edge contact (LDP, ANDP, ORP) and falling-edge contact (LDF, ANDF, ORF)
Footnote can’t be used before API 100 MODRD, API 105 RDST, API 150 MODRW (FUNCTION
CODE H03) these three commands. Otherwise, the data stored in received register will
be incorrect.
Register DATA
D1089 low ‘0’ 30 H ADR 1 ADR (1,0) is AC drive
D1089 high ‘1’ 31 H ADR 0 address
D1090 low ‘0’ 30 H CMD 1
CMD (1,0) is command code
D1090 high ‘6’ 36 H CMD 0
D1091 low ‘0’ 30 H
D1091 high ‘1’ 31 H
Data address
D1092 low ‘0’ 30 H
D1092 high ‘0’ 30 H
D1093 low ‘1’ 31 H
D1093 high ‘7’ 37 H
Data contents
D1094 low ‘7’ 37 H
D1094 high ‘0’ 30 H
D1095 low ‘7’ 37 H LRC CHK 1 LRC CHK (0,1) is error
D1095 high ‘1’ 31 H LRC CHK 0 check code
Register DATA
D1070 low ‘0’ 30 H ADR 1
D1070 high ‘1’ 31 H ADR 0
D1071 low ‘0’ 30 H CMD 1
D1071 high ‘6’ 36 H CMD 0
D1072 low ‘0’ 30 H
D1072 high ‘1’ 31 H
Data address
D1073 low ‘0’ 30 H
D1073 high ‘0’ 30 H
D1074 low ‘1’ 31 H
D1074 high ‘7’ 37 H
Data content
D1075 low ‘7’ 37 H
D1075 high ‘0’ 30 H
D1076 low ‘7’ 37 H LRC CHK 1
D1076 high ‘1’ 31 H LRC CHK 0
Communication between PLC and VFD-S series AC drives (RTU Mode, M1143=On)
Program
M1002
Example MOV H87
Setting communication
D1120 protocol 9600, 8, E, 1
2
Communication
SET M1120
protocol latched
Setting communication
MOV K100 D1129 time out 100ms
M1002
Setting communication protocol
MOV H87 D1120
to 9600, 8, E, 1
Setting communication
MOV K100 D1129 time-out to 100ms
X0 Setting communication command:
MODRW K1 H0100 H1770 device address 01,
data address H0100
X0 data H1770
SET M1122 Setting transmission request
M1129
Communication time-out Retry
M1140
data receive error Retry
M1141
sending address error Retry
receiving completed
M1123
The receiving data in ASCII
handle received data
format stored in D1070-D1085.
For detail information of the related flags and special registers, please refer to the
Footnote footnote of API 80 RS command.
If using rising-edge (LDP, ANDP, ORP)/falling-edge (LDF, ANDF, ORF) before API 101
MODWR and API 150 MODRW (Function Code H06 and H10), it needs to start
transmission request M1122 to act correct.
Communication between PLC and VFD-A series AC drives, retry for communication
Program
Example time-out and received data error.
M1002
Setting communication
MOV H0073 D1120 protocol 4800, 8, O, 1
Setting communication
MOV K100 D1129 time-out 100ms
X0 Setting communication command:
device address 0
FWD K0 K500 K1
frequency setting is 500Hz
X0 K1 is the AC drive for
SET M1122 designated address
Setting transmission flag
M1129
communication time-out Retry
M1142 received data error Retry
: Status object
n = 0 Frequency command n = 2 Output current
n = 1 Output frequency n = 3 Operation command
The feedback (return) data stored in the low byte of address D1070 to D1080 are total
11 words (please refer to VFD-A series manual).
”Q, S, B, Uu, Nn, ABCD”
feedback
Explanation Data storage
(return)
Q Starting word: ’Q’ (51H). D1070 low
S Checksum code: 03H. D0171 low
B Command authorization. correct: 06H, error: 07H. D1072 low
U Communication address (address: 00~31). ”Uu” = D1073 low
u (“00”~”31”) indicated by ASCII. D1074 low
N D1075 low
Status object (00~03).”Nn” = (“00~03”) indicated by ASCII.
n D1076 low
A Status data. The content of ”ABCD” will be different D1077 low
B according to the status objects (00~03). 00~03 indicate D1078 low
C frequency, current and operation mode respectively. D1079 low
D Please refer to the explanation shown below for details. D1080 low
Nn = “00” Frequency command = ABC.D(Hz)
Nn = “01” Output command = ABC.D(Hz)
Nn = “02” Output current = ABC.D(A)
PLC will automatically convert ASCII word of ”ABCD” to value and store
the value in D1050. For example, if ”ABCD” = “0600”, PLC will
automatically convert ASCII word to the value of K0600 (0258 H) and store
it in the special register in D1050.
Nn = “03” Operation command
: Starting device for the operation of sum check (ASCII mode) : Operand
Command
numbers : Starting device for storing the operation result. LRC check: please
Explanation
refer to the footnote.
: operand numbers should be even and range is from K1~K256. If it is out of
range, error will be occurred and commond won’t be executed. At this time, M1067 and
M1068 will be On and error code 0E1A will be record in D1067.
16-bit conversion mode: When M1161=Off, hexadecimal data that start from the source
devcie will be divided into upper 8-bit and lower 8-bit and perform the operation
of LRC command on numbers. Then, store the result into upper and lower 8-bit
of device .
8-bit conversion mode: When M1161=On, divide hexadecimal data that start from the
source devcie into upper 8-bit (invalid data) and lower 8-bit and perform the
operation of LRC command on numbers. Then, store the result into lower 8-bit
of device and it will use two resisters (upper 8-bit of all be zero (0)).
Communication between PLC and VFD-B series AC drives (ASCII Mode, M1143= Off),
Program
(8-bit Mode, M1161=On), writing transmitting data in advance to read six data from
Example
VFD-B parameter address H2101.
M1002
Setting communication
MOV H86 D1120 protocol 9600, 7, E, 1
Register DATA
D113 low ‘D’ 44 H LRC CHK 1 LRC CHK (0,1) is error
D114 low ‘4’ 34 H LRC CHK 0 check code
D115 low CR AH
END
D116 low LF DH
The LRC CHK (0,1) above is error check code and it can be calculated by LRC command
(8-bit Mode, M1161=On).
M1000
LRC D101 K12 D113
: Starting device for the operation of sum check (RTU mode) : Operand
Command
numbers : Starting device for storing the operation result. CRC check: please
Explanation
refer to the footnote.
: range is from K1~K256. If it is out of range, error will be occurred and commond
won’t be executed. At this time, M1067 and M1068 will be On and error code 0E1A will
be record in D1067.
16-bit conversion mode: When M1161=Off, hexadecimal data that start from the source
devcie will be divided into high byte and low byte. To perform the operation of
CRC command on numbers and store the result into upper and lower 8-bit of
device .
8-bit conversion mode: When M1161=On, divide hexadecimal data that start from the
source devcie into high byte (invalid data) and low byte. To perform the
operation of CRC command on numbers and store the result into low byte of
device and it will use two resisters (upper 8-bit of all be zero (0)).
When PLC connects to VFD-S AC drive (RTU Mode, M1143=ON), (16-bit Mode,
Program
M1161=ON), writing transmitting data, H12, in advance into VFD-S parameter address
Example
H2000
Setting communication
MOV K100 D1129
time out 100ms
X10
RS D100 K8 D120 K8
receiving
completed
Process of receiving data
M1123
RST M1123 receiving completed and flag reset
PLC VFD-S, PLC transmitting: 01 06 2000 0012 02 07
Register DATA
D100 low 01 H Address
D101 low 06 H Function
D102 low 20 H
Data address
D103 low 00 H
D104 low 00 H
Data content
D105 low 12 H
D106 low 02 H CRC CHK 0
D107 low 07 H CRC CHK 1
The CRC CHK (0,1) above is error check code and it can be calculated by CRC command
(8-bit Mode, M1161=On).
M1000
CRC D100 K6 D106
CRC check: At the time, 02 H is stored in the lower 8-bit of D106 and 07 H is stored in the
lower 8-bit of D107.
RTU mode of communication data, the format is listed below:
Footnote START Please refer to the following explanation
Address Communication address: 8-bit binary
Function Function code: 8-bit binary
DATA (n-1) Data content:
……. n × 8-bit data
DATA 0
CRC CHK Low CRC check:
CRC CHK High 16-bit CRC check sum consists of 2 8-bit binary
END Please refer to the following explanation
CRC check:
CRC check starts from “Address” and ends in “Data content”. CRC check starts from
“Address” and ends in “Data content”. Its calculation is as follows:
Step 1: Load the 16-bit register (the CRC register) with FFFFH.
Step 2: Exclusive OR the first 8-bit byte message command with the 16-bit CRC
register of the low byte, then store the result into the CRC register.
Step 3: Shift the CRC register one bit to the right and fill 0 in the higher bit.
Step 4: Check the value that shifts to the right. If it is 0, store the new value from
step 3 into the CRC register, otherwise, Exclusive OR A001H and the CRC
register, then store the result into the CRC register.
Step 5: Repeat step 3 and 4 and calculates the 8-bit.
Step 6: Repeat Steps 2~5 for the next 8-bit message command, till all the message
commands are processed. And finally, the obtained CRC register value is
the CRC check value. What should be noticed is that the CRC check must
be placed interchangeably in the check sum of the message command.
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
: Lower limit of binary floating point zone comparison : Upper limit of binary
Command
floating point zone comparison : Comparison value of binary floating point
Explanation
: Comparison result, 3 continuous devices used.
The data of is compared to the data range of ~ and the result (>,
=, <) is showed by three bit devices in .
If the source operand or is indicated as constant K or H, the integer value
will automatically be converted to binary floating point to compare.
When > , will be used as upper and lower limit for the comarison.
If the specified device is M10, M10~M12 will automatically be used.
Program
When X1=On and execute DEZCP command, one of M0~M2 will be On. When X1=Off
Example
and not to execute EZCP command, M0~M2 will retain the state before X1= Off.
Please use RST or ZRST command to reset the result.
X0
DEZCP D0 D10 D20 M0
M10
It is On when (D1A D0)>(D21A D20)
M11
it is On when (D1A D0) < (D21A D20)<(D11A D10)
M12
It is On when (D21A D20)>(D11A D10)
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
D1 D0 degree value
binary floating point
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
D1 D0 radian value
binary floating point
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
When X0=On, the binary floating point value in D1, D0 will be converted to decimal
Program
floating point stored in D3, D2.
Example
X0
DEBCD D0 D2
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
When X1=On, the decimal floating point value in D1, D0 will be converted to binary
Program
floating point stored in D3, D2.
Example
1 X1
DEBIN D0 D2
When X2=On, add binary floating point value of (D11, D10) and K1234 (automatically
Program
Example converted to binary floating point) and store the result in (D21, D20).
2
X2
DEADD D10 K1234 D20
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
When X2=On, binary floating point value of (D1, D0) is subtracted from K1234
Program
Example (automatically converted to binary floating point) and the result is stored in (D11, D10).
2 X2
DESUB K1234 D0 D10
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
When X2=On, binary floating point value of (D1, D0) is multiplied with K1234
Program
Example (automatically converted to binary floating point) and the result is stored in (D11, D10).
2 X2
DEMUL K1234 D0 D10
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
When X2=On, binary floating point value of (D1, D0) is divided by K1234 (automatically
Program
Example converted to binary floating point) and the result is stored in (D11, D10).
2
X2
DEDIV D0 K10 D10
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
M1
DEXP D10 D20
M2
DEBCD D20 D30
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
M1
DLN D10 D20
M2
DEBCD D20 D30
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
D2 D12
M1
D10 D12 D20
M2
DEBCD D20 D30
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
D2 D12
M1
D10 D12 D20
M2
DEBCD D20 D30
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
When X1=On, the binary floating point value of (D21, D20) will be converted to BIN
integer and the result is stored in (D31, D30). The decimal of BIN integer will be
discarded.
X0
INT D0 D10
X1
DINT D20 D30
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
S
-2 - 32 -2 -2 0
2
3
2
2
-1
When M1018=Off, it is radian mode. When X0=On, specify RAD value (D1, D0).
Program
Example Calculate SIN value of angle and store the result in (D11, D10). The result stored in
1 (D11, D10) are all in binary floating point format.
M1002
RST M1018
X0
DSIN D0 D10
M1002
SET M1018
X0
DSIN D0 D10
D1 D0 angle value
SIN value
D 11 D 10 (binary floating point)
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
S
-2 - 32 -2 -2 0
2
3
2
2
-1
When M1018=Off, it is radian mode. When X0=On, specify RAD value (D1, D0).
Program
Example Calculate COS value of angle and store the result in (D11, D10). The value in (D1, D0)
1 and the result stored in (D11, D10) are all in binary floating point format.
M1002
RST M1018
X0
DCOS D0 D10
COS value
D1 D10 binary floating point
When M1018=On, it is angle mode. When X0=On, it is angle of specific (D1, D0). Angle
Program
Example range: 0°≦angle<360°. After converting to COS value, save in (D11, D10) with binary
2 floating point.
M1002
SET M1018
X0
DCOS D0 D10
D1 D0 angle value
COS value
D1 D 10 (binary floating point)
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
-2 2
2
- S
-2 0 3
- 32 -1 1
2
When M1018=Off, it is radian mode. When X0=On, specify RAD value (D1, D0).
Program
Example Calculate TAN value of angle and store the result in (D11, D10). The value in (D1, D0)
1 and the result stored in (D11, D10) are all in binary floating point format.
M1002
RST M1018
X0
DTAN D0 D10
D1 D0 angle value
TAN value
D1 D 10 (binary floating point)
As for the operation function of floating point, please refer CH 5.3 Handling of Numeric
Footnote Values for detail.
S
-1,0 0 1,0
-2
When X0=On, specify binary floating point (D1, D0). Calculate ASIN value and save the
Program
result in (D11, D10). The result stored in (D11, D10) is all in binary floating point format.
Example
X0
DASIN D0 D10
S
-1,0 0 1,0
When X0=On, specify binary floating point (D1, D0). Calculate ACOS value and save
Program
the result in (D11, D10). The result stored in (D11, D10) is all in binary floating point
Example
format.
X0
DACOS D0 D10
S
0
-
2
When X0=On, specify binary floating point (D1, D0). Calculate ATAN value and save
Program
the result in (D11, D10). The result stored in (D11, D10) is all in binary floating point
Example
format.
X0
DATAN D0 D10
X0
DCOSH D0 D10
When GPWM command has been executed, the pulse output width and pulse
output cycle is output through pulse output device .
When ≦ 0, there is no pulse output from the pulse output device. When
≧ , the pulse output device will be always On.
When X0=On, Y10 will output following pulse. When X0=Off, Y10 output will also be
Program Off.
Example
t T
X0
GPWM K1000 K2000 Y10
t=1000ms
Output Y10
T=2000ms
This command counts by scan cycle so the maximum offset will be a PLC scan cycle.
Footnote The value of , and ( - ) should be larger than PLC scan cycle.
Otherwise, there will be error occurs for GPWM outputs.
Please notice that if using this command in subroutine or interruption, GPWM output
may not be accurate.
Operand S2 usage range is 1~3000 to show 0.1°C ~300°C. The unit is 0.1°C. If (
+1) (refer to footnote) sets to K0 to show 0.1°C~300°C.
Therefore, when user gets the result that analog converts to digital from temperature
sensor, it needs to convert to the value during 1~3000 by using the four fundamental
operations of arithmetic.
is sampling time setting. If setting is less than K1, command won’t act. If setting
exceeds K200, it will be regarded as K200.
The setting of ( +1) only can be K0 (means °C) and K1 (means °F). When setting
is not these two settings (K0 and K1), this setting will be set to K0.
Operand D usage range is 0~100 to show 0%~100%. User should use with other
commands by heater type when using this command. For example, it can use with
GPWM command to control pulse output as shown in footnote (example 1).
X0
FTC D0 D1 D100 D150
+5:
Control Diagram:
FTC
+ e Fuzzy
MV
Controller
PV
Temperature
Sensor
SV + e Fuzzy MV PWM
Program Y10
D0 Controller D10
PV D1
Temperature
Pt Module Sensor
Following time chart is using GPWM command to output Y10. (t is pulse output width
and T is pulse output cycle time)
T11
T10
The setting of FTC command is sampling time D2=K10 (unit: 10ms) and temperature
unit is D3=K0(℃). Other example for using with temperature control are shown in
following.
M3
FTC D0
SET M4
CJ P0
CJ P0
M4
> T10 K99 SET Y10
RST M4
M3
TMR T10
Y10
TMR T11
T11
RST Y10
T10
SET Y10
RST T10
D0
High Byte Low Byte
When X0=ON, swapping upper 8-bit and lower 8-bit of D11 and swapping upper 8-bit
Program
Example and lower 8-bit of D10.
2 X0
DSWAP D10
D11 D10
High Byte Low Byte High Byte Low Byte
32-bit command DMEMR reads 100 items data from the 20th address of file register
Program
Example and store the read data in the data register started from D3000.
2 When X0=On, the command is executed. When X0 goes to Off, the command is not
executed and the content of previous read data has no change.
X0
DMEMR K20 D3000 K100
EH series models: when EH series PLC startup or goes from STOP to RUN, EH
File Register series PLC will determine M1101 (if startup the function of file register), D1101 (file
register starts to give number, K0~K9,999), D1102 (numbers of file registers of being
read, K1~K8,000), D1103 (destination device which stores the read data of file register,
specified data register D start to give number, K2,000~K9,999) and decide if
automatically transfer the content of file register to the specified data register.
EH series models: When the value of D1101 is less than 0, or the value of D1103 is
less than 2,000 or more than 9,999, reading data from file register to data register is
disabled.
EP series models: when EP series PLC startup or goes from STOP to RUN, EP series
PLC will determine M1101 (if startup the function of file register), D1101 (file register
starts to give number, K0~K1,600), D1102 (numbers of file registers of being read,
K1~K8,000), D1103 (destination device which stores the read data of file register,
specified data register D start to give number, K2,000~K4,999) and decide if
automatically transfer the content of file register to the specified data register.
EP series models: When the value of D1101 is less than 0 or more than 1,600, or the
value of D1103 is less than 2,000 or more than 4,999, reading data from file register to
data register is disabled.
When file register read data to data register D, if the address of file register or data
register exceeds the limit range, PLC will stop reading.
As for the data read and write in of file register, in PLC program only can use API
command 147 MEMR to read and use API command 148 MEMW to write in. For
detailed information about file registers, please refer to CH2 section 2.8.3.
There are 32,768 file registers. The file registers don’t have real number, therefore the
read/write in function of file register should be performed by the API command 147
MEMR and 148 MEMW, or using a peripheral equipment HPP and WPLSoft software.
The destination device is not always continuous. One part is on the inner SRAM and
the other part is on the SRAM CARD. If user did not insert the SRAM CARD and the
read address exceeds 2,000 addresses, then the read value will be all 0(zero).
Related special relays and registers of file register:
Flag Function Explanation
M1101 If startup the function of file register, Latched, Default is Off
Special
Function Explanation
Register
D1101 File register starts to give number K0~K9,999, Latched, Default is 0
D1102 Numbers of file registers of being read K1~K8,000, Latched, Default is 0
D1103 Destination device which stores the read data of file register, specified
data register D start to give number K2,000~K9,999, Latched, Default is
2,000
User can use MOV, DMOV or BMOV commands to move D1296~D1311 that store
Program hexadecimal data to general register to use. For ES series, other command is invalid
Example to this area.
1
Received data is stored in 8 continuous registers that start from D0 and specified by
users in hexadecimal format in RTU mode. At the same time, D1296~D1311 is invalid.
In ASCII mode or RTU mode, PLC will store the transmission data in D1256~D1295.
Users can move these register data to general register by using MOV, DMOV or
BMOV commands. Other commands are invalid to this area.
Data received from AC drive is stored in registers specified by users. After complete
receiving data, PLC will automatically check if the received data is correct. If there is
any fault, M1140 will be set to ON.
If inner data address of AC drive is illegal to specified device, it will have fault code.
Fault code will be stored in D1130 and M1141 will be on. For example, 8000H is illegal
to VFD-S and M1141=ON and D1130=2. Please refer to VFD-S user manual to fault
code.
After M1140=ON or M1141=ON, it will transmit a correct data to AC drive. If received
data is correct, M1140 and M1141 will be reset.
M1002
setting communication
MOV H87 D1120 protocol 9600, 8, E, 1
setting communication
MOV K100 D1129 time out 100ms
X10
M1143 RTU mode setting
X0
MODRW K1 K3 H2100 D0 K8
connection function data address data stored read/write data
device code K3 H2100 register length (word)
address K1 read many
items data
X0
SET M1122 Setting sending request
M1127
handling received data
M1002
setting communication
MOV H87 D1120 protocol 9600, 8, E, 1
setting communication
MOV K100 D1129 time out 100ms
X10
M1143
X0
MODRW K1 K6 H2000 D50 K1
connection function data address data stored read/write data
device code K6 H2000 register length (word)
address K1 write one
data in
X0
SET M1122 setting transmit flag
M1127
handling received data
ASCII mode : received data in ASCII format stored in special registers D1070~1078.
RTU mode : received data in hexadecimal format stored in special registers D1070~1078.
Function code K16(H10) : write many items WORD data into register
Program
Example 1. PLC connects to VFD-S AC drive. (ASCII Mode when M1143=OFF)
3
2. PLC connects to VFD-S AC drive. (RTU Mode when M1143=ON)
When in ASCII mode, users store the data that will be wrote to AC drive in ASCII
format in 8 continuous specified register started from D0. Received data from AC drive
will be stored in registers D1070~D1078.
When in RTU mode, users store the data that will be wrote to AC drive in hexadecimal
format in 8 continuous specified register started from D0. Received data from AC drive
will be stored in registers D1070~D1078.
When in ASCII mode or RTU mode, PLC will store the transmission data in registers
D1256~D1295. Users can move these data to general registers by using MOV, DMOV
or BMOV commands. Other commands are invalid to this area.
After complete receiving data, PLC will automatically check if the received data is
correct. If there is any fault, M1140 will be set to ON.
If inner data address of AC drive is illegal to specified device, it will have fault code.
Fault code will be stored in D1130 and M1141 will be on. For example, 8000H is illegal
to VFD-S and M1141=ON and D1130=2. Please refer to VFD-S user manual to fault
code.
M1002
setting communication
MOV H87 D1120 protocol 9600, 8, E, 1
setting communication
MOV K100 D1129 time out 100ms
X10
M1143
X0
MODRW K1 K16 H2000 D50 K8
connection function data address data stored read/write data
device code K16 H2000 register length (word)
address K1 write one
data in
X0
SET M1122 setting transmit flag
M1127
handling received data
ASCII mode : received data in ASCII format stored in special registers D1070~1078.
RTU mode : received data in hexadecimal format stored in special registers D1070~1078.
The startup condition (the contact) before MODRD, RDST, MODRW these three
Footnote commands, cannot use rising-edge contact and falling-edge. Otherwise, the data
stored in received register will be incorrect.
Related flags and special registers of RS-485 communication MODRW command:
Please refer to the footnote of API 80 RS command for more detail information.
Flag/Special
Function Description
Register
Communication setting latched. The change of D1120 will be
M1120
invalid after setting.
M1121 When it is Off, RS-485 of PLC is sending communication data.
M1122 Delivery request
M1123 Receive completed
M1124 Receive waiting message
M1125 Receive status disable
M1126 STX/ETX system definition selection
M1127 MODRD / RDST / MODRW commands data receive completed
M1128 Transmitting/receiving indication
M1129 Receive time out
M1130 Users/system definition STX/ETX
M1131 MODRD / MODWR / MODRW data convert to HEX, M1131=ON
M1140 MODRD / MODWR / MODRW data receive error
M1141 MODRD / MODWR / MODRW command parameter error
M1142 VFD-A convenience command data receive error
ASCII/RTU mode selection (use with commands
M1143 MODRD/MODWR/MODRW) (Off is ASCII mode, ON is RTU
mode)
It is PLC built-in RS-485 communication convenience command.
This command will send messages during executing and if the
D1070~D1085 receiver receives, it will return messages and save it in
D1070~D1085. Users can view return data by this register
content.
D1120 RS-485 communication protocol
PLC communication address.(save PLC communication address,
D1121
has latched function)
D1122 Remainder characters of delivery data
D1123 Remainder characters of received data
D1124 Start text definition(STX)
D1125 Definition of the first end character(ETX1)
D1126 Definition of the second end character(ETX2)
D1129 Communication time out abnormal. Time unit:(ms)
D1130 Return fault code record of MODBUS
This is PLC built-in RS-485 communication convenience
command MODRW. The message that this command sends
D1256~D1295
during executing will be saved in D1256~D1295. User can check
according to this register content.
PLC will automatically convert ASCII data saved in the register
D1296~D1311
specified by users to hexadecimal format.
: Source device
Command
The limit range of is K0~K9, specified special D register and can measure ten
Explanation
interrupt subroutine at most, the number of specified special D register is D1156~1165
in order. For example, when the value of is K5, it means the number of
specified special D register is D1161
Program When X0 is Off→On, enter into I001 interrupt subtoutine, the RTMU command will
Example
start a 8-bit timer (unit time is 10us). When reaching RTMD command K0 , close the
timer and store the measurin time in special D register (there are totally ten registers
D1156~D1165 and it is specified as K0~K9).
FEND
M1000
I 001 RTMU K0 D0
M1000
RTMD K0
IRET
After developing PLC program completed, we recommanded that user should remove
Footnote this command.
Additional Explanation:
1. Due to the time interrupt executed by RTMU command is a less priority (less
important than other interrupts), the timer may not be triggered and cannot count the
time when executing high-speed pulse input counting or specifying high-speed pulse
input during the execution period of RTMU command.
2. If user execute RTMU command but not execute RTMD command before the end of
program interrupt, then the interrupt will not be ended.
3. Please specially notice that RTMU command is executed by starting one inner timer
interrupt of PLC, therefore, the timer may be disordered if execute multiple RTMU or
RTMD commands simultaneously.
: lower bound for producing random number. : upper bound for producing
Command
random number. : result for producing random number.
Explanation
When user inputs S1 > S2, PLC will occur operand error and won’t execute it, and
then M1067, M1068=On, and records error code 0E1A(HEX) in D1067.
When X10=On, the random number that produced during lower bound D0 and upper
Program
bound D10 will save in D20.
Example
X10
RAND D0 D10 D20
This command provides continuous absolute position data read function of mitsubishi
Command
servo drive MR-J2 (with absolute position check function).
Explanation
: Input signal from Servo : Control signal for controling Servo :
Absolute position data (32 bit) read from Servo
is the input signal from Servo and it will use 3 continuous devices , +1,
+2. Device and +1 are connected to the ABS (bit0, bit1) of Servo for
data transmitting. Device +2 is connected to Servo for transmitting data ready flag.
Please see the wiring drawing below for details.
is the control signal for controling Servo and it will use 3 continuous devices ,
+1, +2. Device is connected to Servo On (SON) of Servo, device
+1 is connected to ABS data transmitting mode of Servo and +2 is connected
to ABS data request signal. Please see the wiring drawing below for details.
PLC SERVO AMP
DVP32EH00T MR-J2-A
CN1B
+24V VDD 3
S/S
ABS(bit 0)
X0 D01 4
ABS(bit 1)
X1 ZSP 19
transmission data is ready
X2 TLC 6
24G SG 10
SERVO ON
Y4 SON 5
ABS transmission mode
Y5 ABSM 8
ABS requirement
Y6 ABSR 9
C4
is the absolute position data (32 bit) read from Servo and it will use 2 continuous
devices , +1. is low word and +1 is high word. The absolute
position data should be stored in the current value registers (D1337, D1336)
corresponding to CH0 pulse or the current value registers (D1339, D1338) corresponding
to CH1 pulse, so it is recommanded to specify these two registers. If specify other
devices, finally, the user still have to transmit the data into the current value registers
(D1337, D1336) corresponding to CH0 pulse or the current value registers (D1339,
D1338) corresponding to CH1 pulse.
When DABSR command drvie contact turns ON and read starts, the command execution
completed flag M1029, M1030 will be energized. The flags must be reset by user.
When driving the DABSR command, please specify normally open contact. If the drive
contact of DABSR command turns Off when DABSR command read starts, the execution
of absolute current value read will be interrupted and result in incorrect data. Please be
careful and notice that.
If the drive contact of DABSR command turns Off after the read is completed, the Servo
On (SON) signal connected to will also turn Off and the operation will be disabled.
When X7= On, the absolute position data (32 bit) read from Servo should be stored in the
Program
current value register (D1337, D1336) corresponding to CH0 pulse. At the same time,
Example
drive a timer T10 to count 5 second. If over 5 second and the absolute position data (32
bit) read not complete, it will drvie M10=On and this means the absolute position data (32
bit) read is abnormal.
When connecting to system, please set the power of DVP-PLC and SERVO AMP to be
On at the same time or set the SERVO AMP to be ON earlier than the power of DVP-PLC.
X7
DABS X0 Y4 D1336
M11
TMR T0 K50
ABS read completed
M1029
ABS absolute position
SET M11 data read completed
execution completed
flag
CN1 CN1B
ABS(bit 0)
X0 PF 24 X0 D01 4
ABS(bit 1)
X1 ZSP 23 X1 ZSP 19
transmitting data ready flag
X2 TLC 25 X2 TLC 6
+ COM SG 16 COM SG 10
24V
SERVO ON
Y4 SON 12 Y4 SON 5
ABS data transmitting mode
Y5 D13 44 Y5 ABSM 8
ABS data request
Y6 D14 45 Y6 ABSR 9
COM4
SERVO ON SON
ABS data
transmitting mode ABSM
Transmitting
TLC AMP output
data ready
ABS data ABSR Controller output
request
ABS(bit 1) ZSP AMP output
ABS(bit 0)
D01 AMP output
This command is applicable to the Servo motor equipped with absolute positioning
function is connected, such as Mitsubishi MR-J2-A Servo drive.
The Servo motor with absolute positioning function should be rotated more than one
revolution and given the reset signal before manufacturing equipments. Please use one of
the following methods to proceed the first time zero point return:
1. Complete zero point return by using reset signal function to execute API 156 ZRN
command.
2. After using JOG or manual operation to adjust the zero point position of the
equipment, input reset signal SERVO AMP. As for the reset signal input, please refer
to the external switches diagram below to see if using DVP-PLC controller to output.
For the detail of the wiring between DVP-PLC and Mitsubishi MR-J2-
A, please
refer to the API 159 DRVA.
CR 8
reset
SG 10
Flags description:
M1010: In EH series MPU, when M1010= On, CH0 (Y0, Y1) and CH1 (Y2, Y3) will
output pulse while END command is executed. When output starts, M1010 will
automatically turn Off.
M1029: In EH series MPU, M1029=On after the first group pulse (Y0, Y1) pulse output
complete or other relative command complete execution.
M1030: In EH series MPU, M1030= On after the second group pulse (Y2, Y3) pulse
output complete.
M1334: In EH series MPU, CH0 (Y0, Y1) pulse stop output when M1334= On.
M1335: In EH series MPU, CH1 (Y2, Y3) pulse stop output when M1335= On.
M1336: In EH series MPU, CH0 (Y0, Y1) pulse output indication flag
M1337: In EH series MPU, CH1 (Y2, Y3) pulse output indication flag
M1346: In EH series MPU, ZRN command CLEAR output signal enable flag
Special registers description:
D1337, D1336: 1. D1337(HIGH WORD), D1336(LOW WORD) represents the
current value registers of positioning control commands (API 156
ZRN, API 157 PLSV, API 158 DRVI, API 159 DRVA) output to the
first output group Y0, Y1, the current value increases or decreases
in accordance with the direction of rotation.
2. D1337(HIGH WORD), D1336(LOW WORD) represents the total
number of output pulse of pulse output commands (API 57 PLSY,
API 59 PLSR) output to the first output group Y0, Y1.
D1338, D1339: 1. D1339(HIGH WORD), D1338(LOW WORD) represents the
current value registers of positioning control commands (API 156
ZRN, API 157 PLSV, API 158 DRVI, API 159 DRVA) output to the
second output group Y2, Y3, the current value increases or
decreases in accordance with the direction of rotation.
2. D1339(HIGH WORD), D1338(LOW WORD) represents the total
number of output pulse of pulse output commands (API 57 PLSY,
API 59 PLSR) output to the first output group Y2, Y3.
D1340: Operates as the frequency setting of the first step acceleration and
last step deceleration when positioning control commands (API 57
PLSY, API 59 PLSR) are executed.
Setting range: This speed can not less than 10Hz. If the speed is less
than 10Hz or larger than max. output frequency, it will output by 10Hz.
Factory setting is 200Hz.
Note: When controlling stepping motor, please consider the
resonance of stepping motor and limit of initial frequency while setting
speed.
D1341, D1342: D1342(HIGH WORD), D1341(LOW WORD) represents as the
maximum speed setting when positioning control commands ((API
156 ZRN, API 158 DRVI, API 159 DRVA) are executed.
Setting range: it is 200KHz.
D1343: Operates as the Acceleration/Deceleration time setting in which
maximum speed (D1342, D1341) is achieved from the first step
acceleration and last step deceleration when positioning control
commands (API 156 ZRN, API 158 DRVI, API 159 DRVA) are
executed.
Setting range: This acceleration / deceleration time can’t be less than
50ms. If it less than 50ms or larger than 5000ms, it will output by
50ms.Facotry setting is 100ms.
Note: When controlling stepping motor, please consider the
resonance of stepping motor and limit of initial frequency while setting
speed.
: Zero point return speed : Creep speed : Near point signal (DOG)
Command
: Pulse output device (Please use transistor output as output module)
Explanation
is specified as the zero point return speed as, 16-bit 10 to 32,767Hz or 32-bit 10
to 200,000Hz.
is specified as the creep speed, the lower speed after near point signal (DOG)
turns On and its available range is 10 to 32,767Hz.
is specified as the near point signal (DOG) input (A contact input). If any Y, M, S
device other than an input relay (X) is specified for the near point signal, it will be
affected by the scanning cycle of the PLC and the dispersion of zero point may be
large.
about 20ms
+ 1 scan time inside 1ms
ON
M1336, M1337
Pulse output monitor OFF
4. When the operation of pulse output is completed and flag M1029, M1030 is
activated, indication flag M1336 sent by CH0 pulse or indication flag M1337 sent
by CH1 pulse will be Off.
5. Hence, the command can not search the position of Near point signal (DOG) and
the operation of ZRN command only can be processed in unidirection. In the
operation of ZRN command, the content value of current value register (D1337,
D1336) of CH0 pulse or current value register (D1339, D1338) of CH1 pulse will
decrease.
Near point
LSR signal ON switch near LSF
(Backward limit) (DOG) zero point (Forward limit)
DOG
Motor
Back end Front end
Backward Forward
When the drive contact of DRVI command turns Off, it is impossible to drive DRVI
command again even if the pulse send indication flag M1336 of CH0 pulse or pulse
send indication flag M1337 of CH1 pulse is set.
When M10= On, twenty thousands (20000) of 2KHz frequency pulses outputs from Y0
Program
(relative positioning). Y5= On represents the positive direction.
Example
M10
DRVI K20000 K2000 Y0 Y5
Current
position -3,000
Output pulse
frequency
The minimum value of output pulse frequency which can be actually used is deternined
by the following equation:
1. Minimum value of output pulse frequency =
3. The actual output pulse frequency of the first step acceleration and last step
deceleration also use the calculation value of the equation above as the minimum value.
2. Although the specified output pulse frequency is equal to 400 Hz (lower than
the calculation value, 500 Hz), the frequency of 500 Hz will be still be used when
output the pulses.
50000Hz
500Hz 500Hz
Flags description:
M1010: In EH series MPU, when M1010= On, Y0, Y1 and Y2, Y3 will output pulse
while END command is executed. When output starts, M1010 will
automatically turn Off.
M1029: In EH series MPU, M1029= On after Y0, Y1 pulse output complete.
In EP/ES series MPU, M1029= On after Y0 pulse output complete.
M1030: In EH series MPU, M1030= On after Y2, Y3 pulse output complete.
In EP/ES series MPU, M1030= On after Y1 pulse output complete.
M1334: In EH series MPU, CH0 (Y0, Y1) pulse stop output when M1334= On.
M1335: In EH series MPU, CH1 (Y2, Y3) pulse stop output when M1335= On.
M1336: In EH series MPU, CH0 (Y0, Y1) pulse output indication flag
M1337: In EH series MPU, CH1 (Y2, Y3) pulse output indication flag
M1346: In EH series MPU, ZRN command output signal enable flag
D1340: Operates as the frequency setting of the first step acceleration and last
step deceleration when positioning control commands (API 156 ZRN,
API 158 DRVI, API 159 DRVA) are executed.
Setting range: 1/10 or less of maximum speed (D1342, D1341)
If the current value exceeds the range, it is automatically set to 1/10 of
the maximum speed during operation.
3. Note: When controlling stepping motor, please consider the
resonance of stepping motor and limit of initial frequency while
setting speed.
D1341, D1342: D1342(HIGH WORD), D1341(LOW WORD) represents as the maximum
speed setting when positioning control commands (API 156 ZRN, API
158 DRVI, API 159 DRVA) are executed.
Setting range: 10 to 200,000Hz, the factory setting (default) is 200,000Hz
Note: The output pulse frequency specified by operand S2 of API 158
DRVI command should be under this maximum speed.
When M10= On, twenty thousands (20000) of 2KHz frequency pulses outputs from Y0
Program
(absolute positioning), Y5= On represents the positive direction.
Example
M10
DRVA K20000 K2000 Y0 Y5
Zero point
0
Fa accelerated gradient
output
Current Initial value: 50ms
Initial value: 50ms pulse
position (D1343) (D1343) number
The relation between actual frequency and acceleration / deceleration time is in the
following:
3-phase power
servo motor
L
220VAC S V
220VAC
single-phase T W
N
+24V CN1
S/S 7 DO1+ SRDY
24G DO_COM CN1 24V 6 DO1-
X0 start VDD 17 5 DO2+ ZSPD
X1 zero point reset COM+ 11 4 DO2-
X2 JOG(+) DI 1 9 3 DO3+ TPOS
X3 JOG(-) DI 5 33 2 DO3-
X4 stop DI 6 32 1 DO4+ ALARM
X5 error reset DI 7 31 26 DO4- DO_COM
X6 forward limit DI 8 30
X7 reverse limit COM- 50
DI 1 : servo start
DI 5 : servo reset
X10 SRDY
DI 6 : forward limit CN2 Encoder
X11 ZSPD DI 7 : reverse limit
X12 TPOS DI 8 : emergency stop
Error
X13 ALARM CN1
Counter
X14 /OZ 24
Z phase signal (zero point signal)
DO_COM COM- 45
Electric
Gear
pulse clear
Y2 DI 2 10 200KPPS
C2 COM- 45
pulse output
Y0 /PLS 43
C0 COM- 47
forward/reverse direction
Y1 /SIGN 36
C1 COM- 49
DVP32EH00T
Note:
Please connect forward/reverse limit switch to SERVO AMP.
Wiring example of connection between DVP-EH series PLC and a Mitsubishi
MR-J2-□A Servo drive:
3-phase power
servo motor
L
220VAC S V
220VAC
single power T W
N
+24V CN1A
S/S CN1B 14 RD Rc3
24G SON 5
X0 start RES 14 18 INP Rc2
pulse output
Y0 PP 3
C0 SG 10
forward/reverse direction
Y1 NP 2
C1 SG 10
DVP32EH00T
The current value register (D1337 high byte, D1336 low byte) of CH0 pulse or current
value register (D1339 high byte, D1338 low byte) of CH1 will both be used in position
control commands and pulse output commands and this will result in complicated
operation. To avoid incorrect operation when pulse output commands are required while
position control commands are used, it is recommended to use position control
commands in place of pulse output commands.
Explanation of pulse output terminals Y0, Y1of CH0 pulse and Y2, Y3 of CH1 pulse:
1. Voltage range: DC5V to DC24V
2. Current range: 10 mA to 100 mA
3. Output pulse frequency: Y0, Y2 is 200KHz, Y1, Y3 is 10KHz.
Pulse output signal settings of positioning operation:
There are three kinds of pulse output signal of positioning operation for DVP-EH series
PLC:
1. 1-phase 1 output + direction (it is recommended to use this)
U/D
U/D FLAG
2. 1-phase 2 outputs (frequency limit is 10KHz)
U
D
3. 2-phase 2 outputs (frequency limit is 10KHz)
A
B
Please follow the PLC output settings above to set the pulse input type of parameters
on SERVO AMP or stepping motor.
Flags description:
M1010: In EH series MPU, when M1010= On, CH0 (Y0, Y1) and CH1 (Y2, Y3) will
output pulse while END command is executed. When output starts, M1010 will
automatically turn Off.
M1029: In EH series MPU, M1029= On after first group pulse CH0 (Y0, Y1) pulse
output complete or other relative commands complete execution.
M1030: In EH series MPU, M1030= On after second group pulse CH1 (Y2, Y3) pulse
output complete.
M1334: In EH series MPU, CH0 (Y0, Y1) pulse stop output when M1334= On.
M1335: In EH series MPU, CH1 (Y2, Y3) pulse stop output when M1335= On.
M1336: In EH series MPU, CH0 (Y0, Y1) pulse output indication flag
M1337: In EH series MPU, CH1 (Y2, Y3) pulse output indication flag
M1346: In EH series MPU, ZRN command output signal enable flag
100 200,000Hz
Zero point
500Hz
Acceleration/
Deceleration time
200ms
In this example, the minimum output pulse frequency calculated by equation=
MaxSpeed [D1342,D1341]Hz ÷ ( 2 × (Acceleration\Deceleration [ D1343]ms ÷1000 ))
M1000
Return to the zero point
M1346 with reset signal is valid
※1. If the maximum speed (D1342,D1341), the acceleration/deceleration (D1343) can set
in their factory setting value (default), then the programming is not required. The
factory setting value (default) of the maximum speed (D1342,D1341) is 200,000Hz.
The factory setting value (default) of the acceleration/deceleration (D1343) is 100
ms.
X3 M5
Reset the normal rotation
RST M12 positioning completed flag
JOG(-) Operation
2 being stopped
Reset the reverse rotation
RST M13 positioning completed flag
X4 M5 M10
Reset the normal rotation
RST M12 positioning completed flag
Positioning Operation Zero point
in normal being stopped return
rotation completed Reset the reverse rotation
flag RST M13 positioning completed flag
X5 M5 M10
Reset the normal rotation
RST M12 positioning completed flag
Positioning Operation Zero point
in reverse being stopped return
rotation completed Reset the reverse rotation
flag RST M13 positioning completed flag
※2. The maximum size of a JOG command is ±999,999 pulses, as this is equal to the
maximum number of output pulses for API 158 DRVI command. If a greater distance is
required, please execute the JOG command again.
S0 M50
Zero point return command
DZRN K50000 K5000 X6 Y0 operate in the (-) direction
Zero point
return Zero point Creep Near point Pulse output
return speed signal (DOG) device
speed
M1029
SET M10 Reset the zero point return
Execution completed flag
completed
M1336 M50
Zero point return is completed
RST S0 (auto-reset)
Y0 being
output
M1000 3
M50
※3. In order to prevent position control commands being driven at the same time, the
command drive timing is delayed by one scanning cycle.
M1000
M53
M1000
M54
RET
END
M10
ON when 12:20:45 >
M11
ON when 12:20:45 =
M12
ON when 12:20:45 <
: Lower limit time data : Upper limit time data : Current time of
Command
perpetual calendar : Comparison result
Explanation
is compared to the time period of ~ and the comparsion result is
stored in .
, +1, +2: respectively represent “Hours”, “Minutes”, “Seconds” of
the lower limit time data.
, +1, +2: respectively represent “Hours”, “Minutes”, “Seconds” of
the Upper limit time data。
M10
ON when
M11
ON when
M12
ON when
When X10= On, the command is executed. Add the time data specified by D0~D2 and
Program
D10~D12 and store the result in the register specified by D20~D22.
Example
X10
TADD D0 D10 D20
8 6 14
10 40 50
20 6 26
If the addition result is in a value greater than 24 hours, the Carry flag M1022=On.
X10
TADD D0 D10 D20
18 11 6
40 30 10
30 8 38
20 14 5
20 30 49
5 8 57
If the subtraction result is a negative value (less than 0), the borrow flag M1021= On.
X10
TSUB D0 D10 D20
5 19 10
20 11 9
30 15 15
2. It will display 4 bits (two right-most digit number + 2000) to replace original 2 digit
number.
3. If you want to write new time setting in 4 digit number display mode, only 2 digit
number you can write in and its range is “00-99” which corresponds to year
“2000-2099”. For example, 00=year 2000, 50=year 2050 and 99=year 2099.
General D Special D
Meaning Content Meaning
device device
D20 Year (A.D.) 00~99 D1319 Year (A.D.)
Perpetual Calendar Clock
Day Day
D21 1~7 D1318
(Mon.~Sun.) (Mon.~Sun.)
New setting time
Set the current time of perpetual calender and adjust the time to 2002/03/23, Tuesday,
Program
Example 15:27:30 (please refer the following program example).
2 The content of D0~D6 is the new setting time of perpetual calender.
When X10= On, then can change the current time of perpetual calender clock to
setting time.
When X11=On every time, the perpetual calender clock will perform the ±30 seconds
correction. “Correction” means that if the second hand of perpetual calender colock is
located between 1~29, the second time will be automatically calculated as “0” (zreo)
second and the minute time won’t change. However, if the second hand of perpetual
calender colock is located between 30~59, the second time will also be automatically
calculated as “0” (zreo) second but the minute time will increase 1 minute.
X10
MOV K02 D0 Year (2002)
MOV K3 D2 Month(March)
2. The year display will switch from two digit number to four digit number after the first
scan program when PLC is running. K2,000 in the command is a fix value.
3. If the new setting time is desired to be written in under the four digit number mode,
also only two digit number can be written in. The range for the year of two digit
number is 0~99. Hence, the corresponding range for the year of four digit number
is 1980~2079.
For example:
80(a two digit number) is equal to 1980(a four digit number)
99(a two digit number) is equal to 1999(a four digit number)
00(a two digit number) is equal to 2000 (a four digit number)
79(a two digit number) is equal to 2079 (a four digit number)
: setting time for turning on and unit is hour. Its setting range is
Command
K1~K32,767. : current time suring counting and unit is hour. Its setting range is
Explanation
K1~K32,767. : output device. +1 saves current time that less than one
hour and unit is second. Its setting range is K0~K3,599.
If using input contact to be timer, output device will be On when attaining setting time
(unit is hour). It can provide user a timer for managing machine operation or maintain.
After output device is On, timer will keep on counting.
When 16-bit timer counts up to max. value (32,767 hours and 3,599 seconds) of
16-bit, it will stop. If you want to recount, and +1 need to clear to 0.
- +3 need to clear to 0.
When 32-bit timer counts up to max. value (2,147,483,647 hours and 3,599 seconds)
of 16-bit, it will stop. If you want to recount, - +3 need to clear to 0.
For 16-bit command: When X0=On, Y10 will turns On and start to count time. When
Program
Example the time reaches 100 hours, Y0 will turns On and D0 will record the current time (unit
1 is hour, but if D0 is less than one hour, unit will be second and its range is 0~3599).
X0
Y10
Y10
HOUR K100 D0 Y0
For 32-bit command: When X0=On, Y10 will turns On and start to count time. When
Program
Example the time reaches 40000 hours, Y0 will turns On. D0 and D1 will record the current time
2 (unit is hour). If current time is less than one hour, D2 will record the current time (unit:
second).
b15 b0
K6513=H1971 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1
Y37 Y20
GRAY6513 0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1
K4Y20
X17 K4X0 X0
GRAY6513 0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1
b15 b0
H1971=K6513 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1
b15 b0
1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
Before MAND
Execution 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
After 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0
Execution 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0
0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0
Right
Left width is 16-bit
b15
D0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 b0
D1
b31 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 b16
D2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 b32
b47
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
Dn-1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
b16n-1
b15 b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before MOR
Execution
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
After
Execution 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
b15 b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before MXOR
Execution
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
After 0 1 0 1 1 0 1 0 1 11 1 0 0 0 0
Execution
0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0
0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0
b15 b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before
MXNR
Execution
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
After 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1
Execution
1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1
1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1
When X0=On, do MINV operation to 3 rows (D0-D2) of 16-bit register and 3 rows
Program
(D10-D12) of 16-bit register. Then save the result in 3 rows (D20-D22) of 16-bit register.
Example
X0
MINV D0 D20 K3
b15 b0
Before 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Execution 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
MINV
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
After
Execution 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
2
b0 D20
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 pointer
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
b47
MCMP
b0
0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1
b47
M1089=1.
X0
MBRD D0 D10 K3 D20
b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
b47 pointer
45
D20
When X0 is from Off→On, pointer clear flag M1094=On, matrix pointer increase flag
Program
M1093=1, and increase 1 to pointer Pr after writing a bit.
Example
When present pointer is D20=45, M1094 (matrix shift/input complement flag) =1.
When X0 is executed once from Off→On, it can get following result:
X0
MBWRP D0 K3 D20
b0
Before 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
Execution 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
b47 M1096
1 (Matrix shift/input complement flag)
45 D20 pointer
After 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
Execution
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1
b47
45 D20 pointer
This command is used to shift to left or right by matrix length. M1097=0 moves
to left and M1097=1 moves to right. It needs to use the state of M1096 (complement
flag) to fill the empty bit (shift to left is b0 and shift to right is b16n-1) due to shiftment
for each bit. If there is one more bit due to shiftment (shift to left is b16n-1 and shift to
right is b0), it needs to send the state to M1095 (carry flag) and save the result in
.
The most use of this command is pulse execution command (MBSP).
When X0=On, M1097=Off means shift matrix to left. Setting complement flag
Program
Example M1096=0, shift 16-bit registers D0-D2 to left and save the result in 16-bit register
1 D20-D22 and carry flag M1095 will be 1.
X0
RST M1097
MBSP D0 D20 K3
0 M1096
b15 b0
Before 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Execution
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
M1095 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
MBS
M1097=0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0
After shifting 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
to left
M1095 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
When X1=On, M1097=On to shift matrix to right. Setting complement flag M1096=1,
Program
Example shift 16-bit registers D0-D2 to right and save the result to 16-bit registers D20-D22 and
2 carry flag M1095 will be 0.
X1
M1097
MBSP D0 D20 K3
0 M1096
b15 b0
Before 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Execution
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
M1095 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
MBS
M1097=0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
M1095 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
MBRP D0 D20 K3
b15 b0
Before 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Execution 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
M1095 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
MBR
M1097=0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
After rotating 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
to left
M1095 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
When X1=On, M1097=On to rotate matrix to right. To rotate 16-bit registers D0-D2 to
Program
Example right and save the result to 16-bit registers D20-D22 . The carry flag M1095 will be 0.
2 X1
M1097
MBRP D0 D20 K3
b15 b0
Before 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 M1095
Execution
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
MBR
M1097=0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 M1095
After rotating 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
to right 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
12 M1098=0
36 M1098=1
Explanation for matrix command:
Footnote M1098: matrix count “bit 1” or “bit 0” flag
M1099: it is On when counted result is 0.
X0
AND & C0 C10 Y10
X1
AND I D10 D0 SET Y11
X2
DAND ^ D200 D100 M50
M3
When X1=ON, using the OR& (Logic “AND” operation) command to compare the
Program
Example content of C0 and C10. If the result is not equal to 0, Y0=ON.
If both X2 and M30 are “ON”, or when using the OR| (Logic “OR” operation) command
to compare the content of D10 and D20 and the result is not equal to 0, or when using
the OR^ (Logic “XOR” operation) command to compare the content of D100 and D200
and the result is not equal to 0, M60=ON.
X1
Y0
OR & C0 C10
X2 M30
M60
If the 32-bit length counter (C200~) is put into this command for comparison, be sure to
use the 32-bit command (DLD*). If the 16-bit command (LD*) is utilized, CPU will
determine it as “Program Error”, and the red “ERROR” indicator on the MPU panel will
be blinking.
If the content of counter C10 is equal to K200, Y10=ON.
Program
Example When the content of D200 is smaller or equal to K–30, and that X1=ON, Y11=ON and
retain.
If the content of C200 is smaller than K678,493 or when M3=ON, M50=ON.
X1
LD> D200 K-30 SET Y11
M3
When the left most bit, MSB (the 16-bit command: b15, the 32-bit command: b31),
from and is 1, this comparison value will be viewed as a negative value
for comparison.
If the 32-bit length counter (C200~C254) is put into this command for comparison, be
sure to use the 32-bit command (DAND*). Or if the 16-bit command (AND*) is
utilized, CPU will determine it as “Program Error”, and the red “ERROR” indicator on
the MPU panel will be blinking.
If X0=ON and that the current value of counter C10 equals K200, Y10=ON.
Program
Example If X1=OFF and that the content of register D0 not equal to K–10, Y11=ON and retain.
If X2=ON and that the contents of the 32-bit registers D11 and D0 are smaller than
K678,493, M50=ON.
X0
AND= K200 C10 Y10
X1
AND<> K-10 D0 SET Y11
X2
DAND> K678493 D10 M50
M3
X2 M30
M60