Chapter 7 Advanced Function List EN-101-178
Chapter 7 Advanced Function List EN-101-178
FUN100 D P FUN100 D P
REGISTER TO TABLE MOVE
R→T R→T
● When move control "EN" = 1 or transition from 0 to 1( P instruction), the contents of the source register Rs
will be written onto the register Tdpr indicated by the pointer Pr within the destination table Td (length is L).
Before executing, this instruction will first check the pointer clear "CLR" input signal. If "CLR" is 1, it will first
clear the pointer Pr, and then carry out the move operation. After the move has been completed, it will then
check the Pr value. If the Pr value has already reached L-1 (point to the last register in the table) then it will
only set the move-to-end flag "END" to 1, and finish execution of this instruction. If the Pr value is less than
L-1, then it must again check the pointer increment "INC" input signal. If "INC" is 1, then Pr value will be also
increased. Besides, pointer clear "CLR" is able to operate independently, without being influenced by other
input.
● The effective range of the pointer is 0 to L-1. Beyond this range, the pointer error "ERR" will be set to 1, and
this instruction will not be performed.
Pr Pr Pr
4 R50 5 R50 6 R50
Td Td Td
0000 R10(T0) 0000 R10 0000 R10
0000 R11(T1) 0000 R11 0000 R11
Rs 0000 R12(T2)
X0= 0000 R12
X0= 0000 R12
R0 8888 0000 R13(T3) (First) 0000 R13 (Second) 0000 R13
0000
0000
R14(T4)
R15(T5)
Ö 8888
0000
R14
R15
Ö 8888
8888
R14
R15
0000 R16(T6) 0000 R16 0000 R16
0000 R17(T7) 0000 R17 0000 R17
7-100
Table Instructions
FUN101 D P FUN101 D P
TABLE TO REGISTER MOVE
T→R T→R
z When move control "EN" = 1 or transition from 0 to 1 ( P instruction), the value of the register Tspr specified by
pointer Pr within source table Ts (length is L) will be written into the destination register Rd. Before executing,
this instruction will first check the input signal of pointer clear "CLR". If "CLR" is 1, it will first clear Pr and then
carry out the move operation. After completing the move operation, it will then check the value of Pr. If the Pr
value has already reached L-1 (point to the last register in the table), then it sets the move-to-end flag to 1, and
finishes executing of this instruction. If Pr is less than L-1, it check the status of "INC". If "INC" is 1, then it will
increase Pr and finish the execution of this instruction. Besides, pointer clear "CLR" can execute independently
and is not influenced by other inputs.
z The effective range of the pointer is 0 to L-1. Beyond this range the pointer error "ERR" will be set to 1 and this
instruction will not be carried out.
X0
101P.T R z In the example at left, at the very beginning Pr = 7 and Ts
EN TS : R 0 END and Rd are as shown at left in the diagram below. When X0
L : 9
have a transition from 0→1 twice, the results are shown at
INC Pr : R 19 ERR
right in the diagram below.
Rd : R 20
CLR z At the second time execution, the pointer has already
reached to the end so there will be no increment.
Ts Pr Pr Pr
R0(T0) 1111 7 R19 8 R19 8 R19
R1(T1) 2222
R2(T2) 3333 X0= X0=
R3(T3) 4444 Rd (first) Rd (second) Rd
R4(T4)
R5(T5)
5555
6666
0 0 0 0 R20
Ö 8 8 8 8 R20
Ö 9 9 9 9 R20
7-101
Table Instructions
FUN102 D P FUN102 D P
TABLE TO TABLE MOVE
T→T T→T
z When move control "EN" = 1 or have a transition from 0 to 1( P instruction), the register Tspr pointed by pointer
Pr within the source table will be moved to a register Tdpr, which also pointed by the pointer Pr in the
destination table. Before execution, it will first check the input signal of pointer clear "CLR". If "CLR" is 1, it will
first clear Pr to 0 and then do the move (in this case Ts0→Td0). After the move action has been completed it
will then check the value of pointer Pr. If the Pr value has already reached L-1 (point to the last register on the
table), then it will set the move-to-end flag "END" to 1 and finish executing of this instruction. If the Pr value is
less than L-1, it will check the status of "INC". If "INC" is 1, then the Pr value will be increased by 1 before
execution. Besides, pointer clear "CLR" can execute independently, and will not be influenced by other input.
z The effective range of the pointer is 0 to L-1. Beyond this range, the pointer error flag "ERR" will be set to 1,
and this instruction will not be carried out.
102P.T T
z The diagram at left below is the status before execution.
X0
EN TS : R 0 END
When X0 from 0→1, the content of R5 in Ts table will copy to
Td : R 10 R15 and pointer R20 will be increased by 1.
INC L : 10 ERR
Pr : R 20
CLR
Pr Pr
R20 5 R20 6
Ts Td Td
R0 1111 R10 0000 R10 0000
R1 1111 R11 0000 R11 0000
R2 1111 R12 0000 R12 0000
R3 1111 R13 0000 X0= R13 0000
R4 1111 R14 8888 Ö R14 8888
R5 1111 R15 0000 R15 1111
R6 1111 R16 0000 R16 0000
R7 1111 R17 0000 R17 0000
R8 1111 R18 0000 R18 0000
R9 1111 R19 0000 R19 0000
Before execution result
7-102
Table Instructions
FUN103 D P FUN103 D P
BLOCK TABLE MOVE
BT_M BT_M
z In this instruction the source table and destination table are the same length. When this instruction was
executed all the data in the Ts table is completely copied to Td. No pointer is involved in this instruction.
z When move control "EN" = 1 or have a transition from 0 to 1 ( P instruction), all the data from source table Ts
(length L) is copied to the destination table Td, which is the same length.
z One table is completely copied every time this instruction is executed, so if the table length is long, it will be
very time consuming. In practice, P modifier should be used to avoid time waste caused by each scan
repeating the same movement action.
Ts Td Td
R0 0000 ──→ R10 0000 R10 0000
R1 1111 ──→ R11 0000 R11 1111
R2 2222 ──→ R12 0000 R12 2222
R3 3333 ──→ R13 0000 X0= R13 3333
R4 4444 ──→ R14 0000 Ö R14 4444
R5 5555 ──→ R15 0000 R15 5555
R6 6666 ──→ R16 0000 R16 6666
R7 7777 ──→ R17 0000 R17 7777
R8 8888 ──→ R18 0000 R18 8888
R9 9999 ──→ R19 0000 R19 9999
Execute
Before executed result
7-103
Table Instructions
FUN104 D P FUN104 D P
BLOCK TABLE SWAP
T_SWP T_SWP
z This instruction swaps the contents of Tables a and b, so the table must be the same length, and the registers
in the table must of write able. Since a complete swap is done with each time the instruction is executed, no
pointer is needed.
z When move control "EN" = 1 or have a transition from 0 to 1 ( P instruction), the contents of Table a and Table
b will be completely swapped.
z This instruction will swap all the registers specified in L each time the instruction is executed, so if the table
length is big, it will be very time consuming, therefore P instruction should be used.
Ta Tb Ta Tb
R0 0000 R10 1111 R0 1111 R10 0000
R1 0000 R11 1111 R1 1111 R11 0000
R2 0000 R12 1111 R2 1111 R12 0000
R3 0000 R13 1111 X0= R3 1111 R13 0000
R4 0000 R14 1111 Ö R4 1111 R14 0000
R5 0000 R15 1111 R5 1111 R15 0000
R6 0000 R16 1111 R6 1111 R16 0000
R7 0000 R17 1111 R7 1111 R17 0000
R8 0000 R18 1111 R8 1111 R18 0000
R9 0000 R19 1111 R9 1111 R19 0000
7-104
Table Instructions
FUN105 D P FUN105 D P
REGISTER TO TABLE SEARCH
R-T_S R-T_S
z When search control "EN" = 1 or has a transition from 0 to 1 ( P instruction), will search from the first register of
Table Ts (when "FHD" = 1 or Pr value has reached L-1), or from the next register (Tspr + 1) pointed by the
pointer within the table ("FHD" = 0, while Pr value is less than L-1) to find the first data different with Rs(when
D/S = 1) or find the first data the same with Rs (when D/S = 0). If it find a data match the condition it will
immediately stop the search action, and the pointer Pr will point to that data and found objective flag "FND" will
set to 1. When the searching has searched to the last register of the table, the execution of the instruction will
stop, whether it was found or not. In that case the search-to-end flag "END" will be set to 1 and the Pr value will
stop at L-1. When this instruction next time is executed, Pr will automatically return to the head of the table (Pr
= 0) before the search begin.
z The effective range of Pr is 0 to L-1. If the value exceeds this range then the pointer error flag "ERR" will
change to 1, and this instruction will not be carried out.
105P.R-T_S
X0 z The instruction at left is searching the table for a register with the
EN RS : 5555 FND value 5555 (because D/S = 0, it is searching for same value).
TS : R 0 Before execution, the pointer point to R2, but the starting point of
FHD L : 10 END the search is Pr + 1 (i.e. it starts from R3). After X0 has transition
Pr : R 20 from 0→1 3 times, the results of each search may be obtained
D/S ERR as shown in the diagram below.
Pr Ts Pr FN EN
R20 2 R0 5555 cX0= R20 6 1 0
R1 0000 (First)
R2 5555
Start
Rs R3 2222← Pr FN EN
point
5555 R4 3333 dX0= R20 9 0 1
R5 4444 (Second)
R6 5555
R7 6666 Pr FN EN
R8 7777 eX0= R20 0 1 0
R9 8888 (Third)
7-105
Table Instructions
FUN106 D P FUN106 D P
TABLE TO TABLE COMPARE
T-T_C T-T_C
z When comparison control "EN" = 1 or has a transition from 0 to 1( P instruction), then starting from the first
register in the tables Ta and Tb (when "FHD" = 1 or Pr value has reached L-1) or starting from the next pair of
registers (Tapr+1 and Tbpr+1) pointed by Pr ("FHD" = 0, while Pr is less than L-1), this instruction will search
for pairs of registers with different values (when "D/S" = 1) or the same value (when "D/S" = 0). When search
found (either different or the same), it will immediately stop the search and the pointer Pr will point to the
register pairs met the search criteria. The found flag "FND" will be set to 1. When it has searched to the last
register of the table, the instruction will stop executing. whether it found or not. The compare-to-end flag "END"
will be set to 1, and the pointer value will stop at L-1. When this instruction is executed next time, Pr will
automatically return to the head of the table to begin the search. The effective range of Pr is 0 to L-1. The Pr
value should not changed by other programs during the operation. As this will affect the result of the search. If
the Pr value not in the effective range, the pointer error flag "ERR" will be set to 1, and this instruction will not
be carried out.
z The instruction at left starts from the register next to the register
106P.T-T_C pointed by the pointer (because "FHD" is 0) to search for register
X0
EN Ta : R 0 FND pairs with different data (because "D/S" is 1) within the 2 tables.
Tb : R 11 At the very beginning, Pr points to Ta1 and Tb1. There are 3
FHD L : 10 END different pairs of data at the position 1,3,6 of the table.
However, it does not compare from the beginning, and this
Pr : R 10
instruction will start searching from position 3 downwards. After
D/S ERR
X0 has changed 3 times from 0 to 1, the results are shown in the
diagram below.
Pr
R10 1
Ta Tb Pr FN EN
7-106
Table Instructions
FUN107 D P FUN107 D P
TABLE FILL
T_FIL T_FIL
L :Table length
z When fill control "EN" = 1 or has a transition from 0 to 1 ( P instruction), the Rs data will be filled into all the
registers of the table Td.
z This instruction is mainly used for clearing the table (fill 0) or unifying the table (filling in the same values). It
should be used with the P instruction.
107P.T_FIL
X0 z The instruction at left will fill 5555 into the whole table
EN RS : 5555 Td. The results are as shown in the diagram below.
Td : R 0
L : 10
Td Td
R0 1547 R0 5555
R1 2314 R1 5555
R2 7725 R2 5555
Rs R3 0013 X0= R3 5555
5555 R4 5247 Ö R4 5555
R5 1925 R5 5555
R6 6744 R6 5555
R7 5319 R7 5555
R8 9788 R8 5555
R9 2796 R9 5555
7-107
Table Instructions
FUN108 D P FUN108 D P
TABLE SHIFT
T_SHF T_SHF
z When shift control "EN" = 1 or has a transition from 0 to 1( P instruction), all the data from table Ts will be taken
out and shifted one position to the left (when "L/R" = 1) or to the right (when "L/R" = 0). The room created by
the shift operation will be filled by IW and the results will be written into table Td. The data shifted out will be
written into OW.
7-108
Table Instructions
FUN109 D P FUN109 D P
TABLE ROTATE
T_ROT T_ROT
z When rotation control "EN" = 1 or has a transition from 0 to 1( P instruction), the data from the table of Ts will
be rotated 1 position to the left (when "L/R" = 1)or 1 position to the right (when "L/R" = 0). The results of the
rotation will then be written onto table Td.
7-109
Table Instructions
FUN110 D P FUN110 D P
QUEUE
QUEUE QUEUE
z Queue is also a kind of table. It is different from ordinary table in that its queue register numbers go from 1 to L
and not from 0 to L-1. In other words QU1~QUL respectively correspond to pointers Pr = 1 to L, and Pr = 0 is
used to show that the queue is empty.
z Queue is a first in first out (FIFO) device, i.e. - the data that first pushed into the queue will be the first to pop
out from the queue. A queue is comprised of L consecutive 16 or 32 bit registers ( D instruction) starting from
the QU register, as in the diagram below:
Pr
4
IW QU
g5555 QU1 f4444
QU2 e3333 Push
push(I/O=1) QU3 d2222 down
QU4 c1111 OW
1.IW always push into QU5 ××××
QU1
……
z When execution control "EN" = 1 or has a transition from 0 to 1 ( P instruction), the status of in/out control "I/O"
determines whether the IW data will be pushed into the queue (when "I/O" = 1) or be popped out and
transferred to OW (when "I/O" = 0). As shown in the diagram above, the IW data will always be pushed into the
first (QU1) register of the queue. After it has been pushed in, Pr will immediately be increased by 1, so that the
pointer can always point to the first data that was pushed into the queue. When it is popped out, the data
pointed by Pr will be transferred directly to OW. Pr will be reduced by 1, so that it still point to the first data
remained in the queue.
7-110
Table Instructions
FUN110 D P FUN110 D P
QUEUE
QUEUE QUEUE
z If no data has yet been pushed into the queue or the pushed in data has already been popped out (Pr = 0),
then the queue empty flag will be set to 1. In this case, even if there is further popping out action, this
instruction will not be executed. If data is only pushed in and not popped out, or pushed in is more than that
popped out, then the queue finally becomes full (pointer Pr indicates the QUL position), and the queue full flag
is changed to 1. In this case, if there is more pushing in action, this instruction will not execute. The pointer for
this instruction is used during access of the queue, to indicate the data that was pushed in the earliest. Other
programs should not be allowed to change it, or else an operation error will be created. If there is a specific
application, which requires the setting of a Pr value, then its permissible range is 0 to L (0 means empty, and 1
to L respectively correspond to QU1 to QUL). Beyond this range, the pointer error flag "ERR" will be set as 1,
and this instruction will not be carried out.
Pr Pr
5 4
QU QU
QU1 5555 R2 QU1 5555 R2
QU2 4444 R3 QU2 4444 R3
QU3 3333 R4 QU3 3333 R4
QU4 2222 R5 OW QU4 2222 R5 OW
QU5 1111 R6 ×××× R20 QU5 R6 1 1 1 1 R20
QU6 R7 ↑ QU6 R7
QU7 R8 OW unchanged QU7 R8
QU8 R9 QU8 R9
QU9 R10 QU9 R10
QU10 R11 QU10 R11
After push in (X1=1,X0 from 0→1) After pop off (X1=0,X0 from 0→1)
7-111
Table Instructions
FUN111 D P FUN111 D P
STACK
STACK STACK
z Like queue, stack is also a kind of table. The nature of its pointer is exactly the same as with queue, i.e. Pr = 1
to L, which corresponds to ST1 to STL, and when Pr = 0 the stack is empty.
z Stack is the opposite of queue, being a last in first out (LIFO) device. This means that the data that was most
recently pushed into the stack will be the first to be popped out of the stack. The stack is comprised of L
consecutive 16 or 32-bit ( D instruction) registers starting from ST, as shown in the following diagram:
Pr
4
c~g is the sequence
number of operation ST
ST1 c1111 ← Bottom of stack
ST2 d2222
ST3 e3333
IW ST4 f4444 OW
g5555 ST5 ××××
z When execution control "EN" = 1 or has a transition from 0 to 1( P instruction), the status of in/out control "I/O"
determines whether the IW data will be pushed into the stack (when "I/O" = 1), or the data pointed by Pr within
the stack (the data most recently pushed into the stack) will be moved out and transferred to OW (when "I/O"
= 0). Note that the data pushed in is stacking, so before pushed in, Pr will increased by 1 to point to the top of
the stack then the data will be pushed in. When it is popped out, the data pointed by pointer Pr (the most
recently pushed in data) will be transferred to OW. After then Pr will decreased by 1. Under any circumstances,
the pointer Pr will always point to the data that was pushed into the stack most recently.
7-112
Table Instructions
FUN111 D P FUN111 D P
STACK
STACK STACK
z When no data has yet been pushed into the stack or the pushed in data has already been popped out (Pr = 0),
the stack empty flag "EPT" will set to 1. In this case any further pop up actions, will be ignored. If more data is
pushed than popped out, sooner or latter the stack will be full (pointer Pr points to STL position), and the stack
full flag "FUL" will set to 1. In this case any further push actions, will be ignored. As with queue, the stack
pointer in normal case should not be changed by other instructions. If there is a special application which
requires to set the Pr value, then its effective range is 0 to L (0 means empty, 1 to L respectively correspond to
ST1 to STL). Beyond this range, the pointer error flag "ERR" will set to 1, and the instruction will not be carried
out.
X0
111P.STACK z The program at left assumes that the initial content of the
EN IW : R 0 EPT stack is just as in the diagram of a stack on the
ST : R 2 preceding page. The operation illustrated in this example
X1
I/O L : 10 FUL is to push a data and than pop it from stack. The results
Pr : R 1 are shown below. Under any circumstances, Pr always
point to the data that was most recently pushed into the
OW : R 20 ERR
stack.
Pr Pr
5 R1 4
ST QU
ST1 1111 R2 ST1 1111 R2
ST2 2222 R3 ST2 2222 R3
ST3 3333 R4 ST3 3333 R4
ST4 4444 R5 OW ST4 4444 R5 OW
ST5 5555 R6 ×××× R20 ST5 R6 5 5 5 5 R20
ST6 R7 ↑ ST6 R7
ST7 R8 OW unchanged ST7 R8
ST8 R9 ST8 R9
ST9 R10 ST9 R10
ST10 R11 ST10 R11
7-113
Table Instructions
FUN112 D P FUN112 D P
BLOCK COMPARE(DRUM)
BKCMP BKCMP
z When comparison control "EN" = 1 or has a transition from 0 to 1( P instruction), comparisons will be perform
one by one between the contents of Rs and the upper and lower limits form by L pairs of 16 or 32-bit ( D
modifier) registers starting from the Ts register (starting from T0 each adjoining 2 register units form a pair of
upper and lower limits). If the value of Rs falls within the range of the pair, then the bit within the comparison
results relay D which corresponds to that pair will be set to 1. Otherwise it will be set as 0 until comparison of
all the L pairs of upper and lower limits is completed.
z When M1975=0, if there is any pair where the upper limit value is less than the lower limit value, then the limit
error flag "ERR" will be set to 1, and the comparison output for that pair will be 0.
z When M1975=1, there is no restriction on the relation of upper limit and lower limit, this can apply for 360°rotary
electronic drum switch application.
z Actually this instruction is a drum switch, which can be used in interrupt program and when incorporate with
immediate I/O instruction (IMDIO) can achieve an accurate electronic drum.
X0 112.BKCMP
z In this program, C0 represents the rotation angle (Rs) of
EN RS : C 0 ERR
a drum shaft. The block compare instruction performs a
Ts : R 10
comparison between Rs and the 4 pairs (L = 4) of upper
L : 4
and lower limits, R10,R11, R12,R13, R14,R15 and
D : Y 5 R16,R17. The comparison results can be obtained from
X1 the four drum output points Y5 to Y8.
PSU C 0 z The input point X1 is a rotation angle detector mounted
C0 PV : 360 on the drum shaft. With each one degree rotation of the
CLR drum shaft angle, X1 produces a pulse. When the drum
shaft rotates a full cycle, X1 produces 360 pulses.
7-114
Table Instructions
FUN112 D P FUN112 D P
BLOCK COMPARE(DRUM)
BKCMP BKCMP
z The program in the diagram above coordinates a rotary encoder or other rotating angle detection device
(directly connect to a rotating mechanism), which can form a mechanical device equivalent to the mechanical
structure of an actual drum (see mechanism shown within dotted line in diagram below). While the upper and
lower limits are being adjusted, you can change at will the range of the activated angle of the drum. This
cannot be done with the traditional drum mechanism.
Rotary encoder
Rotary encoder 200
200
180
180 180
180
Rotating
Rotating
140
140
220
220 . mechanism
mechanism
80
80
90
90 80
80
60
60
320
320 40
40 0
00
Limit
Limit swsw
X1
X1
Y7 Y8
Y5 Y6
Y6
40 140
Y5
80 180
Y6
60
Y7
80 200
Y8
C0
0° 40° 80° 120° 160° 200° 240° 280° 320° 360°
7-115
Table Instructions
FUN113 D P FUN113 D P
DATA SORTING
SORT SORT
● When sort control "EN" = 1 or has a transition from 0 to 1( P instruction), will sort the registers with ascending
order (if A/D = 1) or descending order (if A/D = 0) and put the sorted result to the registers starting by D
register.
● The valid data length of sort operation is between 2 and 127, other length will set the “ERR” to 1 and the sort
operation will not perform.
113P.SORT
X0
EN S : R 0 ERR ․The example at left sorts the table comprised of R0~R9
D : R 10 and stores the sorted data to the table locate at
A/D L : 10 R10~R19.
S D
R0 1547 R10 0013
R1 2314 R11 1547
R2 7725 R12 1925
R3 0013 R13 2314
R4 5247
X0= R14 2796
R5 1925 Ö R15 5247
R6 6744 R16 5319
R7 5319 R17 6744
R8 9788 R18 7725
R9 2796 R19 9788
Before After
7-116
Table Instructions
FUN114 D P FUN114 D P
ZONE WRITE
Z-WR Z-WR
● When operation control "EN"=1 or changes from 0→1( P instruction), it will perform the write operation
according to the input status of write selection, the specified area of registers or bits will all be reset to 0
("1/0"=0) or set to 1("1/0"=1).
114.Z-WR
X0
EN D : R0 ERR
N : 10
I/O
114.Z-WR
X0
EN D : M5 ERR
N : 7
I/O
7-117
Matrix Instructions
Matrix Instructions
● A matrix is comprised of 2 or more consecutive 16-bit registers. The number of registers comprising the
matrix is called the matrix length (L). One matrix altogether has L×16 bits (points), and the basic unit of the
object for each operation is bit.
● The matrix instructions treats the 16×L matrix bits as a set of series points( denoted by M0 to M16L-1).
Whether the matrix is formed by register or not, the operation object is the bit not numerical value.
● Matrix instructions are used mostly for discrete status processing such as moving, copying, comparing,
searching, etc, of single point to multipoint (matrix), or multipoint-to-multipoint. These instructions are
convenient, important for application.
● Among the matrix instructions, most instruction need to use a 16-bit register as a pointer to points a specific
point within the matrix. This register is known as the matrix pointer (Pr). Its effective range is 0 to 16L-1,
which corresponds respectively to the bits M0 to M16L-1 within the matrix.
● Among the matrix operations, there are shift left/right, rotate left/right operations. We define the movement
toward higher bit is left direction, while the movement toward lower bit is right direction, as shown in the
diagram below.
←─ Width is 16 bit ─→
Pr
40 M15 M M0 (right)
M40
↓ ↓
R0
R1 ↑
R2 1
R3
│
R4 │
Pr=40, point y
y
to M40, y
y length
y
y L
y
y
y y │
y y
y y │
y y
↓
RL−1
↑
M16L−1(left)
7 - 11 8
Matrix Instructions
FUN120 P FUN120 P
MATRIX AND
MAND MAND
7 - 11 9
Matrix Instructions
FUN121 P FUN121 P
MATRIX OR
MOR MOR
Ladder symbol
121P.MOR Ma : Starting register of source matrix a
Ma Mb Md
z When operation control "EN" = 1 or has a transition from 0 to 1 ( P
instruction), this instruction will perform a logic OR(If any 2 of the
bits are 1, then the result will be 1, and only if both are 0 will the
result be 0) operation between 2 source matrixes with a length of
L, Ma and Mb. The result will then be stored in the destination L
matrix Md, which is also the same length (the OR operation is
done by bits with the same bit numbers). For example, if Ma0 = 0,
Mb0 = 1, then Md0 = 1; if Ma1 = 0, Mb1 = 0, then Md1 = 0; etc, right
up until OR reaches Ma16L-1 and Mb16L-1.
OR
121P.MOR z In the program at left, when X0 goes from 0→1, then matrix
X0
EN Ma : R 0 Ma, comprised by R0 to R4, and matrix Mb, comprised by
Mb : R 10 R10 to R14, will do an OR operation. The results will then
be stored into the destination matrix Md, comprised by R10
Md : R 10
to R14. In this example, Mb and Md is the same matrix, so
L : 5
after operation the source matrix Mb will replaced by the
new value. The result is shown at right in the diagram
below.
7-120
Matrix Instructions
FUN122 P FUN122 P
MATRIX EXCLUSIVE OR(XOR)
MXOR MXOR
Ma Mb Md
7-121
Matrix Instructions
FUN123 P FUN123 P
MATRIX EXCLUSIVE NOR(XNR)
MXNR MXNR
Ma Mb Md
z When operation control "EN" = 1 or has a transition from 0 to 1 ( P
instruction), will perform a logic XNR operation (if the 2 bits are the
same, then the result will be 1, otherwise it will be 0)between 2
source matrixes with a length of L, Ma and Mb. The results will
then be stored into the destination matrix Md, which also has the L
same length (the XNR operation is done by bits with the same bit
numbers). For example, if Ma0 = 0, Mb0 = 1, then Md0 = 0; Ma1 = 0,
Mb1 = 0, then Md1 = 1; etc, right up until XNR reaches Ma16L-1 and
Mb16L-1.
XNR
X0
123P.MXNR z When operation control "EN" = 1 or goes from 0 to 1 ( P
EN Ma : R 0 instruction), will perform a XNR operation between Ma
Mb : R 10 matrix comprised by R0~R9 and Mb matrix comprised by
Md : R 10 R10~R19. The results will then be stored into the
L : 5 destination matrix Md comprised by R10~R19. The results
are shown at right in the diagram below.
7-122
Matrix Instructions
FUN124 P FUN124 P
MATRIX INVERSE
MINV MINV
Inverse
Ms
7-123
Matrix Instructions
FUN125 P FUN125 P
MATRIX COMPARE
MCMP MCMP
Ladder symbol
125P.MCMP Md : Starting register of matrix a
Comparison control EN Ma : FND Found objective Mb : Starting register of matrix b
Mb : L : Length of matrix (Ma, Mb)
Compare from head FHD L : END Compare to end Pr : Pointer register
Ma, Mb may combine with V, Z, P0~P9 to
Pr :
serve indirect address application
Different/Same option D/S ERR Pointer error
Pr Pr FND END
4 R20
c R20 39 1 0
Ma15 Ma0 Mb15 Mb0
↓ Ma * ↓ ↓ Mb * ↓
R0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 R10 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 Pr FND END
R1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 R11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 d R20 79 0 1
R2 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 R12 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 R13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Pr FND END
R4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 R14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
↑ ↑ ↑ ↑ e R20 2 1 0
Ma79 Ma64 Mb79 Mb64
7-124
Matrix Instructions
FUN126 P FUN126 P
MATRIX BIT READ
MBRD MBRD
Pr
z When readout control "EN" = 1 or has a transition from 0 to 1
( P instruction), the status of the bit Mspr pointed by pointer Pr Ms
within matrix Ms will be read out and appear at the output bit
"OTB". Before the readout, this instruction will first check the Mspr
input -pointer clear "CLR". If "CLR" is 1, then the Pr value will be
OTB
cleared to 0 first before the readout action is carried out. After
the readout is completed, If the Pr value has already reached
16L-1 (the final bit), then the read-to-end flag "END" will be set
L
to 1. If Pr is less than 16L-1, then the status of pointer increment
"INC" will be checked. If "INC" is 1, then Pr will be increased by
1. Besides this, pointer clear "CLR" can execute independently,
and is not affected by other input.
z The effective range of the pointer is 0 to 16L-1. Beyond this range the pointer error flag "ERR" will be set to 1,
and this instruction will not be carried out.
Pr Pr OTB END
Ms15 Ms0
↓ Ms ↓ R20 77 c R20 78 1 0
R0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1
R1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 OTB Pr OTB END
R2 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 0
R3 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 d R20 79 0 0
R4 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
↑ ↑ ↑ Pr OTB END
Ms79 Ms77 Ms64
e R20 79 1 1
7-125
Matrix Instructions
FUN127 P FUN127 P
MATRIX BIT WRITE
MBWR MBWR
L : Matrix length
Pr : Pointer register
Pr
z When write control "EN" = 1 or has a transition from 0 to 1 ( P
instruction), the status of the write-in bit "INB" will be written into Ms
the bit Mdpr pointed by pointer Pr within matrix Md. Before the Mspr
write-in takes place, the status of pointer clear "CLR" will be
checked. If "CLR" is 1, then Pr will be cleared to 0 before the OTB
write-in action. After the write-in action has been completed, the
Pr value will be checked again. If the Pr value has already L
reached 16L-1 (last bit), then the write-to-end flag will be set to
1. If the Pr value is less than 16L-1 and "INC" is 1, then the
pointer will increased by 1. Besides this, pointer clear "CLR" can
execute independently, and is not affected by other input.
z The effective range of Pr is 0 to 16L-1. Beyond this range, the pointer error flag "ERR" will be set to 1, and
this instruction will not be carried out.
X1 Pr Pr END
1 R20 78 R20 79 0
Md15 Md0 Md15 Md0
↓ Md ↓ ↓ Md ↓
R0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 X0= R0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R1
R2
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
0
0
0
0
0
0 Ö R1
R2
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
0
0
0
0
0
0
R3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 R3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 R4 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
↑ ↑ ↑ ↑
Md79 Md64 Md79 Md64
7-126
Matrix Instructions
FUN128 P FUN128 P
MATRIX BIT SHIFT
MBSHF MBSHF
INB
z When shift control "EN" = 1 or has a transition from 0 to 1 Ms Md
( P instruction), source matrix Ms will be retrieved and
completely shifted one position to the left (when L/R = 1) or
one position to the right (when L/R = 0). The space caused
by the shift (with a left shift it will be M0, and with a right
shift it will be M16L-1), is replaced by the status of fill-in bit L
"INB". The status of the bits popped out (with a left shift it
will be M16L-1, and with a right shift it will be M0) will appear Shift
at the output bit "OTB". Then the results of this shifted left
OTB 1 bit
matrix will be filled into the destination matrix Md.
128P.MBSHF
X0
EN Ms : R 0 OTB L
X0 Md : R 0
INB
Shift
L : 5
right
INB 1 bit
L/R
Ö
R2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 R2 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1
R3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 R3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
R4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 R4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
↑ ↑ ↑ ↑
Ms79 Ms64 Md79 Md64
7-127
Matrix Instructions
FUN129 P FUN129 P
MATRIX BIT ROTATE
MBROT MBROT
L/R=1
z When rotate control "EN" = 1 or has a transition from 0 Ms Md
to 1 (P instruction), matrix Ms will be completely
retrieved and rotated by one bit towards the left (when
L/R = 1) or to the right (when L/R = 0). The space
created by the rotation (with a left rotation it will be M0,
and with a right rotation it will be M16L-1) will be L
replaced by the status of the rotated-out bit (with a left
Rotate
rotation it will be M16L-1, and with a right rotation it will left
be M0). The rotated-out bit will not only be used to fill OTB 1 bit
the above-mentioned space, it will also be transferred
to rotated-out bit "OTB".
L
z In the program at left, Ms and Md are the same Shift
matrix. When X0 goes from 0→1, then the whole of Ms right
is retrieved and rotated right (because L/R = 0) by 1 1 bit
bit. It is then stored back into Ms itself (because in this
example Ms and Md are the same matrix). The results
are shown at right in the diagram below.
7-128
Matrix Instructions
FUN130 P FUN130 P
MATRIX BIT STATUS COUNT
MBCNT MBCNT
z When count control "EN" = 1 or has a transition from 0 to 1( P instruction), then among the 16L bits of the
Ms matrix, this instruction will count the total amount of bits with a status of 1 (when input "1/0" = 1) or the
total amount of bits with a status of 0 (when input "1/0" = 0). The results of the counting will be stored into
the register specified by D. If the value of these amounts is 0, then the Result-is-0 flag "D = 0" will be set to
1.
130P.MBCNT z The program at left sets X1 first as 0 (to count bits with
X0
EN Ms : R 0 D=0 status of 0) and then as 1 (to count bits with status of 1)
L : 5 and let the signal X0 has a transition from 0→1 for both
X1
1/0 D : R 0 case, the execution results are shown at right in the
diagram below .
Ms15
Ms
Ms0
D
d D
↓ ↓
R0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
R1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 X0= R20 64 R20 16
R2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 c
R3
R4
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
0
0
0
0
0
0
Ö X1=0 X1=1
↑ ↑
Ms79 Ms64
7-129
I/O Instructions II
Description
z The setting of resolution(RS) must be same between output0(Y0) and output1(Y2) also the setting of output
frequency(Pn). It means both output0 and output1 have the same output frequency and the same output
resolution, only the pulse width can be different. Same principle for output2(Y4) and output3(Y6).
z When operation control “EN” = 1, the specified digital output will perform the PWM output, the expression for
output frequency as shown bellow:
184320
1. f pwm = while Rs(Resolution)=1/100
(Pn + 1)
18432
2. fpwm = while Rs(Resolution)=1/1000
(Pn + 1)
184320
f pwm = =3614.117‧‧‧≒3.6KHz
( 50 + 1)
1
T(Period)= ≒277uS
fpwm
For Rs = 1/100, if OR( Setting of output pulse width ) = 1, then T0 ≒ 2.7uS; if OR( Setting of output pulse width )
= 50, then To ≒ 140uS.
.Output waveform :
7-130
I/O Instructions II
To ≒ 2.7usec
Tp ≒ 277usec
18432
f pwm = ≒91.7Hz
( 200 + 1)
1
T(Period)= ≒10.9mS
fpwm
For Rs = 1/1000, if OR( Setting of output pulse width ) = 10, then T0 ≒ 109uS; if OR( Setting of output pulse
width ) = 800, then To ≒ 8.72mS
.Output waveform :
7-131
NC Positioning Instructions I
Range HR DR ROR K
R0 D0 R5000 2
Ope- ∣ ∣ ∣ ∣
rand R3839 D4095 R8071 256
Ps 0~3
SR ○ ○ ○
WR ○ ○ ○*
Command descriptions
z The NC positioning program of HSPSO (FUN140) instruction is a program written and edited with text. The
executing unit of program is divided by step (which includes output frequency, traveling distance, and
transferring conditions). For one FUN140 instruction, can program 250 steps of positioning points at the most.
Each step of positioning program requires 9 registers. For detailed application, please refer to chapter 13 “the
NC positioning control of FBs-PLC”.
z The benefits of storing the positioning program in the register is that, while in application which use the MMI
(man machine interface) as the operation console can save the positioning programs to MMI. Whenever the
change of the positioning programs is requested, the download of positioning program can be simply done by
a series of write register commands.
z The NC positioning of this instruction doesn’t provide the linear interpolation function.
z When execution control “EN”=1, if Ps0~3 is not controlled by other FUN140 instruction (the status of
Ps0=M1992, Ps1=M1993, Ps2=M1994, and Ps3=M1995 is ON respectively), it will start to execute from the
next step of positioning point (when goes to the last step, it will be restarted from the first step); if Ps0~3 is
controlled by other FUN140 instruction (the status of Ps0=M1992, Ps1=M1993, Ps2=M1994, and
Ps3=M1995 are OFF), this instruction will wait and acquires the control right of output point immediately right
after other FUN140 release the output.
z When execution control input “EN” =0, it stops the pulse output immediately.
z When output pause “PAU” =1 and execution control was 1, it will pause the pulse output. When output
pause “PAU” =0 and execution control is still 1, it will continue the unfinished pulse output.
z When output abort “ABT”=1, it will halt and stop pulse output immediately. (When the execution control
input “EN” becomes 1 next time, it will restart from the first step of positioning point to execute.)
z While send the output pulse, the output indication “ACT” is ON.
z When there is an execution error, the output indication “ERR” will be ON. (The error code is stored in the
error code register.)
z When the execution of each step of positioning program is completed, the output indication “DN” will be ON.
*** The working mode of Pulse Output must be configured (without setting, Y0~Y7 will be treated as normal
output) to any one of following modes, before the HSPSO instruction can be worked.
7-132
NC Positioning Instructions I
Range HR DR ROR K
R0 D0 R5000 2
Ope- ∣ ∣ ∣ ∣
rand R3839 D4095 R8071 256
Ps 0~3
SR ○ ○ ○
Operation descriptions
hIt is not necessary to use this instruction. if the system default for parameter values is matching what user
demanded, then this instruction is not needed. However, if it needs to change the parameter value
dynamically, this instruction is required.
hThis instruction incorporates with FUN140 or FUN147 for positioning control purpose.
hWhether the execution control input “EN” = 0 or 1, this instruction will be performed.
hWhen there are any errors in parameter value, the output indication “ERR” will be ON. (The error code is
stored in the error code register.)
hFor detailed functional description and usage, please refer to Chapter 11 “The NC positioning control of
FBs-PLC” for explanation.
7-133
NC Positioning Instructions I
Ps : 0~3
Enforce the Pulse Output PSOn (n= Ps) to stop.
Command descriptions
z When execution control “EN” =1 or changes from 0→1( P instruction), this instruction will enforce the
assigned number set of HSPSO (High Speed Pulse Output) to stop pulse output.
z While in the application for mechanical original point reset, as soon as reach the original point can use this
instruction to stop the pulse output immediately, so as to make the original point stop at the same position
every time when performing mechanical original point resetting.
z For detailed functional description and usage, please refer to Chapter 11 “The NC positioning control of
FBs-PLC” for explanation.
7-134
NC Positioning Instructions I
Range HR DR ROR K
R0 D0 R5000 2
Ope- ∣ ∣ ∣ ∣
rand R3839 D4095 R8071 256
Ps 0 ~3
D ○ ○ ○
Command descriptions
z When execution control “En” =1 or changes from 0→1( P instruction), this instruction will convert the
assigned current pulse position (PS) to be the mm (or Deg, Inch, or PS) that has same unit as the set value,
so as to make current position displaying.
z Only when the FUN140 instruction is executed, then it can get the correct conversion value by executing
this instruction.
z For detailed functional description and usage, please refer to Chapter 11 “The NC positioning control of
FBs-PLC” for explanation.
7-135
Enable/Disable Instructions
FUN145 P FUN145 P
ENABLE CONTROL OF THE INTERRUPT AND PERIPHERAL
EN EN
z When enable control “EN” =1 or changes from 0→1 ( P instruction), it allows the external input or peripheral
interrupt action which is assigned by LBL.
z The enabled interrupt label name is as follows:(Please refer the section 9.3 for details)
z In practical application, some interrupt signals should not be allowed to work at sometimes, however, it should
be allowed to work at some other times. Employing FUN146 (DIS) and FUN145 (EN) instructions could
attain the above mentioned demand.
Program example
7-136
Enable/Disable Instructions
FUN146 P FUN146 P
DISABLE CONTROL OF THE INTERRUPT AND PERIPHERAL
DIS DIS
z When prohibit control “EN” =1 or changes from 0→1 ( P instruction), it disable the interrupt or peripheral
operation designated by LBL.
z In practical application, some interrupt signals should not be allowed to work at certain situation. To achieve
this, this instruction may be used to disable the interrupt signal.
Program example
7-137
NC Positioning Instructions II
Range HR DR ROR K
R0 D0 R5000
Ope- ∣ ∣ ∣
rand R3839 D3999 R8071
Gp 0~1
SR ○ ○ ○
WR ○ ○ ○*
Instruction Explanation
1. The FUN147 (MHSPO) instruction is used to support the linear interpolation for multi-axis motion control, it
consists of the motion program written and edited with text programming. We named every position point as
a step (which includes output frequency, traveling distance, and transfer conditions). Every step of positioning
point owns 15 registers for coding.
2. The FUN147 (MHSPO) instruction can support up to 4 axes for simultaneous linear interpolation; or 2 sets of 2-axis
linear interpolation (i.e. Gp0 = Axes Ps0 & Ps1 ; Gp1 = Axes Ps2 & Ps3)
3. The best benefit to store the positioning program into the registers is that in the case of association with MMI
(Man Machine Interface) to operate settings, it may save and reload the positioning program via MMI when
replacing the molds.
4. When execution control “EN”=1, if the other FUN147/FUN140 instructions to control Ps0~3 are not active
(corresponding status of Ps0=M1992, Ps1=M1993, Ps2=M1994, and Ps3=M1995 will be ON), it will start to
execute from the next step of positioning point (when goes to the last step, it will be restarted from the first
step to perform); if Ps0~3 is controlled by other FUN147/FUN140 instruction (corresponding status of
Ps0=M1992, Ps1=M1993, Ps2=M1994, and Ps3=M1995 would be OFF), this instruction will acquire the pulse
output right of positioning control once the controlling FUN147/FUN140 has released the control right.
5. When execution control input “EN” =0, it stops the pulse output immediately.
6. When output pause “PAU” =1 and execution control “EN” was 1 beforehand, it will pause the pulse output.
When output pause “PAU” =0 and execution control is still 1, it will continue the unfinished pulse output.
7. When output abort “ABT”=1, it stops pulse output immediately. (When the execution control input “EN”
becomes 1 next time, it will restart from the first step of positioning point to execute.)
8. While the pulse is in output transmitting, the output indication “ACT” is ON.
9. When there is execution error, the output indication “ERR” will be ON.
(The error code is stored in the error code register.)
10. When each step of positioning point is complete, the output indication “DN” will be ON.
11. Please refer to Chapter 11 “The NC Positioning Control of FBs-PLC” for further details.
7-138
NC Positioning Instructions II
FUN148 FUN148
MANUAL PULSE GENERATOR FOR POSITIONING
MPG MPG
148. MPG
:Source of high speed counter; 0~7
Sc
Execution EN Sc : ACT :Axis of pulse output; 0~3
Ps
Ps : :Setting of output speed (2 registers)
Fo
:Setting of multiplier (2 registers)
Mr
Fo :
Mr+0:Multiplicand (Fa)
Mr : Mr+1:Dividend (Fb)
WR:Starting address of working registers, it needs
WR :
4 registers
*This instruction can be supported in PLC OS
firmware V4.60 or late
HR ROR DR K
Range
R0 R5000 D0
Operand
∣ ∣ ∣ 16 bit
R3839 R8071 D3999
Sc ○ ○ ○ 0~7
Ps ○ ○ ○ 0~3
Fo ○ ○ ○
Mr ○ ○ ○
WR ○ ○* ○
● Let this instruction be executed in 50mS fixed time interrupt service routine (50MSI)、or by using
the 0.1mS high speed timer to generate 50mS fixed time interrupt service to have accurate repeat
time to sample the pulse input from manual pulse generator. If it comes the input pulses, it will
calculate the number of pulses needing to output according to the setting of multiplier (Mr+0 and
Mr+1), and then outputs the pulse stream in the speed of setting (Fo) during this time interval.
The setting of output speed (Fo) must be fast enough, and the acceleration / deceleration rate
( Parameter 4 and parameter 8 of FUN141 instruction) must be sharp to guarantee it can complete
the sending of pulse stream during the time interval if it is under high multiplier (100 or 200 times)
situation.
● When execution 〝EN〞=1, this instruction will sample the pulse input from manual pulse generator
by reading the current value of assigned high speed counter every time interval; it doesn’t have
any output if it doesn’t have any input pulse; but If it senses the input pulses, it will calculate the
number of pulses needing to output according to the setting of multiplier (Mr+0 and Mr+1), and
then outputs the pulse stream in the speed of setting (Fo) during this time interval.
Number of output pulses = (Number of input pulses × Fa) / Fb
● This instruction also under the control of hardware resource management; it wouldn’t be executed
if the hardware is occupied.
● The output indicator ACT=1 if it outputs the pulses; otherwise ACT=0.
● Please refer to Chapter 11 “The NC Positioning Control of FBs-PLC” for further details.
50mS 50mS
7-139
Communication Instructions
Range HR ROR DR K
R0 R5000 D0
Ope- ∣ ∣ ∣
rand R3839 R8071 D4095
Pt 1~4
SR ○ ○ ○
WR ○ ○* ○
Description
1. FUN150 (M-BUS) instruction makes PLC act as Modbus master through Port 1~4, thus it is very easy to
communicate with the intelligent peripheral with Modbus RTU/ASCII protocol.
2. The master PLC may connect with 247 slave stations through the RS-485 interface.
3. Only the master PLC needs to use Modbus RTU/ASCII instruction.
4. It employs the program coding method or table filling method to plan for the data flow controls; i.e. from which
one of the slave station to get which type of data and save them to the master PLC, or from the master PLC
to write which type of data to the assigned slave station. It needs only seven registries to make definition;
every seven registers define one packet of data transaction.
5. When execution control 〝EN〞changes from 0→1 and both inputs Pause “PAU” and Abort “ABT” are 0, and if
Port 1/2/3/4 hasn’t been controlled by other communication instructions [i.e. M1960 (Port1) / M1962 (Port2) /
M1936 (Port3) / M1938 (Port4) = 1], this instruction will control the Port 1/2/3/4 immediately and set the
M1960/M1962/M1936/M1938 to be 0 (which means it is being occupied), then going on a packet of data
transaction immediately. If Port 1/2/3/4 has been controlled (M1960/M1962/M1936/M1938 = 0), then this
instruction will enter into the standby status until the controlling communication instruction completes its
transaction or pause/abort its operation to release the control right (M1960/M1962/M1936/M1938 =1), and
then this instruction will become enactive, set M1960/M1962/M1936/M1938 to be 0, and going on the data
transaction immediately.
6. While in transaction processing, if operation control “ABT” becomes 1, this instruction will abort this
transaction immediately and release the control right (M1960/M1962/M1936/M1938 = 1). Next time, when this
instruction takes over the transmission right again, it will restart from the first packet of data transaction.
7. While〝A/R〞=0,Modbus RTU protocol;〝A/R〞=1,Modbus ASCII protocol。
8. While it is in the data transaction, the output indication “ACT” will be ON.
9. If there is error occurred when it finishes a packet of data transaction, the output indication “DN” & “ERR” will
be ON.
10. If there is no error occurred when it finishes a packet of data transaction, the output indication “DN” will be
ON.
7-140
Communication Instructions
Range HR ROR DR K
R0 R5000 D0
Ope- ∣ ∣ ∣
rand R3839 R8071 D4095
Pt 1~4
MD 0~3
SR ○ ○ ○
WR ○ ○* ○
Description
● This instruction provides 4 instruction modes MD0~MD3. Of which, three instruction modes MD0~MD2, are
“regular link network”, and the MD3 is the “high speed link network”. The following are the function description of
respective modes.
hMD0 : Master station mode for FATEK CPU LINK.
For any PLC, whose ladder program contains the FUN151:MD0 instruction, will become master
station of FATEK CPU LINK network. The master station PLC will base on the communication
program stored in data registers in which the target station, data type, data length, etc, were
specified to read or write slave station via “FATEK FB-PLC Communication Protocol” command.
With this approach up to 254 PLC stations can share the data each other
hMD1 : Active ASCII data transmission mode.
With this mode, the FUN151 instruction will parse the communication program stored in data
registers and base on the parsing result send the data from port2 to ASCII peripherals (such as
computer, other brand PLC, inverter, moving sign, etc, this kind of device can command by ASCII
message). The operation can set to be (1) transmit only, which ignores the response from
peripherals, (2) transmit and then to receive the response from peripherals. When operate with
mode (2) then the user must base on the communication protocol of peripheral to parsing and
prepare the response message by writing the ladder instructions.
hMD2 : Passive ASCII data receiving mode.
With this mode, the FUN151 will first wait to receive ASCII messages sent by external ASCII
peripherals (such as computer, other brand PLC, card reader, bar code reader, electronic weight,
etc. this kind of device can send ASCII message). Upon receiving the message, the user can base
on the communication protocol of peripheral to parsing and react accordingly. The operation can
set to (1) receive only without responding, or (2) receive then responding. For operation mode (2)
the user can use the table driver method to write a communication program and after received a
message this instruction can base on this communication program automatically reply the
message to peripheral.
hMD3 : Master station mode of FATEK high speed CPU LINK.
The most distinguished difference between this mode and MD0 is that the communication
response of MD3 is much faster than MD0. With The introduction of MD3 mode CPU LINK, The
FATEK PLC can easily to implement the application of distributed control and real time data
monitoring.
7-141
Data Movement Instructions II
FUN160 D P FUN160 D P
READ/WRITE FILE REGISTER
RWFR RWFR
Description
● When operation control "EN"=1 or changes from 0→1( P instruction), it will perform the read ("R/W"=1) or
write ("R/W"=0) file register operation. While reading, the content of data registers starting from Sa will be
overwritten by the content of file registers addressed by the base file register Sb and record pointer Pr; while
writing, the content of file registers addressed by the base file register Sb and record pointer Pr will be
overwritten by the content of data registers starting from Sa; L is the operation quantity or record size. The
access of file register adopts the concept of RECORD data structure to implement. For example, Sa=R0,
Sb=F0, L=10, the read/write details shown as below
Sb
F0 ~ F9
(L=10) Pr = 0
F10 ~ F19
Sa (L=10) Pr = 1
R0 ~ R9 F20 ~ F29
(L=10) (L=10)
Pr = 2
F30 ~ F39
(L=10) Pr = 3
7-142
Data Movement Instructions II
FUN160 D P FUN160 D P
READ/WRITE FILE REGISTER
RW F R RW F R
● For ladder program application, only this instruction can access the file registers.
● The record pointer will be increased by 1 after execution while pointer control input "INC"=1.
● This instruction will not be executed and error indicator ”ERR" will be 1 while incorrect record size (L=0 or >
511) or the operation out of the file register's range (F0~F8191).
7-143
Data Movement Instructions II
HR ROR DR K XR
Range
R0 R5000 D0
Operand
V、Z
∣ ∣ ∣
P0~P9
R3839 R8071 D4095
S ○ ○ ○ ○
BK 0~1
Os ○ ○ ○ 0~32510
Pr ○ ○* ○
L ○ ○* ○ 1~128
WR ○ ○* ○
● The main purpose of the MEMORY_PACK of FBs series's is used for long term storing of the user's ladder
program, except this, through the FUN161/FUN162 instructions, the MEMORY_PACK can be worked as the
portable MEMORY_PACK for machine working parameters's saving and loading.
When execution control〝EN〞changes from 0→1, it will perform the data writing, where S is the starting
address of the source data, BK is the block number of the MEMORY_PACK to store this writing, Os is the
offset of specified block, Pr is the pointer to point to corresponding data area, L is the quantity of this writing.
The access of MEMORY_PACK manipulation adopts the concept of RECORD data structure to implement
with. The working diagram as shown below :
MEMORY_PACK
● When input "INC" = 1, the content of the pointer will be increased by one after the execution of writing, it
points to next record.
7-144
Data Movement Instructions II
● If the value of L is equal to 0 or greater than 128, or the pointed data area over the range, the output "ERR"
will be 1, it will not perform the writing operation.
● It needs couple of PLC solving scans for data writing and verification; during the execution, the output "ACT"
will be 1; when completing the execution and verification without the error, the output "DN" will be 1; when
completing the execution and verification with the error, the output "ERR" will be 1.
The MEMORY_PACK can be configured to store the user's ladder program or machine's working
parameters, or both. The ladder program can be stored into the block 0 only, but the machine's working
parameters can be stored into block 0 or 1; the memory capacity of each block has 32K Word in total.
Example program : Writing the record into block 1 of MEMORY_PACK with the different length
161P.WR_MP
M1 M100
EN S : R0 ACT
Bk : 1 M101
M2
INC Os : 0 ERR
Pr : D1 M102
DN
L : 20
WR: R2900
161P.WR_MP
M3 M103
EN S : R100 ACT
Bk : 1 M104
M4
INC Os : 10000 ERR
Pr : D2 M105
DN
L : 50
WR: R2910
MEMORY_PACK
Block 1
Head of Block 1
The RECORD starts from R0, Write Os = 0 The length is 20 Pr = 0
the length is 20(R0~R19) of RECORD 0
The length is 20
Pr = 1
of RECORD 1
•
•
•
•
•
The length is 20
Pr = 499
Os = 9999 of RECORD 499
The RECORD starts from R100, Write Os = 10000
The length is 50
the length is 50(R100~R149). Pr = 0
of RECORD 0
•
•
•
•
The length is 50 Pr = 449
Os = 32510 of RECORD 449
7-145
Data Movement Instructions II
Range HR ROR DR K
R0 R5000 D0
Operand
∣ ∣ ∣
R3839 R8071 D3999
BK 0~1
Os ○ ○ ○ 0~32510
Pr ○ ○* ○
L ○ ○* ○ 1~128
D ○ ○* ○
● If the MEMORY_PACK of the FBs series's has stored the data record written by the FUN161 instruction,
they can be read out for machine's working through this instruction, it will reduce the tuning time for machine
operation.
● When execution control "EN" = 1 or from 0→1( P instruction), it will perform the data reading, where BK is
the block number of the MEMORY_PACK storing the record, Os is the offset of specified block, Pr is the
pointer to point to corresponding data area, L is the quantity of this record, and D is the starting address to
stor this reading of record. The access of MEMORY_PACK manipulation adopts the concept of RECORD
data structure to implement with.
The working diagram as shown below:
MEMORY_PACK
Block 0 Block 1
● When input "INC"=1, the content of the pointer will be increased by one after the execution of reading, it
points to next record.
7-146
Data Movement Instructions II
● If the value of L is equal to 0 or greater than 128, or the pointed data area over the range, the output "ERR"
will be 1, it will not perform the reading operation.
● Output will be “ERR” if MEMORY_PACK is empty or data format not correct, and user used FUN162 to read
data from MEMORY_PACK.
Example program : Reading the record from block 1 of MEMORY_PACK with the different length
※ It is necessary that correct data in MEMORY_PACK or this example can’t execute correctly.
162P.RD_MP
M10 M110
EN Bk : 1 ERR
M11 Os : 0
INC Pr : D10
L : 20
D : R0
162P.RD_MP
M12 M111
EN Bk : 1 ERR
M13 Os : 10000
INC Pr : D11
L : 50
D : R100
7-147
In Line Comparison Instructions
● When execution input 〝EN〞=1, this instruction will be executed in signed number to compare Sa
with Sb. If Sa=Sb, the output is 1; otherwise the output is 0.
Example 1:
Example 2:
7-148
In Line Comparison Instructions
● When execution input 〝EN〞=1, this instruction will be executed in signed number to compare Sa
with Sb. If Sa>Sb, the output is 1; otherwise the output is 0.
Example 1:
Description: When M10=1、R20 > R22 or M11=1, the output status of Y2 is 1; otherwise it is 0.
Example 2:
7-149
In Line Comparison Instructions
● When execution input 〝EN〞=1, this instruction will be executed in signed number to compare Sa
with Sb. If Sa<Sb, the output is 1; otherwise the output is 0.
Example 1:
Description: When M10=1、R20 < R22 or M11=1, the output status of Y2 is 1; otherwise it is 0.
Example 2:
Description: When DR600=DR602 or DR604>DR606, after them DR608<DR610 and DR616≧DR618, or DR612
≠DR614 and DR620≦DR622, or M200=1and M201=1, and then M100=1, the output status of Y10
is 1; otherwise it is 0.
7-150
In Line Comparison Instructions
● When execution input 〝EN〞=1, this instruction will be executed in signed number to compare Sa
with Sb. If Sa≠Sb, the output is 1; otherwise the output is 0.
Example 1:
Example 2:
7-151
In Line Comparison Instructions
● When execution input 〝EN〞=1, this instruction will be executed in signed number to compare Sa
with Sb. If Sa≧Sb, the output is 1; otherwise the output is 0.
Example 1:
Example 2:
Description: When DR600=DR602 or DR604>DR606, after them DR608<DR610 and DR616≧DR618, or DR612
≠DR614 and DR620≦DR622, or M200=1and M201=1, and then M100=1, the output status of Y10
is 1; otherwise it is 0.
7-152
In Line Comparison Instructions
● When execution input 〝EN〞=1, this instruction will be executed in signed number to compare Sa
with Sb. If Sa≦Sb, the output is 1; otherwise the output is 0.
Example 1:
Example 2:
Description: When DR600=DR602 or DR604>DR606, after them DR608<DR610 and DR616≧DR618, or DR612
≠DR614 and DR620≦DR622, or M200=1and M201=1, and then M100=1, the output status of Y10
is 1; otherwise it is 0.
7-153
Other Instructions
1 9 0 . S TAT
Gp : Specified status group
Execution EN Gp : 0 : Get information of I/O expansion
1~3 : Reserved
D :
D : Starting address of register to store the system status
D+0 : Quantity of status
D+1 : Status 1
…
K
D+N: Status N
HR ROR DR
Range
∣ ∣ ∣
firmware V4.62 or later
R3839 R8071 D3999
Gp 0~3
D ○ ○* ○
● When execution 〝EN〞=1, this instruction being executed, and if Gp=0, it means to get the
information of I/O expansion modules; total quantity of I/O expansion modules will be stored in D
register, code of I/O expansion module will be stored in D+1~D+N registers in order. Gp=1~3,
reserved for future.
13 FBs-7SG1H
(Non-decode)
14 FBs-7SG2S (Decode)
15 FBs-7SG2H (Non-decode)
16 FBs-6AD
17 FBs-2DA
18 FBs-4DA
19 FBs-4PT
20 FBs-4A2D
7-154
Other Instructions
Example:There are two I/O expansion modules FBs-2DA + FBs-6AD installed in one system
Description: When M500=1, this instruction being executed, register D200 is used to store the total
quantity of I/O expansion modules, register D201 is used to store the code (17=FBs-2DA)
of first I/O expansion module, register D202 is used to store the code (16=FBs-6AD) of
second I/O expansion module.
7-155
Floating Point Instructions
FUN200 D P FUN200 D P
CONVERSION OF INTEGER TO FLOATING POINT NUMBER
IÆF IÆF
Range HR ROR DR K XR
R0 R5000 D0 16/32 V、Z
∣ ∣ ∣ bit
Operand R3839 R8071 D4095 Integer P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System)…page 5 - 9 .
z When conversion control "EN" = 1 or has a transition from 0 to 1 ( P instruction), will convert the integer data
from S register into D~D+1 32-bits register( floating point number data)
200P.I F
X0
EN S : R0 ※ R0 = 200 ( 0000000011001000)
D : D0
Integer To Floating
DD0 = 43480000H
0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0
R0 :
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
I F
0 1 0 0 0 0 1 1 0 1 0 0 1 0 0 0 0 00…0 0
DD0 : b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16 b15 b14 ~ b1 b0
s e e e e e e e e m m m m m m m m mm…m m
7-156
Floating Poing Instructions
FUN201 D P FUN201 D P
CONVERSION OF FLOATING POINT NUMBER TO INTEGER
FÆ I FÆ I
Range HR ROR DR XR
R0 R5000 D0 V、Z
∣ ∣ ∣
Operand R3839 R8071 D4095 P0~P9
S ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System)…page 5 - 9 .
z When conversion control "EN" = 1 or has a transition from 0 to 1 ( P instruction), will convert the floating
point data from S~S+1 32bits register into D register( integer data ).
z If the value exceeds the valid range of destination, then do not carry out this instruction, and set the
range-error flag “ERR” as 1 and the D register will be intact.
201P.F I
X2 Floating To Integer
EN S : R20 ERR
D : D10
D10 = 007BH
7-157
Floating Point Instructions
FUN202 P FUN202 P
FLOATING POINT NUMBER ADDITION
FADD FADD
Sa: Augend
Sb: Addend
D : Destination register to store the results
of the addition
Sa, Sb, D may combine with V, Z, P0~P9 to
serve indirect addressing
Range HR ROR DR K XR
R0 R5000 D0 Floating V、Z
∣ ∣ ∣ point
Operand R3839 R8071 D4095 number P0~P9
Sa ○ ○ ○ ○ ○
Sb ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System)…page 5 - 9 .
z Performs the addition of the data specified at Sa and Sb and writes the results to a specified register D when
the add control input "EN" =1 or from 0 to 1 ( P instruction). If the result exceed the range that the floating
38
point number can be expressed(± 3 . 4 * 1 0 ) then the error flag FO0 will be set to 1 and the D register will
be intact.
202P.FADD
X0
Sa : R0 ERR
Sb : R10
D : R20
7-158
Floating Poing Instructions
Ladder symbol
203P.FSUB Sa: Minuend
Subtraction control EN Sa : ERR Ranger Error (FO0)
Sb: Subtrahend
Sb : D : Destination register to store the results
D : of the subtraction
Sa, Sb, D may combine with V, Z, P0~P9 to
serve indirect addressing
Range HR ROR DR K XR
R0 R5000 D0 Floating V、Z
∣ ∣ ∣ point
Operand R3839 R8071 D4095 number P0~P9
Sa ○ ○ ○ ○ ○
Sb ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System)…page 5 - 9 .
z Performs the subtraction of the data specified at Sa and Sb and writes the results to a specified register D
when the subtract control input "EN" =1 or from 0 to 1 ( P instruction). If the result exceed the range that the
38
floating point number can be expressed(± 3 . 4 * 1 0 ) then the error flag FO0 will be set to 1 and the D
register will be intact.
203P.FSUB
X0
EN Sa : R0 ERR
Sb : R4
D : R10
DR10 C3960000H
7-159
Floating Point Instructions
Ladder symbol
204P.FMUL Sa: Multiplicand
Multiplication control EN Sa : ERR Ranger Error (FO0)
Sb: Multiplier
Sb : D : Destination register to store the results
D : of the multiplication
Sa, Sb, D may combine with V, Z, P0~P9 to
serve indirect addressing
Range HR ROR DR K XR
R0 R5000 D0 Floating V、Z
∣ ∣ ∣ point
Operand R3839 R8071 D4095 number P0~P9
Sa ○ ○ ○ ○ ○
Sb ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System)…page 5 - 9 .
z Performs the multiplication of the data specified at Sa and Sb and writes the results to a specified register D
when the multiplication control input "EN" =1 or from 0 to 1 ( P instruction). If the result exceed the range
38
that the floating point number can be expressed(± 3 . 4 * 1 0 ) then the error flag FO0 will be set to 1 and
the D register will be intact.
204P.FMUL
M10
EN Sa : R10 ERR
Sb : R12
D : R14
DR14 47A39AE2H
7-160
Floating Poing Instructions
Sa: Dividend
Sb: Divisor
D : Destination register to store the results
of the division
Sa, Sb, D may combine with V, Z, P0~P9 to
serve indirect addressing
Range HR ROR DR K XR
R0 R5000 D0 Floating V、Z
∣ ∣ ∣ point
Operand R3839 R8071 D4095 number P0~P9
Sa ○ ○ ○ ○ ○
Sb ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System) page 5 - 9 .
z Performs the division of the data specified at Sa and Sb and writes the result to the registers specified by
register D when the division control input "EN" =1 or from 0 to 1 ( P instruction). If the result exceed the
38
range that the floating point number can be expressed(± 3 . 4 * 1 0 ) then the error flag FO0 will be set to 1
and the D register will be intact.
205P.FDIV
X5
EN Sa : R0 ERR
Sb : R2
D : R4
7-161
Floating Point Instructions
Range HR ROR DR K XR
R0 R5000 D0 Floating V、Z
∣ ∣ ∣ point
Operand R3839 R8071 D4095 number P0~P9
Sa ○ ○ ○ ○ ○
Sb ○ ○ ○ ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System) page 5 - 9 .
z Compares the data of Sa and Sb when the compare control input "EN" =1 or from 0 to 1 ( P instruction). If
the data of Sa is equal to Sb, then set FO0 to 1. If the data of Sa>Sb, then set FO1 to 1. If the data of Sa<Sb,
then set FO2 to 1. If the data of Sa < Sb, then set the FO2 to 1.
X0 206P.FCMP
EN Sa : R0 a=b
Sb : R2 a>b
Y0
a<b
z From the above example, we first assume the data of DR0 is 200.1 and DR2 is 200.2, and then compare the
data by executing the CMP instruction. The FO0 and FO1 are set to 0 and FO2 (a<b) is set to 1 since a<b.
z If you want to have the compound results, such as≧、≦、< > etc., please send =、< and > results to relay first
and then combine the result from the relays.
7-162
Floating Point Instructions
Range HR ROR DR K XR
R0 R5000 D0 Floating V、Z
∣ ∣ ∣ point
Operand R3839 R8071 D4095 number P0~P9
S ○ ○ ○ ○ ○
Su ○ ○ ○ ○ ○
SL ○ ○ ○ ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System) page 5 - 9 .
z When compare control "EN" = 1 or changes from 0 to 1 ( P instruction), compares S with upper limit SU and
lower limit SL. If S is between the upper limit and the lower limit (SL≦S≦SU), then set the inside zone flag
"INZ" to 1. If the value of S is greater than the upper limit SU, then set the higher than upper limit flag "S>U"
to 1. If the value of S is smaller then the lower limit SL, then set the lower than lower limit flag "S<L" as 1.
z The upper limit SU should be greater than the lower limit SL. If SU<SL, then the limit value error flag "ERR"
will set to 1, and this instruction will not carry out.
7-163
Floating Point Instructions
Before-execution
Results of execution
7-164
Advance Function Instruction
Range HR ROR DR K XR
R0 R5000 D0 Floating V、Z
Ope- ∣ ∣ ∣ point
rand R3839 R8071 D4095 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of
the format please refer to 5.3 (Numbering System) page 5 - 9 .
z When operation control "EN" = 1 or from 0 to 1( P instruction), take the square root of the data specified by
the S value or S~S+1 register, and store the result into the register specified by D~D+1.
z If the value of S is negative, then the error flag "ERR" will be set to 1, and do not execute the operation.
208P.FSQR
X0
EN S : 2520.04 ERR
D : D0
7-165
Floating Point Instructions
Range HR ROR DR K XR
R0 R5000 D0 Integer V、Z
Ope- ∣ ∣ ∣ 16 Bit
rand R3839 R8071 D4095 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of the
format please refer to 5.3 (Numbering System) page 5 - 9 .
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), take the SIN value of the angle data specified
by the S register and store the result into the register D~D+1 in floating point number format. The valid range
of the angle is from –18000 to +18000, unit in 0.01 degree.
z If the S value is not within the valid range, then the S value error flag "ERR" will be set to 1, and do not
execute the operation.
209P.FSIN
X0
EN S : 3000 ERR z At left, the example program gets the SIN value of 30,
7-166
Floating Point Instructions
Range HR ROR DR K XR
R0 R5000 D0 Integer V、Z
Ope- ∣ ∣ ∣ 16 Bit
rand R3839 R8071 D4095 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of the
format please refer to 5.3 (Numbering System) page 5-9.
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), take the COS value of the angle data specified
by the S register and store the result into the register D~D+1 in floating point number format. The valid range
of the angle is from –18000 to +18000, unit in 0.01 degree.
z If the S value is not within the valid range, then the S value error flag "ERR" will be set to 1, and do not
execute the operation.
210P.FCOS
X0 z At left, the example program gets the COS value of 60,
EN S : R0 ERR and stores the results the register DR200.
D : R200
7-167
Floating Point Instructions
Range HR ROR DR K XR
R0 R5000 D0 Integer V、Z
Ope- ∣ ∣ ∣ 16 Bit
rand R3839 R8071 D4095 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of the
format please refer to 5.3 (Numbering System) page 5-9.
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), take the COS value of the angle data specified
by the S register and store the result into the register D~D+1 in floating point number format. The valid range
of the angle is from –18000 to +18000, unit in 0.01 degree.
z If the S value is not within the valid range, then the S value error flag "ERR" will be set to 1, and do not
execute the operation.
211P.FTAN
M0 z At left, the example program gets the TAN value of 45,
EN S : R0 ERR and stores the results the register DD50.
D : D50
7-168
Floating Point Instructions
Range HR ROR DR XR
R0 R5000 D0 V、Z
Ope- ∣ ∣ ∣
rand R3839 R8071 D4095 P0~P9
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of the
format please refer to 5.3 (Numbering System) page 5 - 9 .
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), the sign of the floating point number register
specified by D will be toogled.
Programming Example
7-169
Floating Point Instructions
Range HR ROR DR XR
R0 R5000 D0 V、Z
Ope- ∣ ∣ ∣
rand R3839 R8071 D4095 P0~P9
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard. For detail explanation of the
format please refer to 5.3 (Numbering System) page 5 - 9 .
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), calculate the absolute value of the floating
point number register specified by D, and write it back into the original D register.
Programming Example
X0 213P.
z The instruction at left calculates the absolute
EN FABS R0
value of the DR0 register, and stores it back in
DR0.
7-170
Floating Point Instructions
Range HR ROR DR K XR
R0 R5000 D0 V、Z
Floating
Ope- ∣ ∣ ∣
rand R3839 R8071 D3999 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard of 32-bit.
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), take the Napierian logarithm of the data
specified by the S value or S~S+1 register, and store the result into the register specified by D~D+1.
z If the value of S is negative or equal to 0、 invalid indirect addressing、 or over range of the result , the error
flag "ERR" will be set to 1, and not update the value of D~D+1.
E x a mp le
7-171
Floating Point instructions
F 2 1 5 P. F E X P
S : Source data or register to be calculated power
Operation function of nature number
Control EN S : ERR
D : D : Register for storing the result
Range HR ROR DR K XR
R0 R5000 D0 V、Z
Floating
Ope- ∣ ∣ ∣
rand R3839 R8071 D3999 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard of 32-bit.
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), calaulate the nature power function of the data
specified by the S value or S~S+1 register, and store the result into the register specified by D~D+1.
z If the value of S is out of range、 invalid indirect addressing、 or over range of the result , the error flag "ERR"
will be set to 1, and not update the value of D~D+1.
E x a mp le
․ W h e n M 2 1 5 = 1 , c a l c u l a t e t h e n a t u r e p o we r f u n c t i o n , i t i s D D 2 4 8 = e D D 4 8
7-172
Floating Point Instructions
F 2 1 6 P. F L O G
S : Source data or register to be calculated logarithm
Operation value
Control EN S : ERR
D : D : Register for storing the result
HR ROR DR K XR
Range
R0 R5000 D0 V、Z
Floating
∣ ∣ ∣
Ope- number P0~P9
R3839 R8071 D3999
rand
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard of 32-bit.
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), calculate the logarithm value of the data
specified by the S value or S~S+1 register, and store the result into the register specified by D~D+1.
z If the value of S is negative or equal to 0、 invalid indirect addressing、 or over range of the result , the error
flag "ERR" will be set to 1, and not update the value of D~D+1.
E x a mp le
7-173
Floating Point instructions
Range HR ROR DR K XR
R0 R5000 D0 V、Z
Floating
Ope- ∣ ∣ ∣
rand R3839 R8071 D3999 number P0~P9
Sy ○ ○ ○ ○ ○
Sx ○ ○* ○ ○ ○
D ○ ○ ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard of 32-bit.
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), calculate the power function of the exponential
data specified by the Sy、base data specified by the Sx, and store the result into the register specified by
D~D+1.
z If it exists invalid indirect addressing、or over range of the result , the error flag "ERR" will be set to 1, and not
update the value of D~D+1.
E x a mp le
․ W h e n M 2 1 7 = 1 , c a l c u l a t e t h e p o we r f u n c t i o n , i t i s D D 2 5 2 = D D 5 4 D D 5 2
7-174
Floating Point Instructions
F 2 1 8 P. FA S I N
S : Source data or register to be calculated the arc sine
Operation value
Control EN S : ERR
D : D : Register for storing the result
Range HR ROR DR K XR
R0 R5000 D0 V、Z
Floating
Ope- ∣ ∣ ∣
rand R3839 R8071 D3999 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard of 32-bit.
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), calculate the arc sine value of the data
specified by the S value or S~S+1 register, and store the result into the register specified by D~D+1.
z Range of S data : -1~ +1 ; range of D value : -π/2 ~ π/2 (Unit in radian)
z If the value of S is out of range、or invalid indirect addressing, the error flag "ERR" will be set to 1, and not
update the value of D~D+1.
z All floating point instructions can’t be executed in interrupt service routine.
E x a mp le
․ W h e n M 2 1 8 = 1 , c a l c u l a t e t h e a r c s i n e v a l u e , i t i s D D 2 5 6 = s in - 1 D D 5 6 ;
DD256(Unit in radian) × 57.295788(180/π ) to acquire the degree value
7-175
Floating Point instructions
F 2 1 9 P. FA C O S
S : Source data or register to be calculated the arc
Operation cosine value
Control EN S : ERR
D : D : Register for storing the result
Range HR ROR DR K XR
R0 R5000 D0 V、Z
Floating
Ope- ∣ ∣ ∣
rand R3839 R8071 D3999 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard of 32-bit.
z When operation control "EN" = 1 or from 0 to 1( P instruction), calculate the arc cosine value of the data
specified by the S value or S~S+1 register, and store the result into the register specified by D~D+1.
z Range of S data : -1~ +1 ; range of D value : 0 ~ π(Unit in radian)
z If the value of S is out of range、or invalid indirect addressing, the error flag "ERR" will be set to 1, and not
update the value of D~D+1.
z All floating point instructions can’t be executed in interrupt service routine.
E x a mp le
․ W h e n M 2 1 9 = 1 , c a l c u l a t e t h e a r c c o s i n e v a l u e , i t i s D D 2 5 8 = cos - 1 D D 5 8 ;
DD258(Unit in radian) × 57.295788(180/π ) to acquire the degree value
7-176
Floating Point Instructions
F 2 2 0 P. FATA N
S : Source data or register to be calculated the arc
Operation tangent value
Control EN S : ERR
D : D : Register for storing the result
Range HR ROR DR K XR
R0 R5000 D0 V、Z
Floating
Ope- ∣ ∣ ∣
rand R3839 R8071 D3999 number P0~P9
S ○ ○ ○ ○ ○
D ○ ○* ○ ○
Description
z The format of floating point number of Fatek-PLC follows the IEEE-754 standard of 32-bit.
z When operation control "EN" = 1 or from 0 to 1 ( P instruction), calculate the arc tangent value of the data
specified by the S value or S~S+1 register, and store the result into the register specified by D~D+1.
z S data is any number ; range of D value : -π/2 ~ π/2 (Unit in radian)
z If it exists invalid indirect addressing, the error flag "ERR" will be set to 1, and not update the value of D~D+1.
z All floating point instructions can’t be executed in interrupt service routine.
E x a mp le
․ W h e n M 2 2 0 = 1 , c a l c u l a t e t h e a r c ta n g e n t v a l u e , i t i s D D 2 6 0 = tan - 1 D D 6 0 ;
DD260(Unit in radian) × 57.295788(180/π ) to acquire the degree value
7-177