Ch07_Advanced_Function_List.pdf
(
2187 KB
)
Pobierz
Microsoft Word - 7-0_fp.doc
Chapter 7 Advanced Function Instructions
Flow control instructions1
(FUN22).................................................. ...........7-1
Arithmetical operation instructions
(FUN23
~
32) ................................... . . . . 7 - 2 ~ 7 - 9
Logical operation instructions
(FUN35
~
36)………………….……..7-10 ~ 7-13
Comparison instruction
(FUN37) ………………………………………..7-14
Data movement instructions1
(FUN40
~
50) ………………………7-15 ~ 7-25
Shifting
/
Rotating instructions
(FUN51
~
54)………………………….7-26 ~ 7-29
Code conversion instructions
(FUN55
~
64)…………………...…….7-30 ~ 7-46
Flow control instructions2
(FUN65
~
71)……………………...….7-47 ~ 7-54
I
/
O instructions
(FUN74
~
86)……………………….... 7-55 ~ 7-72
Cumulative timer instructions
(FUN87
~
89)……………………...….7-73 ~ 7-74
Watchdog timer instructions
(FUN90
~
91)……………………….... 7-75 ~ 7-76
High speed counting
/
timing
(FUN92
~
93)……………………….... 7-77 ~ 7-78
Report printing instructions
(FUN94) ………………………………7-79 ~ 7-80
Slow up
/
Slow down instructions
(FUN95) ……………………………7-81 ~ 7-82
Table instructions
(FUN100
~
114) ……………………7-84 ~ 7-101
Matrix instructions
(FUN120
~
130)……………...…….7-103 ~ 7-113
NC positioning instructions
(FUN140
~
143).............................7-114 ~ 7-119
Enable
/
Disable instructions
(FUN145
~
146)…………..……….7-120 ~ 7-121
Communication instructions
(FUN150
~
151)……………..…….7-122 ~ 7-123
Data movement instructions2
(FUN160) ………………………7-124 ~ 7-125
Floating Point Number operation instructions(FUN200
~
213).........7-126 ~ 7-140
Advanced Function Instruction
FUN22
P
BREAK
BREAK FROM FOR AND NEXT LOOP
(
BREAK
)
FUN22
P
BREAK
●
When execution control
〝
EN
〞
=1 or
〝
EN
↑〞(
P
instruction
)
changes from 0
→
1
,
it will terminate the FOR
and NEXT program loop
。
●
The program within the FOR and NEXT loop will be executed N times (N is assigned by FOR instruction)
successively
,
but if it is necessary to terminate the execution loop less than N times
,
the BREAK instruction
is necessary to apply
。
●
The BREAK instruction must be located within the FOR and NEXT program loop
。
EN
RST
V
70
FOR
D10
17.CMP
M200
EN
Sa :
Sb :
D100
a=b
R0V
a>b
a<b
M200
EN
BREAK
15
EN
(+1)
V
OVF
71
NEXT
08.MOV
EN
S :
D :
V
D1000
Description
:
The loop count used to execute the FOR and NEXT program loop is assigned by register D10
;
the
program within the FOR and NEXT loop is designed to search the same data storing in D100 from the
register table starting at R0
。
If it finds
,
the searching loop will be terminated and then it goes to execute
the program after the NEXT instruction
;
If it doesn't find
,
the searching loop will be executed N times (N
is the content of D10) and then it goes to execute the program after the NEXT instruction
。
M200 tells the status and D1000 is the pointer of searching
。
7-1
Advanced Function Instruction
FUN 23
P
DIV48
48-BIT DIVISION
FUN 23
P
DIV48
Sa
:
Starting register of dividend
Sb
:
Starting register of divisor
D : Starting register for storing the division
result (quotient)
Sa
,
Sb
,
can combine V, Z, P0~P9 for index
addressing.
Range
HR OR SR ROR DR
XR
Ope-
rand
V
、
Z
P0~P9
Sa
○ ○ ○ ○ ○ ○
Sb
○ ○ ○ ○ ○ ○
D
○ ○ ○
*
○
*
○ ○
R0
∣
R3839
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
z
When operation control “EN”=1 or “EN
↑
” (
P
instruction) changes from 0
→
1, will perform the 48 bits division
operation. Dividend and divisor are each formed by three consecutive registers starting by Sa and Sb
respectively. If the result is zero, ‘D=0’ output will be set to 1. If divisor is zero then the ‘ERR’ will be set to 1
and the resultant register will keep unchanged.
z
All operands involved in this function are all 48 bits, so Sa, Sb and D are all comprised by 3 consecutive
registers.
Example: 48-bit division
In this example dividend formed by register R2, R1, R0 will be divided by divisor formed by register R5, R4, R3. The
quotient will store in R8, R7, and R6.
X0
23P.DIV48
EN
Sa :
Sb :
D :
R
R
R
0
3
6
D=0
U/S
ERR
Sa
R2
R1
R0
2147483647
÷
Sb
R5
R4
R3
1234567
R8
R7
R6
1739
Quotient
7-2
Advanced Function Instruction
FUN 24
D
P
SUM
SUM
(Summation of block data)
FUN 24
D
P
SUM
S : Starting number of source register
N : Number of registers to be summed
(successive N data units starting from S)
D : The register which stored the result (summation)
S, N, D, can associate with V, Z, P0~P9 index register to
serve the indirect addressing application.
Range
WX WY
WM
WS TMR CTR HR
IR
OR SR ROR DR K
XR
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
1
∣
511
V
、
Z
Ope-
rand
P0~P9
S
○
○
○
○
○ ○ ○ ○ ○ ○ ○ ○
○
N
○
○
○
○
○ ○ ○ ○ ○ ○ ○ ○
○
○
D
○
○
○
○ ○ ○
○ ○
*
○
*
○
○
z
When operation control “EN”=1 or “EN
↑
” (
P
instruction) changes from 0
→
1, it puts the successive N units of
16bit or 32 bit (
D
instruction) registers for addition calculation to get the summation, and stores the result into
the register which is designated by D.
z
When the value of N is 0 or greater than 511, the operation will not be performed.
z
Communication port1 or port2 can be used to serve as a general purpose ASCII communication interface. If
the data error detecting method is Check-Sum, this instruction can be used to generate the sum value for
sending data or ot use this instruction to check if the received data is error or not.
〈
Example 1
〉
When M1 changes from OFF
→
ON, following instruction will calculates the summation for 16-bit data.
M1
24P.SUM
z
The left illustrates that 6 16-bit registers starting from R0
is calculated for summation, and the result is stored into
the R100 register.
EN S :
N :
D :
R0
6
R100
R0=0030H
R1=0031H
R2=0032H
R3=0033H
R4=0034H
R5=0035H
Î
R100=012FH
〈
Example 2
〉
When M1 is ON, it calculates the summation for 32-bit data.
M1
24D.SUM
z
The left illustrates that three 32-bit registers starting
from DR0, is calculated for their summation, and the
result is stored into the DR100 register.
EN
S :
N :
D :
R0
3
R100
R1
,
R0=00310030H
R3
,
R2=00330032H
Î
R101
,
R100=00A5009BH
R5
,
R4=00410039H
7-3
Advanced Function Instruction
FUN 25
D
P
MEAN
MEAN
(Average of the block data)
FUN 25
D
P
MEAN
S : Source register number
N : Number of registers to be averaged
(N units of successive registers starting from S
)
D : Register number for storing result (mean value)
The S, N, D may combine with V, Z, P0~P9 to
serve indirect address application
Range
WX WY
WM WS TMR CTR HR
IR
OR
SR ROR DR K XR
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
2
∣
256
V
、
Z
Ope-
rand
P0~P9
S
○
○
○
○
○ ○ ○ ○ ○ ○ ○ ○
○
N
○
○
○
○
○ ○ ○ ○ ○ ○ ○ ○
○
○
D
○
○
○
○ ○ ○
○ ○
*
○
*
○
○
z
When operation control "EN" = 1 or "EN
↑
" (
P
instruction) from 0 to 1, add the N successive 16-bit or 32-bit
(
D
instruction) numerical values starting from S, and then divided by N. Store this mean value (rounding off
numbers after the decimal point) in the register specified by D.
z
While the N value is derived from the content of the register, if the N value is not between 2 and 256, then the
N range error "ERR" will be set to 1, and do not execute the operation.
X0
25P.MEAN
z
At left, the example program gets the mean value of the
3 successive 16-bit registers starting from R0, and stores
the results into the 16-bit register R10
EN
S :
N :
D :
R 0
ERR
3
R 10
R0
123
S
(N
=
3)
R1
9
R2
788
123
+
9
+
788
Ø
X0
=
3
=
306
(
Rouding off the remainder
)
D
R10
306
7-4
Plik z chomika:
artibe22
Inne pliki z tego folderu:
winproladder-tutorial.pdf
(760 KB)
Ch08_Test_Run_Monitoring.pdf
(168 KB)
Ch08_Step_Instruction_Description.pdf
(630 KB)
Ch07_Digital_Outputs.pdf
(290 KB)
Ch07_Advanced_Function_List.pdf
(2187 KB)
Inne foldery tego chomika:
Benedikt
BHP
Dokumenty
Elektronika
Elektryka
Zgłoś jeśli
naruszono regulamin