Posted in

By

8 of 9Updated 2026-11-17249 min read中文版

7-1 Arithmetical Operation Instructions(FUN24~33)

7-1-1 Summation of Block Data(SUM)

FUN24 D P

SUM

SUM

(Summation of block data)

FUN24 D P

SUM

Symbol

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

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

1

∣

511

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When operation control “EN”=1 or changes from 0→1 ( P instruction), 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.
  • When the value of N is 0 or greater than 511, the operation will not be performed.
  • If the data error detecting method is Checksum, 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 X0 changes from OFF→ON, following instruction will calculates the summation for 16-bit data

Ladder diagram

ST

IF X0 THEN

SUM( S:= R0, N:= 6, D:= R100);

END_IF

R0=0030H

R1=0031H

R2=0032H

R3=0033H

R4=0034H

R5=0035H

  • The above illustrates that 6 16-bit registers starting from R0 is calculated for summation, and the result is stored into the R100 register.

Example 2

When X0 is ON, it calculates the summation for 32-bit data.

Ladder diagram

ST

IF X0 THEN

SUM_D( S:= R0, N:= 6, D:= R100);

END_IF

R1~R0=00310030H

R3~R2=00330032H 🡺 R101~R100=00A5009BH

R5~R4=00410039H

  • The above illustrates that three 32-bit registers starting from DR0, is calculated for their summation, and the result is stored into the DR100 register.

7-1-2 Average of Block Data (MEAN)

FUN25 D P

MEAN

MEAN

(Average of the block data)

FUN25 D P

MEAN

Symbol

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

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

∣

256

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When operation control "EN" = 1 or from 0 to 1 (P instruction), 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.
  • While the N value is derived from the content of the register, if the N value is not between 1 and 256, then the N range error "ERR" will be set to 1, and do not execute the operation.

FUN25 D P

MEAN

MEAN

(Average of the block data)

FUN25 D P

MEAN

Example

Ladder diagram

ST

IF R_TRIG( S:= X0 ) THEN

MEAN( S:= R0, N:= 3, D:= R10);

END_IF

  • 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

S

(N=3)

R0

123

R1

9

R2

788

123+9+788

⇩X0=

3

=306(Rouding off the remainder)

D

R10

306

7-1-3 Take the Negative Value (NEGATION)

FUN27 D P

NEG

NEGATION

(Take the negative value)

FUN27 D P

NEG

Symbol

D : Register to be negated

D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WY

WM

WSM

WS

TMR

CTR

HR

OR

SR

ROR

DR

XR

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

V, Z

P0 ~ P9

D

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When operation control "EN" = 1 or from 0 to 1 (P instruction), negate (ie. calculate 2’s complement) the value of the content of the register specified by D, and store it back in the original D register.
  • If the value of the content of D is negative, then the negation operation will make it positive.

Example

Ladder diagram

ST

IF R_TRIG( S:= X0 ) THEN

R0 := – R0;

END_IF

  • The instruction at left negates the value of the R0 register, and stores it back to R0.

D

R0

12345

☞3039H

⇩X0=

D

R0

−12345

☞CFC7H

7-1-4 Take the Absolute Value (ABSOLUTE)

FUN28 D P

ABS

ABSOLUTE

(Take the absolute value)

FUN28 D P

ABS

Symbol

D : Register to be taken absolute value.

D may combine with V, Z, P0~P9 to serve indirect address application.

Range

Operand

WY

WM

WSM

WS

TMR

CTR

HR

OR

SR

ROR

DR

XR

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

V, Z

P0 ~ P9

D

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When operation control "EN" = 1 or from 0 to 1 (P instruction), calculate the absolute value of the content of the register specified by D, and write it back into the original D register.

Example

Ladder diagram

ST

IF X0 THEN

ABS_D( D:= R0 );

END_IF

  • The instruction at left calculates the absolute value of the DR0 register, and stores it back in DR0(R1, R0).

D

R1 R0

−12345

☞CFC7H

⇩X0=

D

R1 R0

12345

☞3039H

7-1-5 Linear Conversion (LCNV)

FUN33 P

LCNV

Linear Conversion

(LCNV)

FUN33 P

LCNV

Symbol

Md: Operation mode, 0~3

S: Starting address of the source data

Ts: Starting address of the parameter table for conversion

D: Starting address to store the result

L: Quantity of conversion entry, 1~64

Range

Operand

HR

IR

OR

SR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Md

0-3

S

○

○

○

○

○

○

○

N

○

○

○

○

○

○

○

D

○

○*

○

○

L

○

○

○

○

○

○

1-64

Description

  • When the analog input module being used for the analog measurement, the raw reading value of the analog input can be converted into the engineering range through this instruction for display or for proceeding control operation.
  • When using temperature or analog modules for temperature or analog measurement applications, if the temperature or engineering readings measured by the PLC deviate from the results measured by standard thermometers or related standard instruments, this command can be used to make a linear correction as a correction for the actual measured value.
  • When execution control "EN"=1 or from 0→1(P instruction), this instruction will perform the linear conversion operation according to the mode selection, where S is the starting address of the source data, Ts is the starting address of the conversion parameter table, D is the starting address to store the converted result, and L is the quantity of conversion entry.
  • There are two expressions to meet the suitable application:

Expression 1: Two points calibration method

Fill the conversion parameter table with the low value of measurement(VML), high value of measurement (VMH), and the corresponding low value of standard (VSL), high value of standard (VSH); the converted result (Dn) will be generated from the source data(Sn) through the formula shown below:

A = (VSL-VSH/VML-VMH)×10000

B = VSL-(VML×A/10000)

Dn = (Sn×A/10000)+B

  • The range of operands VSL, VSH, VML, VMH, Sn and Dn are between -32768 ~ 32767.
  • For analog input scaling, where:

VML=Minmum of analog input

VMH=Maximum of analog input

VSL=Minmum of engineering range

VSH=Maximum of engineering range

FUN33 P

LCNV

Linear Conversion

(LCNV)

FUN33 P

LCNV

Expression 2 : Multiplicator+Offset method

Fill the conversion parameter table with the values of multiplier(A), divisor(B) and offset(C);

The converted result (Dn) will be generated from the source data (Sn) through the formula shown below:

Dn =[(Sn×A)/B]+C

The range of each operand as below:

A = 1~65535

B = 1~65535

C = -32768~32767

Sn = 0~65535

Dn = -32768~32767

Description of operation mode

  1. When Md = 0, the linear conversion works by expression 1, and all source data share the same parameters VML, VMH, VSL and VSH for conversion.
  2. When Md = 1, the linear conversion works by expression 1, and each source data has the independent corresponding parameters VML, VMH, VSL, VSH for conversion; if there are N entries of source data, the conversion parameter table should have N groups of VML, VMH, VSL, VSH for working, there are N×4 registers in the conversion parameter table.
  3. When Md = 2, the linear conversion works by expression 2, and all source data share the same parameters A, B and C for conversion.
  4. When Md = 3, the linear conversion works by expression 2, and each source data has the independent corresponding parameters A, B, C for conversion; if there are N entries of source data, the conversion parameter table should have N groups of A, B, C for working, there are N×3 registers in the conversion parameter table.

FUN33 P

LCNV

Linear Conversion

(LCNV)

FUN33 P

LCNV

Example 1

Mode 0 of linear conversion

Ladder diagram

ST

LCNV( EN:= M0, Md:= 0, S:= R100, Ts:= R1000, D=> R2000, L:= 6);

  • When M0 = 1, it will perform the mode 0 operation of linear conversion, where R100 is the starting address of the source data, R1000 is the starting address of the table of the conversion parameters VML, VMH, VSL, VSH, the quantity is 6, and R2000~R2005 will store the converted results.

FUN33 P

LCNV

Linear Conversion

(LCNV)

FUN33 P

LCNV

Ts

R1000

R1001

R1002

R1003

282

VML

3530

VMH

260

VSL

3650

VSH

S D

R100

282

⇨

R2000

260

R101

3530

R2001

3650

R102

1906

R2002

1955

R103

0

R2003

-34

R104

5000

R2004

5184

R105

-115

R2005

-154

Example 2

Mode 1 of linear conversion

Ladder diagram

ST

LCNV( EN:= M0, Md:= 1, S:= R100, Ts:= R1000, D=> R2000, L:= 3);

Description:

  • When M0 = 1, it will perform the mode 1 operation of linear conversion, where R100 is the starting address of the source data, R1000 is the starting address of the table of the conversion parameters VML, VMH, VSL, VSH, the quantity is 3, and R2000~R2002 will store the converted results.

FUN33 P

LCNV

Linear Conversion

(LCNV)

FUN33 P

LCNV

Ts

VML_0

VMH_0

VSL_0

VSH_0

VML_1

VMH_1

VSL_1

VSH_1

VML_2

VMH_2

VSL_2

VSH_2

R1000

R1001

R1002

R1003

R1004

R1005

R1006

R1007

R1008

R1009

R1010

R1011

282

3530

260

3650

-52

1208

-38

1101

235

4563

264

4588

S D

R100

282

⇨

R2000

260

R101

1208

R2001

1100

R102

2399

R2002

2426

FUN33 P

LCNV

Linear Conversion

(LCNV)

FUN33 P

LCNV

Example 3

Mode 2 of linear conversion

Ladder diagram

ST

LCNV( EN:= M0, Md:= 2, S:= R100, Ts:= R1000, D=> R2000, L:= 6);

Description:

When M0 = 1, it will perform the mode 2 operation of linear conversion, where R100 is the starting address of the source data, R1000 is the starting address of the table of the conversion parameters A, B, C, the quantity is 6, and R2000~R2005 will store the converted results.

FUN33 P

LCNV

Linear Conversion

(LCNV)

FUN33 P

LCNV

Ts

R1000

R1001

R1002

985

1000

20

S D

R100

1000

⇨

R2000

1005

R101

2345

R2001

2329

R102

3560

R2002

3526

R103

401

R2003

415

R104

568

R2004

579

R105

2680

R2005

2659

Example 4

Mode 3 of linear conversion

Ladder diagram

ST

LCNV( EN:= M0, Md:= 3, S:= R100, Ts:= R1000, D=> R2000, L:= 4);

Description:

  • When M0 = 1, it will perform the mode 3 operation of linear conversion, where R100 is the starting address of the source data, R1000 is the starting address of the table of the conversion parameters A, B, C, the quantity is 4, and R2000~R2003 will store the converted results.

FUN33 P

LCNV

Linear Conversion

(LCNV)

FUN33 P

LCNV

Ts

R1000

R1001

R1002

R1003

R1004

R1005

R1006

R1007

R1008

R1009

R1010

R1011

5000

16380

0

10000

16383

0

2200

16380

-200

1600

16383

-100

S D

R100

8192

⇨

R2000

2500

R101

16383

R2001

10000

R102

8190

R2002

900

R103

0

R2003

-100

7-1-6 Multiple Linear Conversion (MLC)

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

Symbol

C:\Users\User\Desktop\說明書翻譯\圖\MLC.png

Rs: Starting address of the source data

Sl: Quantity of source data, 1~64

Tx: Starting address of X table

Ty: Starting address of Y table

Tl: Quantity of table, 2~255

D: Starting address to store the result

Range

Operand

HR

IR

OR

SR

ROR

DR

K

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

Rs

○

○

○

○

○

○

Sl

○

○

○

○

○

○

1-64

Tx

○

○

○

○

○

Ty

○

○

○

○*

○

Tl

○

○

○

○

○

○

2-255

D

○

○

○

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

Description

  • When the analog input module being used for the analog measurement, the raw reading value of the analog input can be converted into the engineering range through this instruction for display or for proceeding control operation.
  • When using temperature or analog modules for temperature or analog measurement applications, if the temperature or engineering readings measured by the PLC deviate from the results measured by standard thermometers or related standard instruments, this command can be used to Make a linear correction as a correction for the actual measured value.
  • When execution control "EN"=1or from 0→1(P instruction), this instruction will perform the multiple linear conversion operation according to the selection of X/Y input; where Rs is the starting address of the source data, Sl is the quantity of source data for conversion, Tx is the starting address of X conversion parameter table, Ty is the starting address of Y conversion parameter table, Tl is the quantity of X/Y table, D is the starting address to store the converted result.
  • When executing and selection X/Y=0, it will compare the source data with the entities of Tx table to find the corresponding location in Tx table (The entities in Tx table must be in ascending sequence), and then calculate the linear conversion according to the located section of Tx and Ty table; When executing and selection X/Y=1, it will compare the source data with the entities of Ty table to find the corresponding location in Ty table (The entities in Ty table can either be in ascending or descending sequence), and then calculate the linear conversion according to the located section of Ty and Tx table.
  • When the source data is out of all entities of table, OVR=1.
  • It wouldn’t execute this instruction if illegal SI or Tl.

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

Expression:

The entities of Tx conversion parameter table must be in ascending sequence to have correct linear conversion; the entities of Ty conversion parameter table can either be in ascending or descending sequence. When executing this instruction, it will search the located section by comparing entities of the table with source data, and then calculate the linear conversion according to the following expression:

Vy = (Vx-Tx_n) × (Ty_n+1-Ty_n/Tx_n+1-Tx_n) + Ty_n if X/Y=0

Vx = (Vy-Ty_n) × (Tx_n+1-Tx_n/Ty_n+1-Ty_n) + Tx_n if X/Y=1

Value of Operand Vy、Vx、Tx_n、Tx_n+1、Ty_n、Ty_n+1 must be -32768~32767

Figure of multiple linear conversion:

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

Example 1

Ladder diagram

ST

MLC( EN:= M10,

XY:= M11,

Rs:= R0,

Sl:= R99,

Tx:= R1000,

Ty:= R2000,

Tl:= R199,

D:= D0,

OVR=> M100);

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

Description:

When M10=1、M11=0, R0 is the starting address of source data、R99 is the quantity of source data, R1000 is the starting address of Tx conversion parameter table, R2000 is the starting address of Ty conversion parameter table, R199 is the quantity of table; the source data R0~R5 will be calculated the linear conversion according to Tx and Ty table between four sections, then store the results into D0~D5.

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

Example 2

Ladder diagram

ST

MLC( EN:= M10,

XY:= M11,

Rs:= R0,

Sl:= R99,

Tx:= R1000,

Ty:= R2000,

Tl:= R199,

D:= D0,

OVR=> M100);

Description:

When M10=1, M11=0, take R0 as the starting source data and R99 as the source data length, according to the Tx conversion table starting from R1000 and the Ty conversion table starting from R2000, and R199 as the conversion table Length, perform 5-segment linear conversion operation on source data such as R0~R5, and store the conversion results in temporary registers D0~D5. In this example, when the value of the source data is less than or equal to 2000, the corresponding value is 280; when the value of the source data is greater than or equal to 8000, the corresponding value is 970.

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

Example 3

Ladder diagram

ST

MLC( EN:= M10,

XY:= M11,

Rs:= R0,

Sl:= R99,

Tx:= R1000,

Ty:= R2000,

Tl:= R199,

D:= D0,

OVR=> M100);

Description:

When M10=1, M11=0, R0 is the starting address of source data, R99 is the quantity of source data, R1000 is the starting address of Tx conversion parameter table, R2000 is the starting address of Ty conversion parameter table, R199 is the quantity of table; the source data R0~R5 will be calculated the linear conversion according to Tx and Ty table between three sections, then store the results into D0~D5. T In this example, when the value of the source data is -8000~8000, the corresponding value is -100~2000 according to the linear conversion shown in the figure below; when the value of the source data is ≧8000, the corresponding value is 2000; and the corresponding values ​​are all -100.

FUN34 P

MLC

Multiple Linear Conversion

(MLC)

FUN34 P

MLC

Example 4

Ladder diagram

ST

MLC( EN:= M10,

XY:= M11,

Rs:= R0,

Sl:= R99,

Tx:= R1000,

Ty:= R2000,

Tl:= R199,

D:= D0,

OVR=> M100);

Description:

When M10=1, M11=0, R0 is the starting address of source data, R99 is the quantity of source data, R1000 is the starting address of Tx conversion parameter table, R2000 is the starting address of Ty conversion parameter table, R199 is the quantity of table; the source data R0~R5 will be calculated the linear conversion according to Tx and Ty table between three sections, then store the results into D0~D5.T In this example, when the value of the source data is 3276~16000, the corresponding value is 0~5000 according to the linear conversion shown in the figure below; when the value of the source data is ≧16000, the corresponding value is 5000; all are 0.

7-2 Logical Operation Instructions (FUN35~36)

7-2-1 EXCLUSIVE OR (XOR)

FUN35 D P

XOR

EXCLUSIVE OR (XOR)

FUN35 D P

XOR

Symbol

Sa: Source data a for exclusive or operation

Sb: Source data b for exclusive or operation

D: Register storing XOR results

Sa, Sb, D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When operation control "EN" = 1 or changes from 0 to 1 (P instruction), will perform the logical XOR (exclusive or) operation of data Sa and Sb. The operation of this function is to compare the corresponding bits of Sa and Sb (B0~B15 or B0~B31), and if bits at the same position have different status, then set the corresponding bit within D as 1, otherwise as 0.
  • After the operation, if all the bits in D are all 0, then set the 0 flag "D = 0" to 1.

FUN35 D P

XOR

EXCLUSIVE OR (XR)

FUN35 D P

XOR

Example

Ladder diagram

ST

IF X0 THEN

R2 := R0 XOR R1 ;

END_IF

  • The instruction makes a logical XOR operation using the R0 and R1 registers, and stores the result in R2.

Sa

R0

1

0

1

1

1

0

1

1

0

1

1

0

1

1

0

1

Sb

R1

1

1

1

0

1

1

1

0

1

0

1

0

0

1

1

0

⇩X0=

D

R2

0

1

0

1

0

1

0

1

1

1

0

0

1

0

1

1

7-2-2 EXCLUSIVE NOR (XNR)

FUN36 D P

XNR

EXCLUSIVE NOR (XNR)

FUN36 D P

XNR

Symbol

Sa: Data a for XNR operation

Sb: Data b for XNR operation

D: Register storing XNR results

Sa, Sb, D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When operation control "EN" = 1 or changes from 0 to 1 (P instruction), will perform the logical XNR (inclusive or) operation of data Sa and Sb. The operation of this function is to compare the corresponding bits of Sa and Sb (B0~B15 or B1~B31), and if the bit has the same value, then set the corresponding bit within D as 1. If not then set it to 0.
  • After the operation, if the bits in D are all 0, then set the 0 flag "D=0" to 1.

FUN36 D P

XNR

EXCLUSIVE NOR (XNR)

FUN36 D P

XNR

Example

Ladder diagram

ST

IF X0 THEN

R2 := R0 XNOR R1 ;

END_IF

  • The instruction makes a logical XNR operation of the R0 and R1 registers, and the results are stored in the R2 register.

Sa

R0

1

0

1

1

1

0

1

1

0

1

1

0

1

1

0

1

Sb

R1

1

1

1

0

1

1

1

0

1

0

1

0

0

1

1

0

⇩X0=

D

R2

1

0

1

0

1

0

1

0

0

0

1

1

0

1

0

0

7-3 Comparison Instructions (FUN37)

7-3-1 ZONE COMPARE (ZNCMP)

FUN37 D P

ZNCMP

ZONE COMPARE

FUN37 D P

ZNCMP

Symbol

S: Register for zone comparison

SU: The upper limit value

SL: The lower limit value

S, SU, SL may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

SU

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

SL

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • When operation 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.
  • 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.

FUN37 D P

ZNCMP

ZONE COMPARE

FUN37 D P

ZNCMP

Example

  • The instruction compares the value of R0 with the upper and lower limit zones formed by R1 and R2. If the values of R0~R2 are as shown in the diagram at bottom left, then the result can then be obtained as shown in the diagram below.

If want to get the status of out side the zone, you can use OUT NOT Y0.

Ladder diagram

ST

S

R0

200

SU

R1

300

(Upper limit value)

SL

R2

100

(Lower limit value)

Before-execution

Y0

X0= 1

☞

Results of execution

7-4 Data Movement Instructions(FUN40~50)

7-4-1 BIT READ (BITRD)

FUN40 D P

BITRD

BIT READ

FUN40 D P

BITRD

Symbol

S: Source data to be read

N: The bit number of the S data to be read out

S, N may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM29104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○

○

○

○

○

0-31

○

Description

  • When read control "EN" = 1 or changes from 0 to 1 (P instruction), take the Nth bit of the S data out, and put it to the output bit "OTB".
  • When the operand is 16-bit, the effective range for N is 0~15. For 32-bit operand (D instruction) it is 0~31. N beyond this range will set the N value error flag "ERR" to 1, and do not carry out this instruction.

FUN40 D P

BITRD

BIT READ

FUN40 D P

BITRD

Example

Ladder diagram

ST

  • The instruction reads the 7th bit (X7) status from WX0 (X0~X15) and output to Y0. The results are as follows:

X15 X7 X0

S

WX0

1

1

0

0

1

1

1

0

1

0

0

1

1

0

0

1

N=7───────────── ⇩X50=

Y0

1

7-4-2 BIT WRITE (BITWR)

FUN41 D P

BITWR

BIT WRITE

FUN41 D P

BITWR

Symbol

D: Register for bit write

N: The bit number of the D register to be written.

D, N may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

0

∣

31

V, Z

P0 ~ P9

D

○

○

○

○

○

○

○

○

○

○*

○*

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • When write control "EN" = 1 or changes from 0 to 1 (P instruction), will write the write bit (INB) into the Nth bit of register D.

FUN41 D P

BITWR

BIT WRITE

FUN41 D P

BITWR

  • When the operand is 16-bit, the effective range of N is 0~15. For 32-bit (D instruction) operand it is 0~31. N beyond this range, will set the N value error flag "ERR" to 1, and do not carry out this instruction.
  • The instruction writes the status of the write bit INB into B3 of R0. Assuming X1 = 1, the result will be as follows:

Ladder diagram

ST

7-4-3 BIT MOVE (BITMV)

FUN42 D P

BITMV

BIT MOVE

FUN42 D P

BITMV

Symbol

S: Source data to be moved

Ns: Assign Ns bit within S as source bit

D: Destination register to be moved

Nd: Assign Nd bit within D as target bit

S, Ns, D, Nd may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Ns

○

○

○

○

○

○

○

○

○

○

○

○

○

0-31

○

D

○

○

○

○

○

○

○

○

○*

○*

○

○

Nd

○

○

○

○

○

○

○

○

○

○

○

○

○

0-31

○

Description

  • When move control "EN" = 1 or changes from 0 to 1 (P instruction), will move the bit status specified by Ns within S into the bit specified by Nd within D.
  • When the operand is 16-bit, the effective range of N is 0~15. For 32-bit (D instruction) operand the effective range is 0~31. N beyond this range will set the N value error flag "ERR" to 1, and do not carry out this instruction.

FUN42 D P

BITMV

BIT MOVE

FUN42 D P

BITMV

Example

Ladder diagram

ST

  • The instruction at left moves the status of B11 (X11) within S into the B7 position within D. Except bit B7, other bits within D does not change.

X15 X11 X0

S

WX0

1

Ns=11───────

⇩X50=

Nd=7 ───────────

D

R0

1

B15 B7 B0

7-4-4 NIBBLE MOVE (NBMV)

FUN43 D P

NBMV

NIBBLE MOVE

FUN43 D P

NBMV

Symbol

S: Source data to be moved

Ns: Assign Ns nibble within S as source nibble

D: Destination register to be moved

Nd: Assign Nd nibble within D as target nibble

S, Ns, D, Nd may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Ns

○

○

○

○

○

○

○

○

○

○

○

○

○

0-7

○

D

○

○

○

○

○

○

○

○

○

○*

○*

○

○

Nd

○

○

○

○

○

○

○

○

○

○

○

○

○

0-7

○

Description

  • When move control "EN" = 1 or has a transition from 0 to 1 (P instruction), will move the Ns’th nibble from within S to the nibble specified by Nd within D. (A nibble is comprised by 4 bits. Starting from the lowest bit of the register, B0, each successive 4 bits form a nibble, so B0~B3 form nibble 0, B4~B7 form nibble 1, etc…)
  • When the operand is 16-bit, the effective range of Ns or Nd is 0~3. For 32-bit (D instruction) operand the range is 0~7. Beyond this range, will set the N value error flag "ERR" to 1 , and do not carry out this instruction.

FUN43 D P

NBMV

NIBBLE MOVE

FUN43 D P

NBMV

Example

Ladder diagram

ST

  • The instruction moves the third nibble NB2 (B8~B11) within S to the first nibble NB1 (B4~B7) within D. Other nibbles within D remain unchanged.

B15 B0

S

R0

1

1

0

1

NB3 NB2 NB1 NB0

Ns=2 ───────

⇩X0=

Nd=1 ─────────

NB3 NB2 NB1 NB0

D

R1

1

1

0

1

B15 B0

7-4-5 BYTE MOVE (BYMV)

FUN44 D P

BYMV

BYTE MOVE

FUN44 D P

BYMV

Symbol

S: Source data to be moved

Ns: Assign Ns byte within S as source byte

D: Destination register to be moved

Nd: Assign Nd byte within D as target byte

S, Ns, D, Nd may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Ns

○

○

○

○

○

○

○

○

○

○

○

○

○

0-3

○

D

○

○

○

○

○

○

○

○

○

○*

○*

○

○

Nd

○

○

○

○

○

○

○

○

○

○

○

○

○

0-3

○

Description

  • When move control "EN" = 1 or has a transition from 0 to 1 ( P instruction), move Nsth byte within S to Ndth byte position within D. (A byte is comprised of 8 bits. Starting from the lowest bit of the register, B0, each successive eight bits form a byte, so B0~B7 form byte 0, B8~B15 form byte 1, etc…)
  • When the operand is 16 bit, the effective range of Ns or Nd is 0~1. For 32 bit ( D instruction) operand, the range is 0~3. Beyond this range, will set the N value error flag "ERR" to 1, and do not carry out this instruction.

FUN44 D P

BYMV

BYTE MOVE

FUN44 D P

BYMV

Example

Ladder diagram

ST

  • The instruction moves the third byte (B16~B23) within S (32 bit register composed of R1R0), to the first byte within D (32 bit register composed of R3R2). Other bytes within D remain unchanged.

B31 B0

S

DR0

1

0

1

1

1

0

1

1

Byte3 Byte2 Byte1 Byte0

Ns=2─────────────

⇩X0=

Nd=1─────────────────────

Byte3 Byte2 Byte1 Byte0

D

DR2

1

0

1

1

1

0

1

1

B31 B0

7-4-6 EXCHANGE (XCHG)

FUN45 D P

XCHG

EXCHANGE

FUN45 D P

XCHG

Symbol

Da: Register a to be exchanged

Db: Register b to be exchanged

Da, Db may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WY

WM

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

XR

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

V, Z

P0 ~ P9

Da

○

○

○

○

○

○

○

○

○

○*

○*

○

○

Db

○

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When exchange control "EN" = 1 or has a transition from 0 to 1 (P instruction), will exchanges the contents of register Da and register Db in 16 bits or 32 bits (D instruction) format.

Example

Ladder diagram

ST

The instruction exchanges the contents of the 16-bit R0 and R1 registers.

FUN45 D P

XCHG

EXCHANGE

FUN45 D P

XCHG

B15 B0

Da

R0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Db

R1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

⇩X0=

B15 B0

Da

R0

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

Db

R1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

7-4-7 BYTE SWAP (SWAP)

FUN46 P

SWAP

BYTE SWAP

FUN46 P

SWAP

Symbol

D: Register for byte data swap

D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WY

WM

WSM

WS

TMR

CTR

HR

OR

SR

ROR

DR

XR

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

V, Z

P0 ~ P9

D

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

B15

B8 B7

B0

Byte 1(high)

Byte 0(low)

FUN46 P

SWAP

BYTE SWAP

FUN46 P

SWAP

Example

Ladder diagram

ST

IF X0 THEN

SWAP( D:= R0);

END_IF

The instruction swaps the data of the low byte (B0~B7) and the high byte (B8~B15) in R0. The results are as follows:

Byte1 Byte0

D

R0

0

0

1

1

0

0

1

1

1

1

1

1

0

0

0

0

B15 B8 B7 B0

⇩X0=

B15 │ B0

D

R0

1

1

1

1

0

0

0

0

0

0

1

1

0

0

1

1

7-5 Shifting/Rotating Instructions (FUN51~54)

7-5-1 SHIFT LEFT (SHFL)

FUN51 D P

SHFL

SHIFT LEFT

FUN51 D P

SHFL

Symbol

D: Register to be shifted

N: Number of bits to be shifted

N, D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

0 0

∣ or ∣

16 32

V, Z

P0 ~ P9

D

○

○

○

○

○

○

○

○

○

○*

○*

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • When shift control "EN" = 1 or has a transition from 0 to 1 (P instruction), will shift the data of the D register towards the left by N successive bits (in ascending order). After the lowest bit B0 has been shifted left, its position will be replaced by shift-in bit INB, while the status of shift-out bits B15 or B31 (D instruction) will appear at shift-out bit "OTB".
  • If the operand is 16 bits, the effective range of N is 1~16. For 32 bits (D instruction) operand, it is 1~32. Beyond this range, will set the N value error flag "ERR" to 1, and do not carry out this instruction.

FUN51 D P

SHFL

SHIFT LEFT

FUN51 D P

SHFL

Example

Ladder diagram

ST

  • The instruction shifts the data in register R0 towards the left by 4 successive bits. The results are shown below.

Y0 B15 R0 B0 INB

←

0

0

1

1

0

0

1

0

1

1

1

1

0

0

0

0

←

1

*

△

⇩X0=

Y0 B15 R0 B0 INB

1

0

0

1

0

1

1

1

1

0

0

0

0

1

1

1

1

1

*

△

△

△

△

△

7-5-2 SHIFT RIGHT (SHFR)

FUN52 D P

SHFR

SHIFT RIGHT

FUN52 D P

SHFR

Symbol

D: Register to be shifted

N: Number of bits to be shifted

D, N may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

0 0

∣ or ∣

16 32

V, Z

P0 ~ P9

D

○

○

○

○

○

○

○

○

○

○*

○*

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • When shift control "EN" = 1 or has a transition from 0 to 1 (P instruction), will shift the data of D register towards the right by N successive bits (in descending order). After the highest bits, B15 or B31 (D instruction) have been shifted right, their positions will be replaced by the shift-in bit INB, while shift-out bit B0 will appear at shift-out bit "OTB".
  • If the operand is 16 bits, the effective range of N is 1~16. For 32 bits (D instruction) operand, it is 1~32. Beyond this range, will set the N value error flag "ERR" to 1, and do not carry out this instruction.

FUN52 D P

SHFR

SHIFT RIGHT

FUN52 D P

SHFR

Example

Ladder diagram

ST

  • The instruction at left shifts the data in R0 register towards the right by 15 successive bits. The results are shown below.

INB B15 R0 B0 Y0

0

→

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

→

△

*

⇩X0=

INB B15 R0 B0 Y0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

△

△

△

△

△

△

△

△

△

△

△

△

△

△

△

△

*

7-5-3 ROTATE LEFT (ROTL)

FUN53 D P

ROTL

ROTATE LEFT

FUN53 D P

ROTL

Symbol

D: Register to be rotated

N: Number of bits to be rotated

D, N may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

0 0

∣ or ∣

16 32

V, Z

P0 ~ P9

D

○

○

○

○

○

○

○

○

○

○*

○*

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • When rotate control "EN" = 1 or has a transition from 0 to 1 (P instruction), will rotate the data of D register towards the left by N successive bits (in ascending order, ie. in a 16-bit instruction, B0→B1, B1→B2, …., B14→B15, B15→B0. In a 32-bit instruction, B0→B1, B1→B2, …., B30→B31, B31→B0). At the same time, the status of the rotated out bits B15 or B31 (D instruction) will appear at rotate-out bit "OTB".
  • If the operand is 16 bits, the effective range of N is 1~16. For 32 bits (D instruction) operand, it is 1~32. Beyond this range, will set the N value error flag "ERR" to 1, and do not carry out this instruction.

FUN53 D P

ROTL

ROTATE LEFT

FUN53 D P

ROTL

Example

Ladder diagram

ST

  • The instruction rotates data from the R0 register towards the left 9 successive bits. The results are shown below.

R0 B0

1

1

1

1

0

0

0

0

1

0

1

0

1

0

1

0

*

Y0

⇩X0=

B15 R0 B0

0

1

0

1

0

1

0

1

1

1

1

0

0

0

0

1

*

1

Y0

*

7-5-4 ROTATE RIGHT (ROTR)

FUN54 D P

ROTR

ROTATE RIGHT

FUN54 D P

ROTR

Symbol

D: Register to be rotated

N: Number of bits to be rotated

D, N may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

0 0

∣ or ∣

16 32

V, Z

P0 ~ P9

D

○

○

○

○

○

○

○

○

○

○*

○*

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • When rotate control "EN" = 1 or has a transition from 0 to 1(P instruction), will rotate the bit data of D register towards the right by N successive bits (in descending order, ie. in a 16-bit instruction, B15→B14, B14→B13, …., B1→B0, B0→B15. In a 32-bit instruction, B31→B30, B30→B29, …., B1→B0, B0→B31). At the same time, the status of the rotated out B0 bits will appear at the rotate-out bit "OTB".
  • If the operand is 16 bits, the effective range of N is 1~16. For 32 bits (D instruction) operand, it is 1~32. Beyond this range, will set the N value error flag "ERR" to 1, and do not carry out this instruction.

FUN54 D P

ROTR

ROTATE RIGHT

FUN54 D P

ROTR

Example

Ladder diagram

ST

  • The instruction rotates data from R0 register towards the right 8 successive bits. The results are shown below.

B15 R0 B0

1

1

1

1

0

0

0

0

1

0

1

0

1

0

1

0

*

Y0

⇩X0=

B15 R0 B0

1

0

1

0

1

0

1

0

1

1

1

1

0

0

0

0

*

Y0

1

*

7-6 Code Conversion Instructions (FUN55~64)

7-6-1 INARY-CODE TO GRAY-CODE CONVERSION (B→G)

FUN55 D P

B→G

BINARY-CODE TO GRAY-CODE CONVERSION

FUN55 D P

B→G

Symbol

S: Starting of source

D: Starting addr ess of destination

S, D operand can combine V, Z, P0~P9 for index addressing

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○*

○

○

Description

  • When the execution control "EN"=1 or from 0→1 (P instruction), convert the binary code of the S register to Gray code.
  • When the conversion bit is less than 16 bits, a temporary register is needed to store the conversion result. When it is greater than or equal to 16 bits, two registers are required (D instruction).
  • The conversion method shown as below

FUN55 D P

B→G

BINARY-CODE TO GRAY-CODE CONVERSION

FUN55 D P

B→G

Example1

When M0 is from OFF→ON, convert R0 (binary code) into Gray code, and then store it in R100.

Ladder diagram

ST

IF R_TRIG( S:= M0 ) THEN

BintoGray( S:= R0, D:= R100);

END_IF

R0=1001010101010011B 🡺 R100=1101111111111010B

Example2

When M0 =1, it will perform the 32-bit code conversion

When M0 is ON, convert DR0 (binary code) to Gray code, and then store it in DR100.

Ladder diagram

ST

IF R_TRIG( S:= M0 ) THEN

BintoGray( S:= DR0, D:= DR100);

END_IF

DR0=00110111001001000010111100010100B 🡺 DR100=00101100101101100011100010011110B

7-6-2 GRAY-CODE TO BINARY-CODE CONVERSION (G→B)

FUN56 D P

G→B

GRAY-CODE TO BINARY-CODE CONVERSION

FUN56 D P

G→B

Symbol

S: Starting of source

D: Starting address of destination

S, D operand can combine V, Z, P0~P9 for index addressing

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○*

○

○

Description

  • When the execution control "EN"=1 or from 0→1 (P instruction), convert the binary code of the S register to Gray code.
  • When the conversion bit is less than 16 bits, a temporary register is needed to store the conversion result. When it is greater than or equal to 16 bits, two registers are required (D instruction).
  • The conversion method shown as below:

FUN56 D P

G→B

GRAY-CODE TO BINARY-CODE CONVERSION

FUN56 D P

G→B

Example1

  • When M0 is from OFF→ON, convert D0 (binary code) into Gray code, and then store it in D100.

Ladder diagram

ST

IF R_TRIG( S:= M0 ) THEN

GraytoBin( S:= D0, D:= D100);

END_IF

D0=1001010101010011B 🡺D100=1110011001100010B

Example2

When M0 =1, it will perform the 32-bit code conversion

When M0 is ON, convert DD0 (binary code) to Gray code, and then store it in DD100

Ladder diagram

ST

IF R_TRIG( S:= M0 ) THEN

GraytoBin_D( S:= D0, D:= D100);

END_IF

DD0=00110111001001000010111100010100B 🡺 DD100=00100101110001111100101000011000B

7-6-3 DECODE (DECOD)

FUN57 P

DECOD

DECODE

FUN57 P

DECOD

Symbol

S : Source data register to be decoded (16 bits)

NS : Starting bits to be decoded within S

NL : Length of decoded value (1~8 bits)

D : Starting register storing decoded results (2~256 points = 1~16 words)

S, NS, NL, D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Ns

○

○

○

○

○

○

○

○

○

○

○

○

○

0-15

○

Nl

○

○

○

○

○

○

○

○

○

○

○

○

○

1-8

○

D

○

○

○

○

○

○

○

○

○

○

○*

○

○

Description

  • This instruction, will set a single bit among the total of 2NL discrete points (D) to 1 and the others bit are set to 0. The bit number to be set to 1 is specified by the value comprised by BNS~BNS+NL−1 of S(which is called the decode value, BNS is the starting bit of the decode value, and BNS+NL−1 is the end value).
  • When decode control "EN" = 1 or has a transition from 0 to 1 ( P instruction), will take out the value BNS~ BNS+NL−1 from S. And with this value to locate the bit position and set D accordingly, and set all the other bit to zero.
  • This instruction only provides 16 bit operand, which means S only has B0~B15. Therefore the effective range of Ns is 0~15, and the NL length of the decode value is limited to 1~8 bits. Therefore the width of the decoded result D is 21~8 points = 2~256 points = 1~16 words (if 16 points are not sufficient, 1 word is still occupied). If the value of NS or NL is beyond the above range, will set the range-error flag "ERR" to 1, and do not carry out this instruction.
  • If the end bit value exceeds the B15 of S, then will extend toward B0 of S + 1. However if this occurs then S+1 can’t exceed the range of specific type of operand (ie. If S is of D type register then S+1 can’t be D3072). If violate this, then this instruction only takes out the bits from starting bit BNs to its highest limit as the decode value.

7-6-4 ENCODE (ENCOD)

FUN58 P

ENCOD

ENCODE

FUN58 P

ENCOD

Symbol

S : Starting register to be encoded

NS : Bit position within S as the encoding start point

NL : Number of encoding discrete points (2~256)

D : Number of register storing encoding results (1 word) S, NS, NL, D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Ns

○

○

○

○

○

○

○

○

○

○

○

○

○

0-15

○

Nl

○

○

○

○

○

○

○

○

○

○

○

○

○

1-8

○

D

○

○

○

○

○

○

○

○

○

○

○*

○

○

Description

  • When encode control "EN" = 1 or has a transition from 0 to 1 ( P instruction), will starting from the points specified by Ns within S, take out towards the left (high position direction) NL number of successive bits BNS~ BNS+NL−1 (BNS is called the encoding start point, and its relative bit number is b0;BNS+NL−1 is called the encoding end point, and its relative bit number is BNL-1). From left to right do higher priority (when H/L=1) encoding or from right to left do lower priority (when H/L=0) encoding (i.e. seek the first bit with the value of 1, and the relative bit number of this point will be stored into the low byte (B0~B7) of encoded resultant register D, and the high byte of D will be filled with 0.

FUN58 P

ENCOD

ENCODE

FUN58 P

ENCOD

Description

  • As shown in the diagram above, for high priority encoding, the bit first to find is bH (with a value of 12), and for low priority encoding, the bit first to find bL (with a value of 4). Among the NL discrete points there must be at least one bit with value of 1. If all bits are 0, will not to carry out this instruction, and the all zero flag "D=0" will set to 1.
  • Because S is a 16-bit register, Ns can be 0~15, and is used to assign a point of B0~B15 within S as the encoding start point (b0). The value of NL can be 2~256, and it is used to identify the encoding end point, i.e. it assigns NL successive single points starting from the start point (b0) towards the left (high position direction) as the encoding zone (i.e. b0~bNL−1). If the value of Ns or NL exceeds the above value, then do not carry out this instruction, and set the range-error flag "ERR" as 1.
  • If the encoding end point (bNL−1) beyond the B15 of S, then continue extending towards S+1, S+2, but it must not exceed the range of specific type of operand. If it goes beyond this, then this instruction can only take the discrete points between b0 and the highest limit into account for encoding.

7-6-5 HOUR:MINUTE:SECOND→SECOND

FUN61 P

→SEC

HOUR:MINUTE:SECOND→SECOND

FUN61 P

→SEC

Symbol

S: Starting calendar data register to be converted

D: Starting register storing results

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

S

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○

○*

○*

○

FUN61 P

→SEC

HOUR:MINUTE:SECOND→SECOND

FUN61 P

→SEC

Description

  • When conversion control "EN" = 1 or has a transition from 0 to 1 ( P instruction), will convert the hour: minute: second data of S~S+2 into an equivalent value in seconds and store it into the 32-bit register formed by combining D and D+1. If the result = 0, then set the "D = 0" flag as 1.
  • Among the Fatek-PLC instructions, the hour: minute: second time related instructions (FUN61 and 62) use 3 words of register to store the time data, as shown in the diagram below. The first word is the second register, the second word is the minute register, and finally the third word is the hour register, and in the 16 bits of each register, only B14~B0 are used to represent the time value. While bit B15 is used to express whether the time values are positive or negative. When B15 is 0, it represents a positive time value, and when B15 is 1 it represents a negative time value. The B14~B0 time value is represented in binary, and when the time value is negative, B14~B0 is represented with the 2’s complement. The number of seconds that results from this operation is the result of summation of seconds from the three registers representing [hour: minute: second].

B15 B14 B0 B15B0

S (sec)

-32768 sec~32767 sec

⇨

D

the sec. value.

S+1 (min)

-32768 min~32767 min

D+1

S+2 (hr)

-32768 hr~32767 hr

B31

B30

B16

↑B31 is used to represent the positive or

The B15 of each register is used to represent the sign of each time value negative nature of the sec. value

  • Any [hour: minute: second] time data will be automatically merged and used except when accessing with FUN61 or 62 instructions. Other instructions will regard it as an individual general register and will not be automatically merged and used, there is no relationship between the 3 registers, so you can operate on any data of hours, minutes, and seconds separately, and the results will not affect each other.

FUN61 P

→SEC

HOUR:MINUTE:SECOND→SECOND

FUN61 P

→SEC

Example

  • The example program at below converts the hour: minute: second data formed by R20~R22 into their equivalent value in seconds then stored in the 32-bit register formed by R50~R51. The results are shown below:

Ladder diagram

ST

IF R_TRIG( S:= X0 ) THEN

ToSEC( S:= R20, D:=R50 );

END_IF

R20

0E11H

=3601sec

S

R21

FD2FH

=-721min

R22

03F3H

=1011hr

⇩X0=

D

R50

EE45H

=3599941sec

R51

0036H

7-6-6 SECOND→HOUR:MINUTE:SECOND

FUN62 P

→HMS

SECOND→HOUR:MINUTE:SECOND

FUN62 P

→HMS

Symbol

S: Starting register of second to be converted

D: Starting register storing result of conversion (hour : minute : second)

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

-117968399

–

117964799

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○

○*

○*

○

FUN62 P

→HMS

SECOND→HOUR:MINUTE:SECOND

FUN62 P

→HMS

Description

  • When conversion control "EN" = 1 or has a transition from 0 to 1 ( P instruction), will convert the second data from the S~S+1 32-bit register into the equivalent hour : minute : second time value and store it in the three successive registers D~D+2. All the data in this instruction is represented in binary (if there is a negative value it is represented using the 2’s complement.)

S

Second

⇨

D  (sec)

-59 sec~59 sec

S+1

D+1 (min)

-59 min~59 min

B31

B16

D+2 (hr)

-32768 hr~32767 hr

↑

The bit B31 of the second register is used as the sign
bit of the second value.

↑

The bits B15 of each register are used as the sign bit of the hour : minute : second value.

  • As shown in the diagram above, after convert to hour : minute : second value, the minute : second value can only be in the range of -59 to 59, and the hour number can be in the range of -32768 to 32767 hours. Because of this, the maximum limit of D is -32768 hours, -59 minutes, -59 seconds to 32767 hours, 59 minutes, 59 seconds, the corresponding second value of S which is in the range of -117968399 to 117964799 seconds. If the S value exceeds this range, this instruction cannot be carried out, and will set the over range flag "OVR" to 1. If S = 0 then result is 0 flag "D = 0" will be set to 1.

FUN62 P

→HMS

SECOND→HOUR:MINUTE:SECOND

FUN62 P

→HMS

Example

  • The program in the diagram below is an example of this instruction. Please note that the contents of the registers are denoted by hexadecimal, and on the right is its equivalent value in decimal notation.

R0

5D17H

6315287sec

R1

0060H

⇩X0=

R10

002FH

47sec

R11

000EH

14min

R12

06DAH

1754hr

Ladder diagram

ST

IF R_TRIG( S:= X0 ) THEN

ToHMS( S:= R0, D:=R10 );

END_IF

7-6-7 CONVERSION OF ASCII CODE TO HEXADECIMAL VALUE (ASCII→HEX)

FUN63 P

→HEX

CONVERSION OF ASCII CODE TO HEXADECIMAL VALUE

FUN63 P

→HEX

Symbol

S: Starting source register.

N: Number of ASCII codes to be converted to hexadecimal values.

D: The starting register that stores the result (hexadecimal value).

S, N, D, can associate with V, Z, P0~P9 to do the indirect addressing application.

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D11999

16/32-bit
+number

V、Z

P0~P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

1~511

○

D

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When conversion control “EN” =1 or changes from 0→1 (P instruction), it will convert the N successive hexadecimal ASCII character(‘0’~’9’,’A’~’F’) convey by 16-bit registers (Low Byte is effective) into hexadecimal value, and store the result into the register starting with D. Every 4 ASCII code is stored in one register. The nibbles of register, which does not involve in the conversion of ASCII code will remain unchanged.
  • The conversion will not be performed when N is 0 or greater than 511.
  • When there is ASCII error (neither 30H~39H nor 41H~46H), the output “ERR” is ON.
  • The main purpose of this command is to convert the ASCII numbers received by communication ports 1~2 from the external ASCII peripherals (transmitting values ​​to the PLC in ASCII codes) into hexadecimal values ​​that can be directly processed by the CPU.

FUN63 P

→HEX

CONVERSION OF ASCII CODE TO HEXADECIMAL VALUE

FUN63 P

→HEX

Example1

When M1 from OFF→ON, ASCII code converted to hexadecimal value.

  • When M1 is from OFF→ON, convert ASCII code to hexadecimal value
  • Convert the ASCII code of R0 to hexadecimal value and store it in Nibble 0 of R100 (Nibble1~Nibble3 remain unchanged)

Ladder diagram

ST

IF R_TRIG( S:= M1 ) THEN

ToHEX( S:= R0, N:= 1, D:= R100);

END_IF

Originally R100=0000H

R0=0039H(9)🡺 R100=0009H

Example2

When M1 is ON, ASCII code converted to hexadecimal value.

  • When M1 is ON, convert ASCII code to hexadecimal value
  • Convert the ASCII codes of R0 and R1 into hexadecimal values ​​and store them in the low bytes of R100 (the high bytes remain unchanged)

Ladder diagram

ST

IF M1 THEN

ToHEX( S:= R0, N:= 2, D:= R100);

END_IF

R0=0039H(9) Originally R100=0000H

R1=0041H(A)🡺 R100=009AH

Example3

  • When M1 is ON, convert ASCII code to hexadecimal value
  • Convert the ASCII codes of R0~R2 into hexadecimal values ​​and store them in R100 (Nibble 3 remains unchanged)

Ladder diagram

ST

IF M1 THEN

ToHEX( S:= R0, N:= 3, D:= R100);

END_IF

R0=0039H (9) Originally R100=0000H

R1=0041H (A)

R2=0045H (E)🡺 R100=09AEH

Example4

When M1 is ON, ASCII code converted to hexadecimal value

  • When M1 is ON, convert ASCII code to hexadecimal value
  • Convert the ASCII codes of R0~R5 into hexadecimal values ​​and store them in R100~R101

Ladder diagram

ST

IF M1 THEN

ToHEX( S:= R0, N:= 6, D:= R100);

END_IF

R0=0031H(1) Originally R100=0000H

R1=0032H(2) R101=0000H

R2=0033H(3)

R3=0034H(4)

R4=0035H(5)🡺 R100=3456H

R5=0036H(6) R101=0012H

7-6-8 CONVERSION OF HEXADECIMAL VALUE TO ASCII CODE (HEX→ASCII)

FUN64 P

→ASCII

CONVERSION OF HEXADECIMAL VALUE TO ASCII CODE

FUN64 P

→ASCII

Symbol

S: Starting source register

N: Number of hexadecimal digits to be converted to ASCII code.

D: The starting register storing result.

S, N, D, can associate with V, Z, P0~P9 to do the indirect addressing application.

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D11999

16-bit
+number

V、Z

P0~P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

○

N

○

○

○

○

○

○

○

○

○

○

○

○

○

1~511

○

D

○

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • When conversion control “EN” =1 or changes from 0→1 (P instruction), will convert the N successive nibbles of hexadecimal value in registers start from S into ASCII code, and store the result to low byte (high byte remain unchanged) of the registers which start from D.
  • The conversion will not be performed when the value of N is 0 or greater than 511.
  • The main purpose of this instruction is to convert the numerical value data, which PLC has processed, to ASCII code and transmit to ASCII peripherals by communication port1 or communication port 2.

FUN64 P

→ASCII

CONVERSION OF HEXADECIMAL VALUE TO ASCII CODE

FUN64 P

→ASCII

Example1

  • When M1 is from OFF→ON, the converted hexadecimal value is ASCII code
  • Convert the Nibble 0 of R0 to ASCII code and store it in R100 (the high byte remains unchanged).

Ladder diagram

ST

IF R_TRIG( S:= M1 ) THEN

ToASCII ( S:= R0, N:= 1, D:= R100);

END_IF

R0=0009H 🡺 R100=0039H(9)

Example2

When M1 is ON, it converts hexadecimal value to ASCII code.

  • When M1 is ON, convert the hexadecimal value to ASCII code
  • Convert NB0~NB1 of R0 into ASCII codes and store them in R100~R101 (the high byte remains unchanged).

Ladder diagram

ST

IF M1 THEN

ToASCII ( S:= R0, N:= 2, D:= R100);

END_IF

R0=009AH 🡺 R100=0039H(9)

R101=0041H(A)

FUN64 P

→ASCII

CONVERSION OF HEXADECIMAL VALUE TO ASCII CODE

FUN64 P

→ASCII

Example3

When M1 is ON, it converts hexadecimal value to ASCII code.

  • When M1 is ON, convert the hexadecimal value to ASCII code
  • Convert NB0~NB2 of R0 into ASCII codes and store them in R100~R102

Ladder diagram

ST

IF M1 THEN

ToASCII ( S:= R0, N:= 3, D:= R100);

END_IF

R0=0123H 🡺 R100=0031H(1)

R101=0032H(2)

R102=0033H(3)

FUN64 P

→ASCII

CONVERSION OF HEXADECIMAL VALUE TO ASCII CODE

FUN64 P

→ASCII

Example4

When M1 is ON, it converts hexadecimal value to ASCII code.

  • When M1 is ON, convert the hexadecimal value to ASCII code
  • Convert NB0~NB5 of R0~R1 to ASCII code and store in R100~R105

Ladder diagram

ST

IF M1 THEN

ToASCII ( S:= R0, N:= 6, D:= R100);

END_IF

R0=3456H 🡺 R100=0031H(1)

R1=0012H R101=0032H(2)

R102=0033H(3)

R103=0034H(4)

R104=0035H(5)

R105=0036H(6)

7-7 Flow Control Instructions II (FUN22、FUN65~71)

7-7-1 Break

FUN22 P

BREAK

BREAK FROM FOR AND NEXT LOOP

(BREAK)

FUN22 P

BREAK

Symbol

Description

  • When execution control “EN” = 1 or changes from 0→1 (P instruction), 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.

FUN22 P

BREAK

BREAK FROM FOR AND NEXT LOOP

(BREAK)

FUN22 P

BREAK

Example

Ladder diagram

ST

V := 0;

FOR D10 := 0 TO 10 BY 1 DO

IF D100 = R0V THEN

M200 := TRUE;

END_IF

IF M200 THEN

BREAK;

END_IF

V := V + 1;

END_FOR

D1000 := V;

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 D100 is the pointer of searching.

7-7-2 LABEL (LBL)

FUN65

LBL

LABEL

FUN65

LBL

Symbol

S: Alphanumeric, 1~6 characters

Range

Operand

K

0~9 , A~Z ; + , –

LN

○

Description

※Only supported in the main program and subroutine

  • This instruction is used to make a tag on certain address within a program, to provide a target address for execution of JUMP, CALL instruction and interrupt service. It also can be used for document purpose to improve the readability and interpretability of the program.
  • This instruction serves only as the program address marking to provide the control of procedure flow or for remark. The instruction itself will not perform any actions; whether the program contains this instruction or not, the result of program execution will not be influenced by this instruction.
  • The label name can be formed by any 1~6 alphanumeric characters and can’t be duplicate in the same program. The following label names are reserved for interrupt function usage. These “reserved words” can’t be used for normal program labels.

FUN65

LBL

LABEL

FUN65

LBL

Reserved words

Interrupt

X0+I~X15+I (INT0~INT15)

X16+I~X23+I(INT16~INT23)

X0−I~X15−I (INT0−~INT15−)

X16−I~X23−I (INT16−~INT23−)

Interrupt service program name of X0~X15, X16~X23

HSC0I~HSC3I

Interrupt service routine name of HSC0~HSC3

STM0I (1MS), STM1I (1MS), STM2I (1MS), STM3I (1MS), LTM0I (10MS), LTM1I (10MS), LTM2I (10MS), LTM3I (10MS)

1mS, 10mS, 2 kinds of timer interrupt service program name in PLC

HST0I~HST3I

Label for high-speed fixed timer interrupt service routine.

In units of 0.1mS

Unless the program you marked is indeed the service program corresponding to the above interrupt, the above name can be used, and it cannot be used elsewhere. Otherwise, when an interrupt occurs, the PLC will execute the general program you marked as an interrupt program, resulting in errors or crash.

FUN65

LBL

LABEL

FUN65

LBL

Example

The label of following diagram illustration served only as program remarks (it is not treated as a label for call or jump target). For the application of labeling in jump control, please refer to JMP instruction for explanation. As to the labeling serves as subroutine names, please refer to CALL instruction for details.

Ladder diagram

ST

D:\patrick\說明書翻譯\圖\圖片1.png

LBL ( PGM1)

Program 1

LBL ( PGM2)

Program 2

7-7-3 JUMP (JMP)

FUN66 P

JMP

JUMP

FUN66 P

JMP

Symbol

LBL: The program label to be jumped

Range

Operand

K

0~9 , A~Z ; + , –

LB

○

Description

  • When jump control “EN” = 1 or changes from 0→1 (P instruction), PLC will jump to the location behind the marked label and continuous to execute the program.
  • This instruction is especially suit for the applications where some part of the program will be executed only under certain condition. This can shorter the scan time while not executes the whole program. And also, can use this instruction in the application of multiple coil outputs, the input control is used to select the application of executing a certain program.
  • This instruction allows jump backward (i.e., the address of LBL is comes before the address of JMP instruction). However, care should be taken if the jump action causes the scan time exceed the limit set by the watchdog timer, the WDT interrupt will be occurred and stop executing.
  • The jump instruction allows only for jumping among main program or jumping among subroutine area, it can’t jump across main/subroutine area.

FUN66 P

JMP

JUMP

FUN66 P

JMP

Example

Ladder diagram

ST

IF X0 THEN

GOTO(“PATHB”)

END_IF

Program A

LBL(“PATHB”)

Program B

In this diagram, when X0=1, the program will jump directly to the LBL position named PATHB and continuing to execute program B. Therefore, it will skip the program A and none of the instructions of program A will be executed. The status of registers and the coils associated with program A will keep unchanged (as if there is no program section A).

7-7-4 FUNCTION BLOCK LABEL

FUN165

FLBL

FUNCTION BLOCK LABEL

FUN165

FLBL

Symbol

S: English/ Digit 1~6

Range

Operand

K

0~9 , A~Z ; + , –

LN

○

Discription

※It only supported in the function block diagram.

  • This command labels a specific address in the program, so the program function block diagram jumps (FJUMP) to the address where the label is located for execution. If there is no need for flow control, such as jumping or calling, it can also be labeled to annotate the program to facilitate program identification or improve readability.
  • This instruction is only used as a program address label for process control or annotation. The instruction itself will not perform any action. Whether there is this instruction in the program, the execution result will not be affected by it.
  • The label can consist of 1 to 6 non-repeating arbitrary English letters or numbers.

FUN165

FLBL

FUNCTION BLOCK LABEL

FUN165

FLBL

Reserved words

Discription

X0+I~X15+I (INT0~INT15)

X16+I~X23+I(INT16~INT23)

X0−I~X15−I (INT0−~INT15−)

X16−I~X23−I (INT16−~INT23−)

Interrupt service program name of X0~X15, X16~X23

HSC0I~HSC3I

Interrupt service routine name of HSC0~HSC3

STM0I (1MS), STM1I (1MS), STM2I (1MS), STM3I (1MS), LTM0I (10MS), LTM1I (10MS), LTM2I (10MS), LTM3I (10MS)

Labels for 1ms, 10ms PLC internal timer interrupt service routine

HST0I~HST3I

Labels for high-speed fixed timer interrupt service routine

In units of 0.1mS

Unless the program you labeled is indeed the service program corresponding to the above interrupts, the above labels can be used and cannot be used elsewhere. Otherwise, the PLC will execute the general program you labeled as an interrupt program when an interrupt occurs, resulting in errors or crashes.

FUN165

FLBL

FUNCTION BLOCK LABEL

FUN165

FLBL

Example

The illustration below is an example of a label only used as a program comment (not called or jumped to this mark). As for applying the label in jump control, please refer to the description of the JMP instruction. Please refer to the order’s CALL Description when the label is a subroutine name.

Ladder diagram

ST

LBL_F (“PGM1”)

Program 1

LBL_F(“PGM2”)

Program 2

7-7-5 FUNCTION BLOCK JUMP

FUN166 P

FJMP

FUNCTION BLOCK JUMP

FUN166 P

FJMP

Symbol

FLBL:The program label to be jumped

Range

Operand

K

0~9 , A~Z ; + , –

LB

○

Discription

※It’s only supported in the function block diagram.

  • When the function block jump controls "EN"=1 or from 0→1 (P command), PLC directly jumps to the position labeled FLBL and continues to execute the program.
  • This command is especially suitable for the application that only needs to execute a particular part of the program when a specific situation occurs, and in the application of multiple outputs of the coil and then use the input control to select and execute a particular section of the program—usually not managed to save time.
  • This command can jump back (that is, the FLBL address of the jump back is smaller than the address of the FJMP command). Still, it should be noted that if the leap back causes the scan time to extend beyond the time set by the Watchdog Timer, the PLC will generate WDT Interrupted, stops running, and issues an error signal.
  • Function block jump commands are limited to the same function block diagram.

FUN166 P

FJMP

FUNCTION BLOCK JUMP

FUN166 P

FJMP

Example

Ladder diagram

ST

IF X0 THEN

FJMP_166(“PATHB”)

END_IF

Program A

FLBL(“PATHB”)

Program B

In the figure above, when X0=1, the execution will jump directly from where the JMP command is located to the site where the FLBL name is PATHB so that program A is skipped and all instructions in A are not executed. The list related to program A Points or register status remains unchanged (as if there is no A program).

7-7-6 CALL

FUN67 P

CALL

CALL

FUN67 P

CALL

Symbol

LBL: The subroutine label name to be called.

Range

Operand

K

0~9 , A~Z ; + , –

LB

○

Description

  • When call control “EN” = 1 or changes from 0→1 (P instruction), PLC will call (perform) the subroutine bear the same label name as the one being called. When execute the subroutine, the program will execute continuous as normal program does but when the program encounters the RTS instruction then the flow of the program will return back to the address immediately after the CALL instruction.

Ladder diagram

ST

LBL(“SUB1”)

Program 1

JMP_66(“SUB3”)

LBL(“SUB2”)

Program 2

LBL(“SUB3”)

Program 3

RETURN;

  • All the subroutines must end with one “return from subroutine instruction RTS” instruction; otherwise it will cause executing error or CPU shut down. Nevertheless, an RTS instruction can be shared by subroutines (so called as multiple entering subroutines; even though the entry points are different, they have a same returning path) as illustrated in the right diagram subroutine SUB1-3.

FUN67 P

CALL

CALL

FUN67 P

CALL

  • When main program called a subroutine, the subroutine also can call the other subroutines (so called the nested subroutines) for up to 8 levels at the most (include the interrupt routine).

  • Interrupt service programs (HSC0I~HSC7I, HST0I~HST3I, PSO0I~PSO3I, X0+I~X15+I / INT0~INT15, X0-I~X15-I / INT0-~INT15-, HSTAI / ATMRI, STM0I~STM3I, LTM0I~LTM3I) are also a kind of subroutine. It is also placed in sub program area. However, the calling of interrupt service program is triggered off by the signaling of hardware to make the CPU perform the corresponding interrupt service program (which we called as the calling of the interrupt service program). The interrupt service program can also call subroutine or interrupted by other interrupts with higher priority. Since it is also a subroutine (which occupied one level), please refer to RTI instruction for explanation.
  • You can also use FCM to implement functions or function blocks. Functions implemented with FCM are like custom instructions and can be added to the ladder diagram network just like all built-in instructions. For more details, please refer to the “M PLC Function Function Block User Manual”.

7-7-7 RETURN FROM SUBROUTINE (RTS)

FUN68

RTS

RETURN FROM SUBROUTINE

FUN68

RTS

Symbol

Description

  • This instruction is used to represent the end of a subroutine. Therefore, it can only appear within the subroutine area. Its input side has no control signal, so there is no way to serially connect any contacts. This instruction is self sustain, and is directly connected to the power line.
  • When PLC encounter this instruction, it means that the execution of a subroutine is finished. Therefore, it will return to the address immediately after the CALL instruction, which were previously executed and will continue to execute the program.
  • If the above instructions are used in the subroutine and causing the subroutine not to execute the RTS instruction, then PLC will halt the operation and set the DR35361 ‘Bit9 (System Stack Error) to 1. Therefore, no matter what the flow is going, it must always ensure that any subroutine must be able to execute a matched RTS instruction.
  • For the usage of the RTS instruction please refer to instructions for the CALL instruction.

7-7-8 RETURN FROM INTERRUPT (RTI)

FUN69

RTI

RETURN FROM INTERRUPT

FUN69

RTI

Symbol

Description

  • The function of this instruction is similar to RTS. Nevertheless, RTS is used to end the execution of sub program, and RTI is used to end the execution of interrupt service program. Please refer to the explanation of RTS instruction.
  • A RTI instruction can be shared by more than one interrupt service program. The usage is the same as the sharing of an RTS by many subroutines. Please refer to the explanation of CALL instruction.
  • The difference between interrupts and call is that the sub program name (LBL) of a call is defined by user, and the label name and its call instruction are included in the main program or other sub program. Therefore, when PLC performs the CALL instruction and the input “EN” = 1 or changes from 0→1 (P instruction), the PLC will call (execute) this sub program. For the execution of interrupt service program, it is directly used with hardware signals to interrupt CPU to pause the other less important works, and then to perform the interrupt service program corresponding to the hardware signal (we call it the calling of interrupt service program). In comparing to the call instruction that need to be scanned to execute, the interrupt is a more real time in response to the event of the outside world. In addition, the interrupt service program cannot be called by label name; therefore, we preserve the special “reserved words” label name to correspond to the various interrupts offered by PLC (check FUN65 explanation for details). For example, the reserved word X0+I is assigned to the interrupt occurred at input point X0; as long as the sub program contains the label of X0+I, when input point X0 interrupt is occurred (X0: ), the PLC will pause the other lower priority program and jump to the subroutine address which labeled as X0+I to execute the program immediately.

FUN69

RTI

RETURN FROM INTERRUPT

FUN69

RTI

Description

  • If there is an interrupt occurred while CPU is handling the higher priority (such as hardware high speed counter interrupt) or same priority interrupt program (please refer to Chapter 10 for priority levels), the PLC will not execute the interrupt program for this interrupt until all the higher priority programs were finished.
  • If the RTI instruction cannot be reached and performed in the interrupt service routine, may cause a serious CPU shut down. Consequently, no matter how you control the flow of program, it must be assured that the RTI instruction will be executed in any interrupt service program.
  • For the detailed explanation and example for the usage of interrupts, please refer to Chapter 5 for explanation.

7-7-9 FOR

FUN70

FOR

FOR

FUN70

FOR

Symbol

N: Number of times of loop execution

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

1

–

16383

N

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • This instruction has no input control, is connected directly to the power line, and cannot be in series with any conditions.
  • The programs within the FOR and NEXT instructions form a program loop (the start of the loop program is the next instruction after FOR, and the last is the instruction before NEXT). When PLC executes the FOR instruction, it first records the N value after that instruction (loop execution number), then for N times successively execution from start to last of the programs in the loop. Then it jumps out of the loop, and continues executes the instruction immediately after the NEXT instruction.
  • The loop can have a nested structure, i.e., the loop includes other loops, like an onion. 1 loop is called a level, and there can be a maximum of 32 levels. The FOR and NEXT instructions must be used in pairs. The first FOR instruction and the last NEXT instruction are the outermost (first) level of a nested loop. The second FOR instruction and the second last NEXT instruction are the second level, the last FOR instruction and the first NEXT instruction form the loop’s innermost level.

FUN70

FOR

FOR

FUN70

FOR

Example

Ladder diagram

ST

FOR 0 TO 2 BY 1 DO

~

FOR 0 TO 3 BY 1 DO

~

FOR 0 TO 4 BY 1 DO

~

END_FOR

~

END_FOR

~

END_FOR

  • In the example in the diagram, loop will be executed 4 ×3 ×2 = 24 times, loop will be executed 3 ×2 = 6 times, and loop will be executed 2 times.
  • If there is a FOR instruction and no corresponding NEXT instruction, or the FOR and NEXT instructions in the nested loop have not been used in pairs, or the sequence of FOR and NEXT has been misplaced, then a syntax error will be generated and this program may not be executed.
  • Do not use JMP command to jump out of the loop, otherwise the PLC system stack will be destroyed, the program flow will be disordered, and it may cause a serious crash.
  • The effective range of N is 1~16383 times. Beyond this range PLC will treat it as 1. Care should be taken, if the amount of N is too large and the loop program is too big, a WDT may occur.

7-7-10 NEXT

FUN71

NEXT

LOOP END

FUN71

NEXT

Symbol

Description

  • This instruction and the FOR instruction together form a program loop. The instruction itself has no input control, is connected directly to the power line, and cannot be in series with any conditions.
  • When PLC has not yet entered the loop (has not yet executed to the FOR instruction, or has executed but then jumped out), but the NEXT instruction is reached, then PLC will not take any action, just as if this instruction did not exist.
  • For the usage of this instruction please refer to the explanations for the FOR instruction on the preceding page.

7-7-11 PROGRAM END

END

PROGRAM END

END

Symbol

No operand

Description

  • When end control "EN" = 1, this instruction is activated. Immediately end this program scan, all the programs after the END instruction will not be executed. When "EN" = 0, this instruction is ignored, and programs after the END instruction will continue to be executed as the END instruction is not exist.
  • This instruction may be placed more than one point within a program, and its input (end control "EN") controls the end point of program execution. It is especially useful for debugging and for testing.
  • It’s not necessary to put any END instructions in the main program, CPU will automatically restart to start point when reach the end of main program.

END

PROGRAM END

END

Example

7-8 I/O Instructions (FUN74~86)

7-8-1 IMMEDIATE I/O REFRESH (IMDIO)

FUN74 P

IMDIO

IMMEDIATE I/O REFRESH

FUN74 P

IMDIO

Symbol

C:\Users\User\Desktop\說明書翻譯\圖\IMDIO.png

D: The starting address of the I/O point to be updated

N: The number of I/O points to be updated

Range

Operand

X

Y

K

XN on the host computer

YN on the host computer

1

–

24

D

○

○

N

○

Description

  • The input/output signal update of the PLC system usually grabs all the input signals at one time before the program is executed, and then starts to scan the program. After all the scans are over, all the output results are sent to the output point at one time. In this way, the input action to the output response is at least there will be one scan time delay (maximum 2 scan times). The method of this instruction is to immediately grab or send the input signal or output signal specified by the Instruction when encountering this Instruction, so that the most immediate and fast input/output response can be obtained.

FUN74 P

IMDIO

IMMEDIATE I/O REFRESH

FUN74 P

IMDIO

  • When update control "EN" = 1 or changes from 0 to 1 (P instruction), update the status of N input points or output points (i.e., D~D+N-1) starting from input point or output point designated by D.
  • The I/O points of the immediate I/O update of the PLC are limited to the I/O points on the host computer. The following table shows the allowable real-time I/O numbers of MQ , MA and ME/MS hosts:

I/O ports

Legal ports

MQ

MA

MS/ME/MU

Input

X0~X15

X16 ~ X23

X0~X15

X0~X7

Output

Y0~Y15

Y0~Y15

Y0~Y15

  • If the range of the real-time I/O ports in the program exceeds the input point or output ports number of the host (for example, D=X7, N=9 in the program, it means that 9 input point signals such as X7~X15 should be captured immediately, and assuming that The Model is MS/ME model, the maximum input point is X7, obviously X15 has exceeded the input point number of the host), then the PLC will not be able to run.
  • When this instruction is executed, although the PLC will immediately capture or send out the real-time input/output signal, the delay of the hardware or software components on the input point or the action delay of the output point (Action response time of output components such as relays or transistors) still exists, please pay special attention.

7-9 PID Control (FUN30,FUN38, FUN99)

7-9-1 General PID operation (Main Unit)

FUN30

PID

General PID operation

FUN30

PID

Symbol

Ts:Solution interval between calculations
(1~3000 ; unit in 0.01S)

SR:Starting register of loop settings ;
it takes 8 registers in total.

OR:Output register of PID loop operation.

PR:Starting register of loop parameters;
it takes 7registers.

WR:Staring register of working registers for this instruction ,it takes 5 registers and can’t be repeated in using.

Range

Operand

R

ROR

D

K

R0

∣

R34767

R43224

∣

R47319

D0

∣

D7999

Ts

○

○

○

1~3000

SR

○

○*

○

8 word

OR

○

○*

○

PR

○

○*

○

7 word

WR

○

○*

○

5 word

FUN30

PID

PID

FUN30

PID

Description

  • The M PLC software algorithm uses mathematical functions to simulate a three-mode (PID) analog controlling technique to provide direct digital control. The control technique responds to an error with an output signal. The output is proportional to the error, the error’s integral and the rate of change of the process variable. Control algorithms include, P, PI, PD and PID which all include the features of auto/manual operation, bumpless/balanceless transfers, reset wind-up protection, and adaptive tuning of gain, integral, and derivative terms.
  • The digitized mathematical expression of M PLC PID instruction as bellows:

Mn : Control output at "n" time

Mn

R35765 :The gain constant, the default is 1000, which can be set between 1~5000.

Pb :Proportional band

The expression stating the percent change in error required to change the output full scale. ( Range:1~5000,unit in 0.1%;Kc(gain)=R35765/P )

Ki : Integral tuning constant(range:0~9999,it means 0.00~99.99 Repeats/Minute)

Td : Derivative tuning constant(range:0~3600,equivalent to 0~3600 Seconds)

: Process variable at time "n"

:Process variable when loop was last solved

En : The difference between the set point (SP) and the process variable (PV) at time "n".

En = SP – .

Ts : Solution interval between calculations(Range:1~3000, unit in 0.01S)

Bias : Offset to the output(Range:0~16383)

FUN30

PID

PID

FUN30

PID

Principle of PID parameter adjustment

  • As the proportional band (Pb) adjustment getting smaller, the larger the proportional contribution to the output. This can obtain a sensitive and rapid control reaction. However, when the proportional band is too small, it may cause oscillation. Do the best to adjust “Pb” smaller (but not to the extent of making oscillation), which could increase the process reaction and reduce the steady state error.
  • Integral item may be used to eliminate the steady state error. The larger the number (Ki, integral tuning constant), the larger the integral contribution to the output. When there is steady state error, adjust the “Ki” larger to decrease the error.
    When the “Ki” = 0, the integral item makes no contribution to the output.
    For ex, if the reset time is 6 minutes, Ki=100/6=17;if the integral time is 5 minutes, Ki=100/5=20.
  • Derivative item may be used to make the process smoother and not too over shoot. The larger the number (Td, derivative tuning constant), the larger the derivative contribution to the output. When there is too over shoot, adjust the “Td” larger to decrease the amount of over shoot.
    When the “Td” = 0, the derivative item makes no contribution to the output.
    For ex, if the rate time is 1 minute, then the Td = 100; if the rate time is 2 minutes, then the Td = 200.
  • Properly adjust the PID parameters can obtain an excellent result for loop control.

FUN30

PID

PID

FUN30

PID

Instruction description

  • When control input "A/M"=0, it performs manual control and will not execute the PID calculation. Directly fill the output value into the output register (OR) to control the loop operation.
  • When control input "A/M"=1, it defines the auto mode of loop control; the output of the loop operation is loaded by the PID instruction every time it is solved. It is equal to Mn (control loop output) in the digital approximation equation.
  • When control input "BUM"=1, it defines bumpless transfer while the loop operation changing from manual into auto mode.
  • When control input "A/M"=1, and direction input "D/R"=1, it defines the direct control for loop operation;
    it means the output increases as error increases
  • When control input "A/M"=1, and direction input "D/R"=0, it defines the reverse control for loop operation;
    it means the output decreases as error increases
  • When comes the error setting of loop setting points or loop parameters, the PID operation will not be performed and the output indication "ERR" will be ON
  • While the engineering value of the controlling process is greater than or equal to the user set High Limit, the output indication "HAL" will be ON regardless of "A/M" state.
  • While the engineering value of the controlling process is less than or equal to the user set Low Limit, the output indication "LAL" will be ON regardless of "A/M" state.
  • Description of operand Ts:
  • Ts:It defines the solution interval between PID calculations, the unit is in 0.01 sec; this term may be constant or variable data.

FUN30

PID

PID

FUN30

PID

  • Description of operand SR (Loop setting registers):
  • SR+0 = Scaled Process Variable:This register is loaded by the PID instruction every time it gets solved. A linear scaling is done on SR+6 using the high and low engineering range found in SR+4 and SR+5.
  • SR+1 = Setpoint (SP) :The user must load this register with the desired setpoint the loop should control at. The setpoint is entered in engineering units, it must be the range:LER ≦ SP ≦ HER
  • SR+2 = High Alarm Limit (HAL): The user must load this register with the value at which the process variable should be alarmed as a high alarm (above the setpoint). This value is entered as the actual alarm point in engineering units and it must be the range:LER ≦ LAL < HAL ≦ HER
  • SR+3 = Low Alarm Limit (LAL): The user must load this register with the value at which the process variable should be alarmed as a low alarm (below the setpoint). This value is entered as the actual alarm point in engineering units and it must be the range:LER ≦ LAL < HAL ≦ HER
  • SR+4 = High Engineering Range (HER): The user must load this register with the highest value for which the measurement device is spanned. (For example a thermocouple might be spanned for 0 to 500 degrees centigrade, resulting in a 0 to 10V analog input to the M PLC (0V=0℃, 10V=500℃); the high engineering range is 500, this is the value entered into SR+4.) The high engineering range must be:-9999 < HER ≦ 19999
  • SR+5 = Low Engineering Range (LER):The user must load this register with the lowest value for which the measurement device is spanned. The low engineering range must be:-9999 ≦ LER ≦ LAL < HAL ≦ HER .
  • SR+6 = Raw Analog Measurement (RAM):The user’s program must load this register with the process variable (measurement). It is the value that the content of analog input register(R34768〜R34895)is added by the offset if necessary. It must be the range:0 ≦ RAM ≦ 16380 if the analog input is 14-bit format but valid 12-bit resolution, and 0 ≦ RAM ≦ 16383 if the analog input is 14-bit format and valid 14-bit resolution.The resolution of analog input can be defined by register R35764, R35764=0, it means 14-bit format but valid 12-bit resolution ; R35764=1, it means 14-bit format and valid 14-bit resolution.

FUN30

PID

PID

FUN30

PID

  • SR+7 = Offset of Process Variable (OPV):The user must load this register with the value as described follows: OPV must be 0 if the raw analog signal and the measurement span of the analog input module are all 0〜20mA, there is no loss of the measurement resolution; OPV must be 3276 if the raw analog signal is 4〜20mA but the measurement span of the analog input module is 0〜20mA, there will have few loss of the measurement resolution(16383×4 / 20 = 3276). It must be the range: 0 ≦ OPV < 16383 .
  • When the setting mentioned above comes error, it will not perform PID operation and the output indication "ERR" will be ON.
  • Description of operand OR:
  • OR:Output register, this register is loaded directly by the user while the loop in manual operation mode. While the loop in auto operation mode, this register is loaded by the PID instruction every time it is solved. It is equal to Mn (control loop output) in the digital approximation equation. It must be the range:0 ≦ OR ≦ 16383
  • Description of operand PR (Loop parameters):
  • PR+0 = Proportional Band (Pb):The user must load this register with the desired proportional constant. The proportion constant is entered as a value between 1 and 5000 where the smaller the number, the larger the proportional contribution.

(This is because the equation uses R35765 divided by Pb.)

It must be the range:1 ≦ Pb ≦5000, unit is in 0.1%.

Kc(gain)=R35765/ Pb; the default of R35765 is 1000, and it’s range is 1 ≦ R35765 ≦ 5000.

  • PR+1 = Integral tuning Constant (Ki):The user may load this register to add integral action to the calculation. The value entered is "Repeats/Minute" and is entered as a number between 0 and 9999. (The actual range is 00.00 to 99.99 Repeats/Minute.) The larger the number, the larger the integral contribution to the output.

It must be the range:0 ≦ Ki ≦ 9999 (0.00~99.99 Repeats/Minute)

  • PR+2 = Rate Time Constant (Td):The user may load this register to add derivative action to the calculation. The value is entered as minutes and entered as a number between 0 and 9999. (The actual range is 0.00 to 99.99 minutes.) The larger the number, the larger the derivative contribution to the output.

It must be the range:0 ≦ Td ≦ 9999 (0.00~99.99 Minutes)

FUN30

PID

PID

FUN30

PID

  • PR+3 = Bias:The user may load this register if a bias is desired to be added to the output when using PI or PID control. A bias must be used when running proportional only control. The bias is entered as a value between 0 and 16383 and is added directly to the calculated output. Bias is not required for most applications and may be left at 0.

It must be the range:0 ≦ Bias ≦ 16383

  • PR+4 = High Integral Wind_up Limit (HIWL):The user must load this register with the output value, (1 to 16383), at which the loop shoud go into "anti-reset wind-up" mode. Anti-reset wind-up consists of solving the digital approximation for the integral value. For most applications this should be set to 16383.

It must be the range:1 ≦ HIWL ≦ 16383

  • PR+5 = Low Integral Wind_up Limit (LIWL):The user must load this register with the output value, (0 to 16383), at which the loop shoud go into "anti-reset wind-up" mode. It functions in the same manner as PR+4. For most applications this should be set to 0.

It must be the range:0 ≦ LIWL ≦ 16383

  • PR+6 = PID Method:

=0 , Standard PID method;

=1 , Minimum Overshoot Method;

Method 0 is prefer because most applications using PI control (Td=0).

The user may try method 1 when using PID control and the result is not stable.

  • When the setting mentioned above comes error, it will not perform PID operation and the output indication "ERR" will be ON.

FUN30

PID

PID

FUN30

PID

  • Description of operand WR (Working registers):
  • WR+0 = Loop status register :

Bit0 =0 , Manual operation mode

=1 , Auto mode

Bit1 : This bit will be a 1 during the scan the solution is being solved,

and it is ON for a scan time.

Bit2=1 , Bumpless transfer

Bit4 : The status of "ERR" indication

Bit5 : The status of "HAL" indication

Bit6 : The status of "LAL" indication

  • WR+1 = Loop timer register:This register stores the cyclic timer reading from the system’s 1ms cyclic timer each time the loop is solved. The elapsed time is calculated by calculating the difference between the current reading of the system’s 1ms cyclic timer and the value stored in this register. This difference is compared to 10× the solution interval. If the difference is greater than or equal to the solution interval, the loop should be solved this scan.
  • WR+2 = Low order integral summation:This register stores the low order 16 bits of the 32-bit sum created by the integral term.
  • WR+3 = High order integral summation:This register stores the high order 16 bits of the 32-bit sum created by the integral term.
  • WR+4 = Process variable – previous solution:The raw analog input (Register SR+6) at the time the loop was last sovled. This is used for the derivative control mode.

FUN30

PID

PID

FUN30

PID

Program example

FUN30

PID

PID

FUN30

PID

R999 :The setting of solution interval between calculations; for example the content of R999 is 200, it means it will perform this PID operation every 2 seconds.

R1000 :Scaled process variable, which is the engineering unit loaded by the PID instruction every time it gets solved. A linear scaling is done on R1006 using the high and low engineering range found in R1004 and R1005.

R1001 :Setpoint, it is the desired value the loop should control at; which is entered in engineering unit. For example the span of controlling process is 0°C~500°C, the setting of R1001 is equal to 100, it means the desired result is at 100°C.

R1002 :The setting of high alarm limit; which is entered in engineering unit.
The example mentioned above, if the setting of R1002 is equal to 105, it means there will have the high alarm while the loop is greater than or equal to 105°C.

R1003 :The setting of low alarm limit; which is entered in engineering unit. The example mentioned, if the setting of R1003 is equal to 95, it means there will have the low alarm while the loop is less than or equal to 95°C.

R1004 :The setting of high engineering range. The example mentioned, if the setting of R1004 is equal to 500, it means the highest value of this loop is 500°C.

R1005 :The setting of low engineering range. The example mentioned, if the setting of R1005 is equal to 0, it means the lowest value of this loop is 0°C.

R1006 :Raw analog measurement; it is the value that the content of analog input register (R34768〜R34895) is added by the offset of 2048.

R1007:Offset of process variable; let it be 0 if the raw analog signal and the span of the analog input module are all 0〜10V.

R1020 :The setting of proportional band; for example the content of R1020 is 20,
it means the proportional band is 2.0% and the gain is 50.

R1021 :The setting of integral tuning constant;
for example the content of R1021 is 17,
it means the reset time is 6 minutes
(100/6≒17).

R1022 :The setting of derivative tuning constant; for example the content of R1022 is 0, it means PI control.

R1023 :The setting of the bias to the output;
most applications let it be 0.

R1024 :The setting of high integral wind-up;
most applications let it be 16383.

R1025 :The setting of low integral wind-up;
most applications let it be 0.

R1026 :The setting of PID method;
most applications let it be 0.

R1030 = Loop status register

Bit0 =0, Manual operation mode
=1, Auto operation mode

Bit1 : This bit will be a 1 during the scan the solution is being solved, and it is ON for
a scan time.

Bit2=1 , Bumpless transfer

Bit4 : The status of "ERR" indication

Bit5 : The status of "HAL" indication

Bit6 : The status of "LAL" indication

R1031~R1034: They are the working registers, please refer to the description of operand WR.

7-9-2 General-Purpose PID 2 Instruction

FUN38

PID2

PID 2

FUN38

PID2

Symbol

ID: The number of the expansion module used as the input signal

CH: Channel number for input signal

SR: Program-controlled setting value starting register number, a total of 8 registers are occupied

OR: PID output register number

PR: The starting register number of the parameter setting value, a total of 7 registers are occupied

WR: The starting number of the working register used by this command, occupying 5 registers in total, and other places cannot be reused.

Range

Operand

HR

SR

ROR

DR

K

R0

∣

R34767

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D11999

ID

0~127

CH

○

○

○

○

0 ~ 63

SR

○

○

○

8 word

OR

○

○*

○

PR

○

○

○

7 word

WR

○

○

○

5 word

FUN38

PID2

PID 2

FUN38

PID2

Description

  • The use of PID2 differs from PID in that PID2 distributes the computation on the module which supports PID function instead of using the computation power of the CPU unit.
  • The general-purpose PID2 command (FUN38) regards the currently measured external analog input value as a process variable (Process Variable, referred to as PV). It sets the set point (SP) set by the user and the programmed variable through the software. After the PID mathematical calculation, the appropriate output control value is obtained through the D/A analog output module or reprocessed through other interfaces to control the controlled program within the user’s wanted setting range.
  • The digital PID calculation formula is as follows:

Mn = [KpxEn]- [KpxTdx(PVn-PVn-1)/Ts] + Bias

Mn = : Control output at "n" time

Kp :Proportional term real number(range:±(1.8*10-38~3.4*1038))

Ti : Integral time constant(range:0~3600,equivalent to 0~3600 Repeats/Seconds)

Td : Differential time constant(range:0~3600,equivalent to 0~3600 Seconds)

PVn : Program-controlled variable value at "n" time

PV n-1 : "n" last programmed variable value

En : Error at "n" time = set value (SP) – program variable value at "n" time (PVn)

Ts : Interval time between PID operations (range: 1~300, unit: 0.1S)

Bias : Bias output (range: ± (1.8*10-38~3.4*1038)

FUN38

PID2

PID 2

FUN38

PID2

  • When the control selection "A/M"=0, it means the manual control mode, the PID calculation result will not be used, and the manual output value MOUT will be automatically copied to MV.
  • When the control selection "A/M"=1, it means automatic control mode, the MV value is calculated by PID, if MAUTO=1, the MV value will be automatically copied to MOUT.
  • When the control selection "A/M"=1 and the operation direction "D/R"=1, the program control is forward PID control; that is, when the error (SP-PVn) is positive, the control output of the PID operation result: The larger the value is; when the error is negative, the control output of the PID calculation result is smaller.
  • When the control selection "A / M" = 1 and the operation direction "D/R" = 0, the program control is reverse PID control; that is, when the error (SP-PVn) is positive, the control output of the PID operation result: The smaller it is; when the error is negative, the control output of the PID operation result is larger.
  • When the program control setting value or parameter setting value is wrong, the PID instruction will not be executed, and the error indicator "ERR"=1 is set.
  • If you need to update the parameters, after updating the contents of the relevant registers, turn UPD OFF->ON to update the parameters.

For more details of information, please refer to the function and application user manual.

7-9-3 PID Temperature Control Instruction 2 (TPCTL 2)

FUN99 P

TPCTL2

PID TEMPERATURE CONTROL INSTRUCTION 2

FUN99 P

TPCTL2

Symbol

ID: The number of the expansion module to perform temperature control

CH: Expansion module channel that performs temperature control

SR: Program-controlled setting start register

RP: Gain setting start register

OR: Output start register

WR: Work start register

Range

Operand

R

SR

ROR

DR

K

R0

∣

R34767

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

0~127

CH

○

○

○

○

0~63

SR

○

○

○

8 word

PR

○

○*

○

OR

○

○*

○

7 word

WR

○

○*

○

5 word

FUN99 P

TPCTL2

PID TEMPERATURE CONTROL INSTRUCTION 2

FUN99 P

TPCTL2

Discription

  • PID temperature control (FUN99) uses the temperature module and the temperature planning form to measure the current external temperature value as a Process Variable (referred to as PV) and the Set Point (Abbreviated as SP) set by the user and program-controlled variables through the software PID mathematical formula to obtain the appropriate output control value to control the temperature within the temperature range expected by the user.
  • Convert the numerical result after PID operation into time-proportional ON/OFF (PWM) output, and control the heating or cooling circuit connected in series with the SSR through the transistor-type contact output so that a very accurate and inexpensive control result can be obtained.
  • EN: Execute temperature control when ON, stop when OFF
  • UPD: When ON, the parameters will be updated to the specified channel of the module
  • A/M: PID manual mode, if enabled, the output will be in manual control mode, and the MOUT value will be automatically copied to MV instead of using the PID calculation result as the output.
  • H/C: Perform heating or cooling control

For more details of information, please refer to the function and application user manual.

7-10 Cumulateive Timer Instruction (FUN87~89)

7-10-1 ACCUMULATIVE TIMER (10ms, 100ms, 1s)

FUN87 T.01S

FUN88 T.1S

FUN89 T1S

ACCUMULATIVE TIMER (0.01s, 0.1s, 1s)

FUN87 T.01S

FUN88 T.1S

FUN89 T1S

Symbol

CV : Register storing elapse time

(current value)

PV : Preset value of timer

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

0-32767

or

0-2147483647

CV

○

○

○

○

○

○

○

○

○*

○*

○

○

PV

○

○

○

○

○

○

○

○

○

○

○

Description

  • The operation for this instruction is the same as that for the basic timer (T0~T1023), except that the basic timer only has a "timing control" input – when its input is 1 it starts timing, and when input is 0 it get clear. Every time the input changes, it starts timing again and is unable to accumulate. Timing with this instruction is only permissible when enable control "EN" = 1. With this instruction, when timing control "TIM" is 1, it is the same as a basic timer, but when "TIM" is 0, it does not clear, but keeps the current value. If the timer need to clear, then change enable control "EN" to 0. When timing control "TIM" is once again to be 1, it will continue to accumulate from the previous value when the timer last paused. In addition, this instruction also has two outputs: Time to “TUP” (when time up it is 1, usually it is 0) and Time not to “NUP” (usually it is 1, when time is up it is 0). Users can utilize input and output combinations to produce timers with various different functions.

FUN87 T.01S

FUN88 T.1S

FUN89 T1S

ACCUMULATIVE TIMER

FUN87 T.01S

FUN88 T.1S

FUN89 T1S

Example 1

ON DELAY DE-ENERGIZING Timer

Ladder diagram

ST

ACTimer_10MS( TIM:= M0, EN:= M0, CV:= R0, PV:= 10, TUP=> Y0);

  • This timer’s output (Y0 in this example) is normally not energized. When this timer’s input control (X0 in this example) is activated (ON), only after delay by 10 sec will output Y0 become energized (ON).

Example 2

ON DELAY DE-ENERGIZING Timer

Ladder diagram

ST

ACTimer_10MS( TIM:= M0, EN:= M0, CV:= R0, PV:= 10, NUP=> Y0);

  • The output Y0 of this timer is usually energized. When this timer’s input control X0 is on, only after delay by 10 sec will the output become de-energized (OFF).

Example 3

OFF DELAY ENERGIZING Timer

Ladder diagram

ST

IF M0 = 0 Then

M1 := 1;

ELSE

M1 := 0;

END_IF

ACTimer_10MS( TIM:= M1 , EN:= M1, CV:= R0, PV:= 10, TUP=> Y0);

  • This timer’s output Y0 is usually de-energized. When this timer’s input control M0 is off, only after delay by 10 sec will output Y0 become energized (ON).

Example 4

OFF DELAY ENERGIZING Timer

Ladder diagram

ST

IF M0 = 0 Then

M1 := 1;

ELSE

M1 := 0;

END_IF

ACTimer_10MS( TIM:= M1 , EN:= M1, CV:= R0, PV:= 10, NUP=> Y0);

  • This timer’s output Y0 is usually energized. When this timer’s timing control X0 is off, only after delay by 10 sec will output Y0 become de-energized (OFF).

FUN87 T.01S

FUN88 T.1S

FUN89 T1S

ACCUMULATIVE TIMER

FUN87 T.01S

FUN88 T.1S

FUN89 T1S

The diagram below shows the relation on input and output for the above 4 kinds of timers.

7-11 Watchdog Timer Instructions (FUN90~91)

7-11-1 Watchdog Timer (WDT)

FUN90 P

WDT

WATCHDOG TIMER

FUN90 P

WDT

Symbol

N: The watchdog time.

Its value can only be 50, 60, 70…990,

The unit is 10MS, that is, the set time range is (50~990) x10MS, that is, 0.05 seconds to 9.9 seconds.

Description

  • When the execution control "EN"=1 or from 0→1 (P instruction), change the setting time of the monitoring timer to NX10MS. Once set, WATCHDOG TIMER (WDT) will use this as the timing time, if the scan time exceeds the set time, the PLC will stop and not execute.
  • The watchdog timer is normally implemented by a hardware one-shot timer (it can not be software, otherwise if CPU fail, the timer becomes ineffective, and safeguards are quite impossible). "One-shot" means that after triggered the timer once, the timing value will immediately be reset to 0 and timing will restart. If WDT has begun timing, and never triggered it again, then the WDT timing value will continue accumulating until it reach the preset value of N, at that time WDT will be activated, and PLC will be shut down. If trigger the WDT once every time before the WDT time N has been reached, then WDT will never be activated. PLC can use this feature to ensure the safety of the system. Each time when PLC enters into system housekeeping after finished the program scanning and I/O refresh, it will usually trigger WDT once, so if the system functions normally and scan time does not exceed WDT time then WDT is never activated. However, if CPU is damaged and unable to trigger WDT, or the scan time is too long, then there will not be enough time to trigger WDT within the period N, WDT will be activated and will shut off PLC.
  • Once the set value is set, it will be saved forever, and there is no need to set it once for each scan, so this command should be used practically P instruction.
  • The WDT time is set at 0.25 seconds.
  • For the working principle of WDT, please refer to the FUN91 (RSWDT) instruction.

7-11-2 RESET WATCHDOG TIMER (RSWDT)

FUN91 P

RSWDT

RESET WATCHDOG TIMER

FUN91 P

RSWDT

Symbol

This instruction has no operand.

Description

  • When the execution control "EN"=1 or from 0→1 (P instruction), the WDT timer is cleared (that is, the WDT starts counting from 0 again).
  • The function of WATCHDOG TIMER has been described in FUN90 (WDT command), and its principle is as follows:
  • WATCHDOG TIMER are generally hardware ONE-SHOT timers (you cannot use software to do this, otherwise if the CPU crashes, the timer will be invalid, of course it cannot be protected), the so-called one-shot means That is, as long as you trigger the timer once, the timer value will be cleared to 0 immediately and restarted. If you do not trigger the WDT after it starts timing, the WDT timing will continue to increase to the set value N, and then the WDT will act and stop the PLC. If you trigger the WDT once before the WDT timing N has reached, the WDT will never happen, and the PLC uses this principle to ensure system security, because the PLC generally enters the program scan and I/O update WDT is triggered once during system service (HOUSEKEEPING). If the system is normal and the scan time does not exceed the set time N of WDT, there must be time to clear WDT and make it inactive. However, if the CPU is damaged, WDT cannot be triggered. Or the scan time is too long to trigger the WDT within N time, the WDT will act and turn off the PLC.
  • In some applications, you have set the WDT time (FUN90), and your program scans the time in some cases, and it may temporarily exceed the set time of WDT, which is expected and allowed by you. Of course, you don’t want the PLC to stop because of this. At this time, you can use this command to trigger WDT to avoid WDT from happening. This is the main purpose of this command.

7-12 High Counting/Timing Instruction (FUN92~93)

7-12-1 Hareware High Speed Counter Current Value Access

FUN92D P

HSCTR

Hareware High Speed Counter Current Value (CV) Access

FUN92D P

HSCTR

Symbol

CN:Hardware high speed counter number

0:HSC0

1:HSC1

2:HSC2

3:HSC3

4:HSC4

5:HSC5

6:HSC6

7:HSC7

Description

  • The HSC0~HSC3 counters of M-Series PLC are 4 sets of 32bit high speed counter with the variety counting modes such as up/down pulse. All the 4 high speed counters are built in the ASIC hardware and could perform count, compare, and send interrupt independently without the intervention of the CPU. Since the current values CV of HSC0~HSC3 are built in the internal hardware circuits of ASIC, the user control program (ladder diagram) cannot retrieve them directly from ASIC. Therefore, it must employ this instruction to get the CV value from hardware HSC and put it into the register which control program can access. The following is the arrangement of CV, PV in ASIC and their corresponding CV, PV registers of PLC for HSC0~HSC3.

FUN92D P

HSCTR

Hareware High Speed Counter Current Value (CV) Access

FUN92D P

HSCTR

PLC register

ASIC

DR35280

CV

CV register

H

L

HSC0

DR35282

PV

HSC0

PV register

H

L

DR35284

CV

CV register

H

L

HSC1

DR35286

PV

HSC1

PV register

H

L

DR35288

CV

CV register

H

L

HSC2

DR35290

PV

HSC2

PV register

H

L

DR35292

CV

CV register

H

L

HSC3

DR35294

PV

HSC3

PV register

H

L

  • When access control “EN” =1 or changes from 0→1( P instruction), will gets the CV value of HSC designated by CN from ASIC and puts into the HSC corresponding CV register (i.e. the CV of HSC0 will be read and put into DR35280 or the CV of HSC1 will be read and put into DR35284).
  • Although the PV within ASIC has a corresponding PV register in CPU, but it is not necessary to access it (actually it can’t be) for that the PV value within ASIC comes from the PV register in CPU.
  • For detailed applications, please refer to Chapter 8 “The high speed counter and high speed timer of M-Series PLC”.

7-12-2 Hardware High Speed Counter Current Value and Preset Value Writing

FUN93D P

HSCTW

Hardware High Speed Counter Current Value and Preset Value Writing

FUN93D P

HSCTW

Symbol

CN:Hardware high speed counter to be written

0:HSC0

1:HSC1

2:HSC2

3:HSC3

4:HST4

5:HSC5

6:HSC6

7:HST7

D: Write target (0 represents CV, 1 r epresents PV)

FUN93D P

HSCTW

Hardware High Speed Counter Current Value and Preset Value Writing

FUN93D P

HSCTW

Description

● Please refer to FUN92 for the relationship between the CV or PV values ​​of HSC0~HSC3 in the ASIC and the corresponding CV registers and PV registers inside the PLC.

● When the writing control "EN"=1 or from 0→1 (P command), write the contents of the CV register or PV register of the high-speed counter designated by the PLC internal CN to the ASIC correspondingly CV or PV of HSC.

● General applications often need to write PV, that is, write your preset set value to the PV in ASIC. When the count value reaches your set value, the counter will immediately send an interrupt. Through the interrupt service program, you It can be used for various precise counting or positioning control.

  • M PLC will automatically read the value of the current value register CV of HSC0~HSC3 inside the ASIC at that time when the power is off, and then write it into the CV register of HSC0~HSC3 inside the PLC (with power-off hold function), and when the PLC is powered on again, it will reversely write the CV registers inside the PLC back to the CV registers inside the ASIC. The content value of the register will automatically return to the value before the last power failure, but if your control application needs to be cleared to 0 or start counting from a specific value when the power is restored, you must use this instruction to do ASIC internal write to the CV value of HSC.
  • For detailed applications, please refer Chapter 7 “The high-speed counter and high speed timer of M-Series PLC”.

FUN93D P

HSCTW

Hardware High Speed Counter Current Value and Preset Value Writing

FUN93D P

HSCTW

Example

Ladder diagram

ST

IF R_TRIG( S:= M0) THEN

HSCTW( S:= 0, CN:= HSC_HSC0, D:= HSC_CV);

END_IF

IF M0 = FALSE THEN

HSCTR( CN:= 0);

END_IF

IF R_TRIG( S:= M1) THEN

HSCTW( S:= R500, CN:= HSC_HSC0, D:= HSC_PV);

END_IF

As the program in this diagram, when M0 changes from 0→1, it clears the current value of HSC0 to 0, and writes into ASIC hardware through FUN93.

  • When M0 is 0, it reads out the current counting value.
  • When M1 changes from 0→1, it moves DR500 to DR35282, and writes the preset value into ASIC hardware through FUN93.
  • Whenever the current value equals to the DR500, The HSC0I interrupt sub program will be executed.

7-13 Slow Up/Slow Down (FUN95~98)

7-13-1 TRACKING TYPE RAMP FUNCTION FOR D/A OUTPUT

FUN98

RAMP2

TRACKING TYPE RAMP FUNCTION FOR D/A OUTPUT

FUN98

RAMP2

Symbol

98.RAMP2

Om :

Ta :

Td :

Rt :

Rc :

WR :

OM: Maximum output; range from 0~65535

TA: The acceleration time for the output, from 0 up to maximum; Range from 0~65000, unit is in mS.

TD: The deceleration time for the output, from maximum down to 0; Range from 0~65000, unit is in mS.

RT: Register of target output; Range from 0~65535

RC: Register of current output, it is used for analog output

WR: Starting address of working registers, it needs 4 registers

Range

Operand

HR

OR

ROR

DR

K

R0

∣

R34767

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

16-Bit

Om

○

○

○

0~65535

Ta

○

○

○

0~65000

Td

○

○

○

0~65000

Rt

○

○

○

Rc

○

○

○

○

WR

○

○*

○

4 word

FUN98

RAMP2

TRACKING TYPE RAMP FUNCTION FOR D/A OUTPUT

FUN98

RAMP2

Description

● When execution 〝EN〞=0, current output value (Rc) will be 0 immediately; the output indicators ACC=0 and DEC=0.

● When execution 〝EN〞=1, this instruction being executed; it will output current value (Rc) first, and then compare the target output value (Rt) with current output value (Rc) every scan; if the target output value is greater than current output value, the current output will be increased according to the rate, which is decided by the settings of acceleration time (Ta) and maximum output (Om), till current output value is equal to the target output value (ACC=1 during this time); if the target output value is less than current output value, the current output will be decreased according to the rate, which is decided by the settings of deceleration time (Td) and maximum output (Om), till current output value is equal to the target output value (DEC=1 during this time).

● If the setting value of target output (Rt) is greater than maximum output(Om), the output value will be clamped by the maximum value.

● It can have smooth activity for acceleration and deceleration control via the execution of this instruction by using current output value (Rc) for analog output (R35024~R35151).。

● The setting value of target output (Rt) needs to stay two scan times at least for proper operation.

● It needs 4 registers for working, they can not be repeated in use.

● This instruction is for positive value operation, but it also can have negative output by short and easy application program for help. Please see example 2.

FUN98

RAMP2

TRACKING TYPE RAMP FUNCTION FOR D/A OUTPUT

FUN98

RAMP2

Example 1

Positive output for ACC/DEC control

Ladder diagram

ST

RAMP2( EN:= M0, Om:= D10, Ta:= D0, Td:= D1, Rt:= D100, Rc:= R35024, WR:= D1000, ACC=> M0, DEC=> M1);

D10: Setting of maximum output, it is 16383

D0: The acceleration time for the output from 0 up to maximum, it is 30000mS

D1: The deceleration time for the output from maximum down to 0, it is 20000mS

D100: Setting of target output value, it is 8192

R35024: Register of current output, it is used for D/A output

D1000~D1003: Working registers

Description:

When M0=0, current output value is 0 immediately (No ramp). When M0=1, it will output the value of R35024 first; and then compare the target output value (D100) with current output value (R35024) every scan; if D100>R35024, the current output value of R35024 will be increased according to the rate of 16383/30000 (Om=16383, Ta=30000), till R35024=D100 (ACC=1 during this time); if D100<R35024, the current output value of R3904 will be decreased according to the rate of 16383/20000 (Om=16383, Td=20000), till R35024=D100 (DEC=1 during this time).

FUN98

RAMP2

TRACKING TYPE RAMP FUNCTION FOR D/A OUTPUT

FUN98

RAMP2

Example 2

Both positive and negative output for ACC/DEC control

Ladder diagram

ST

D10 :Setting of maximum output, it is 8191

D0 :The acceleration time for the output from 0 up to maximum, it is 20000mS

D1 :The deceleration time for the output from maximum down to 0, it is 10000mS

D100:Setting of target output value, it is 0

D200:Register of current output, it is used for analog output

D1000~D1003:Working registers

FUN98

RAMP2

TRACKING TYPE RAMP FUNCTION FOR D/A OUTPUT

FUN98

RAMP2

Description:

Description: When M0=0, current output value is 0 immediately (No ramp).

When M0=1, it will output the value of D200 first; and then compare the target output value (D100) with current output value (D200) every scan; if D100>D200, the current output value of D200 will be increased according to the rate of 8191/20000 (Om=8191, Ta=20000), till D200=D100 (ACC=1 during this time); if D100<D200, the current output value of D200 will be decreased according to the rate of 8191/10000 (Om=8191, Td=10000), till D200=D100 (DEC=1 during this time).

M100=1, positive output control; M101=1, negative output control.

The target output (D100) is always positive value from 0~65535.

Table Instructions

100. R→T 107. T_FIL

101. T→R 108. T_SHF

102. T→T 109. T_ROT

103. BT_M 110. QUEUE

104. T_SWP 111. STACK

105. R-T_S 112. BKCMP

106. T-T_C

  • A table consists of 2 or more consecutive registers (16 or 32 bits). The number of registers that comprise the table is called the table length (L). The operation object of the table instructions always takes the register as unit (i.e. 16 or 32 bit data).
  • The operation of table instructions are used mostly for data processing such as move, copy, compare, search etc, between tables and registers, or between tables. These instructions are convenient for application.
  • Among the table instructions, most instructions use a pointer to specify which register within a table will be the target of operation. The pointer for both 16 and 32-bit table instructions will always be a 16-bit register. The effective range of the pointer is 0 to L-1, which corresponds to registers T0 to TL-1 (a total of L registers). The table shown below is a schematic diagram for 16-bit and 32-bit tables.
  • Among the table operations, shift left/right, rotate left/right operations include a movement direction. The direction toward the higher register is called left, while the direction toward the lower register is called right, as shown in the diagram below.

7-14 Table Instruction (FUN100~114)

7-14-1 REGISTER TO TABLE MOVE

FUN100 D P

R→T

REGISTER TO TABLE MOVE

FUN100 D P

R→T

Symbol

Rs : Source data , can be constant or register

Td : Source register for destination table

L : Length of destination table

Pr : Pointer register

Rs, Td can associate with V, Z, P0~P9 index register as indirect addressing

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32bit
+/- number

V、Z

P0~P9

Rs

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Td

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

2~2048

Pr

○

○

○

○

○

○

○

○

○

○*

○*

○

Description

  • 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.

FUN100 D P

R→T

REGISTER TO TABLE MOVE

FUN100 D P

R→T

  • 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.

Example

Ladder diagram

ST

  • The example at left at the very beginning pointer Pr = 4, the entire content of table Td is 0, and the Rs value is 8888. The diagram below shows the operation results when X1 have the transition of 0→1 twice.
  • Because INC is 1, Pr will increase by 1 each time the instruction is executed.

Pr

Pr

Pr

4

R50

5

R50

6

R50

Td

Td

Td

0000

R10(T0)

X0=1

(First)

⇨

0000

R10

X0=1

(Second)

⇨

0000

R10

0000

R11(T1)

0000

R11

0000

R11

Rs

0000

R12(T2)

0000

R12

0000

R12

R0

8888

0000

R13(T3)

0000

R13

0000

R13

0000

R14(T4)

8888

R14

8888

R14

0000

R15(T5)

0000

R15

8888

R15

0000

R16(T6)

0000

R16

0000

R16

0000

R17(T7)

0000

R17

0000

R17

Before

First time result

Second time result

7-14-2 TABLE TO REGISTER MOVE

FUN101 D P

T→R

TABLE TO REGISTER MOVE

FUN101 D P

T→R

Symbol

Ts : Source table starting register

L : Length of source table

Pr : Pointer register

Rd : Destination register

Ts, Rd may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32bit
+/- number

V、Z

P0~P9

Ts

○

○

○

○

○

○

○

○

○

○

○

○

○

○

L

○

○*

○

2~2048

Pr

○

○

○

○

○

○

○

○

○

○*

○*

○

Rd

○

○

○

○

○

○

○

○

○

○*

○*

○

○

Description

  • 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.

FUN101 D P

T→R

TABLE TO REGISTER MOVE

FUN101 D P

T→R

  • 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.

Example

Ladder diagram

ST

  • In the example at left, at the very beginning Pr = 7 and Ts and Rd are as shown at left in the diagram below. When X0 have a transition from 0→1 twice, the results are shown at right in the diagram below.
  • 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

X0=1

(first)

⇨

8

R19

X0=1

(second)

⇨

8

R19

R1(T1)

2222

R2(T2)

3333

R3(T3)

4444

Rd

Rd

Rd

R4(T4)

5555

0000

R20

8888

R20

9999

R20

R5(T5)

6666

R6(T6)

7777

END

END

END

R7(T7)

8888

0

0

1

R8(T8)

9999

Before execution

First time execution

Second time Eexecution

7-14-3 TABLE TO TABLE MOVE

FUN102 D P

T→T

TABLE TO TABLE MOVE

FUN102 D P

T→T

Symbol

Ts: the starting number of the register in the source list

Td: the starting number of the register of the destination list

L: list length (Ts and Td)

Pr: index register number

Ts, Td can be combined with V, Z, P0~P9 for indirect addressing applications.

Range

Ope-rand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

2048

V、Z

P0~P9

Ts

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Td

○

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Pr

○

○

○

○

○

○

○

○

○

○*

○*

○

Description

  • 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.

FUN102 D P

T→T

(TABLE TO TABLE MOVE)

FUN102 D P

T→T

  • 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.

Example

Ladder diagram

ST

  • The diagram at left below is the status before execution. When X0 from 0→1, the content of R5 in Ts table will copy to R15 and pointer R20 will be increased by 1.

Pr

Pr

R20

5

R20

6

Ts

Td

Td

R0

1111

R10

0000

X0=1

⇨

R10

0000

R1

1111

R11

0000

R11

0000

R2

1111

R12

0000

R12

0000

R3

1111

R13

0000

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-14-4 BLOCK TABLE MOVE (BT_M)

FUN103 D P

BT_M

BLOCK TABLE MOVE

FUN103 D P

BT_M

Symbol

Ts : Starting register for source table

Td : Starting register for destination table

L : Lengths of source and destination tables

Ts, Td may combine with V, Z, P0~P9 to serve indirect

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

∣

256

V、Z

P0~P9

Ts

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Td

○

○

○

○

○

○

○

○

○

○

○

○

○

L

○

○*

○

○

Description

  • 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.
  • 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.
  • 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 instruction should be used to avoid time waste caused by each scan repeating the same movement action.

FUN103 D P

BT_M

BLOCK TABLE MOVE

FUN103 D P

BT_M

Example

Ladder diagram

ST

IF X0 THEN

BT_M( Ts:= R0, Td:= R10, L:= 10);

END_IF

  • The program example in the above figure assumes that the state of the TS and TD lists is as shown in the left figure before execution. When X0 changes from 0 to 1, the execution result as shown in the right figure below can be obtained:

D:\patrick\說明書翻譯\圖\圖片2.png

7-14-5 REGISTER TO TABLE SEARCH

FUN105 D P

R-T_S

REGISTER TO TABLE SEARCH

FUN105 D P

R-T_S

Symbol

Rs : Data to search, it can be a constant or a register

Ts : Starting register of table being searched

L : Label length

Pr : Pointer of table

Rs, Ts may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit
+/- number

V、Z

P0~P9

Rs

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Ts

○

○

○

○

○

○

○

○

○

○

○

○

○

○

L

○

○*

○

2~256

Pr

○

○

○

○

○

○

○

○

○

○*

○*

○

Description

  • 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.
  • 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.

FUN105 D P

R-T_S

REGISTER TO TABLE SEARCH

FUN105 D P

R-T_S

Example

Ladder diagram

ST

IF X0 THEN

T_Search( FHD:= FALSE, DS:= FALSE, Rs:= 5555, Ts:= R0, L:= 10, Pr:= R20, FND=> M0, END=> M1, ERR=> M2);

END_IF

  • The instruction at left is searching the table for a register with the value 5555 (because D/S = 0, it is searching for same value). Before execution, the pointer point to R2, but the starting point of the search is Pr + 1 (i.e. it starts from R3). After X0 has transition from 0→1 3 times, the results of each search may be obtained as shown in the diagram below.

Pr

Ts

Pr

F

EN

R20

2

R0

5555

➀X0=

(First)

R20

6

1

0

R1

0000

R2

5555

Start

point

Rs

R3

2222

←

Pr

FN

EN

5555

R4

3333

➁X0=

(Second)

R20

9

0

1

R5

4444

R6

5555

R7

6666

Pr

FN

EN

R8

7777

➂X0=

(Third)

R20

0

1

0

R9

8888

Before execution

After execution

7-14-6 TABLE TO TABLE COMPARE

FUN106 D P

T-T_C

TABLE TO TABLE COMPARE

FUN106 D P

T-T_C

Symbol

Ta : Starting register of Table a

Tb : Starting register of Table b

L : Lengths of Table

Pr : Pointer

Ta, Tb may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ta

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Tb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

L

○

○*

○

○

Pr

○

○

○

○

○

○

○

○

○

○*

○*

○

Description

  • 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.

FUN106 D P

T-T_C

TABLE TO TABLE COMPARE

FUN106 D P

T-T_C

Example

Ladder diagram

ST

IF X0 THEN

T_Compare( FHD:= FALSE, DS:= TRUE, Ta:= R0, Tb:= R11, L:= 10, Pr:= R10, FND=> M0, END=> M1, ERR=> M2);

END_IF

  • The instruction at right starts from the register next to the register pointed by the pointer (because "FHD" is 0) to search for register pairs with different data (because "D/S" is 1) within the 2 tables. At the very beginning, Pr points to Ta1 and Tb1. There are 3 different pairs of data at the position 1,3,6 of the table. However, it does not compare from the beginning, and this instruction will start searching from position 3 downwards. After 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

R0

0000

R11

0000

➀X0=1

(First)

R10

3

1

0

R1

1111

R12

0000

R2

2222

R13

2222

←

Start

point

R3

3333

R14

1234

Pr

FN

EN

R4

4444

R15

4444

➁X0=1

(Second)

R10

6

1

0

R5

5555

R16

5555

R6

6666

R17

0000

R7

7777

R18

7777

Pr

FN

EN

R8

8888

R19

8888

➂X0=1

(Third)

R10

9

0

1

R9

9999

R20

9999

Before execution

After execution

7-14-7 TABLE FILL (T_FIL)

FUN107 D P

T_FIL

TABLE FILL

FUN107 D P

T_FIL

Symbol

Rs : Source data to fill, can be a constant or a register

Td : Starting register of destination table

L :Table length

Rs, Td may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Rs

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Td

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

2-256

Description

  • 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.
  • 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.

FUN107 D P

T_FIL

TABLE FILL

FUN107 D P

T_FIL

Example

Ladder diagram

ST

IF X0 THEN

T_Fill( Rs:= 555, Td:= R0, L:= 10);

END_IF

  • This instruction will fill 5555 into the whole table Td. The results are as shown in the diagram below.

Td

Td

R0

1547

X0=

⇨

R0

5555

R1

2314

R1

5555

R2

7725

R2

5555

Rs

R3

0013

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

Before execution

After execution

7-14-8 TABLE SHIFT

FUN108 D P

T_SHF

TABLE SHIFT

FUN108 D P

T_SHF

Symbol

IW: Data to fill the room after shift operation, can be a constant or a register

Ts: Source table

Td: Destination table storing shift results

L: Lengths of tables Ts and Td

OW: Register to accept the shifted-out data

Ts, Td may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand-

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit
+/- number

V、Z

P0~P9

IW

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Ts

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Td

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

2~256

OW

○

○

○

○

○

○

○

○

○*

○*

○

Description

  • 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.

FUN108 D P

T_SHF

TABLE SHIFT

FUN108 D P

T_SHF

Example

Ladder diagram

ST

  • In the program at left, Ts and Td is the same table. Therefore, the table shifts itself and then writes back to itself (the table must be writ able). It first perform a shift left operation (let X1 = 1, and X0 go from 0→1) then perform a shift to right operation (let X1 = 0, and makes X0 go from 0→1). The result are shown at right in the diagram below.

Ts(Td)

(Shift Left)

(Shift Right)

Td(Ts)

Td(Ts)

R0

0000

R0

1234

R0

0000

Shift left

R1

1111

R1

0000

R1

1111

R2

2222

R2

1111

R2

2222

R3

3333

OW

R3

2222

R3

3333

R10

1234

R4

4444

R11

××××

R4

3333

R4

4444

R5

5555

R5

4444

R5

5555

R6

6666

Shift

Left

R6

5555

R6

6666

R7

7777

R7

6666

R7

7777

R8

8888

R8

7777

R8

8888

R9

9999

R9

8888

R9

1234

OW

OW

Dotted line is the path for shift right

R11

9999

R11

1234

Before execution

➀First time

➁Second time

7-14-9 TABLE ROTATE

FUN109 D P

T_ROT

TABLE ROTATE

FUN109 D P

T_ROT

Symbol

Ts : Source table for rotate

Td : Destination table storing results of rotation

L : Lengths of table

Ts, Td may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ts

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Td

○

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Description

  • 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.

FUN109 D P

T_ROT

TABLE ROTATE

FUN109 D P

T_ROT

Example

Ladder diagram

ST

  • In the program at left, Ts and Td is the same table. The table after rotation will write back to itself. It first perform one left rotation (let X1 = 1, and X0 go from 0→1), and then performs one right rotation (let X1 = 0, and X0 go from 0→1). The results are shown at right in the diagram below.

(Rotate Left)

(Rotate Right)

Ts(Td)

Td(Ts)

Td(Ts)

R0

0000

(Right)

R0

9999

R0

0000

R1

1111

R1

0000

R1

1111

R2

2222

R2

1111

R2

2222

R3

3333

R3

2222

R3

3333

R4

4444

Rotate

Right

R4

3333

R4

4444

R5

5555

R5

4444

R5

5555

R6

6666

R6

5555

R6

6666

R7

7777

R7

6666

R7

7777

R8

8888

R8

7777

R8

8888

R9

9999

(Left)

R9

8888

R9

9999

Before Execution

➀First time

➁Second time

7-14-10 QUEUE

FUN110 D P

QUEUE

QUEUE

FUN110 D P

QUEUE

Symbol

IW: the data to be inserted into the storage column or its register number

QU: The starting register number of the storage row

L: the length of the storage column

PR: index register number

OW: Register number receiving data moved out from the memory

QU can be combined with V, Z, P0~P9 for indirect addressing application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit
+/- number

V、Z

P0~P9

IW

○

○

○

○

○

○

○

○

○

○

○

○

○

○

QU

○

○

○

○

○

○

○

○

○

○

○*

○

○

L

○

○*

○

2~256

Pr

○

○

○

○

○

○

○

○

○

○*

○*

○

OW

○

○

○

○

○

○

○

○

○

○*

○*

○

Description

  • 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.

Note: The system uses the serial number L+1 register for internal calculations, users must avoid this register

  • 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.

FUN110 D P

QUEUE

QUEUE

FUN110 D P

QUEUE

Pr

4

IW

QU

➄5555

QU1

➃4444

Push down

QU2

➂3333

QU3

➁2222

QU4

➀1111

OW

QU5

××××

……

➀~➄is the sequence number

of operation

QUL

  • 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.
  • 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.

FUN110 D P

QUEUE

QUEUE

FUN110 D P

QUEUE

Example

Ladder diagram

ST

IF X0 THEN

QUEUE( InOut:= X1,

IW:= R0,

Qu:= R2,

L:= 10,

Pr:= R1,

OW:= R20,

EPT=> M0,

FUL=> M1);

END_IF

  • The program above assumes the queue content is the same with the queue at preceding page. It will first perform queue push operation, and then perform pop out action. The results are shown below. Under any circumstance, Pr always point to the first (oldest) data that was remained in queue.

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

X X X X

R20

QU5

R6

1111

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-14-11 STACK

FUN111 D P

STACK

STACK

FUN111 D P

STACK

Symbol

IW : Data pushed into stack, can be a constant or a register

ST : Starting register of stack

L : Size of stack

Pr : Pointer register

OW : Register accepting data popped out from stack

ST may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit
+/- number

V、Z

P0~P9

IW

○

○

○

○

○

○

○

○

○

○

○

○

○

○

ST

○

○

○

○

○

○

○

○

○

○

○*

○

○

L

○

○*

○

2~256

Pr

○

○

○

○

○

○

○

○

○

○*

○*

○

OW

○

○

○

○

○

○

○

○

○

○*

○*

○

Description

  • 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.
  • 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:

FUN111 D P

STACK

STACK

FUN111 D P

STACK

Pr

➀~➄is the sequence

Number of operation

4

ST

ST1

➀1111

←

Bottom of stack

ST2

➁2222

ST3

➂3333

IW

ST4

➃4444

OW

➄5555

ST5

××××

push

STL

  • 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.
  • 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.

FUN111 D P

STACK

STACK

FUN111 D P

STACK

Example

Ladder diagram

ST

IF X0 THEN

STACK( InOut:= X1,

IW:= R0,

ST:= R2,

L:= 10,

Pr:= R1,

OW:= R20,

EPT=> M0,

FUL=> M1);

END_IF

  • The program above assumes that the initial content of the stack is just as in the diagram of a stack on the preceding page. The operation illustrated in this example is to push a data and than pop it from stack. The results are shown below. Under any circumstances, Pr always point to the data that was most recently pushed into the 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

X X X X

R20

ST5

R6

5555

R20

ST6

R7

↑

ST6

R7

ST7

R8

OW unchanged

ST7

R8

ST8

R9

ST8

R9

ST9

R10

ST9

R10

ST10

R11

ST10

R11

After push(X1=1,X0 from 0→1)

After pop(X1=0,X0 from 0→1)

7-14-12 BLOCK COMPARE (DRUM)

FUN112 D P

BKCMP

BLOCK COMPARE (DRUM)

FUN112 D P

BKCMP

Symbol

Rs : Data for compare, can be a constant or a register

Ts : Starting register block storing upper and lower limit

L : Number of pairs of upper and lower limits

D : Starting relay storing results of comparison

Range

Operand

Y

M

S

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

Y0

∣

Y1023

M0

∣

M9119

S0

∣

S3103

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit
+/- number

Rs

○

○

○

○

○

○

○

○

○

○

○

○

○

Ts

○

○

○

○

○

○

○

○

○

○

○

○

L

○

○*

○

1~256

D

○

○

○

Description

  • 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.
  • When M9160=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.
  • When M9160=1, there is no restriction on the relation of upper limit and lower limit, this can apply for 360°rotary electronic drum switch application.

FUN112 D P

BKCMP

BLOCK COMPARE(DRUM)

FUN112 D P

BKCMP

Example

Upper limit

Lower limit

Compared

←

→

Compare value

Result

←

→

Output

0

TS1

TS0

RS

D0

1

TS3

TS2

←

←→

D1

~

~

~

~

~

~

L−1

TS2L−1

TS2L−2

DL−1

  • 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.

Ladder diagram

ST

IF X0 THEN

BKCMP( Rs:= C0, Ts:= R10, L:= 4, D:= Y5);

END_IF

Counter( Pulse:= X1,

Clr:= C0,

C:= 0,

PV:=360,

IsUp=> C0);

  • In this program, C0 represents the rotation angle (Rs) of a drum shaft. The block compare instruction performs a comparison between Rs and the 4 pairs (L = 4) of upper and lower limits, R10,R11, R12,R13, R14,R15 and R16,R17. The comparison results can be obtained from the four drum output points Y5 to Y8.
  • The input point X1 is a rotation angle detector mounted on the drum shaft. With each one degree rotation of the drum shaft angle, X1 produces a pulse. When the drum shaft rotates a full cycle, X1 produces 360 pulses.

FUN112 D P

BKCMP

BLOCK COMPARE(DRUM)

FUN112 D P

BKCMP

  • 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.

Equivalent mechanical drum emulated by above program

7-14-13 DATA SORTING (SORTING)

FUN113 D P

SORT

SORTING

FUN113 D P

SORT

Symbol

C:\Users\User\Desktop\說明書翻譯\圖\SORT.png

S : Starting register of source registers to sort

D : Starting register of destination registers to store the

data after sorted

L : Total register for sorting

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2-256

V、Z

P0~P9

S

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○

○

○

○

L

○

○

○*

○*

○

○

Description

  • 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.。

FUN113 D P

SORT

DATA SORTING

FUN113 D P

SORT

Example

Ladder diagram

ST

IF X0 THEN

SORT( AD:= TRUE,

S:= R0,

D:= R10,

L:= 10);

END_IF

  • This example sorts the table comprised of R0~R9 and stores the sorted data to the table locate at R10~R19.

S

D

R0

1547

X0=

⇨

R10

0013

R1

2314

R11

1547

R2

7725

R12

1925

R3

0013

R13

2314

R4

5247

R14

2796

R5

1925

R15

5247

R6

6744

R16

5319

R7

5319

R17

6744

R8

9788

R18

7725

R9

2796

R19

9788

7-14-14 ZONE WRITE

FUN114 D P

Z-WR

ZONE WRITE

FUN114 D P

Z-WR

Symbol

D : Starting address of being set or reset

N : Quantity of being set oe reset, 1~511

D、N operand can combine V、Z、P0~P9 for index addressing while word operation

Range

Ope-

rand

Y

M

SM

S

WY

WM

WS

TMR

CTR

HR

OR

SR

ROR

DR

K

XR

Y0

∣

Y1023

M0

∣

M9119

M9120

|

M25599

S0

∣

S3103

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

1

∣

511

V、Z

P0~P9

D

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

N

○

Description

  • 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).
  • The valid data length of sort operation is between 0 and 511, other length will set the “ERR” to 1 and the sort operation will not perform.

FUN114 D P

Z-WR

ZONE WRITE

FUN114 D P

Z-WR

Example 1

Registers R0~R9 will be reset to 0 while X0=1

Ladder diagram

ST

IF X0 THEN

ZoneWR( Val:= FALSE,

D:= R0,

N:= 10);

END_IF

C:\Users\User\Desktop\說明書翻譯\圖\Z_WR_Example1.png

FUN114 D P

Z-WR

ZONE WRITE

FUN114 D P

Z-WR

Example 2

(When X50 is “ON”, clear M5~M11 to 0)

Ladder diagram

ST

IF X50 THEN

ZoneWR( Val:= FALSE,

D:= M5,

N:= 7);

END_IF

Matrix Instructions

120. MAND 126. MBRD

121. MOR 127. MBWR

122. MXOR 128. MBSHF

123. MXNR 129. MBROT

124. MINV 130. MBCNT

125. MCMP

  • 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.

7-15 Matrix Instruction (FUN120~130)

7-15-1 MATRIX AND

FUN120 P

MAND

MATRIX AND

FUN120 P

MAND

Symbol

Ma : Starting register of source matrix a

Mb : Starting register of source matrix b

Md : Starting register of destination matrix

L : Length of matrix (Ma, Mb and Md)

Ma, Mb, Md may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ma

○

○

○

○

○

○

○

○

○

○

○

○

○

Mb

○

○

○

○

○

○

○

○

○

○

○

○

○

Md

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Description

  • When operation control "EN" = 1 or has a transition from 0 to 1 (P instruction), this instruction will perform a logic AND (only if 2 bits are 1 will the result be 1, otherwise it will be 0)operation between two source matrixes with a length of L, Ma and Mb. The result will then be stored in the destination matrix Md, which is also the same length (the AND operation is done by bits with the same bit numbers). For example, if Ma0 = 0, Mb0 = 1, then Md0 = 0; if Ma1 = 1, Mb1 = 1, then Md1 = 1; etc, right up until AND reaches Ma16L-1 and Mb16L-1.

FUN120 P

MAND

MATRIX AND

FUN120 P

MAND

Example

Ladder diagram

ST

IF X0 THEN

MAND( Ma:= R0, Mb:= R10, Md:= R20, L:= 5);

END_IF

  • In the program at left, when X0 goes from 0→1, then matrix Ma, comprised by R0 to R4, and matrix Mb, comprised by R10 to R14, will do an AND operation. The results will be stored back in matrix Md, comprised by R20 to R24. The result is shown at right in the diagram below.

Ma15

↓

Ma

Ma0

↓

Mb15

↓

Mb

Mb0

↓

Md15

↓

Md

Md0

↓

R0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R10

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R20

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R1

1

1

1

1

1

1

1

1

0

0

0

0

0

0

0

0

R11

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R21

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R2

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R12

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R22

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R3

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R13

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R23

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

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

R24

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

↑

Ma79

↑

Ma64

↑

Mb79

↑

Mb64

↑

Md79

↑

Md64

Before Execution

After Execution

7-15-2 MATRIX OR

FUN121 P

MOR

MATRIX OR

FUN121 P

MOR

Symbol

Ma : Starting register of source matrix a

Mb : Starting register of source matrix b

Md : Starting register of destination matrix

L : Length of matrix (Ma, Mb and Md)

Ma, Mb, Md may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ma

○

○

○

○

○

○

○

○

○

○

○

○

○

Mb

○

○

○

○

○

○

○

○

○

○

○

○

○

Md

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Description

  • 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 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.

FUN121 P

MOR

MATRIX OR

FUN121 P

MOR

Example

Ladder diagram

ST

IF X0 THEN

MOR( Ma:= R0, Mb:= R10, Md:= R20, L:= 5);

END_IF

  • In the program at left, when X0 goes from 0→1, then matrix Ma, comprised by R0 to R4, and matrix Mb, comprised by R10 to R14, will do an OR operation. The results will then be stored into the destination matrix Md, comprised by R10 to R14. In this example, Mb and Md is the same matrix, so after operation the source matrix Mb will replaced by the new value. The result is shown at right in the diagram below.

Ma15

↓

Ma

Ma0

↓

Mb15

↓

Mb

Mb0

↓

Md15

↓

Md

Md0

↓

R0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R10

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R20

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R1

1

1

1

1

1

1

1

1

0

0

0

0

0

0

0

0

R11

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R21

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R2

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R12

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R22

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R3

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R13

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R23

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

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

R24

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

↑

Ma79

↑

Ma64

↑

Mb79

↑

Mb64

↑

Md79

↑

Md64

Before execution

After execution

7-15-3 MATRIX EXCLUSIVE OR

FUN122 P

MXOR

MATRIX EXCLUSIVE OR

FUN122 P

MXOR

Symbol

Ma : Starting register of source matrix a

Mb : Starting register of source matrix b

Md : Starting register of destination matrix

L : Length of matrix (Ma, Mb and Md)

Ma, Mb, Md may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ma

○

○

○

○

○

○

○

○

○

○

○

○

○

Mb

○

○

○

○

○

○

○

○

○

○

○

○

○

Md

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Description

  • When operation control "EN" = 1 or has a transition from 0 to 1 ( P instruction), this instruction will performs a logic XOR (if the 2 bits are different, then the result will be 1, otherwise it will be 0)between 2 source matrixes with a length of L, Ma and Mb. The result will then be stored back into the destination matrix Md, which also has a length of L. For example the XOR operation is done by bits with the same bit numbers – for example, if Ma0 = 0, Mb0 = 1, then Md0 = 1; if Ma1 = 1, Mb1 = 1, then Md1 = 0; etc, right up until XOR reaches Ma16L-1 and Mb16L-1.

FUN122 P

MXOR

MATRIX EXCLUSIVE OR

FUN122 P

MXOR

Example

Ladder diagram

ST

IF X0 THEN

MXOR( Ma:= R0, Mb:= R10, Md:= R20, L:= 5);

END_IF

  • In the program at left, when X0 goes from 0→1, will perform a XOR operation between matrix Ma, comprised by R0 to R4, and matrix Mb, comprised by R10 to R14. The results will then be stored in destination matrix Md, comprised by R20 to R24. The results are shown at right in the diagram below.

Ma15

↓

Ma

Ma0

↓

Mb15

↓

Mb

Mb0

↓

Md15

↓

Md

Md0

↓

R0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R10

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R20

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R1

1

1

1

1

1

1

1

1

0

0

0

0

0

0

0

0

R11

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R21

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R2

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R12

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R22

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

R13

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R23

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

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

R24

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

↑

Ma79

↑

Ma64

↑

Mb79

↑

Mb64

↑

Md79

↑

Md64

Before Execution

After Execution

7-15-4 MATRIX ENCLUSIVE NOR

FUN123 P

MXNR

MATRIX EXCLUSIVE NOR

FUN123 P

MXNR

Symbol

Ma : Starting register of source matrix a

Mb : Starting register of source matrix b

Md : Starting register of destination matrix

L : Length of matrix (Ma, Mb and Md)

Ma, Mb, Md may combine with V, Z,P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ma

○

○

○

○

○

○

○

○

○

○

○

○

○

Mb

○

○

○

○

○

○

○

○

○

○

○

○

○

Md

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Description

  • 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 same length (the XNR operation is done by bits with the same bit numbers). For example, if Ma0 = 0, Mb0 = 1, then Md0 = 1; if Ma1 = 1, Mb1 = 1, then Md1 = 0; etc, right up until XNR reaches Ma16L-1 and Mb16L-1.

FUN123 P

MXNR

MATRIX EXCLUSIVE NOR

FUN123 P

MXNR

Example

Ladder diagram

ST

IF X0 THEN

MXNR( Ma:= R0, Mb:= R10, Md:= R10, L:= 5);

END_IF

  • When operation control "EN" = 1 or goes from 0 to 1 ( P instruction), will perform a XNR operation between Ma matrix comprised by R0~R9 and Mb matrix comprised by R10~R19. The results will then be stored into the destination matrix Md comprised by R10~R19. The results are shown at right in the diagram below.

Ma15

↓

Ma

Ma0

↓

Mb15

↓

Mb

Mb0

↓

Md15

↓

Md

Md0

↓

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R10

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R20

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

0

0

0

0

0

0

0

0

R11

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R21

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

1

1

1

1

1

R12

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R22

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

0

R13

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R23

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

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

R24

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

↑

Ma79

↑

Ma64

↑

Mb79

↑

Mb64

↑

Md79

↑

Md64

Before Execution

After Execution

7-15-5 MATRIX INVERSE

FUN124 P

MINV

MATRIX INVERSE

FUN124 P

MINV

Symbol

Ms: Starting register of source matrix

Md : Starting register of destination

L : Length of matrix (Ms and Md)

Ma, Md may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ms

○

○

○

○

○

○

○

○

○

○

○

○

○

Md

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Description

  • When operation control "EN" = 1 or has a transition from 0 to 1 ( P instruction), source register Ms, which has a length of L, will be completely inverted (all the bits with a value of 1 will change to 0, and all those with a value of 0 will change to 1). The results will then be stored into destination matrix Md.

FUN124 P

MINV

MATRIX INVERSE

FUN124 P

MINV

Exaxmple

Ladder diagram

ST

IF X0 THEN

MINV( Ms:= R0, Md:= R0, L:= 5);

END_IF

  • In the program at left, when X0 goes from 0→1, the matrix comprised by R0 to R4 will be inverted, and then store back into itself (because in this example Ms and Md are the same matrix). The results obtained are shown at right in the diagram below.

Ms15

↓

Ms

Ms0

↓

Md15

↓

Md

Md0

↓

R0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R0

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R1

1

1

1

1

1

1

1

1

0

0

0

0

0

0

0

0

R1

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R2

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

R2

1

1

1

1

1

1

1

1

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

1

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

1

R4

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

↑

Ms79

↑

Ms64

↑

Md79

↑

Md64

Before Execution

After Execution

7-15-6 MATRIX BIT SHIFT

FUN128 P

MBSHF

MATRIX BIT SHIFT

FUN128 P

MBSHF

Symbol

Ms : Starting register of source matrix

Md : Starting register of destination matrix

L : Length of matrix (Ms and Md)

Ms, Md may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ms

○

○

○

○

○

○

○

○

○

○

○

○

○

Md

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Description

  • When shift control "EN" = 1 or has a transition from 0 to 1 (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 "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 at the output bit "OTB". Then the results of this shifted matrix will be filled into the destination matrix Md.

FUN128 P

MBSHF

(MATRIX BIT SHIFT)

FUN128 P

MBSHF

FUN128 P

MBSHF

(MATRIX BIT SHIFT)

FUN128 P

MBSHF

Example

Ladder diagram

ST

IF X0 THEN

MBSHF( INB:= X0, L_R:= TRUE, Ms:= R0, Md:= R0, L:= 5, OTB=> M0); END_IF

  • The program at left is an example where Ms and Md are the same matrix. When X0 goes from 0→1, Ms will be completely retrieved and moved to the left (because L/R = 1) by 1 bit. It will then be stored back to Md, and the results are shown at right in the diagram below.

Ms15

↓

Ms

Ms0

↓

X0=1

⇨

Md15

↓

Md

Md0

↓

R0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

R1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

0

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

Before Execution

After Execution

7-15-7 MATRIX BIT ROTATE

FUN129 P

MBROT

MATRIX BIT ROTATE

FUN129 P

MBROT

Symbol

Ms : Starting register of source matrix

Md : Starting register of destination matrix

L : Length of matrix (Ms and Md)

Ms, Md may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2

|

256

V、Z

P0~P9

Ms

○

○

○

○

○

○

○

○

○

○

○

○

○

Md

○

○

○

○

○

○

○

○

○*

○*

○

○

L

○

○*

○

○

Description

  • When rotate control "EN" = 1 or has a transition from 0 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 replaced by the status of the rotated-out bit (with a left rotation it will be M16L-1, and with a right rotation it will be M0). The rotated-out bit will not only be used to fill the above-mentioned space, it will also be transferred to rotated-out bit "OTB".

FUN129 P

MBROT

MATRIX BIT ROTATE

FUN129 P

MBROT

FUN129 P

MBROT

MATRIX BIT ROTATE

FUN129 P

MBROT

Example

Ladder diagram

ST

IF X0 THEN

MBROT( L_R:= FALSE, Ms:= R0, Md:= R0, L:= 5, OTB=> M0);

END_IF

  • In the program at left, Ms and Md are the same matrix. When X0 goes from 0→1, then the whole of Ms is retrieved and rotated right (because L/R = 0) by 1 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.

Ms15

↓

Ms

Ms0

↓

X0=1

⇨

Md15

↓

Md

Md0

↓

R0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R0

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R1

0

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R2

1

1

1

1

1

1

1

1

0

0

0

0

0

0

0

0

R2

0

1

1

1

1

1

1

1

1

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

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

R4

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

R4

0

1

1

1

1

1

1

1

1

1

1

1

1

1

1

1

↑

Ms79

↑

Ms64

↑

Md79

↑

Md64

Before Execution

After Execution

7-15-8 MATRIX BIT STATUS COUNT(MBCNT)

FUN130 P

MBCNT

MATRIX BIT STATUS COUNT

FUN130 P

MBCNT

Symbol

Ms : Starting register of matrix

L : Matrix length

D : Register storing count results

Ms may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

WX

WY

WM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

2-256

V, Z

P0 ~ P9

Ms

○

○

○

○

○

○

○

○

○

○

○

○

○

L

○

○*

○

○

D

○

○

○

○

○

○

○

○

○

○*

○

Description

  • 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.

FUN130 P

MBCNT

MATRIX BIT STATUS COUNT

FUN130 P

MBCNT

Example

Ladder diagram

ST

IF X0 THEN

MBCNT( OnOff:= X1, Ms:= R0, L:= 5, D:= R20);

END_IF

  • This program sets X1 first as 0 (to count bits with status of 0) and then as 1 (to count bits with status of 1) and let the signal X0 has a transition from 0→1 for both case, the execution results are shown at right in the diagram below .

C:\Users\User\Desktop\說明書翻譯\圖\MBCNT_example.png

7-16 NC Positioning Instruction (FUN137~143)

7-16-1 ICA

FUN137

ICA

ICA

FUN137

ICA

Symbol

Ps:The set number of Pulse Output (0~7)

0:Y0 & Y1

1:Y2 & Y3

2:Y4 & Y5

3:Y6 & Y7

4:MQ Y16 & Y17, Y8 & Y9 otherwise

5:MQ Y18 & Y19, Y10 & Y11 otherwise

6:MQ Y20 & Y21, Y12 & Y13 otherwise

7:MQ Y22 & Y23, Y14 & Y15 otherwise

Is:MQ: X0~X23 or Y0~Y23

MA: X0~X23 or Y0~Y23

ME, MS, MU: X0~X7 or Y0~Y7

Fo:Target Working Speed

(1~2147483647)

Ag:Fixed angle during interrupt (0~36000)

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

Ps

0~7

Fo

○

○

○

○

○

○

○

○

○

○

○

○

○

0~2147483647

Ag

○

○

○

○

○

○

○

○

○

○

○

○

○

0~36000

FUN137

ICA

ICA

FUN137

ICA

Range

Operand

CPU’s Xn

CPU’s Yn

XR

0~23

(MQ)

0~15

(MA)

0~7

(MS/ME/MU)

0~23

(MQ)

0~15

(MA/MS/ME/MU)

V、Z

P0~P9

Is

○

○

○

○

○

○

Description

  • The positioning axis can be controlled up to PSO7, but the actual maximum axis number that can be controlled varies by model.
  • The target working speed and the maximum frequency is 200KHz.
  • For MS and ME-series, external input points 8~15 of X will be reserved for the motion function and not supported by this command.
  • The external input point does not need additional special configuration in the interrupt setting in the I/O configuration. The relevant settings will be automatically made when the command is executed.
  • For more details of information, please refer to the function and application user manual.

7-16-2 ICF

FUN138

ICF

ICF

FUN138

ICF

Symbol

Ps:The set number of Pulse Output (0~7)

0:Y0 & Y1

1:Y2 & Y3

2:Y4 & Y5

3:Y6 & Y7

4:MQ Y16 & Y17, Y8 & Y9 otherwise

5:MQ Y18 & Y19, Y10 & Y11 otherwise

6:MQ Y20 & Y21, Y12 & Y13 otherwise

7:MQ Y22 & Y23

ME, MS, MA: Y14 & Y15

Ls:MQ: X0~X23 or Y0~Y23

MA: X0~X23 or Y0~Y23

ME, MS: X0~X7 or Y0~Y7

Fo:Target Working Speed

(1~2147483647)

Fd:Amount of pulse wave movement after interrupt capture

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

Pw

0~7

Fo

○

○

○

○

○

○

○

○

○

○

○

○

○

0~2147483647

Fd

○

○

○

○

○

○

○

○

○

○

○

○

○

0~2147483647

FUN138

ICF

ICF

FUN138

ICF

Range

Operand

CPU’s Xn

CPU’s Yn

XR

0~23

(MQ)

0~15

(MA)

0~7

(MS/ME/MU)

0~23

(MQ)

0~15

(MA/MS/ME/MU)

V、Z

P0~P9

Is

○

○

○

○

○

○

Description

  • The positioning axis can be controlled up to PSO7, but the actual maximum axis number that can be controlled varies by model.
  • The target working speed and the maximum frequency is 200KHz.
  • For MS and ME-series, external input points 8~15 of X will be reserved for the motion function and not supported by this command.
  • The external input point does not need additional special configuration in the interrupt setting in the I/O configuration. The relevant settings will be automatically made when the command is executed.
  • For more details of information, please refer to the function and application user manual.

7-16-3 HSPWM

FUN139

HSPWM

HIGH SPEED PULSE WIDTH MODULATION

FUN139

HSPWM

Symbol

Pw: Output of High-Speed Pulse Width Modulation

0 : Y0

1 : Y2

2 : Y4

3 : Y6

4 : MQ Y16, Y8 otherwise

5 : MQ Y18, Y10 otherwise

6 : MQ Y20, Y12 otherwise

7 : MQ Y22, Y14 otherwise

Op: Output polarity;

0=Output non-reversed phase

1=Output reversed phase

Rs: Resolution;

0=1/100 (1%)

1=1/1000 (0.1%)

Pn: Setting of output frequency parameter (0~255)

OR: PWM Output Width Setting Register

0~100 or 0~1000

WR: Instruction operation work register, other programs cannot be reused.

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

Pw

0~7

Op

0~1

Rs

0~1

Pn

○

○

○

○

○

○

○

○

○

○

○

○

○

0~255

OR

○

○

○

0~100 or 0~1000

WR

○

○

○

○

○

○

○

○

○

○

○

FUN139

HSPWM

HIGH SPEED PULSE WIDTH MODULATION

FUN139

HSPWM

Description

  • 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).
  • When operation control “EN” = 1, the specified digital output will perform the PWM output, the expression for output frequency as shown bellow:

1. While Rs (Resolution)=1/100

2. While Rs (Resolution)=1/1000

  • For more details of information, please refer to the function and application user manual.

7-16-4 High Speed Pulse Output Instruction

FUN140

HSPSO

HIGH SPEED PULSE OUTPUT INSTRUCTION

FUN140

HSPSO

Symbol

Ps : The set number of Pulse Output (0~7)

0:Y0 & Y1

1:Y2 & Y3

2:Y4 & Y5

3:Y6 & Y7

4:MQ Y16 & Y17, Y8 & Y9 otherwise

5:MQ Y18 & Y19, Y10 & Y11 otherwise

6:MQ Y20 & Y21, Y12 & Y13 otherwise

7:MQ Y22 & Y23, Y14 & Y15 otherwise

SR: Starting register for positioning program

WR: Starting register for instruction operation controls 7 registers, which the other program cannot repeat in using.

Range

Operand

HR

ROR

DR

K

R0

∣

R34767

R43224

∣

R47319

D0

∣

D7999

Ps

0-7

SR

○

○

○

WR

○

○*

○

7 word

FUN140

HSPSO

HIGH SPEED PULSE OUTPUT INSTRUCTION

FUN140

HSPSO

Description

  • The positioning axis can be controlled up to PSO7, but the actual maximum axis number that can be controlled varies by model.
  • The NC positioning program of the FUN140 (HSPSO) command is edited in the form of a text program; each positioning point is called one step (including output frequency, action stroke, and transfer conditions), and one FUN140 can program up to 250 positioning points. Each positioning point needs to occupy 9 registers.
  • The biggest advantage of storing the positioning program in the temporary register is that if the HMI is combined with the machine control setting, the positioning program can be stored in the HMI.
  • When the execution control input "EN"=1, if Ps0~Ps7 are not occupied by other FUN140 instructions (Ps0=M9183, Ps1=M9184, Ps2=M9185, Ps3=M9186, Ps4=M9191, Ps5=M9192, Ps6= M9193, Ps7=M9194 state is ON, otherwise it is OFF), then start to execute from the next positioning point (if it has reached the last step, then start to execute from step 1 again); if Ps0~7 are occupied by other FUN140 instructions , the FUN140 to be occupied releases the control right, and this instruction obtains the pulse output right of positioning control.
  • When the execution control "EN"=0, stop the pulse output immediately.
  • When the pause output "PAU"=1, and the execution control "EN" was previously 1, the pulse output is paused. When the pause output "PAU"=0 and the execution control "EN" is still 1, it will continue to output the unfinished pulse number.
  • When the output "ABT" = 1, stop the pulse output immediately. (The next time when the execution control input "EN"=1, it will be executed again from the first step positioning point)
  • When pulse output is in progress, the output indicator "ACT" is ON.
  • When the command is executed incorrectly, the output indication "ERR" is ON. (The error code is stored in the error code register)
  • When each step of positioning is completed, the output indication "DN" is ON.
  • For more details of information, please refer to the function and application user manual.

7-16-5 Positioning program parameter setting command (MPARA)

FUN141

MPARA

MPARA

FUN141

MPARA

Symbol

Ps: Group of Pulse output (0~7)

SR: Parameter table starting register, 18 parameters in total, occupying 24 registers

Range

Operand

HR

IR

OR

ROR

DR

K

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

Ps

0~7

SR

○

○

○

○

○

Description

  • The positioning axis can be controlled up to PSO7, but the actual maximum axis number that can be controlled varies by model.
  • It is not necessary to use this instruction (But in the first-time setting is necessary). 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.
  • This instruction incorporates with FUN140 for positioning control purpose.
  • Whether the execution control input “EN” = 0 or 1, this instruction will be performed.
  • When there are any errors in parameter value, the output indication “ERR” will be ON. (The error code is stored in the error code register.)

FUN141

MPARA

MPARA

FUN141

MPARA

R2000

0~2

Parameter 0

System default =1

R2001

1~65535 Ps/Rev

Parameter 1

System default =2000

DR2002

1~999999 M/Rev

1~999999 mDeg/Rev

1~999999 x 0.1 mInch/Rev

Parameter 2

System default =2000

R2004

0~3

Parameter 3

System default =2

DR2005

1~200000 Ps/sec

1~153000

Parameter 4

System default =200000

DR2007

0~200000 Ps/sec

1~153000

Parameter 5

System default =141

R2009

1~65535 Ps/sec

Parameter 6

System default =1000

R2010

0~32767

Parameter 7

System default =0

R2011

0~30000

Parameter 8

System default =5000

R2012

0~1

0~1

Parameter 9

System default =0100H

R2013

-32768~32767

Parameter 10

System default =0

R2014

-32768~32767

Parameter 11

System default =0

R2015

0~30000

Parameter 12

System default =0

R2016

0~30000

Parameter 13

System default =500

DR2017

0~1999999

Parameter 14

System default =0

DR2019

00H~FFH

00H~FFH

Parameter 15

System default =FFFFFFFFH

00H~FFH

00H~FFH

DR2021

-999999~999999

Parameter 16

System default =0

R2023

0~255

Parameter 17

System default =1

FUN141

MPARA

MPARA

FUN141

MPARA

Use UperLogic to edit the servo parameter table

In the project window, click the servo parameter table:

Project Name

Table Edit

Servo Parameter Table After right-clicking, click "Add Servo Parameter Table".

  • Table type: fixed as "servo parameter form".
  • able name: You can enter an easily identifiable name for the servo parameter table, which is convenient for future modification or debugging.
  • Table start position: The start position of the data table start register SR used by the servo parameter command (FUN141).

Parameter Description

  • Parameter 0: unit setting, the default value is 1

□When the setting value is 0, the travel and speed setting values ​​used in the program are specified in mm, Deg, Inch as the unit, which is called the mechanical unit.

□When the setting value is 1, the travel and speed setting values ​​used in the program are all specified in the unit of Pulse, which is called the motor unit.

□When the setting value is 2, the stroke setting values ​​used in the program are all specified in mm, Deg, Inch as the unit, and the speed setting is all specified in Pulse as the unit, which is called compound unit.

Parameter 0, Unit

“0” Mechanical unit

“1” Motor unit

“2” Compound unit

Parameter 1, 2

no need to set

No need to set

Must be set

Parameter 3, 7, 10, 11

Mm, Deg, Inch

Ps

Mm, Deg, Inch

Parameter 4, 5, 6, 15, 16

Cm/Min, Deg/Min, Inch/Min

Ps/Sec

Ps/Sec

FUN141

MPARA

MPARA

FUN141

MPARA

  • Parameter 1: pulse number/1 revolution, the default value is 2000, that is, 2000 Ps/Rev

The number of pulses required for one revolution of the motor (A)

A=1~65535 (when it is above 32767, set it as a decimal positive number) Ps/Rev

When parameter 14 = 0, take parameter 1 as pulse number/1 revolution.

When parameter 14 ≠ 0, take parameter 14 as pulse number/1 revolution.

  • Parameter 2: movement amount/1 revolution, the default value is 2000, that is, 2000 Ps/Rev
  • The distance driven by one revolution of the motor (B)

B=1~999999 M/Rev

1~999999 mDeg/Rev

1~999999×0.1 mInch/Rev

  • Parameter 3: The minimum setting unit, the default value is 2, equivalent to two decimal places

Parameter 0

Parameter3

Set Value =0, Mechanical unit; Set Value =2, Compound unit;

Set Value 1

Motor unit Ps

mm

Deg

Inch

Set Value=0

x1

x1

x0.1

x1000

Set Value =1

x0.1

x0.1

x0.01

x100

Set Value =2

x0.01

x0.01

x0.001

x10

Set Value =3

x0.001

x0.001

x0.0001

x1

FUN141

MPARA

MPARA

FUN141

MPARA

  • Parameter 4: Maximum speed setting, the default value is 200000, that is, 200000 Ps/Sec

□Motor and compound unit: 1~200000 Ps/Sec

□Mechanical unit: 1~153000 (cm/Min, x10 Deg/Min, Inch/Min)

But the highest frequency can not be greater than 200000 Ps/Sec

f_max =(V_max x 1000 x A)/(6 x B)200000 Ps/Sec

f_min  1 Ps/Sec

Note: A=parameter 1, B=parameter 2

  • Parameter 5: start/end speed, default value=141

□Motor and compound unit: 1~200000 Ps/Sec

□Mechanical unit: 1~15300(cm/Min,10 Deg/Min,Inch/Min)

But the highest frequency cannot be greater than 200000 Ps/Sec。

  • Parameter 6: homing deceleration speed, the default value is 1000

Motor and compound unit: 1~65535 Ps/Sec

Mechanical unit: 1~15300 (Cm/Min, x10 Deg/Min, Inch/Min)

  • Parameter 7: Gear backlash correction value, default value=0

Note: Multi-axis linear interpolation command is invalid

Setting range: 0~32767 Ps。

When walking in reverse, the walking distance will automatically add this value.

FUN141

MPARA

MPARA

FUN141

MPARA

  • Parameter 8: Acceleration and deceleration time setting, default value=5000, unit is mS.

Note: Multi-axis linear interpolation command is invalid

Setting range: 0~30000 mS.

This time represents the time required to accelerate from rest to maximum speed (parameter 4), or decelerate from maximum speed to rest.

The acceleration and deceleration of this system is equal slope control.

When parameter 12=0, this parameter is used as the deceleration time.

The acceleration and deceleration control of this system will automatically move in a triangle wave or trapezoid wave according to the actual action stroke.

  • Parameter 9: Setting of homing direction and running direction, the default value is 0100H

Note: Multi-axis linear interpolation command is invalid

SR+12

b15 b8 b7 b0

Parameter 9-1

Parameter 9-0

  • Parameter 9-0: Running direction setting, the default value is 0

When the set value = 0, the forward rotation pulse output, the current Ps value will increase

Reverse the pulse output, the current Ps value will decrease

When the set value = 1, the forward rotation pulse output, the current Ps value will decrease

Reverse the pulse output, and increase the current Ps value

  • Parameter 9-1:Homing return direction setting, the default value is 1

When the set value is 0, the homing direction is the current Ps value plus the upward direction (the origin is on the right)

When the set value = 1, the direction of homing is the direction of decreasing the current Ps value (the origin is on the left)

  • Parameter 10: Forward rotation movement correction value, default value=0

Note: Multi-axis linear interpolation command is invalid

Setting range: 32768~32767 Ps

  • When outputting forward rotation pulse wave, this value will be automatically added as the moving distance.
  • Parameter 11: Reverse movement compensation value, default value=0 Note: Multi-axis linear interpolation command is invalid

Setting range:-32768~32767 Ps

  • When the pulse output is reversed, this value will be automatically added as the moving distance.
  • Parameter 12: Deceleration time setting, the default value = 0, the unit is mS

Note: The multi-axis linear interpolation command is invalid

  • Setting range:0~30000 mS。
  • When parameter 12 = 0, use parameter 8 as the deceleration time.
  • When parameter 12 ≠ 0, use parameter 12 as the deceleration time.
  • Parameter 13: Interpolation acceleration and deceleration time (fixed number) setting, the default value is 500

Note: Multi-axis line tweening command is dedicated

  • Setting range: 0~30000 mS
  • It is used to set the time required to accelerate from stillness (speed=0) to the working frequency during linear interpolation motion; this time is also used for deceleration and stop control
  • Parameter 14: pulse number/1 revolution, the default value is 0
  • Setting range: 0~1999999。
  • When parameter 14 = 0, take parameter 1 as pulse number/1 revolution.
  • When parameter 14 ≠ 0, take parameter 14 as pulse number/1 revolution.
  • Parameter 15: Control interface I/O setting, the default value isFFFFFFFFH

b15 b8 b7 b0

SR+19

Parameter 15-1

Parameter 15-0

SR+20

Parameter 15-3

Parameter 15-2

  • Parameter 15-0: Proximity DOG input contact setting; must be the input point of the host (SR+19)

b6~b0 : Proximity DOG input contact number (0~15, namely X0~X15)

b7 = 0: Near-point DOG input is a normally open contact (A or NO contact)

= 1: The near-point DOG input is a normally closed contact (B or NC contact)

b7~b0=FFH, no near-point DOG input

  • Parameter 15-1: Travel limit input contact setting (SR+19)

b14~b8 : Travel limit input contact number (0~125, namely X0~X125)

b15 = 0: Travel limit input is a normally open contact (A or NO contact)

= 1: Travel limit input is a normally closed contact (B or NC contact)

b15~b8=FFH : No stroke limit input

FUN141

MPARA

MPARA

FUN141

MPARA

  • Parameter 15-2: Zero signal PG0 input contact setting; must be the input point of the host (SR+20)

b6~b0 : Zero signal PG0 input contact number (0~15, namely X0~X15)

b7 = 0 : The leading edge of near point DOG starts to count the zero point signal

= 1 : The trailing edge of the near point DOG starts to count the zero signal

b7~b0 = FFH : No zero signal PG0 input

  • Parameter 15-3: Zero reset signal CLR output contact setting; must be the output point of the host (SR+20)

b15~b8 : Output contact number of zero reset signal CLR (0~23, that is, Y0~Y23)

b15~b8=FFH : CLR output without reset signal

  • Parameter 16: Mechanical origin position value, the default value is 0

-999999~999999 Ps

  • Parameter 17: Zero point signal number, the default value is1

0~255 Count

7-16-6 STOP THE HSPSO PULSE OUTPUT (PSOFF)

FUN142 P

PSOFF

STOP THE HSPSO PULSE OUTPUT

FUN142 P

PSOFF

Symbol

N: 0~7

Enforce the Pulse Output PSOn (n= Ps) to stop

Range

Operand

K

Ps

0~7

Description

  • The positioning axis can be controlled up to PSO7, but the actual maximum axis number that can be controlled varies by model.
  • 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.
  • 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.

Example

Ladder diagram

ST

PSOFF( EN:= M0, Ps:= 0);

When M0 changes from 0→1, force Ps0 to stop pulse output.

7-16-7 Convert The Current Pulse Value to Display Value(PSCNV)

FUN143 P

PSCNV

CONVERT THE CURRENT PULSE VALUE TO DISPLAY VALUE

(mm, Deg, Inch, PS)

FUN143 P

PSCNV

Symbol

Ps : 0~3; it converts the number of the pulse position to be the mm (Deg, Inch, PS) that has same unit as the set value, so as to make current position displayed.

D : Register that stores the current position after conversion. It uses 2 registers, e.g. if D = D10, which means D10 is Low Word and D11 is High Word.

Range

Operand

HR

ROR

DR

K

R0

∣

R34767

R43224

∣

R47319

D0

∣

D7999

Ps

0~7

D

○

○*

○

2 word

Description

  • The positioning axis can be controlled up to PSO7, but the actual maximum axis number that can be controlled varies by model.
  • 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.
  • Only when the FUN140 instruction is executed, then it can get the correct conversion value by executing this instruction.

FUN143 P

PSCNV

CONVERT THE CURRENT PULSE VALUE TO DISPLAY VALUE

(mm, Deg, Inch, PS)

FUN143 P

PSCNV

Example

Ladder diagram

ST

PSCNV( EN:= M0, Ps:= 0, D:= D10);

When M0 changes from 0 to 1, convert the current pulse wave position of Ps0 (DR4088) into mm (or Deg or Inch or PS) with the same unit as the set value, and store it in DD10 as the current position display.

7-16-8 HIGH SPEED PULSE WIDTH MODULATION 2

FUN144

HSPWM2

HIGH SPEED PULSE WIDTH MODULATION 2

FUN144

HSPWM2

Symbol

PW:Output of pulse width modulation

0:Y0 & Y1

1:Y2 & Y3

2:Y4 & Y5

3:Y6 & Y7

4:MQ Y16 & Y17, Y8 & Y9 otherwise

5:MQ Y18 & Y19, Y10 & Y11 otherwise

6:MQ Y20 & Y21, Y12 & Y13 otherwise

7:MQ Y22 & Y23, Y14 & Y15 otherwise

Op:Output polarity (0=positive phase, 1=negative phase)

Hz:Output frequency (1~100000000 or 1~200000000, unit: 0.001Hz)

OR:Width of output pulse (0~100, unit: %)

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

D

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

Pw

○

○

○

○

○

○

○

○

○

○

○

○

○

0~7

Op

0~1

Hz

○

○

○

○

○

○

○

○

○

○

○

○

○

OR

○

○

○

○

○

○

○

○

○

○

○

○

○

0~100

FUN144

HSPWM2

HIGH SPEED PULSE WIDTH MODULATION 2

FUN144

HSPWM2

Description

  1. Compared with FUN139, FUN144 provides more direct and convenient high-speed PWM output control without calculating parameters through built-in formulas.
  2. If the maximum output frequency exceeds the maximum output frequency, it will not be executed.

7-17 Enable/Disable (FUN145~146)

7-17-1 ENABLE CONTROL OF THE INTERRUPT AND PERIPHERAL

FUN145 P

EN

ENABLE CONTROL OF THE INTERRUPT AND PERIPHERAL

FUN145 P

EN

Symbol

LBL : External input or peripheral label name that to be enabled.

Range

Operand

1-16

17-20

21-24

25-32

33-40

41

42

43-48

66-97

X0+I

∣

X7-I

STM0I

∣

STM3I

LTM0I

∣

LTM3I

HST0I

∣

HST7I

HSC0I

∣

HSC7I

COCPUI

LHMI

RHM0I

∣

RHM5I

X8+I

∣

X23-I

LB

○

○

○

○

○

○

○

○

○

Description

  • 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.
  • The enabled interrupt label name is as follows:(Please refer the section 5.3 for details).

FUN145 P

EN

ENABLE CONTROL OF THE INTERRUPT AND PERIPHERAL

FUN145 P

EN

Description

LBL name

Description

LBL name

Description

LBL name

Description

HSC0I

HSC0 High speed counter interrupt

X4−I

X4 negative edge interrupt

X11+I

X0 positive edge interrupt

HSC1I

HSC1 High speed counter interrupt

X5+I

X5 positive edge interrupt

X11−I

X0 negative edge interrupt

HSC2I

HSC2 High speed counter interrupt

X5−I

X5 negative edge interrupt

X12+I

X0 positive edge interrupt

HSC3I

HSC3 High speed counter interrupt

X6+I

X6 positive edge interrupt

X12−I

X0 negative edge interrupt

X0+I

X0 positive edge interrupt

X6−I

X6 negative edge interrupt

X13+I

X0 positive edge interrupt

X0−I

X0 negative edge interrupt

X7+I

X7 positive edge interrupt

X13−I

X0 negative edge interrupt

X1+I

X1 positive edge interrupt

X7−I

X7 negative edge interrupt

X14+I

X0 positive edge interrupt

X1−I

X1 negative edge interrupt

X8+I

X0 positive edge interrupt

X14−I

X0 negative edge interrupt

X2+I

X2 positive edge interrupt

X8−I

X0 negative edge interrupt

X15+I

X0 positive edge interrupt

X2−I

X2 negative edge interrupt

X9+I

X0 positive edge interrupt

X15−I

X0 negative edge interrupt

X3+I

X3 positive edge interrupt

X9−I

X0 negative edge interrupt

X16+I

X0 positive edge interrupt

X3−I

X3 negative edge interrupt

X10+I

X0 positive edge interrupt

X16−I

X0 negative edge interrupt

X4+I

X4 positive edge interrupt

X10−I

X0 negative edge interrupt

X17+I

X0 positive edge interrupt

FUN145 P

EN

ENABLE CONTROL OF THE INTERRUPT AND PERIPHERAL

FUN145 P

EN

Description

LBL name

Description

LBL name

Description

LBL name

Description

X17−I

X0 negative edge interrupt

STM0I

1 ms timer

STM0 interrupt

X18+I

X0 positive edge interrupt

STM1I

1 ms timer

STM1 interrupt

X18−I

X0 negative edge interrupt

STM2I

1 ms timer

STM2 interrupt

X19+I

X0 positive edge interrupt

STM3I

1 ms timer

STM3 interrupt

X19−I

X0 negative edge interrupt

LTM0I

10 ms timer

LTM0 interrupt

X20+I

X0 positive edge interrupt

LTM1I

10 ms timer

LTM1 interrupt

X20−I

X0 negative edge interrupt

LTM2I

10 ms timer

LTM2 interrupt

X21+I

X0 positive edge interrupt

LTM3I

10 ms timer

LTM3 interrupt

X21−I

X0 negative edge interrupt

HST0I

HST0 High speed counter interrupt

X22+I

X0 positive edge interrupt

HST1I

HST1 High speed counter interrupt

X22−I

X0 negative edge interrupt

HST2I

HST2 High speed counter interrupt

X23+I

X0 positive edge interrupt

HST3I

HST3 High speed counter interrupt

X23−I

X0 negative edge interrupt

FUN145 P

EN

ENABLE CONTROL OF THE INTERRUPT AND PERIPHERAL

FUN145 P

EN

  • 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.

Example

Ladder diagram

ST

IF M0 THEN

INTEnable( LB:= X0 + I );

END_IF

  • When M0 changes from 0→1, it allows X0 to send interrupt when X0 changes from 0→1. CPU can rapidly process the interrupt service program of X0+I.

7-17-2 DISABLE CONTROL OF THE INTERRUPT AND PERIPHERAL

FUN146 P

DIS

DISABLE CONTROL OF THE INTERRUPT AND PERIPHERAL

FUN146 P

DIS

Symbol

LBL : Interrupt label intended to disable or peripheral name to be disabled.

Range

Operand

1-16

17-20

21-24

25-32

33-40

41

42

43-48

66-97

X0+I

∣

X7-I

STM0I

∣

STM3I

LTM0I

∣

LTM3I

HST0I

∣

HST7I

HSC0I

∣

HSC7I

COCPUI

LHMI

RHM0I

∣

RHM5I

X8+I

∣

X23-I

LB

○

○

○

○

○

○

○

○

○

Description

  • When prohibit control “EN” =1 or changes from 0→1 ( P instruction), it disable the interrupt or peripheral operation designated by LBL.
  • The interrupt label name can be referred to in the section of FUN145.

FUN146 P

DIS

DISABLE CONTROL OF THE INTERRUPT AND PERIPHERAL

FUN146 P

DIS

  • 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.

Example

Ladder diagram

ST

IF M0 THEN

INTDisable( LB:= X2+I );

END_IF

  • When M0 changes from 0→1, it prohibits X2 from sending interrupt when X2 changes from 0→1.

7-18 NC Positioning Instructions II (FUN147~149)

7-18-1 Multi-Axis High Speed Pulse Output

FUN147

MHSPO

Multi-Axis High Speed Pulse Output

FUN147

MHSPO

Symbol

Ladder symbol

Gp: Group number (0~3)

SR: Starting register for positioning program (example explanation)

WR: Starting register for instruction operation (example explanation). It controls 9 registers, which the other program cannot repeat in using.

Range

Operand

R

IR

OR

ROR

DR

K

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

Gp

0~3

SR

○

○

○

○

○

WR

○

○

○

9 word

Description

Instruction Explanation

  • 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 tex 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.
  • 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)
  • 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.
  • When execution control “EN”=1, if the other FUN147/FUN140 instructions to control Ps0~3 are not active (corresponding status of Ps0=M9183, Ps1=M9184, Ps2=M9185, and Ps3=M9186 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=M9183, Ps1=M9184, Ps2=M9185, and Ps3=M9186 would be OFF), this instruction will acquire the pulse output right of positioning control once the controlling FUN147/FUN140 has released the control right.
  • When execution control input “EN” =0, it stops the pulse output immediately.
  • 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.
  • 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.)
  • While the pulse is in output transmitting, the output indication “ACT” is ON.
  • When there is execution error, the output indication “ERR” will be ON. (The error code is stored in the error code register.)
  • When each step of positioning point is complete, the output indication “DN” will be ON.
  • For more details of information, please refer to the function and application user manual.

7-18-2 MANUAL PULSE GENERATOR FOR POSITIONING

FUN148

MPG

MANUAL PULSE GENERATOR FOR POSITIONING

FUN148

MPG

Symbol

Sc: Source of high-speed counter; 0~7

Ps: Axis of pulse output; 0~3

Fo: Setting of output speed (2 registers)

Mr: Setting of multipliers (2 registers)

Mr+0: Multiplicand (Fa)

Mr+1: Dividend (Fb)

WR: Starting address of working registers, it needs 4 registers

Range

Operand

HR

ROR

DR

K

R0

∣

R3839

R5000

∣

R8071

D0

∣

D7999

Sc

○

○

○

0~7

Ps

○

○

○

0~7

Fo

○

○

○

2 word

Mr

○

○

○

2 word

WR

○

○*

○

4 word

FUN148

MPG

MANUAL PULSE GENERATOR FOR POSITIONING

FUN148

MPG

Description

  • Let this instruction be executed in 10mS fixed time interrupt service routine (PV value set 5,unit times is 10ms,total 50ms,LTM1I)、or by using the 0.1mS high speed timer to generate 10mS 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.
  • This instruction will use 4 Registers(WR), other instructions can’t share with.
  • Please refer to Chapter 13 “The NC Positioning Control of M Serial PLC”of Advanced Application user manual for further details.

…

FUN148

MPG

MANUAL PULSE GENERATOR FOR POSITIONING

FUN148

MPG

Example 1

Ladder diagram (sub)

ST

LBL (INIT)

MPARA( EN:=TRUE , Ps:=0 , SR:=R2000 );

MPARA( EN:=TRUE , Ps:=1 , SR:=R2100 );

D800 := 0;

D801 := 0;

RETURN;

LBL (LTM0I)

MPG( EN:= M500, Sc:= 0, Ps:= 0, Fo:= D600, Mr:= D700, WR:= D800, ACT=> M510);

MPG( EN:= M501, Sc:= 0, Ps:= 1, Fo:= D602, Mr:= D700, WR:= D810, ACT=> M511);

Ladder diagram (main)

ST

IF M9131 Then

CALL (INIT)

END_IF

IF X32 AND M100 Then

M500 := TRUE;

ELSE

M500 := FALSE;

END_IF

IF X33 AND M100 Then

M501 := TRUE;

ELSE

M501 := FALSE;

END_IF

IF X34 Then

D700 := 1;

D701 := 1;

END_IF

IF X35 Then

D700 := 10;

D701 := 1;

END_IF

IF X36 Then

D700 := 100;

D701 := 1;

END_IF

FUN148

MPG

MANUAL PULSE GENERATOR FOR POSITIONING

FUN148

MPG

X32: Select the 0st axis (Ps0)

X33: Select the 1st axis (Ps1)

X34: output magnification is 1

X35: output magnification is 10

X36: output magnification is 100

M100: Manual wheel action selection

DR2005: Maximum output frequency of axis 0 (parameter 4 of FUN141 command); 200K Hz

R2011: Acceleration and deceleration time of the 0th axis (parameter 8 of the FUN141 instruction); 30mS

DD600: 0th axis manual wheel actuation output frequency; 200K Hz

DR2105: The maximum output frequency of the first axis (parameter 4 of the FUN141 command); 200K Hz

R2111: Acceleration and deceleration time of the first axis (parameter 8 of FUN141 instruction); 30mS

DD602: 1st axis manual wheel actuation output frequency; 200K Hz

Example description: Put the manual wheel positioning processing instructions of Ps0 and Ps1 in the 50MSI timing interrupt processing program.

When X32=1 and M100=1, start Ps0 hand wheel positioning processing; each interval (50mS) will sample the hand wheel input pulse (from HSC0); if no pulse input is sampled, FUN148 The command will not output; if there is a sampled pulse wave input, the output pulse number will be calculated according to the multiplier setting (D700 and D701), and then the calculated output pulse number will be output at the output frequency set by DD600.

Output pulse number = (HSC0 input pulse number in interval time×D700)/D701

FUN148

MPG

MANUAL PULSE GENERATOR FOR POSITIONING

FUN148

MPG

Example 2

Ladder diagram (main)

ST

IF M1924 Then

CALL (INIT)

END_IF

IF X32 AND M100 Then

M500 := TRUE;

ELSE

M500 := FALSE;

END_IF

IF X33 AND M100 Then

M501 := TRUE;

ELSE

M501 := FALSE;

END_IF

IF X34 Then

D700 := 1;

D701 := 1;

END_IF

IF X35 Then

D700 := 10;

D701 := 1;

END_IF

IF X36 Then

D700 := 100;

D701 := 1;

END_IF

Ladder diagram (sub)

ST

LBL (INIT)

MPARA( EN:=TRUE , Ps:=0 , SR:=R2000 );

MPARA( EN:=TRUE , Ps:=1 , SR:=R2100 );

D800 := 0;

D801 := 0;

RETURN;

LBL (HSTAI)

MPG( EN:= M500, Sc:= 0, Ps:= 0, Fo:= D600, Mr:= D700, WR:= D800, ACT=> M510);

MPG( EN:= M501, Sc:= 0, Ps:= 1, Fo:= D602, Mr:= D700, WR:= D810, ACT=> M511);

FUN148

MPG

MANUAL PULSE GENERATOR FOR POSITIONING

FUN148

MPG


X32: Select the 0th axis (Ps0)

X33: Select the 1st axis (Ps1)

X34: output magnification is 1

X35: output magnification is 10

X36: output magnification is 100

M100: Manual wheel action selection

DR2005: Maximum output frequency of axis 0 (parameter 4 of FUN141 command); 200K Hz

R2011: Acceleration and deceleration time of the 0th axis (parameter 8 of the FUN141 instruction); 30mS

DD600: 0th axis manual wheel actuation output frequency; 200K Hz

DR2105: The maximum output frequency of the first axis (parameter 4 of the FUN141 command); 200K Hz

R2111: Acceleration and deceleration time of the first axis (parameter 8 of FUN141 instruction); 30mS

DD602: 1st axis manual wheel actuation output frequency; 200K Hz

Example description: Set the 0.1mS high-speed timer (HSTA) as a 50mS timer interrupt, and put the manual wheel positioning processing instructions of Ps0 and Ps1 in the HSTAI interrupt processing program.

When X33=1 and M100=1, start Ps1 hand wheel positioning processing; each interval (50mS) will sample the hand wheel input pulse (from HSC0); if no pulse input is sampled, FUN148 There will be no output for the command; if there is a sampled pulse wave input, the output pulse number will be calculated according to the multiplier setting (D700 and D701), and then the calculated output pulse number will be output at the output frequency set by DD602.

Output pulse number = (HSC0 input pulse number in interval time×D700)/D701

7-18-3 Arc High Speed Pulse Output

FUN149

AHSPO

Arc High Speed Pulse Output

FUN149

AHSPO

Symbol

Ladder symbol

SR: Start Address of Register for Positioning Process.

WR: Working Address of Register for Operating.

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

R

IR

OR

SR

ROR

DR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

SR

○

○

○

○

○

○

○

○

○

○

○

○

○

WR

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • The Function 149 (AHSPO) command is to edit the motion parameters in a table, you can use any two axes in Ps0~Ps7 as the pulse output axis, when it is used as the output axis of fun149, it will not be used by other functions, and the output axis func149 occupied by other functions cannot be used.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.
  • This command sets the target point in a table and divides it into three modes: radius, center of circle, and point for circular interpolation motion.
  • Each target point in the motion interpolation is called a step (including parameters such as motion mode, distance, vector of speed, and change conditions), and each step requires 40 16-bit registers, and a maximum of 250 steps can be edited.
  • Once the parameters are set, the pulse output is activated using the pin, and the output pin, WR register, and associated relay/register are displayed in real time during the process.
  • During the motion interpolation of the pulse wave, the user can also use the transition condition and the change condition to achieve a specific goal.
  • When input "EN"=1, the pulse output starts, and the next step will be executed according to the change conditions when one step is completed.
  • When "EN" = 0 is input, the pulse output will be stopped, and the next "EN" ON will be performed again from the first step.
  • When "PAU" = 1 and "EN" was previously 1, the pulse is temporarily output.
  • When "PAU" = 0 and "EN" is still 1, the unfinished pulse output of the previous step continues.
  • When input "ABT" = 1, the pulse output will be stopped.
  • When "ABT" = 0 and "EN" = 1 is entered, the execution starts from the first step.
  • When the pulse wave is output, the output indicates "ACT" ON.
  • When an error occurs in pulse execution, the output indicates "ERR" ON and the pulse will stop outputing.
  • When each step is completed, the output indicates "DN" ON.
  • For more details of information, please refer to the function and application user manual.

7-19 Communication Instruction (FUN150~156)

7-19-1 MODBUS MASTER INSTRUCTION(M-BUS)

FUN150

M-BUS

MODBUS MASTER INSTRUCTION

(WHICH MAKES PLC AS THE MODBUS MASTER THROUGH PORT 1~2)

FUN150

M-BUS

Symbol

Pt :1~4, specify the communication port being acted as the Modbus master

SR:Starting register of communication program

WR : Starting register for instruction operation. It controls 8 registers, the other programs can not repeat in using.

Range

Operand

HR

IR

OR

ROR

DR

K

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

Pt

1-4

SR

○

○

○

○

○

WR

○

○*

○

Description

  • FUN150 (M-BUS) instruction makes PLC act as Modbus master through Port 1~2, thus it is very easy to communicate with the intelligent peripheral with Modbus RTU/ASCII protocol.
  • The master PLC may connect with 247 slave stations through the RS-485 interface.
  • Only the master PLC needs to use Modbus RTU/ASCII instruction.
  • 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 7 registries to make definition; every 7 registers define one packet of data transaction.

FUN150

M-BUS

MODBUS MASTER INSTRUCTION

(WHICH MAKES PLC AS THE MODBUS MASTER THROUGH PORT 1~2)

FUN150

M-BUS

Description

  • When execution control〝EN〞changes from 0→1 and Abort“ABT”is 0, and if Port 1/2 hasn’t been controlled by other communication instructions [i.e. M9135(Port1) / M9138(Port2)], this instruction will control the Port 1/2 immediately and set the M9135/M9138 to be 0 (which means it is being occupied), then going on a packet of data transaction immediately. If Port 1/2 has been controlled (M9135/M9138 = 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 (M9135/M9138 =1), and then this instruction will become enactive, set M9135/M9138 to be 0, and going on the data transaction immediately.。
  • While in transaction processing, if operation control “ABT” becomes 1, this instruction will abort this transaction immediately and release the control right (M9135/M9138 = 1). Next time, when this instruction takes over the transmission right again, it will restart from the first packet of data transaction.。
  • While〝A/R〞=0,Modbus RTU protocol;〝A/R〞=1,Modbus ASCII protocol.
  • While it is in the data transaction, the output indication “ACT” will be ON.
  • If there is error occurred when it finishes a packet of data transaction, the output indication “DN” & “ERR” will be ON.
  • If there is no error occurred when it finishes a packet of data transaction, the output indication “DN” will be ON.
  • For detailed application examples, please refer to Chapter 11 "Ethernet Function and Ethernet Communication" of the Advanced Software User Manual.

7-19-2 COMMUNICATION LINK INSTRUCTION (CLINK)

FUN151

CLINK

COMMUNICATION LINK INSTRUCTION

(WHICH MAKES PLC ACT AS THE MASTER STATION IN CPU LINK NETWORK THROUGH PORT 1~4)

FUN151

CLINK

Symbol

Pt: Assign the port, 1~4

MD: Communication mode, MD0~MD5

#MD3 is only for Port2.

SR: Starting register of communication table

WR: Starting register for instruction operation. It controls 8 register, the other programs can not repeat in using.

Range

Operand

HR

HR

HR

ROR

DR

K

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

Pt

1-4

MD

0-5

SR

○

○

○

○

○

WR

○

○*

○

FUN151

CLINK

COMMUNICATION LINK INSTRUCTION

(WHICH MAKES PLC ACT AS THE MASTER STATION IN CPU LINK NETWORK THROUGH PORT 1~4)

FUN151

CLINK

Description

  • This instruction provides MD0~MD1. The following are the function description of respective modes.
  • FUN151 (CLINK) : MD 0, it makes PLC act as the master of FATEK CPU Link Network through Port 1~2
  • The master PLC may connect with 254 slave stations through the RS485 interface.
  • Only the master PLC needs to use FUN151 instruction, the slave doesn’t need.
  • 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 7 registries to make definition; every 7 registers define one packet of data transaction.
  • When execution control〝EN〞changes from 0→1 and both inputs“PAU”and “ABT”are 0, and if Port 1/2 hasn’t been controlled by other communication instructions [i.e. M9135 (Port1) / M9138 (Port2) = 1], this instruction will control the Port 1/2 immediately and set the M9135/M9138 to be 0 (which means it is being occupied), then going on a packet of data transaction immediately. If Port 1/2 has been controlled (M9135/M9138= 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 (M9135/M9138 =1), and then this instruction will become enactive, set M9135/M9138 to be 0, and going on the data transaction immediately.
  • While in transaction processing, if operation control“PAU”becomes 1, this instruction will release the control right (M9135/M9138 = 1) after this transaction. Next time, when this instruction takes over the transmission right again, it will restart from the next packet of data transaction.
  • While in transaction processing, if operation control“ABT”becomes 1, this instruction will abort this transaction immediately and release the control right (M9135/M9138 = 1). Next time, when this instruction takes over the transmission right again, it will restart from the first packet of data transaction.
  • While it is in the data transaction, the output indication“ACT”will be ON.
  • If there is error occurred when it finishes a packet of data transaction, the output indication“DN”&“ERR”will be ON.
  • If there is no error occurred when it finishes a packet of data transaction, the output indicatio “DN”will be ON.
  • Please refer to Chapter 10-2 “The Applications for M-Series PLC Communication Link”.

7-19-3 Network Active Communication (NCR)

FUN152

NCR

Network Active Communication

FUN152

NCR

Symbol

D:\patrick\說明書翻譯\圖\NCR.png

SR: Table starting register address

MD: Modbus TCP active communication (=1,2)

WR: Working register

Range

Operand

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R35151

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

SR

○

○

○

○

○

○

○

○

○

○*

○*

○

MD

1,2

WR

○

○

○

○

○

○

○

○

○

○*

○*

○

Description

  • The FUN152 (NCR) command is connected to the smart peripheral (slave station) with the Modbus communication protocol through the Ethernet port.
  • This command is mainly based on the specified form, such as using the Modbus Master TCP form, read or write according to the specified form, and actively carry out network communication. The communication form must be set before use; only six registers are defined, and every 6 registers define a transfer transaction.
  • When EN is ON for this command, the communication will continue.
  • When the data transaction is being transmitted, the output indication "ACT" is ON.
  • For more details of information, please refer to the function and application user manual.

FUN152

NCR

Network active communication

FUN152

NCR

Example

Slave Station (IP: 192.168.0.151) 400101~ 400105 ->

Master Station (IP: 192.168.0.150) R100~R104

Ladder diagram

ST

NCR( EN:= M1, SR:= R1000, MD:= 1, WR:= R1500, ACT=> M11, ERR=> M12, DN=> M13);

Description

  • When the input control "EN" changes from 0 to 1, based on the settings in the Modbus TCP table, the remote IP slave station reads the register data and stores it in the PLC master station, and continuously completes the data transaction.
  • The setting steps are as follows.
  • First add the Modbus Master form in the data form.
  • In the Modbus Master form, define the remote IP and Port, and the address to be read and written, including the data of the master station and the data of the slave station.
  • Edit the Fun152 NCR instruction on the Ladder of the master station.

7-19-4 CMCTL

FUN156P

CMCTL

CMCTL

FUN156P

CMCTL

Symbol

D:\patrick\說明書翻譯\圖\CMCTL.png

ID : Used module number

Pt : Appointed COMA/COMB (A= 0;B=1)

Ts : Communication table mask

Bit 1 : Table 1

Bit 2 : Table 2

|

Bit 15 : Table 15

Bit 16~Bit 31 : Reserved. Do not use.

MD : Set mode

0 : RUN ONCE

1 : RUN CYCLING

2 : STOP

WR : Saving operations state

Bit0~Bit1 : Table 0 state

Bit2~Bit3 : Table 1 state

Bit30~Bit31 : Table 15 state

= 0 : RUN_ONCE

= 1 : RUN_CYCLING

= 2 : STOP,

Range

Operand

HR

IR

OR

SR

ROR

DR

K

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

0-5

Pt

0-1

Ts

○

○*

○

0-65535

MD

○

○

○

○

○

○

0-63

WR

○

○

○

5word

FUN156P

CMCTL

CMCTL

FUN156P

CMCTL

Description

Such command should be used with the CM25 and CM55 communication modules. Before each use, it is required to set up the communication module data.

  • EN OFF->ON will carry out communication control, ON->OFF will stop
  • PAU is not yet supported
  • The communication status code of each table will be updated in the allocated status register, and the address can be confirmed by using the device view

FUN156:WR Description

Bit0

Table0 Status

Table0 = 0(00): RUN_ONCE

= 1(01): RUN_CYCLING

= 2(10): STOP

Bit1

Bit2

Table1 Status

Table1 = 0(00): RUN_ONCE

= 1(01): RUN_CYCLING

= 2(10): STOP

Bit3

Bit4

Table2 Status

Table2 = 0(00): RUN_ONCE

= 1(01): RUN_CYCLING

= 2(10): STOP

Bit5

Bit6

Table3 Status

Table3 = 0(00): RUN_ONCE

= 1(01): RUN_CYCLING

= 2(10): STOP

Bit7

……

Bit30

Bit31

Table15 Status

Table15 = 0(00): RUN_ONCE

= 1(01): RUN_CYCLING

= 2(10): STOP

Reserved after Bit32

FUN156P

CMCTL

CMCTL

FUN156P

CMCTL

Example

Ladder diagram

ST

CMCTL( EN:= M0, PAU:= M1, ID:= 0, Pt:= 0, Ts:= 3, MD:= 1, WR:= R0, ERR=> M2);

As indicated in the figure above, when M0 becomes 1, the command will open Port 0 of the No. #0 module and then start the communication according to Table 1 and Table 2 (0001b+0010b=0011b and then 3(10) is obtained). Next, select RUN CYCLING Mode and then RO for use as the working register.

7-20 Data Movement Instructions (FUN160~162)

7-20-1 Read/Write File Register

FUN160D P

RWFR

Read/Write File Register

FUN160D P

RWFR

Symbol

Sa : Starting address of data register

Sb : Starting address of file register

Pr : Record pointer register

L : Quantity of register to form a record, 1~511

Sa operand can combine V、Z、P0~P9 for index addressing.

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

FR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

|

D7999

V, Z

P0 ~ P9

F0

|

F32767

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

Pr

○

○

○

○

○

○

○

○

○

○*

○*

○

L

○

○*

○

1-511

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:

FUN160D P

RWFR

Read/Write File Register

FUN160D P

RWFR

  • 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).

Example 1

Ladder diagram

ST

ReadWriteFileReg( EN:=M0,

R_W:= FALSE,

INC:= TRUE,

Sa:= R0,

Sb:= F100,

Pr:= D0,

L:= 50);

  • When M0 changes from 0🡪1, if D0 =2, the contents of file registers F200~F249 will be overwritten by the content of data registers R0~R49. the record length is 50.
  • Pointer will be increased by 1 after operation.

FUN160D P

RWFR

Read/Write File Register

FUN160D P

RWFR

Example 2

Ladder diagram

ST

ReadWriteFileReg( EN:=M0,

R_W:= TRUE,

INC:= TRUE,

Sa:= R0,

Sb:= F100,

Pr:= D0,

L:= 50);

  • When M0 changes from 0🡪1, if D0 = 1, the content of data registers R0~R49 will be overwritten by the file registers F150~F199.
  • The record pointer will be increased by 1 after operation.

7-20-2 Write SD Card (WR-MP)

FUN161P

WR-MP

Write Data Record into the MEMORY_PACK

(Write memory pack)

FUN161P

WR-MP

Symbol

S:Starting address of the source data

BK:Block number of the MEMORY_PACK,0~1

Os:Offset of the block

Pr:Address of the pointer

L:Quantity of writing,1~128

WR:Starting address of working registers, it takes 2 registers

S may combine with V、Z、P0~P9 for indirect addressing application.

Range

Operand

HR

IR

OR

SR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

|

D7999

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

Bk

0-3

Os

○

○

○

0-32511

Pr

○

○

○

○

○*

○

L

○

○

○

○

○*

○

1-128

WR

○

○*

○

FUN161P

WR-MP

Write Data Record into the MEMORY_PACK

(Write memory pack)

FUN161 P

WR-MP

Description

  • The main purpose of the MEMORY_PACK of M-Series PLC is used for long term storing of the user’s ladder program, except this, through this instruction, 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 :

  • When input "INC" = 1, the content of the pointer will be increased by one after the execution of writing, it points to next record.
  • 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.

FUN161P

WR-MP

Write Data Record into the MEMORY_PACK

(Write memory pack)

FUN161P

WR-MP

  • 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.
  • M-Series PLC 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

Writing the record into block 1 with the different length

Ladder diagram

ST

WriteSDMem( EN:= M0, INC:= M1, S:= R0, Bk:= 1, Os:= 0, Pr:= D1, L:= 20, WR:= R2900, ACT=> M100, ERR=> M101, DN=> M102);

WriteSDMem( EN:= M2, INC:= M3, S:= R100, Bk:= 1, Os:= 10000, Pr:= D2, L:= 50, WR:= R2910, ACT=> M103, ERR=> M104, DN=> M105);

FUN161P

WR-MP

Write Data Record into the MEMORY_PACK

(Write memory pack)

FUN161P

WR-MP

7-20-3 Read SD Card (RD-MP)

FUN162 P

RD-MP

Read Data Record from the MEMORY_PACK

(Read memory pack)

FUN162 P

RD-MP

Symbol

BK:Block number of the MEMORY_PACK,0~1

Os:Offset of the block

Pr:Address of the pointer

L:Quantity of reading,1~128

D:Starting address to store the reading record

Range

Operand

HR

IR

OR

SR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

|

D7999

V, Z

P0 ~ P9

Bk

0-3

Os

○

○

○

0-32511

Pr

○

○

○

○

○*

○

L

○

○

○

○

○*

○

1-128

D

○

○*

○

○

Description

  • If the MEMORY_PACK of the M-Series PLC 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 :

FUN162 P

RD-MP

Read Data Record from the MEMORY_PACK

(Read memory pack)

FUN162 P

RD-MP

  • When input "INC"=1, the content of the pointer will be increased by one after the execution of reading, it points to next record.
  • 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.

FUN162 P

RD-MP

Read Data Record from the MEMORY_PACK

(Read memory pack)

FUN162 P

RD-MP

Example

Reading the record from block 1 with the different length

※ It is necessary that correct data in MEMORY_PACK or this example can’t execute correctly.

Ladder diagram

ST

ReadSDMem( EN:=M10,

INC:= M11,

Bk:= 1,

Os:=0,

Pr:= D10,

L:= 20,

D:= R0,

ERR=> M110);

ReadSDMem( EN:=M12,

INC:= M13,

Bk:= 1,

Os:= 10000,

Pr:= D11,

L:= 50,

D:= R100,

ERR=> M111);

7-21 In Line Comparison Instruction (FUN170~175)

7-21-1 Equal To Compare

FUN170 D

=

EQUAL TO COMPARE

(Compare whether Sa is equal to Sb)

FUN170 D

=

Symbol

D:\patrick\說明書翻譯\圖\=.png

Sa:Operand A or the starting address of Sa

Sb:Operand B or the starting address of Sb

Sa、Sb may combine with V、Z、P0~P9 for indirect addressing application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM91200

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • 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.

FUN170 D

=

EQUAL TO COMPARE

(Compare whether Sa is equal to Sb)

FUN170 D

=

Example 1

Ladder diagram

ST

IF R0 = R2 AND R4 = R6 AND M0 Then

Y0 := TRUE;

ELSEIF R0 = R2 AND R8 = R10 AND M1 Then

Y1 := TRUE;

ELSE

Y0 := FALSE;

Y1 := FALSE;

END_IF

Description: When R0=R2、R4=R6 and M0=1, the output status of Y0 is 1; otherwise it is 0. R0=R2、R8=R10 and M1=1, the output status of Y1 is 1; otherwise it is 0.

FUN170 D

=

EQUAL TO COMPARE

(Compare whether Sa is equal to Sb)

FUN170 D

=

Example 2

Ladder diagram

ST

IF DR600 = DR602 OR DR604 > DR606 Then

IF (DR608 < DR610 AND DR616 >= DR618) OR (DR612 <> DR614 AND DR620 <= DR622) OR (M200 AND M201) Then

IF M100 Then

Y10 := TRUE;

END_IF

END_IF

ELSE

Y10 := FALSE;

END_IF

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-21-2 GREATER THAN COMPARE

FUN171 D

>

GREATER THAN COMPARE

(Compare whether Sa is greater than Sb)

FUN171 D

>

Symbol

D:\patrick\說明書翻譯\圖\greater.png

Sa:Operand A or the starting address of Sa

Sb:Operand B or the starting address of Sb

Sa、Sb may combine with V、Z、P0~P9 for indirect addressing application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM91200

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • 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

Ladder diagram

ST

IF M10 AND (R20 > R22 OR M11) Then

Y2 := TRUE;

ELSE

Y2 := FALSE;

END_IF

Description: When M10=1、R20 > R22 or M11=1, the output status of Y2 is 1; otherwise it is 0.

FUN171 D

>

GREATER THAN COMPARE

(Compare whether Sa is greater than Sb)

FUN171 D

>

Example 2

Ladder diagram

ST

IF DR600 = DR602 OR DR604 > DR606 Then

IF (DR608 < DR610 AND DR616 >= DR618) OR (DR612 <> DR614 AND DR620 <= DR622) OR (M200 AND M201) Then

IF M100 Then

Y10 := TRUE;

END_IF

END_IF

ELSE

Y10 := FALSE;

END_IF

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-21-3 LESS THAN COMPARE

FUN172 D

<

LESS THAN COMPARE

(Compare whether Sa is less than Sb)

FUN172 D

<

Symbol

D:\patrick\說明書翻譯\圖\172.png

Sa:Operand A or the starting address of Sa

Sb:Operand B or the starting address of Sb

Sa、Sb may combine with V、Z、P0~P9 for indirect addressing application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM91200

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • 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.

FUN172 D

<

LESS THAN COMPARE

(Compare whether Sa is less than Sb)

FUN172 D

<

Example 1

Ladder diagram

ST

IF M10 AND (R20 < R22 OR M11) Then

Y2 := TRUE;

ELSE

Y2 := FALSE;

END_IF

Description: When M10=1、R20 < R22 or M11=1, the output status of Y2 is 1; otherwise it is 0.

FUN172 D

<

LESS THAN COMPARE

(Compare whether Sa is less than Sb)

FUN172 D

<

Example 2

Ladder diagram

ST

IF DR600 = DR602 OR DR604 > DR606 Then

IF (DR608 < DR610 AND DR616 >= DR618) OR (DR612 <> DR614 AND DR620 <= DR622) OR (M200 AND M201) Then

IF M100 Then

Y10 := TRUE;

END_IF

END_IF

ELSE

Y10 := FALSE;

END_IF

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-21-4 Not Equal To Compare

FUN173 D

<>

NOT EQUAL TO COMPARE

(Compare whether Sa is not equal to Sb)

FUN173 D

<>

Symbol

D:\patrick\說明書翻譯\圖\173.png

Sa:Operand A or the starting address of Sa

Sb:Operand B or the starting address of Sb

Sa、Sb may combine with V、Z、P0~P9 for indirect addressing application

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM91200

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • 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.

FUN173 D

<>

NOT EQUAL TO COMPARE

(Compare whether Sa is not equal to Sb)

FUN173 D

<>

Example 1

When M10=1 and R20≠R22 or M11=1, the output Y2 is 1; otherwise it is 0.

Ladder diagram

ST

IF M10 AND (R20 <> R22 OR M11) Then

Y2 := TRUE;

ELSE

Y2 := FALSE;

END_IF

FUN173 D

<>

NOT EQUAL TO COMPARE

(Compare whether Sa is not equal to Sb)

FUN173 D

<>

Example 2

Ladder diagram

ST

IF DR600 = DR602 OR DR604 > DR606 Then

IF (DR608 < DR610 AND DR616 >= DR618) OR (DR612 <> DR614 AND DR620 <= DR622) OR (M200 AND M201) Then

IF M100 Then

Y10 := TRUE;

END_IF

END_IF

ELSE

Y10 := FALSE;

END_IF

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-21-5 GREATER THAN OR EQUAL TO COMPARE

FUN174 D

>=

GREATER THAN OR EQUAL TO COMPARE

FUN174 D

>=

Symbol

D:\patrick\說明書翻譯\圖\174.png

Sa:Operand A or the starting address of Sa

Sb:Operand B or the starting address of Sb

Sa、Sb may combine with V、Z、P0~P9 for indirect addressing application.

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM91200

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • 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

When M10=1 and R20≧R22 or M11=1, the output Y2 is 1; otherwise it is 0.

Ladder diagram

ST

IF M10 AND (R20 >= R22 OR M11) Then

Y2 := TRUE;

ELSE

Y2 := FALSE;

END_IF

FUN174 D

>=

GREATER THAN OR EQUAL TO COMPARE

FUN174 D

>=

Example 2

Ladder diagram

ST

IF DR600 = DR602 OR DR604 > DR606 Then

IF (DR608 < DR610 AND DR616 >= DR618) OR (DR612 <> DR614 AND DR620 <= DR622) OR (M200 AND M201) Then

IF M100 Then

Y10 := TRUE;

END_IF

END_IF

ELSE

Y10 := FALSE;

END_IF

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-21-6 LESS THAN OR EQUAL TO COMPARE

FUN175 D

=<

LESS THAN OR EQUAL TO COMPARE

FUN175 D

=<

Symbol

D:\patrick\說明書翻譯\圖\175.png

Sa:Operand A or the starting address of Sa

Sb:Operand B or the starting address of Sb

Sa、Sb may combine with V、Z、P0~P9 for indirect addressing application.

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM91200

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • 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.

FUN175 D

=<

LESS THAN OR EQUAL TO COMPARE

FUN175 D

=<

Example 1

When M10=1 and R20≦R22 or M11=1, the output Y2 is 1; otherwise it is 0.

Ladder diagram

ST

IF M10 AND (R20 <= R22 OR M11) Then

Y2 := TRUE;

ELSE

Y2 := FALSE;

END_IF

FUN175 D

=<

LESS THAN OR EQUAL TO COMPARE

FUN175 D

=<

Example 2

Ladder diagram

ST

IF DR600 = DR602 OR DR604 > DR606 Then

IF (DR608 < DR610 AND DR616 >= DR618) OR (DR612 <> DR614 AND DR620 <= DR622) OR (M200 AND M201) Then

IF M100 Then

Y10 := TRUE;

END_IF

END_IF

ELSE

Y10 := FALSE;

END_IF

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-22 Motion Control Instructions

7-22-1 Running motion process (MFFlowStart)

FUN176

MFFlowStart

Start motion process

FUN176

MFFlowStart

Symbol

If different axes should be activated at the same time, do not use the ID repeatedly.

ID: The ID number of the motion process to be started.

EN: = 1. Means the motion process defined by the command will be started.

ACT: = 1. Means the system is running the defined motion process.

ERR: = 1. Means error is found in the motion process.

DN: =1. Means the motion process is completed.

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

Example

Ladder diagram

ST

MFFlowStart ( EN:= M70, ID:= 1, ACT=> M71, ERR=> M72, DN=> M73);

IF M73 Then

M70 := FALSE;

END_IF

  • When the execution control "EN" = 1, the motion flow ID 1 will be executed.
  • If there is no ID 1 motion flow, ERR = 1 will be triggered.

7-22-2 Stop all motion processes (MFSysStop)

FUN177

MFSysStop

Stop all motion processes

FUN177

MFSysStop

Symbol

No operands

Description

  • Interrupt all motion processes and stop EtherCAT communication. If you want to restart the process, you need to start the EtherCAT communication in MFSysInit.
  • EN = 1: Interrupt all motion processes and motion control system emergency stop
  • ACT = 1: The system is in emergency stoping
  • ERR = 1: system emergency stop error
  • DN = 1: The system has completed emergency stop

Example

Ladder diagram

ST

MFSysStop ( EN:= M10, ACT=> M11, ERR=> M12, DN=> M13);

  • When the execution control "EN" = 1, the motion control will be stopped immediately.
  • If you want to restart the operation after execution, you need to perform initialization and start.

7-22-3 Home re-set (MFHome)

FUN178

MFHome

Home re-set (MFHome)

FUN178

MFHome

Symbol

AX: Means the axis where the Home re-setting will be executed.

Relay and Register

Operand

HR

ROR

DR

K

Range

R0

∣

R34767

R43224

∣

R47319

D0

∣

D7999

AX

○

○

○

1~16

Description

Specify the motion axis to perform homing.

  • EN = 1: trigger homing
  • ACT = 1: Return-to-origin is in progress
  • ERR = 1: Return-to-origin action error
  • DN = 1: Return-to-origin is completed
  • AX: Axis to execute

Special register

Axis 1: In return-to-origin operation M10621

Axis 1: Return to origin completed M10622

For the modes and details of the HOME command, please refer to Chapter 10.

FUN178

MFHome

Home re-set (MFHome)

FUN178

MFHome

Example

Ladder diagram

ST

MFHome ( EN:= M98, AX:= 1, ACT=> M99, ERR=> M100, DN=> M101);

  • When the execution control "EN" = 1, the origin return will be performed according to the parameters on the motion axis setting page.

7-22-4 Position Control (MFPointMov)

Fun179 P

MFPointMov

Position Control (MFPointMov)

Fun179 P

MFPointMov

Symbol

PT: Command number of motion point table

AX: Motion control axis number

Relay and Register

Type

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

Range

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~256

AX

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

Description

Execute the point table position control instruction.

  • EN = 1: trigger position control
  • ACT = 1: position control action
  • ERR = 1: position control error
  • DN = 1: The position control action is completed
  • PT: Select the point of the movement point parameter
  • AX: Axis to execute

Special registers:

  • Axis 1: Position control action M10623
  • Axis 1: Position control action completed M10624

Fun179 P

MFPointMov

Position Control (MFPointMov)

Fun179 P

MFPointMov

Example

Ladder diagram

ST

MFPointMov ( EN:= M85, PT:= 3, AX:= 1, ACT=> M86, ERR=> M87, DN=> M88);

  • When the execution control "EN" = 1, the axis specified by AX will execute the point table with the number specified by PT.
  • When the execution control "EN" = 0, the movement will stop immediately.
  • The following table is used as an example. When PT = 1 and AX = 1, axis 1 will run according to the parameters in point table 1;

However, if PT=2 and AX=1 was set, it will fail due to the difference from the point table setting, and ERR will be triggered.

Axis

1

M: Axis_1

2

M: Axis_2

3

M: Axis_1

7-22-5 JOG (MFJog)

Fun180

MFJog

JOG (MFJog)

Fun180

MFJog

Symbol

AX: Means the axis where JOG action will be executed.

MD: Mode of execution

Relay and Register

Type

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

Range

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

AX

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

MD

○

○

○

○

○

○

○

○

○

○

○

○

○

0~3

Fun180

MFJog

JOG (MFJog)

Fun180

MFJog

Description

According to the JOG parameter and mode setting, the specified motion axis executes the JOG function.

  • EN = 1: trigger manual control
  • D/R = 1 forward / = 0 reverse
  • ACT = 1: JOG action
  • ERR = 1: JOG error
  • DN = 1: JOG action completed
  • AX: Axis to execute
  • MD: mode 0~mode 3

Mode 0: Continue to advance at the JOG start speed.

Mode 1: Advance at JOG start speed, advance the jogging distance and then stop.

Mode 2: Start at the JOG start speed, accelerate to the JOG speed with the JOG acceleration and continue moving forward.

Mode 3: Start at the JOG start speed, accelerate to the JOG speed with the JOG acceleration, and stop after moving forward.

Special registers

  • Axis 1: JOG action M10625
  • Axis 1: JOG completed M10626

Please refer to Chapter 11 for JOG instruction modes and details.

Fun180

MFJog

JOG (MFJog)

Fun180

MFJog

Example

Ladder diagram

ST

MFJog ( EN:= M93, D_R:= M94, AX:= 1, MD:= 1, ACT=> M95, ERR=> M96, DN=> M97);

  • When the execution control "EN" = 1, the axis specified by AX will execute the mode specified by MD.
  • When the execution control "EN" = 0, the movement will stop immediately.
  • Take the following table as an example. When AX = 1 and MD = 1, it means axis 1 will run a distance of 100mm at a speed of 1mm/s.

Axis 1

JOG Start Speed

1mm/s

JOG Speed

10mm/s

JOG Acceleration

1000mm/s²

JOG Deceleration

1000mm/s²

Jog Distance

100mm

7-22-6 Change motion control parameters (MFChgTbPrm)

FUN181

MFChgTbPrm

Change block parameters (MFChgTbPrm)

FUN181

MFChgTbPrm

Symbol

TM: Flow Block Table

PN: The number of blocks

S: Item Number

PV: Written value

Range

Operand

HR

ROR

DR

K

R0

∣

R34767

R43224

∣

R47319

D0

∣

D7999

TM

0~128

PN

1~4096

S

○

○

○

0~50

PV

○

○

○

-2147483648~2147482647

Description

  • [Fun181 Change Motion Control Parameters] is used to change a single or a few motion control parameters. If you need to read or write a large number of motion control parameters, you can use [Fun188 Recipe Read] and [Fun189 Recipe Write].
  • Operands TM table number: 0 point table, 1 axis table, 2 synchronization table, 128 flow table.

PN point number: Correspond to different types of numbers according to the table to be modified by TM, point table number, axis number, process block number.

S item number: please refer to the table below

PV write value: the value to be written, fixed Double Word.

  • When the execution control [EN] is triggered by the upper differential, Fun181 will write the PV value into the specified motion control parameter.
  • When the execution control [EN] is triggered by the lower differential, all output indications are reset.
  • When writing motion control parameters, if there is an error, the output indication [ERR] will be ON.
  • When the writing of motion control parameters is completed, the output indication【DN】ON.

FUN181

MFChgTbPrm

Change block parameters (MFChgTbPrm)

FUN181

MFChgTbPrm

Example

Ladder diagram

ST

MFChgTbPrm ( EN:= M1000, TM:= 0, PN:= 1, S:= 2, PV:= 1000000, ERR=> M1001, DN=> M1002);

  • When M1000 OFF→ON, change the point table parameters (TM: 0 point table, PN: 1 point table 1, S: 2 spindle coordinates, PV: change to 1000.000mm), and the spindle movement distance of point table 1 is changed to 1000.000 mm.

7-22-7 Pause Motion Flow (MFFlowPause)

FUN182 P

MFFlowPause

Pause Motion Flow (MFFlowPause)

FUN182 P

MFFlowPause

Symbol

ID: The motion process to be paused.

Relay and Register

Type

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

Range

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

Description

Pause the motion process of the specified ID, and stop after executing the current process block,

To resume a paused motion process, you can use Fun183 MFFlowResume to resume execution.

  • EN = 1: Stop entering the next step after executing the current process block
  • ACT = 1: pause action
  • ERR = 1: timeout error
  • DN = 1: Pause completed
  • ID: UID of the motion process to be paused

FUN182 P

MFFlowPause

Pause Motion Cycle (MFFlowPause)

FUN182 P

MFFlowPause

Example

Ladder diagram

ST

MFFlowPause ( EN:= M73, ID:= 1, ACT=> M74, ERR=> M75, DN=> M76);

IF M76 Then

M73 := FALSE;

END_IF

  • When the execution control "EN" = 1, it will pause and not execute the next step after executing the current motion flow block.

7-22-8 Resume Motion Process (MFFlowResume)

FUN183 P

MFFlowResume

Resume Motion Process (MFFlowResume)

FUN183 P

MFFlowResume

Symbol

ID: Means the motion process to be resumed.

Relay and Register

Type

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

Range

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

Description

Resume the paused or interrupted motion process and continue execution.

  • EN = 1: resume motion flow
  • ACT = 1: resume motion flow in action
  • ERR = 1: Resume movement flow error
  • DN = 1: The motion flow resume is completed

FUN183 P

MFFlowResume

Resume Motion Process (MFFlowResume)

FUN183 P

MFFlowResume

Example

Ladder diagram

ST

ME_RESUME( EN:= M77, ID:= 1, ACT=> M75, ERR=> M76, DN=> M78);

IF M78 Then

M77 := FALSE;

END_IF

  • When the execution control "EN" = 1, the motion process suspended due to the execution of Fun182 (MFFlowPause) or Fun184 (MFFlowHalt) will be resumed.

7-22-9 Motion Process Halt (MFFlowHalt)

FUN184 P

MFFlowHalt

Motion Process Halt (MFFlowHalt)

FUN184 P

MFFlowHalt

Symbol

ID: Means the motion process to be suspended.

Relay and Register

Type

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

Range

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

Description

Immediately stops the currently executing process block,

If you want to continue the stopped motion process, you can use Fun183 MFFlowResume to resume execution.

  • EN = 1: Halt motion process
  • ACT = 1: Halt action
  • ERR = 1: Halt error
  • DN = 1: Halt complete
  • ID: UID of the motion process to be interrupted

FUN184 P

MFFlowHalt

Suspend Motion Process (MFFlowHalt)

FUN184 P

MFFlowHalt

Example

Ladder diagram

ST

MFFlowHalt ( EN:= M77, ID:= 1, ACT=> M78, ERR=> M79, DN=> M80);

IF M80 Then

M77 := FALSE;

END_IF

  • When the execution control "EN" = 1, the running motion flow block will be suspended immediately.

7-22-10 Reset Motion Alarm (MFSysRstAlm)

FUN185 P

MFSysRstAlm

Reset Motion Alarm (MFSysRstAlm)

FUN185 P

MFSysRstAlm

Symbol

Description

Clears all motion sequences and driver error alerts; however, the communication alarm of the drive cannot be cleared by this command and needs to be powered on again.

  • EN = 1: Upper edge trigger clears motion error alarm
  • ACT = 1: Clear motion error alarm action
  • ERR = 1: Clear motion error alarm error
  • DN = 1: Clear motion error alarm completed

FUN185 P

MFSysRstAlm

Reset Motion Alarm (MFSysRstAlm)

FUN185 P

MFSysRstAlm

Example

Ladder diagram

ST

MFSysRstAlm ( EN:= M101, ACT=> M102, ERR=> M103, DN=> M104);

  • When the execution control "EN" = 1, it will clear the motion process and errors occurred in the driver.

7-22-11 Motion Process Terminate (MFFlowStop)

FUN186 P

MFFlowStop

Stop Motion Process (MFFlowStop)

FUN186 P

MFFlowStop

Symbol

Ladder

ID: ID number for the motion process to be finished.

Relay and Register

Type

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

Range

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

Description

Immediately end the motion process of the specified ID.

When execution of this instruction is complete, MFFlowResume cannot be used to resume execution. Need to use MFFlowStart to restart the process.

  • EN = 1: The upper edge triggers the motion process to stop
  • ACT = 1: The stop of the motion process is in motion
  • ERR = 1: Motion process stop error
  • DN = 1: The motion process stop is completed

FUN186 P

MFFlowStop

Stop Motion Process (MFFlowStop)

FUN186 P

MFFlowStop

Example

Ladder diagram

ST

MFFlowStop ( EN:= M80, ID:= 1, ACT=> M81, ERR=> M82, DN=> M83);

IF M83 Then

M80 := FALSE;

END_IF

  • When the execution control "EN" = 1, the motion process of the specified ID will stop immediately.

7-22-12 Servo Initialization (MFSysInit)

FUN187 P

MFSysInit

Servo Initialization

FUN187 P

MFSysInit

Symbol

No operands

Description

  • If you want to control the servo through EtherCAT communication, you must execute this command before executing any motion control.
  • If you want to use Fun 235 to convert the physical axis to the imaginary axis, it must be executed before this command.
  • EN = 1: Start motion control initialization (trigger condition supports up and down differential input)
  • ACT = 1: Motion control initialization action
  • ERR = 1: Motion control initialization error
  • DN = 1: Motion control initialization is complete

FUN187 P

MFSysInit

Servo Initialization

FUN187 P

MFSysInit

Example

Ladder diagram

ST

MFSysInit ( EN:= TRUE, ACT=> M1, ERR=> M2, DN=> M3);

  • When the execution control "EN" = 1, the motion control function initialization action will be executed.
  • If there is no response during execution, please confirm whether the sports link setting is consistent with the actual link.
  • After initialization, the servo needs to be turned on to continue subsequent operations, such as all axes enable (Servo on) register (M10520).

7-22-13 Recipe Reading (MFSysRCPR)

FUN188 P

MFSysRCPR

Recipe Reading (MFSysRCPR)

FUN188 P

MFSysRCPR

Symbol

Md: 0, read parameters from PLC

D: The starting position of the data register for moving into the mapping table

GP: Recipe tables number, starting from 1

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

0~1

D

○

○

○

○

○

○

○

○

○

○

○

○

○

Gp

○

○

○

○

○

○

○

○

○

○

○

○

○

0~100

Description

  • [Fun188 Recipe Read] and [Fun189 Recipe Write] are used to read or write a large number of motion control parameters. If you only need to modify a single or a few parameters, you can use [Fun181 Change Motion Control Parameters] or [Fun198 Mapping Table].
  • Parameters can only be read when the axis stops.
  • When the execution control [EN] is triggered by the upper differential, Fun188 will read the specified recipe to the specified register.
  • When the execution control [EN] is triggered by the lower differential, all output indications are reset.
  • When the recipe is read, the output indication [ACT] is ON.
  • When reading the recipe, if there is an error, the output indication [ERR] will be ON.
  • When the reading of the recipe is completed, the output indication [DN] ON.

Recipe Table

【Project Management】>【Motion Control】>【Motion Recipe】

  • Motion Recipe table

Tables: Point table, Axis table, Synchronization table

Index: Point table (number of points), Axis table (number of axes), Synchronization table (number of axes)

Length: Continuous point table or continuous axis

Start address: The start address of the register for reading and writing recipes

  • Please refer to the following table for the definition of the register value of the motion recipe table

Recipe Point Table

Start Addres+N

Item

Size

Type

L

Definition

R+0

Operation Mode

WORD

INT

1

  1. Unuse
  2. Single/ABS
  3. Single/INC
  4. Linear(2Axis)/ABS
  5. Linear(2Axis)/INC
  6. Linear(3Axis)/ABS
  7. Linear(3Axis)/INC
  8. Linear(4Axis)/ABS
  9. Linear(4Axis)/INC
  10. Arc/ABS
  11. Arc/ INC
  12. Arc 3D/ABS
  13. Arc 3D/ INC
  14. Helical/ABS
  15. Helical/ INC
  16. Single Velocity

R+1

Accerlation Profile

WORD

INT

1

  1. T Curve
  2. S Curve

R+2

Master Axis

WORD

INT

1

1~16

Non use = 0

R+3

Interpolation 1

WORD

INT

1

1~16

Non use = 0

R+4

Interpolation 2

WORD

INT

1

1~16

Non use = 0

R+5

Interpolation 3

WORD

INT

1

1~16

Non use = 0

R+6

Target Position

Master Axis

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+8

Target Position

Interpolation 1

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+10

Target Position

Interpolation 2

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+12

Target Position

Interpolation 3

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+14

Velocity

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+16

Acceleration

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+18

Deceleration

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+20

Acceleration S Curve

WORD

INT

1

Precision: 0.1

R+21

Deceleration S Curve

WORD

INT

1

Precision: 0.1

R+22

Arc Mode

WORD

INT

1

  1. Border Point
  2. Center
  3. Radius

R+23

Arc Direction

WORD

INT

1

  1. CW
  2. CCW

R+24

Arc (Border/Center) X coordinate

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+26

Arc (Border/Center) Y coordinate

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+28

Arc Radius

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+30

Aux Radius

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+32

Standby Time

DWORD

UINT

2

Unit: ms

R+34

Continuous Point

WORD

INT

1

1~1024

End = 0

R+35

Circle Revolution

WORD

UINT

1

0~65535

R+36

Continuous Mode

WORD

INT

1

  1. Standby
  2. Next Point Speed Continue
  3. Current Point Speed Continue
  4. Starting Speed Continue

R+37-41

Reserve

5

R+42

Arc (Border/Center) Z coordinate

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

Recipe Axis Table

Start Addres+N

Item

Size

Type

L

Definition

R+0

Encoder Type

WORD

1

0 = Incremental

1 = Absolute

R+1

Unit

WORD

1

  1. PLS
  2. Mm
  3. Deg
  4. inch

R+2

Decimal Point

WORD

1

1000: 1

100: 0.1

10: 0.01

1: 0.001

R+3

Pulse/Revolution

DWORD

2

Precision: Decimal Place

R+5

Unit/Revolution

DWORD

2

Precision: Decimal Place

R+7

Velocity Unit

DWORD

1

  1. PLS/Sec
  2. PLS/min
  3. RPM

R+8

Velocity Gain

DWORD

2

Precision: 0.001

R+10

Start Velocity

DWORD

2

Precision: Decimal Place

R+12

Max Motor Velocity

DWORD

2

Precision: 1

Unit: RPM

R+14

Default Acceleration

DWORD

2

Precision: Decimal Place

R+16

Default Deceleration

DWORD

2

Precision: Decimal Place

R+18

Soft Limit(+)

DWORD

2

Precision: Decimal Place

(positive number only)

R+20

Soft Limit(-)

DWORD

2

Precision: Decimal Place

(positive number only)

R+22

Following Error Window

DWORD

2

Precision: Decimal Place

R+24

Following Error Timeout

DWORD

2

Unit: ms

R+26

Pos Done Tolerance

DWORD

2

Precision: Decimal Place

R+28

Pos Done Check Time

DWORD

2

Unit: ms

R+30

Maximum Motor Torque

WORD

1

Precision: 0.1

R+31

Maximum Torque Limit(+)

WORD

1

Precision: 0.1

R+32

Maximum Torque Limit(-)

WORD

1

Precision: 0.1

R+33

Touch Probe1 Source

WORD

1

  1. Disable
  2. Input
  3. Z Signal

R+34

Touch Probe1 Mode

WORD

1

  1. Rising Edge Single
  2. Rising Edge Continue
  3. Falling Edge Single
  4. Falling Edge Continue

R+35

Touch Probe2 Source

WORD

1

  1. Disable
  2. Input
  3. Z Signal

R+36

Touch Probe2 Mode

WORD

1

  1. Rising Edge Single
  2. Rising Edge Continue
  3. Falling Edge Single
  4. Falling Edge Continue

R+37-40

Reserve

4

R+41

Stop Mode

WORD

1

5. Deceleration Stop

7. Immediately Stop

R+42

Stop Deceleration

DWORD

2

Precision: Decimal Place

R+44

Homing Mode

WORD

1

99. Homing on current position
100. Forward-Falling Trigger
101. Backward-Falling Trigger
102. Z Signal-Forward-Rising Trigger
103. Z Signal-Forward-Falling Trigger

104. Forward- Rising Trigger

105. Backward-Rising Trigger

106. Z Signal-Backward-Rising Trigger

107. Z Signal-Backward-Falling Trigger

R+45

Homing IO Source

WORD

1

  1. From Servo Driver
  2. From PLC

R+46

Homing Start Direction

WORD

1

  1. Negative
  2. Positive

R+47

Homing Origin Offset

DWORD

2

Precision: Decimal Place

(negative number allow)

R+49

Homing Find Velocity

DWORD

2

Precision: Decimal Place

R+51

Homing Creep Velocity

DWORD

2

Precision: Decimal Place

R+53

Homing Deceleration

DWORD

2

Precision: Decimal Place

R+55

Limit Switch(-)(DI)

WORD

1

R+56

Limit Switch(+)(DI)

WORD

1

R+57

Homing Switch(DI)

WORD

1

R+58

Homing Z Count

DWORD

2

R+60

Jogging Base Velocity

DWORD

2

Precision: Decimal Place

R+62

Jogging Velocity

DWORD

2

Precision: Decimal Place

R+64

Jogging Acceleration

DWORD

2

Precision: Decimal Place

R+66

Jogging Deceleration

DWORD

2

Precision: Decimal Place

R+68

Inching Distance

DWORD

2

Precision: Decimal Place

Recipe Synchronous Table

Start Addres+N

Item

Size

Type

L

Definition

R+0

Input axis coordinate Unit

WORD

1

R+1

Input axis coordinate decimal point

WORD

1

R+2

Input axis period

DWORD

2

Precision: Decimal Place

R+4

Clutch OFF sliding time at deceleration stop

DWORD

2

R+6

Input axis phase init method

WORD

1

R+7

Sync master axis phase default value

DWORD

2

Precision: Decimal Place

R+9

Master axis phase default value after phase compensation

DWORD

2

Precision: Decimal Place

R+11

Main clutch input axis phase default value

DWORD

2

Precision: Decimal Place

R+13

Auxiliary clutch input axis phase default value

DWORD

2

Precision: Decimal Place

R+15

Cam input axis/clutch output axis phase init method

WORD

1

R+16

Main clutch output axis phase default value

DWORD

2

Precision: Decimal Place

R+18

Auxiliary clutch output axis phase default value

DWORD

2

Precision: Decimal Place

R+20

Reserve

DWORD

2

R+22

Cam input axis phase default value

DWORD

2

Precision: Decimal Place

R+24

Cam output axis base coordinate

DWORD

2

Precision: Decimal Place

R+26

Master Axis 1 input selection

WORD

1

R+27

Master Axis 1 external reference number

WORD

1

R+28

Master Axis 1 prevent reverse

WORD

1

R+29

Master Axis 1 coordinate transformation setting

WORD

1

R+30

Master Axis 1 coordinate transformation numerator

DWORD

2

R+32

Master Axis 1 coordinate transformation denominator

DWORD

2

R+34

Master Axis 2 input selection

WORD

1

R+35

Master Axis 2 external reference number

WORD

1

R+36

Master Axis 2 prevent reverse

WORD

1

R+37

Master Axis 2 coordinate transformation setting

WORD

1

R+38

Master Axis 2 coordinate transformation numerator

DWORD

2

R+40

Master Axis 2 coordinate transformation denominator

DWORD

2

R+42

Aux Axis input selection

WORD

1

R+43

Aux Axis external reference number

WORD

1

R+44

Aux Axis prevent reverse

WORD

1

R+45

Aux Axis coordinate transformation setting

WORD

1

R+46

Aux Axis

coordinate transformation numerator

DWORD

2

R+48

Aux Axis coordinate transformation denominator

DWORD

2

R+50

Master Axis compensation command value

DWORD

2

Precision: Decimal Place

R+52

Master Axis compensation change mode

WORD

1

R+53

Master Axis compensation change time

DWORD

2

R+55

Aux Axis compensation command value

DWORD

2

Precision: Decimal Place

R+57

Aux Axis compensation change mode

WORD

1

R+58

Aux Axis compensation change time

DWORD

2

R+60

Variable gear retio numerator

DWORD

2

R+62

Variable gear retio denominator

DWORD

2

R+64

Gear retio change mode

WORD

1

R+65

Variable gear retio change time

DWORD

2

R+67

Main clutch ON condition

WORD

1

R+68

Main clutch ON setting value

DWORD

2

Precision: Decimal Place

R+70

Main clutch ON delay

DWORD

2

Precision: Decimal Place

R+72

Reserve

WORD

1

R+73

Main clutch ON connection method

WORD

1

R+74

Reserve

WORD

1

R+75

Main clutch ON sliding curve

WORD

1

R+76

Reserve

DWORD

2

R+78

Main clutch ON sliding time

DWORD

2

R+80

Main clutch ON following time

DWORD

2

R+82

Main clutch ON follow-ups

DWORD

2

Precision: Decimal Place

R+84

Main clutch OFF condition

WORD

1

R+85

Main clutch OFF setting value

DWORD

2

Precision: Decimal Place

R+87

Main clutch OFF delay

DWORD

2

Precision: Decimal Place

R+87

Reserve

WORD

1

R+90

Main clutch OFF connection method

WORD

1

R+91

Reserve

WORD

1

R+92

Main clutch OFF sliding curve

WORD

1

R+93

Reserve

DWORD

2

R+95

Main clutch OFF sliding time

DWORD

2

R+97

Aux clutch ON condition

WORD

1

R+98

Aux clutch ON setting value

DWORD

2

Precision: Decimal Place

R+100

Aux clutch ON delay

DWORD

2

Precision: Decimal Place

R+102

Reserve

WORD

1

R+103

Aux clutch ON connection method

WORD

1

R+104

Reserve

WORD

1

R+105

Aux clutch ON sliding curve

WORD

1

R+106

Reserve

DWORD

2

R+108

Aux clutch ON sliding time

DWORD

2

R+110

Aux clutch ON following time

DWORD

2

R+112

Aux clutch ON follow-ups

DWORD

2

Precision: Decimal Place

R+114

Aux clutch OFF condition

WORD

1

R+115

Aux clutch OFF setting value

DWORD

2

Precision: Decimal Place

R+117

Aux clutch OFF delay

DWORD

2

Precision: Decimal Place

R+119

Reserve

WORD

1

R+120

Aux clutch OFF connection method

WORD

1

R+121

Reserve

WORD

1

R+122

Aux clutch OFF sliding curve

WORD

1

R+123

Reserve

DWORD

2

R+125

Aux clutch OFF sliding time

DWORD

2

R+127

Reserve

WORD*5

5

R+132

Step Angle Compensation Base speed

DWORD

2

Precision: Decimal Place

R+134

Step Angle Compensation Base value

DWORD

2

Precision: Decimal Place

R+136

Step Angle Compensation value change mode

WORD

1

R+137

Step Angle Compensation value change time

DWORD

2

R+139

Cam data No.

WORD

1

R+140

Cam stroke

DWORD

2

Precision: Decimal Place

R+142

Cam contact output No.

WORD

1

R+143

Output filter time constant

DWORD

2

R+145-149

Reserve

Example

Ladder diagram

ST

MFSysRCPR ( EN:= M1000, Md:= 0, D:= R1000, Gp:= 0, ACT=> M1001, ERR=> M1002, DN=> M1003);

Motion Recipe Table

  • When M1000 is from OFF→ON, read all recipe tables and store them in R1000.
  • Read the parameters of PLC point table 1 and store them in R1000~R1049
  • Read the parameters of the PLC axis table (axis 1) and store them in R1050~R1119
  • Read the parameters of the PLC synchronization table (axis 1) and store them in R1120~R1269

FUN188 P

MFSysRCPR

Motion Control Recipe Writing (MFSysRCPR)

FUN188 P

MFSysRCPR

Example

Find in “Project”-> “Motion recipe”

Take the target position of the point table as an example for mapping; the following figure is the setting page:

The following is a sample program using the point table as an example:

FUN188 P

MFSysRCPR

Motion Control Recipe Writing (BSysRCPR)

FUN188 P

MFSysRCPR

Ladder diagram (sub)

ST

Timer( EN:= M50 = FALSE,

T:= 0,

PV:= 1000,

IsTimeout=> T0);

ME_SYSINIT( EN:= T0, ACT=> M100, ERR=> M101, DN=> M102);

Timer( EN:= T0,

T:= 1,

PV:= 1000,

IsTimeout=> T1);

IF T1 AND M50 = FALSE Then

M10520 := TRUE;

END_IF

MFPointMov ( EN:= M0, PT:= 1, AX:= 1, ACT=> M103, ERR=> M104, DN=> M105);

MFSysStop ( EN:= M50, ACT=> M106, ERR=> M107, DN=> M108);

MFSysRCPR ( EN:= M60, Md:= 1, D:= R0, Gp:= 1, ACT=> M109, ERR=> M110, DN=> M111);

In this example, the motion control system will be initialized one second after the first execution, and the other axes will be Servo On after one second. When M60 is on, all contents of the midpoint table will be moved into recipe 1. Because R0 is the start register to be moved into the point table, then turn M0 ON to execute the point table, and its setting will follow the position of DR6.

If you need to restore the recipe table before use, you can turn on the M50 and turn it off to restart the Motion control system.

7-22-14 Motion Control Recipe Writing (MFSysRCPW)

FUN189 P

MFSysRCPW

Motion Control Recipe Writing (MFSysRCPW)

FUN189 P

MFSysRCPW

Symbol

Md: 0, write parameters to PLC

D: The starting position of the register for reading the mapping table data

GP: Number of the recipe table, starting from 1

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

0~1

D

○

○

○

○

○

○

○

○

○

○

○

○

○

Gp

○

○

○

○

○

○

○

○

○

○

○

○

○

0~100

Description

  • [Fun188 Recipe Read] and [Fun189 Recipe Write] are used to read or write a large number of motion control parameters. If you only need to modify a single or a few parameters, you can use [Fun181 Change Motion Control Parameters] or [Fun198 Mapping Table].
  • Parameters can only be written when the axis stops.
  • Operands

Md mode: 0 use PLC register

D recipe starting register: the starting address of the register to be written into the recipe table

Gp writes the column of the formula table: writes the column of the recipe table, 0 writes all

  • When the execution control [EN] is triggered by the upper differential, Fun188 will write the specified register to the specified recipe

When the execution control [EN] is triggered by the lower differential, all output indications are reset

  • When writing into the recipe, the output indication [ACT] ON.
  • When writing in the recipe, if there is an error, the output indication [ERR] ON.
  • When writing the recipe is completed, the output indication [DN] ON.

Recipe Table

【Project Management】>【Motion Control】>【Motion Recipe】

  • Motion Recipe table

Tables: Point table, Axis table, Synchronization table

Index: Point table (number of points), Axis table (number of axes), Synchronization table (number of axes)

Length: continuous point table or continuous axis

Start address: The start address of the register for reading and writing recipes

  • Please refer to the following table for the definition of the temporary register value of the motion recipe table.

Recipe Point Table

Start Addres+N

Item

Size

Type

L

Definition

R+0

Operation Mode

WORD

INT

1

  1. Unuse
  2. Single/ABS
  3. Single/INC
  4. Linear(2Axis)/ABS
  5. Linear(2Axis)/INC
  6. Linear(3Axis)/ABS
  7. Linear(3Axis)/INC
  8. Linear(4Axis)/ABS
  9. Linear(4Axis)/INC
  10. Arc/ABS
  11. Arc/ INC
  12. Arc 3D/ABS
  13. Arc 3D/ INC
  14. Helical/ABS
  15. Helical/ INC
  16. Single Velocity

R+1

Accerlation Profile

WORD

INT

1

  1. T Curve
  2. S Curve

R+2

Master Axis

WORD

INT

1

1~16

Non use = 0

R+3

Interpolation 1

WORD

INT

1

1~16

Non use = 0

R+4

Interpolation 2

WORD

INT

1

1~16

Non use = 0

R+5

Interpolation 3

WORD

INT

1

1~16

Non use = 0

R+6

Target Position

Master Axis

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+8

Target Position

Interpolation 1

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+10

Target Position

Interpolation 2

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+12

Target Position

Interpolation 3

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+14

Velocity

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+16

Acceleration

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+18

Deceleration

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+20

Acceleration S Curve

WORD

INT

1

Precision: 0.1

R+21

Deceleration S Curve

WORD

INT

1

Precision: 0.1

R+22

Arc Mode

WORD

INT

1

  1. Border Point
  2. Center
  3. Radius

R+23

Arc Direction

WORD

INT

1

  1. CW
  2. CCW

R+24

Arc (Border/Center) X coordinate

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+26

Arc (Border/Center) Y coordinate

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

R+28

Arc Radius

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+30

Aux Radius

DWORD

INT

2

Precision: Decimal Place

(positive number only)

R+32

Standby Time

DWORD

UINT

2

Unit: ms

R+34

Continuous Point

WORD

INT

1

1~1024

End = 0

R+35

Circle Revolution

WORD

UINT

1

0~65535

R+36

Continuous Mode

WORD

INT

1

  1. Standby
  2. Next Point Speed Continue
  3. Current Point Speed Continue
  4. Starting Speed Continue

R+37-41

Reserve

5

R+42

Arc (Border/Center) Z coordinate

DWORD

INT

2

Precision: Decimal Place

(negative number allow)

Recipe Axis Table

Start Addres+N

Item

Size

Type

L

Definition

R+0

Encoder Type

WORD

1

0 = Incremental

1 = Absolute

R+1

Unit

WORD

1

  1. PLS
  2. Mm
  3. Deg
  4. inch

R+2

Decimal Point

WORD

1

1000: 1

100: 0.1

10: 0.01

1: 0.001

R+3

Pulse/Revolution

DWORD

2

Precision: Decimal Place

R+5

Unit/Revolution

DWORD

2

Precision: Decimal Place

R+7

Velocity Unit

DWORD

1

  1. PLS/Sec
  2. PLS/min
  3. RPM

R+8

Velocity Gain

DWORD

2

Precision: 0.001

R+10

Start Velocity

DWORD

2

Precision: Decimal Place

R+12

Max Motor Velocity

DWORD

2

Precision: 1

Unit: RPM

R+14

Default Acceleration

DWORD

2

Precision: Decimal Place

R+16

Default Deceleration

DWORD

2

Precision: Decimal Place

R+18

Soft Limit(+)

DWORD

2

Precision: Decimal Place

(positive number only)

R+20

Soft Limit(-)

DWORD

2

Precision: Decimal Place

(positive number only)

R+22

Following Error Window

DWORD

2

Precision: Decimal Place

R+24

Following Error Timeout

DWORD

2

Unit: ms

R+26

Pos Done Tolerance

DWORD

2

Precision: Decimal Place

R+28

Pos Done Check Time

DWORD

2

Unit: ms

R+30

Maximum Motor Torque

WORD

1

Precision: 0.1

R+31

Maximum Torque Limit(+)

WORD

1

Precision: 0.1

R+32

Maximum Torque Limit(-)

WORD

1

Precision: 0.1

R+33

Touch Probe1 Source

WORD

1

  1. Disable
  2. Input
  3. Z Signal

R+34

Touch Probe1 Mode

WORD

1

  1. Rising Edge Single
  2. Rising Edge Continue
  3. Falling Edge Single
  4. Falling Edge Continue

R+35

Touch Probe2 Source

WORD

1

  1. Disable
  2. Input
  3. Z Signal

R+36

Touch Probe2 Mode

WORD

1

  1. Rising Edge Single
  2. Rising Edge Continue
  3. Falling Edge Single
  4. Falling Edge Continue

R+37-40

Reserve

4

R+41

Stop Mode

WORD

1

5. Deceleration Stop

7. Immediately Stop

R+42

Stop Deceleration

DWORD

2

Precision: Decimal Place

R+44

Homing Mode

WORD

1

99. Homing on current position
100. Forward-Falling Trigger
101. Backward-Falling Trigger
102. Z Signal-Forward-Rising Trigger
103. Z Signal-Forward-Falling Trigger

104. Forward- Rising Trigger

105. Backward-Rising Trigger

106. Z Signal-Backward-Rising Trigger

107. Z Signal-Backward-Falling Trigger

R+45

Homing IO Source

WORD

1

  1. From Servo Driver
  2. From PLC

R+46

Homing Start Direction

WORD

1

  1. Negative
  2. Positive

R+47

Homing Origin Offset

DWORD

2

Precision: Decimal Place

(negative number allow)

R+49

Homing Find Velocity

DWORD

2

Precision: Decimal Place

R+51

Homing Creep Velocity

DWORD

2

Precision: Decimal Place

R+53

Homing Deceleration

DWORD

2

Precision: Decimal Place

R+55

Limit Switch(-)(DI)

WORD

1

R+56

Limit Switch(+)(DI)

WORD

1

R+57

Homing Switch(DI)

WORD

1

R+58

Homing Z Count

DWORD

2

R+60

Jogging Base Velocity

DWORD

2

Precision: Decimal Place

R+62

Jogging Velocity

DWORD

2

Precision: Decimal Place

R+64

Jogging Acceleration

DWORD

2

Precision: Decimal Place

R+66

Jogging Deceleration

DWORD

2

Precision: Decimal Place

R+68

Inching Distance

DWORD

2

Precision: Decimal Place

Recipe Synchronous Table

Start Addres+N

Item

Size

Type

L

Definition

R+0

Input axis coordinate Unit

WORD

1

R+1

Input axis coordinate decimal point

WORD

1

R+2

Input axis period

DWORD

2

Precision: Decimal Place

R+4

Clutch OFF sliding time at deceleration stop

DWORD

2

R+6

Input axis phase init method

WORD

1

R+7

Sync master axis phase default value

DWORD

2

Precision: Decimal Place

R+9

Master axis phase default value after phase compensation

DWORD

2

Precision: Decimal Place

R+11

Main clutch input axis phase default value

DWORD

2

Precision: Decimal Place

R+13

Auxiliary clutch input axis phase default value

DWORD

2

Precision: Decimal Place

R+15

Cam input axis/clutch output axis phase init method

WORD

1

R+16

Main clutch output axis phase default value

DWORD

2

Precision: Decimal Place

R+18

Auxiliary clutch output axis phase default value

DWORD

2

Precision: Decimal Place

R+20

Reserve

DWORD

2

R+22

Cam input axis phase default value

DWORD

2

Precision: Decimal Place

R+24

Cam output axis base coordinate

DWORD

2

Precision: Decimal Place

R+26

Master Axis 1 input selection

WORD

1

R+27

Master Axis 1 external reference number

WORD

1

R+28

Master Axis 1 prevent reverse

WORD

1

R+29

Master Axis 1 coordinate transformation setting

WORD

1

R+30

Master Axis 1 coordinate transformation numerator

DWORD

2

R+32

Master Axis 1 coordinate transformation denominator

DWORD

2

R+34

Master Axis 2 input selection

WORD

1

R+35

Master Axis 2 external reference number

WORD

1

R+36

Master Axis 2 prevent reverse

WORD

1

R+37

Master Axis 2 coordinate transformation setting

WORD

1

R+38

Master Axis 2 coordinate transformation numerator

DWORD

2

R+40

Master Axis 2 coordinate transformation denominator

DWORD

2

R+42

Aux Axis input selection

WORD

1

R+43

Aux Axis external reference number

WORD

1

R+44

Aux Axis prevent reverse

WORD

1

R+45

Aux Axis coordinate transformation setting

WORD

1

R+46

Aux Axis

coordinate transformation numerator

DWORD

2

R+48

Aux Axis coordinate transformation denominator

DWORD

2

R+50

Master Axis compensation command value

DWORD

2

Precision: Decimal Place

R+52

Master Axis compensation change mode

WORD

1

R+53

Master Axis compensation change time

DWORD

2

R+55

Aux Axis compensation command value

DWORD

2

Precision: Decimal Place

R+57

Aux Axis compensation change mode

WORD

1

R+58

Aux Axis compensation change time

DWORD

2

R+60

Variable gear retio numerator

DWORD

2

R+62

Variable gear retio denominator

DWORD

2

R+64

Gear retio change mode

WORD

1

R+65

Variable gear retio change time

DWORD

2

R+67

Main clutch ON condition

WORD

1

R+68

Main clutch ON setting value

DWORD

2

Precision: Decimal Place

R+70

Main clutch ON delay

DWORD

2

Precision: Decimal Place

R+72

Reserve

WORD

1

R+73

Main clutch ON connection method

WORD

1

R+74

Reserve

WORD

1

R+75

Main clutch ON sliding curve

WORD

1

R+76

Reserve

DWORD

2

R+78

Main clutch ON sliding time

DWORD

2

R+80

Main clutch ON following time

DWORD

2

R+82

Main clutch ON follow-ups

DWORD

2

Precision: Decimal Place

R+84

Main clutch OFF condition

WORD

1

R+85

Main clutch OFF setting value

DWORD

2

Precision: Decimal Place

R+87

Main clutch OFF delay

DWORD

2

Precision: Decimal Place

R+87

Reserve

WORD

1

R+90

Main clutch OFF connection method

WORD

1

R+91

Reserve

WORD

1

R+92

Main clutch OFF sliding curve

WORD

1

R+93

Reserve

DWORD

2

R+95

Main clutch OFF sliding time

DWORD

2

R+97

Aux clutch ON condition

WORD

1

R+98

Aux clutch ON setting value

DWORD

2

Precision: Decimal Place

R+100

Aux clutch ON delay

DWORD

2

Precision: Decimal Place

R+102

Reserve

WORD

1

R+103

Aux clutch ON connection method

WORD

1

R+104

Reserve

WORD

1

R+105

Aux clutch ON sliding curve

WORD

1

R+106

Reserve

DWORD

2

R+108

Aux clutch ON sliding time

DWORD

2

R+110

Aux clutch ON following time

DWORD

2

R+112

Aux clutch ON follow-ups

DWORD

2

Precision: Decimal Place

R+114

Aux clutch OFF condition

WORD

1

R+115

Aux clutch OFF setting value

DWORD

2

Precision: Decimal Place

R+117

Aux clutch OFF delay

DWORD

2

Precision: Decimal Place

R+119

Reserve

WORD

1

R+120

Aux clutch OFF connection method

WORD

1

R+121

Reserve

WORD

1

R+122

Aux clutch OFF sliding curve

WORD

1

R+123

Reserve

DWORD

2

R+125

Aux clutch OFF sliding time

DWORD

2

R+127

Reserve

WORD*5

5

R+132

Step Angle Compensation Base speed

DWORD

2

Precision: Decimal Place

R+134

Step Angle Compensation Base value

DWORD

2

Precision: Decimal Place

R+136

Step Angle Compensation value change mode

WORD

1

R+137

Step Angle Compensation value change time

DWORD

2

R+139

Cam data No.

WORD

1

R+140

Cam stroke

DWORD

2

Precision: Decimal Place

R+142

Cam contact output No.

WORD

1

R+143

Output filter time constant

DWORD

2

R+145-149

Reserve

FUN189 P

MFSysRCPW

Motion Control Recipe Writing (MFSysRCPW)

FUN189 P

MFSysRCPW

Example

Ladder diagram

ST

MFSysRCPW ( EN:= M1000, Md:= 0, D:= R1000, Gp:= 0, ACT=> M1001, ERR=> M1002, DN=> M1003);

  • When M1000 is from OFF→ON, write all recipe tables from R1000.

7-22-15 Cam Read (MFSysCAMR)

FUN191 P

MFSysCAMR

Motion Control Cam Read

FUN191 P

MFSysCAMR

Symbol

Md: Mode

D: Cam initial register

ID: Cam number

L: Cam resolution

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

Md

○

○

○

○

○

○

○

○

○

○

○

○

○

0~1

D

○

○

○

○

○

○

○

○

○

○

○

○

○

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

L

2048~32768

Description

Operands

Md mode: 0 use PLC register

D cam start register: The start address of the register to be stored after reading the cam

ID cam number: Cam number

L cam resolution: The length of the temporary register to be stored after reading the cam

  • When the execution control [EN] is triggered by the upper differential, Fun191 will read the specified cam to the specified register.

When the execution control [EN] is triggered by the lower differential, all output indications are reset.

  • When the cam is being read, the output indication [ACT] is ON.
  • When reading the cam, if there is an error, the output indication [ERR] will be ON.
  • When the reading of the cam is completed, the output indication [DN] ON.

Example

Ladder diagram

ST

MFSysCAMR ( EN:= TRUE, Md:= 0, D:= R1000, ID:= 1, L:= 2048, ACT=> M1001, ERR=> M1002, DN=> M1003);

CAM

Data Table

When M1000 is from OFF→ON, read the cam ID: 1 data table and store 2048 in DR1000~DR5094.

7-22-16 Cam Write (MFSysCAMW)

FUN192 P

MFSysCAMW

Motion Control Cam Write (MFSysCAMW)

FUN192 P

MFSysCAMW

Symbol

Md: Mode

D: Cam initial register

ID: Cam number

L: Cam resolution

Relay and Register

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

Md

○

○

○

○

○

○

○

○

○

○

○

○

○

0~1

D

○

○

○

○

○

○

○

○

○

○

○

○

○

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

L

2048~32768

Description

Operands

Md mode: 0 use PLC register

D cam start register: The start address of the register to be stored after reading the cam

ID cam number: Cam number

L cam resolution: The length of the temporary register to be stored after reading the cam

  • When the execution control [EN] is triggered by the upper differential, Fun191 will read the specified cam to the specified register.

When the execution control [EN] is triggered by the lower differential, all output indications are reset.

  • When the cam is being read, the output indication [ACT] is ON.
  • When reading the cam, if there is an error, the output indication [ERR] will be ON.
  • When the reading of the cam is completed, the output indication [DN] ON.

Example

Ladder diagram

ST

MFSysCAMW ( EN:= M1000, Md:= 0, D:= R1000, ID:= 1, L:= 2048, ACT=> M1001, ERR=> M1002, DN=> M1003);

CAM

Data Table

  • When M1000 is from OFF→ON, write the cam ID from DR1000~DR5094: 1 data table 2048.

7-22-17 Handwheel (MFGearMPG)

FUN193 D P

MFGearMPG

Handwheel (MFGearMPG )

FUN193 D P

MFGearMPG

Symbol

Operand

M: EtherCat spindle number

S: EtherCat auxiliary shaft number

N: Gear ratio numerator

D: Gear ratio denominator

T: Conversion time (in ms)

Relay and Register

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

M

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16,100~108

S

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

N

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○

○

○

○

○

T

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • Fun 193 (EtherCAT hand wheel) integrates position-synchronized hand wheel related settings to provide users with quick setting of the hand wheel.
  • Operands

M spindle input source: EtherCAT_axis number 1~1

: Encoder_Gray code 100 (X8~X15)

: Encoder_hardware high-speed counter number 101 ~ 104 (HSC4~HSC7 )

S slave axis output target: EtherCAT_axis number 1~16

([M spindle input source] cannot be the same as [S slave axis output target])

FUN193 D P

MFGearMPG

Handwheel (MFGearMPG )

FUN193 D P

MFGearMPG

  • Operands

N Variable gear ratio numerator: positive and negative numbers, including the [decimal point position] of the [motion axis setting] in the [motion control]

([Axis unit] set mm, [Decimal point position] set 0.001, N: DR0 = 1000 is equal to 1.000mm)

D Variable gear ratio denominator: positive number (a real number greater than zero), including the [decimal point position] of [motion axis setting] in [motion control]

T conversion time (ms): positive number (real number greater than zero), the unit is ms

  • When the execution control [EN] is triggered by the upper differential, Fun193 uses the current parameters to start the synchronous control of the handwheel position.

When the execution control [EN] is triggered by the lower differential, Fun193 stops the synchronous control of the handwheel position and resets all output indicators.

  • In handwheel synchronous control, if the update parameter [UPD] changes to 1, this command will update the handwheel parameters (N, D, T) immediately.
  • When the hand wheel is under synchronous control, the output indication [ACT] is ON.
  • During the synchronous control of the manual wheel, if an error occurs, the output indication [ERR] will be ON.
  • When the update of the manual wheel parameters is completed, the output indication [UPD] ON.

FUN193 D P

MFGearMPG

Handwheel (MFGearMPG )

FUN193 D P

MFGearMPG

Example

Ladder diagram

ST

MFGearMPG _D( EN:= M1000, UPD_in:= M1005, M:= 1, S:= 2, N:= R1000, D:= R1002, T:= R1004, ACT=> M1001, ERR=> M1002, DN=> M1003, UPD_out=> M1004);

IF M1004 THEN

M1005 := FALSE;

END_IF

Axis Parameter Setting

When M1000 is from OFF→ON, start the manual wheel synchronization according to the current Fun193 parameters (M: EtherCAT axis 1, N: EtherCAT axis 2, N: variable gear ratio numerator 0.001, D variable gear ratio denominator 0.001, T: 1ms).

Ladder diagram

ST

MFGearMPG _D( EN:= M1000, UPD_in:= M1005, M:= 1, S:= 2, N:= R1000, D:= R1002, T:= R1004, ACT=> M1001, ERR=> M1002, DN=> M1003, UPD_out=> M1004);

After changing the parameters (D variable gear ratio denominator 0.002), when M1005 is from OFF→ON, update the hand wheel according to the changed parameters. After the parameter update is completed, the output indication [UPD] is ON, and the stroke of the slave axis of the hand wheel is halved.

7-22-18 Velocity Control Mode (MFVelCtl)

FUN194 D P

MFVelCtl

Velocity Control Mode (MFVelCtl)

FUN194 D P

MFVelCtl

Symbol

S: Axis number

V: Speed command

MX: Maximum torque

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

S

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

V

○

○

○

○

○

○

○

○

○

○

○

○

○

MX

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • Operands

S speed control axis: EtherCAT_ axis number 1~16

V speed: speed setting value, unit Pulses/s

MX maximum torque limit: when the speed cannot reach the speed setting value, the maximum torque limit, 0 equals no limit, unit 0.0%

  • When the execution control [EN] is triggered by the upper differential, Fun194 uses the current parameters to start the axis speed control

When the execution control [EN] is triggered by the lower differential, Fun194 stops the axis speed control and resets all output indications

  • In axis speed control, if the update parameter [UPD] becomes 1, this command will update the speed control parameters (V, MX) immediately.
  • When the axis speed is under control, the output indicator [ACT] ON.
  • During axis speed control, if an error occurs, the output indication [ERR] will be ON.
  • When updating the speed control parameters is completed, the output indication [UPD] ON.

FUN194 D P

MFVelCtl

Velocity Control Mode (MFVelCtl)

FUN194 D P

MFVelCtl

Example

Ladder diagram

ST

MFVelCtl_D( EN:= M1000, UPD_in:= M1005, S:= 1, V_n:= R1000, MX:= R1002, ACT=> M1001, ERR=> M1002, DN=> M1003, UPD_out=> M1004);

  • When M1000 is from OFF→ON, start velocity control according to the current Fun194 parameters (S: EtherCAT axis 1, V: 131072 Pulses per second, MX: no torque limit).

Ladder diagram

ST

MFVelCtl_D( EN:= M1000, UPD_in:= M1005, S:= 1, V_n:= R1000, MX:= R1002, ACT=> M1001, ERR=> M1002, DN=> M1003, UPD_out=> M1004);

  • After changing the parameter (V: 262144 Pulses per second), when M1005 changes from OFF to ON, the parameter update is completed according to the changed parameter update speed, and the output indicator M1004 [UPD] ON is turned on, and the speed doubles.

7-22-19 Torque Control Mode (MFTorqCtl)

FUN195 D P

MFTorqCtl

Torque Control Mode (MFTorqCtl)

FUN195 D P

MFTorqCtl

Symbol

S: Axis number

V: Speed command

MX: Maximum torque

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

S

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

T

○

○

○

○

○

○

○

○

○

○

○

○

○

MX

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • Operands

S torque control axis: EtherCAT_ axis number 1~16

T torque: Torque setting value, unit 0.0%

MX Maximum speed limit: When the torque cannot reach the torque setting value, the maximum speed limit, 0 equals no limit, unit rpm

  • When the execution control [EN] is triggered by the upper differential, Fun195 uses the current parameters to start the shaft torque control

When the execution control [EN] is triggered by the lower differential, Fun195 stops the shaft torque control and resets all output indications

  • In axis torque control, if the update parameter [UPD] becomes 1, this command will update the torque control parameters (T, MX) immediately.
  • When the axis torque is under control, the output indicator [ACT] ON.
  • During axis torque control, if an error occurs, the output indication [ERR] will be ON.
  • When updating the torque control parameters is completed, the output indication [UPD] ON.

FUN195 D P

MFTorqCtl

Torque Control Mode (MFTorqCtl)

FUN195 D P

MFTorqCtl

Example

Ladder diagram

ST

MFTorqCtl ( EN:= M1000, UPD_in:= M1005, S:= 1, V_n:= R1000, MX:= R1002, ACT=> M1001, ERR=> M1002, DN=> M1003, UPD_out=> M1004);

  • When M1000 is from OFF to ON, torque control is started according to the current Fun194 parameters (S: EtherCAT axis 1, T: 5.0%, MX: no speed limit).

Ladder diagram

ST

MFTorqCtl ( EN:= M1000, UPD_in:= M1005, S:= 1, V_n:= R1000, MX:= R1002, ACT=> M1001, ERR=> M1002, DN=> M1003, UPD_out=> M1004);

  • After changing the parameter (T: 10.0%), when M1005 changes from OFF→ON, the torque will be updated according to the changed parameter. After the parameter update is completed, the output indication M1004 [UPD] ON will double the torque.

7-22-20 Cam Generate (MFSysCAMGen)

FUN196 P

MFSysCAMGen

Cam Generate (MFSysCAMGen)

FUN196 P

MFSysCAMGen

Symbol

ID: Axis number

Md: Mode

D: Start address of scratchpad

L: Length

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

Md

0~20

D

○

○

○

○

○

○

○

○

○

○

○

○

○

L

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • Operands

ID cam number: 1~16

Md cam generation mode: 0 is the same as cam table, 1 is chasing shear curve

D register start bit: set the start register of the cam

L The number of cam curve segments: Mode 0 only has the setting of each segment of the cam, and other modes do not need to be set

  • When the execution control [EN] is triggered by the upper differential, Fun196 will generate the cam according to the set mode.

When the execution control [EN] is triggered by the lower differential, all output indications are reset.

  • When the cam is being generated, the output indication [ACT] ON.
  • When the cam is generating, if there is an error, the output indication [ERR] will be ON.
  • When the cam generation is completed, the output indication [DN] will be ON.

FUN196 P

MFSysCAMGen

Cam generate (MFSysCAMGen)

FUN196 P

MFSysCAMGen

Mode 0

Example

Ladder diagram

D

ST

MFSysCAMGen ( EN:= M1000, ID:= 1, Md:= 0, D:= R1000, L:= R998, ACT=> M1001, ERR=> M1002, DN=> M1003);

CAM

Cam Parameter

  • When M1000 is from OFF to ON, the cam is generated according to the current Fun196 number (ID: cam number 1, Md: mode 0, D: setting the cam generation parameters from R1000, L: 2-stage cam curve).

7-22-21 Axis Movement (MFAxMov)

FUN197 D P

MFAxMov

Axis Movement

FUN197 D P

MFAxMov

Symbol

S: EtherCAT control axis

MD: Operating mode

PS: Target position

V: Speed

A: Acceleration

D: Deceleration

SA: S acceleration curve %

SD: S deceleration curve%

DR: Direction

BF: Speed continuous mode

Relay and Register

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

S

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16/1001~1016

MD

0~1

Ps

○

○

○

○

○

○

○

○

○

○

○

○

○

V

○

○

○

○

○

○

○

○

○

○

○

○

○

A

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○

○

○

○

○

SA

○

○

○

○

○

○

○

○

○

○

○

○

○

SD

○

○

○

○

○

○

○

○

○

○

○

○

○

DR

○

○

○

○

○

○

○

○

○

○

○

○

○

1~2

BF

0~5

FUN197 D P

MFAxMov

Axis Movement

FUN197 D P

MFAxMov

Description

  • Operands

S EtherCAT control axis: EtherCAT_ axis number 1~16

MD operation mode: 0 absolute, 1 relative

PS target position: positive and negative numbers, including the [decimal point position] of the [motion axis setting] in the [motion control]

([Axis unit] set mm, [Decimal point position] set 0.001, PS: DR0 = 1000 is equal to 1.000mm)

V speed: positive number (a real number greater than zero), including the [decimal point position] of the [motion axis setting] in the [motion control]

A Acceleration: positive number (a real number greater than zero), including the [decimal point position] of the [motion axis setting] in the [motion control]

D Deceleration: positive number (a real number greater than zero), including the [decimal point position] of the [motion axis setting] in the [motion control]

SA S acceleration curve %: positive integer, 0~1000 ‰

SD S deceleration curve %: positive integer, 0~1000 ‰

DR direction: 1 positive direction, 2 negative direction

BF: Speed ​​continuous mode: 0 executes the current command immediately, 1 waits for the end of the previous command, 2 selects the lower speed continuous, 3 selects the previous command speed continuous, 4 selects the current command speed continuous, 5 selects the higher speed continuous

  • When the execution control [EN] is triggered by the upper differential, Fun197 executes the axis position control.

When the execution control [EN] is triggered by the lower differential, Fun197 stops the axis position control and resets all output indications.

  • In axis position control, if the update parameter [UPD] becomes 1, this command will immediately update the position control parameters (S, PS, V, A, D, SA, SD, DR).
  • When the axis position is under control, the output indicator [ACT] ON.
  • During axis position control, if an error occurs, the output indication [ERR] will be ON.
  • When the axis position control is completed, the output indication [DN] will be ON.
  • When updating the position control parameters is completed, the output indication [UPD] ON.

Example

  • When M1000 is from OFF→ON, according to the curr

Ladder diagram

ST

MFAxMov_D( EN:= M0, UPD_in:= M1, S:= 1, MD:= 0, Ps:= R1000, V_n:= R1002, A:= R1004, D:= R1004, SA:= R1006, SD:= R1006, DR:= R1, BF:= 0, ACT=> M2, ERR=> M3, DN=> M4, UPD_out=> M5);

Axis Parameter Setting

  • When M0 is from OFF→ON, according to the current Fun197 parameters (S: EtherCAT axis 1, MD: Absolute position, PS: Move to 500.000mm, V: Velocity 80.000mm/s, A: Acceleration 10000.000 mm/s^2, D: Deceleration 10000.000 mm/s^2, SA: S Acceleration Curve 0.0%, SD: S Deceleration Curve 0.0%, DR: Forward Direction, BF: Execute current command immediately) to execute position control.

Interrupt Constant Feed

  • Using two Fun197 to implement an interrupt constant feed application.
  • When M0 is from OFF→ON, according to the first Fun197 parameters (S: EtherCAT axis 1, MD: Infinite distance mode, PS: Meaningless, set to 0, V: Velocity 80.000mm/s, A: Acceleration 10000.000 , D: Deceleration 10000.000 , SA: S Acceleration Curve 0.0%, SD: S Deceleration Curve 0.0%, DR: Forward Direction, BF: Execute current command immediately) to execute position control.
  • When M6 is from OFF→ON, according to the second Fun197 parameters (S: EtherCAT axis 1, MD: Relative position, PS: Move to 50.000mm, V: Velocity 15.000mm/s, A: Acceleration 10000.000 , D: Deceleration 10000.000 , SA: S Acceleration Curve 0.0%, SD: S Deceleration Curve 0.0%, DR: Forward Direction, BF: Execute current command immediately) to execute position control, that is, interrupt constant feed.

The cursor range is set to the interrupt constant feed distance in PS(register R1008).

7-22-22 Mapping Table Setting (MFMapTbPrm)

FUN198 P

MFMapTbPrm

Mapping Table Setting (MFMapTbPrm)

FUN198 P

MFMapTbPrm

Symbol

Gp: Mapping table group number

N: Mapping start table number

L: Mapping continuous length

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

Gp

0~64

N

○

○

○

○

○

○

○

○

○

○

○

○

○

0~1024

L

○

○

○

○

○

○

○

○

○

○

○

○

○

1~1024

Description

  • [Fun198 Write Mapping Table] is used to change a single or a small number of motion control parameters. If you need to read or write a large number of motion control parameters, you can use [Fun188 Recipe Read] and [Fun189 Recipe Write].
  • Operands

Gp mapping table group number: group number 1~16, 0 means all groups.

N Mapping table start table number: mapping table number 1~1024, 0 means the entire mapping table

L Map Consecutive Length: Number of Consecutive Map Items

  • When the execution control [EN] is triggered by the upper differential, Fun198 will map (write) the PLC temporary register to the motion control parameters.

When the execution control [EN] is triggered by the lower differential, all output indications are reset.

  • When the mapping is being written, the output indication [ACT] ON.
  • When the mapping is being written, if an error occurs, the output indication [ERR] will be ON.
  • When the mapping is written in, the output indication [DN] will be ON.

FUN198 P

MFMapTbPrm

Mapping Table Setting (MFMapTbPrm)

FUN198 P

MFMapTbPrm

Example

Ladder diagram

ST

MFMapTbPrm ( EN:= M1000, Gp:= 1, N:= 1, L:= 2, ACT=> M1001, ERR=> M1002, DN=> M1003);

Mapping Table

Motion Axis Setting Table

  • When M1000 is from OFF to ON, according to the current Fun198 parameters (Gp 1: mapping table 1 (1: PM), N: starting from the first line of the mapping table (1: PM1), L: length 1) to execute mapping table writing, It can be seen from the motion axis setting table that the JOG speed has been modified to 2.000mm/s^2, and the inch movement distance has been modified to 6.000mm.

7-22-23 Real Axis to Virtual Axis (MFSysSetVirt)

FUN235 P

MFSysSetVirt

Real Axis to Virtual Axis

FUN235 P

MFSysSetVirt

Symbol

Ladder

Operand

AX: Axis number to be converted

EN: Trigger command

ACT: Acting

ERR: Conversion error

DN: Execution complete

Relay and Register

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D11999

ID

○

○

○

○

○

○

○

○

○

○

○

○

○

1~16

Description

  • This command is to convert real axis into virtual axis.
  • Make sure the motion control system is in stop state before use, if it is in initialization state, ERR will output 1.
  • If you need to stop the initialized system, you can refer to the instruction of FUN177 stop all motion flows.
  • For details of this command, please refer to the instructions in the motion control manual.

Example

Ladder

  • When enable M0, the motion controller will convert axis 1 to virtual axis.

7-22-24 EtherCAT SDO Read (MFSDOR)

Fun236 P

MFSDOR

EtherCAT SDO Read

Fun236 P

MFSDOR

Symbol

Ladder Symbol

Operands

S : Slave Number

I : Index

SI : Sub-index

LN : Length

EC : Register for error code

D : Data Register (DWORD)

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

S

○

○

○

○

○

○

○

○

○

○

○

○

○

I

○

○

○

○

○

○

○

○

○

○

○

○

○

SI

○

○

○

○

○

○

○

○

○

○

○

○

○

LN

○

○

○

○

○

○

○

○

○

○

○

○

○

EC

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • Operands

S : Slave Number in EtherCAT

I : Index of parameter in slave memory

SI : Sub-index of parameter in slave memory

LN : Length of the parameter

EC : Register for error code

D : Data Register (DWORD)

  • When execution control (EN) is triggered in upper edge, the function will be executed for SDO reading.
  • When the function is in operating, the coil ACT will be set to ON.
  • When the function is in error, the coil ERR will be set to ON.
  • When the function is finished, the coil DN will be set to ON.

Fun236 P

MFSDOR

EtherCAT SDO Read

Fun236 P

MFSDOR

Example

Ladder

  • Assume we want to read the status word of slave 1. The parameters will be: S = 1, I = 0x6041, SI = 0, LN = 2. After trigger the pin EN, the status word will be showed at R10 (D = R10).

7-22-25 EtherCAT SDO Write (MFSDOW)

Fun237 P

MFSDOW

EtherCAT SDO Write

Fun237 P

MFSDOW

Symbol

Ladder Symbol

Operands

S : Slave Number

I : Index

SI : Sub-index

LN : Length

EC : Register for error code

D : Data Register (DWORD)

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

S

○

○

○

○

○

○

○

○

○

○

○

○

○

I

○

○

○

○

○

○

○

○

○

○

○

○

○

SI

○

○

○

○

○

○

○

○

○

○

○

○

○

LN

○

○

○

○

○

○

○

○

○

○

○

○

○

EC

○

○

○

○

○

○

○

○

○

○

○

○

○

D

○

○

○

○

○

○

○

○

○

○

○

○

○

Fun237 P

MFSDOW

EtherCAT SDO Write

Fun237 P

MFSDOW

Description

  • Operands

S : Slave Number in EtherCAT

I : Index of parameter in slave memory

SI : Sub-index of parameter in slave memory

LN : Length of the parameter

EC : Register for error code

D : Data Register (DWORD)

  • When execution control (EN) is triggered in upper edge, the function will be executed for SDO writing.
  • When the function is in operating, the coil ACT will be set to ON.
  • When the function is in error, the coil ERR will be set to ON.
  • When the function is finished, the coil DN will be set to ON.

Fun237 P

MFSDOW

EtherCAT SDO Write

Fun237 P

MFSDOW

Example

  • Assume we want to write the servo data of slave 1 as 0x1011. The data address in slave 1 is 0x3000. The parameters will be: S = 1, I = 0x3000, SI = 0, LN = 2, R10 = 0x1011. After trigger the pin EN, you can use FUN236 to read the parameter or use software tool of servo to check the data is rewritten or not.

  • After executing the instruction,user can use the SDO read instruction for checking, or check through the drive software to see if the parameter has been written.

7-22-26 Linear Interpolation (MFAxLMov)

Fun238 D P

MFAxLMov

Linear Interpolation

Fun238 D P

MFAxLMov

Symbol

Ladder Symbol

Operands

TAX : Total Axis Number

MD : Operation Mode

DR : Direction

BF : Continuous Mode

D : Parameter Register Start Address

EC : Register for Error code

Relay and Register

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

TAX

○

○

○

○

○

○

○

○

○

○

○

○

○

1~4

MD

0~1

DR

○

○

○

○

○

○

○

○

○

○

○

○

○

1~2

BF

○

○

○

○

○

○

○

○

○

○

○

○

○

0~5

D

○

○

○

○

○

○

○

○

○

○

○

○

○

EC

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

  • Operands

TAX (Total Axis Number) : Axes number in movement – 1 ~ 4

MD (Operation Mode) : 0 – Absolute Positioning, 1 – Relative Positioning.

DR (Direction) : 1 – Positive, 2 – Negative.

BF (Continuous Mode) : 0: Stop Current Movement

1: Wait Current Mov Finish

2: Continue with Lower Speed

3: Continue with Current Speed

4: Continue with New Speed

5: Continue with higher Speed

D : First Register Address of Data.

EC : Register for Error Code.

  • When execution control (EN) is triggered in upper edge, the Fun238 will be executed for linear interpolation.

When execution control (EN) is triggered in lower edge, the Fun238 will be stopped, and all the coils will be reset.

  • When the function is in operating, if the update parameter is trigger in upper edge, current value of in the parameter D and the value DR will be updated immediately.
  • When the function is in operating, the coil ACT will be set to ON.
  • When the function is in error, the coil ERR will be set to ON.
  • When the function is finished, the coil DN will be set to ON.
  • When the parameter update is success, the coil UPDN will be set to ON.

Motion data in parameter D:

Register Address

Parameter

Date Type

Note

R+0

Axis 1

WORD

Main Axis

R+1

Axis 2

WORD

Interpolation Axis

R+2

Axis 3

WORD

Interpolation Axis

R+3

Axis 4

WORD

Interpolation Axis

R+4

Target Position 1

DWORD

Decimal point of Axis 1

R+6

Target Position 2

DWORD

Decimal point of Axis 2

R+8

Target Position 3

DWORD

Decimal point of Axis 3

R+10

Target Position 4

DWORD

Decimal point of Axis 4

R+12

Maximum Velocity

DWORD

Decimal point of Axis 1, positive

R+14

Acceleration Time (ms)

DWORD

Time from 0 to maximum

R+16

Deceleration Time (ms)

DWORD

Time from maximum to 0

R+18

Acc S curve (‰)

WORD

Range: 0~1000 ‰

R+19

Dec S curve (‰)

WORD

Range: 0~1000 ‰

Example

Ladder

  • When M0 is triggered in upper edge, the 2 axis linear interpolation movement will be executed in absolute mode (MD = 0). The parameter is in positive direction (DR = 1), and the movement will interrupt the current movement (BF = 0).
  • The movement will follow the parameters in R0 to R19 (D = R0) and the error code will be showed in R100 (EC = R100).

Fun238 D P

MFAxLMov

Linear Interpolation

Fun238 D P

MFAxLMov

Example

  • Motion data

Register Address

Parameter

Value

R0

Axis 1

1

R1

Axis 2

2

R2

Axis 3

0

R3

Axis 4

0

DR4

Target Position 1

60000

DR6

Target Position 2

80000

DR8

Target Position 3

0

DR10

Target Position 4

0

DR12

Maximum Velocity

10000

DR14

Acceleration Time (ms)

2

DR16

Deceleration Time (ms)

2

R18

Acc S curve (‰)

0

R19

Dec S curve (‰)

0

  • When entering the target position and maximum velocity on the status page, the decimal point position set in the axis table must be taken into account. In this example, the decimal point position is set to three decimal places, so three zeros must be added.

7-22-27 Arc Interpolation (MFAxCirMov)

Fun239D P

MFAxCirMov

Arc Interpolation

Fun239 D P

MFAxCirMov

Symbol

Ladder Symbol

Operands

TAX : Total Axis Number

MD : Operation Mode

DR : Direction

BF : Continuous Mode

D : Parameter Register Start Address

EC : Register for Error code

Relay and Register

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

TAX

○

○

○

○

○

○

○

○

○

○

○

○

○

2~3

MD

0~1

DR

○

○

○

○

○

○

○

○

○

○

○

○

○

1~2

BF

○

○

○

○

○

○

○

○

○

○

○

○

○

0~5

D

○

○

○

○

○

○

○

○

○

○

○

○

○

EC

○

○

○

○

○

○

○

○

○

○

○

○

○

Fun239D P

MFAxCirMov

Arc Interpolation

Fun239 D P

MFAxCirMov

Descriotion

  • Operands

TAX (Total Axis Number) : Axes number in movement – 2 ~ 3

MD (Operation Mode) : 0 – Absolute Positioning, 1 – Relative Positioning.

DR (Direction) : 1 – Positive, 2 – Negative.

BF (Continuous Mode) : 0: Stop Current Movement

1: Wait Current Mov Finish

2: Continue with Lower Speed

3: Continue with Current Speed

4: Continue with New Speed

5: Continue with higher Speed

D : First Register Address of Data.

EC : Register for Error Code.

  • When execution control (EN) is triggered in upper edge, the Fun239 will be executed for arc interpolation.

When execution control (EN) is triggered in lower edge, the Fun239 will be stopped, and all the coils will be reset.

  • When the function is in operating, if the update parameter is trigger in upper edge, current value of in the parameter D and the value DR will be updated immediately.
  • When the function is in operating, the coil ACT will be set to ON.
  • When the function is in error, the coil ERR will be set to ON.
  • When the function is finished, the coil DN will be set to ON.
  • When the parameter update is success, the coil UPDN will be set to ON.

Fun239D P

MFAxCirMov

Arc Interpolation

Fun239 D P

MFAxCirMov

Motion data in parameter D:

Register Address

Parameter

Data Type

Note

R+0

Axis 1

WORD

R+1

Axis 2

WORD

R+2

Axis 3

WORD

R+3

Target Position 1

WORD

Decimal point of Axis 1

R+5

Target Position 2

DWORD

Decimal point of Axis 2

R+7

Target Position 3

DWORD

Decimal point of Axis 3

R+9

Maximum Velocity

DWORD

Decimal point of Axis 1, positive

R+11

Acceleration Time (ms)

DWORD

Time from 0 to maximum

R+13

Deceleration Time (ms)

DWORD

Time from maximum to 0

R+15

Acc S curve (‰)

WORD

Range: 0~1000 ‰

R+16

Dec S curve (‰)

WORD

Range: 0~1000 ‰

R+17

Circular (Arc) Mode

WORD

0: Border, mode,

1: Center, Clockwise,

2: Center, Counterclockwise,

3: Radius, Clockwise,

4: Radius, Counterclockwise,

R+18

X Coordinate / Radius

DWORD

Decimal point of Axis 1

R+20

Y Coordinate

DWORD

Decimal point of Axis 1

R+22

Z Coordinate

DWORD

Decimal point of Axis 1

Fun239D P

MFAxCirMov

Arc Interpolation

Fun239 D P

MFAxCirMov

Example

Ladder

  • When M0 is triggered in upper edge, the 2 axis arc interpolation movement will be executed in relative mode (MD = 1). The parameter is in positive direction (DR = 1), and the movement will interrupt the current movement (BF = 0).
  • The movement will follow the parameters in R0 to DR22 (D = R0) and the error code will be showed in R100 (EC = R100).
  • Motion data

Register Address

Parameter

Value

R0

Axis 1

1

R1

Axis 2

2

R2

Axis 3

0

DR3

Target Position 1

100000

DR5

Target Position 2

0

DR7

Target Position 3

0

DR9

Maximum Velocity

20000

DR11

Acceleration Time (ms)

2

DR13

Deceleration Time (ms)

2

R15

Acc S curve (‰)

0

R16

Dec S curve (‰)

0

R17

Circular (Arc) Mode

1

DR18

X Coordinate / Radius

50000

DR20

Y Coordinate

0

DR22

Z Coordinate

0

Fun239D P

MFAxCirMov

Arc Interpolation

Fun239 D P

MFAxCirMov

  • When entering the target position, maximum velocity and X coordinate / radius on the status page, the decimal point position set in the axis table must be taken into account. In this example, the decimal point position is set to three decimal places, so three zeros must be added.

Fun239D P

MFAxCirMov

Arc Interpolation

Fun239 D P

MFAxCirMov

Combining the use of Fun238 and Fun239

  • When M0 of Fun238 is triggered in upper edge, the 2 axis linear interpolation movement will be executed in absolute mode (MD = 1). The parameter is in positive direction (DR = 1), and the movement will interrupt the current movement (BF = 0).
  • Motion data

Register Address

Parameter

Value

R0

Axis 1

1

R1

Axis 2

2

R2

Axis 3

0

R3

Axis 4

0

DR4

Target Position 1

40000

DR6

Target Position 2

30000

DR8

Target Position 3

0

DR10

Target Position 4

0

DR12

Maximum Velocity

10000

DR14

Acceleration Time (ms)

2

DR16

Deceleration Time (ms)

2

R18

Acc S curve (‰)

0

R19

Dec S curve (‰)

0

  • When M4 of Fun239 is triggered in upper edge, the 2 axis linear interpolation movement will be executed in absolute mode (MD = 1). The parameter is in positive direction (DR = 1), and the movement will interrupt the current movement (BF = 0).

Fun239D P

MFAxCirMov

Arc Interpolation

Fun239 D P

MFAxCirMov

  • Motion data

Register Address

Parameter

Value

R50

Axis 1

1

R51

Axis 2

2

R52

Axis 3

0

DR53

Target Position 1

50000

DR55

Target Position 2

0

DR57

Target Position 3

0

DR59

Maximum Velocity

10000

DR61

Acceleration Time (ms)

2

DR63

Deceleration Time (ms)

2

R65

Acc S curve (‰)

0

R66

Dec S curve (‰)

0

R67

Circular (Arc) Mode

3

DR68

X Coordinate / Radius

25000

DR70

Y Coordinate

0

DR72

Z Coordinate

0

7-22-28 Path Movement (MFPathMov)

Fun240 D P

MFPathMov

Path Movement( in development )

Fun240 D P

MFPathMov

Symbol

Ladder Symbol

Operands

AX1 : Axis 1 Number

AX2 : Axis 2 Number

AX3 : Axis 3 Number

PT : Path Number

V : Velocity

TA : Acceleration Time

TD : Deceleration Time

SA : Acceleration S Curve Percentage

SD : Deceleration S Curve Percentage

EC : Register for Error Code

Relay and Register

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

|

R34895

R35024

|

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

AX1

0~16

AX2

0~16

AX3

0~16

PT

○

○

○

○

○

○

○

○

○

○

○

○

○

0~10

V

○

○

○

○

○

○

○

○

○

○

○

○

○

TA

○

○

○

○

○

○

○

○

○

○

○

○

○

TD

○

○

○

○

○

○

○

○

○

○

○

○

○

SA

○

○

○

○

○

○

○

○

○

○

○

○

○

SD

○

○

○

○

○

○

○

○

○

○

○

○

○

EC

○

○

○

○

○

○

○

○

○

○

○

○

○

Fun240 D P

MFPathMov

Path Movement( in development )

Fun240 D P

MFPathMov

Description

  • Operands

AX1: EtherCAT axis number range 1~16

AX2: EtherCAT axis number range 1~16

AX3: EtherCAT axis number range 1~16r

PT: Path Number range 1~10

V: Velocity is positive integer and include the decimal point in the axis table of the main axis

(AX1).

TA: Acceleration time of the interpolation. The unit is milli-second.

TD: Deceleration time of the interpolation. The unit is milli-second.

SA: The percentage of the S curve in acceleration. The range is 0~1000‰.

SD: The percentage of the S curve in acceleration. The range is 0~1000‰.

EC: Register for Error Code.

  • When execution control (EN) is triggered in upper edge, the Fun240 will move to the first point of the path.

When execution control (EN) is triggered in lower edge, the Fun240 will be stopped, and all the coils will be reset.

  • When start movement (ACT) is triggered in upper edge, the Fun240 will start the path movement.

When start movement (ACT) is triggered in lower edge, the Fun240 will be halt. And the function will be resumed when ACT is back to high level.

  • When the function is in operating, if the update parameter is trigger in upper edge, current value of in the parameter D and the value DR will be updated immediately.
  • When the function is in operating, the coil ACT will be set to ON.
  • When the function is in error, the coil ERR will be set to ON.
  • When the function is finished, the coil DN will be set to ON.
  • When the parameter update is success, the coil UPDN will be set to ON.

Fun240 D P

MFPathMov

Path Movement( in development )

Fun240 D P

MFPathMov

Example

Requires HMI( in development )

Ladder

  • When the EN is triggered in upper edge, the axis 1 and axis 2 will move to the first point of Path number 1. The path velocity and other motion parameters will follow the parameters in function 240.
  • After the ACT is triggered in upper edge, the path control will start.

7-23 Other Instructions (FUN115, FUN258)

7-23-1 Data Buffering (DBUF)

FUN115P

DBUF

Data Buffering

FUN115P

DBUF

Symbol

D:\patrick\說明書翻譯\圖\DBUF.png

ID: Expansion module ID

CH: The channel designated for expansion module (0~3)

D: Starting position where the data will be saved.

Range

Operand

HR

IR

OR

SR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

ID

0-127

○

CH

○

○

○

○

○*

○*

0-63

○

D

○

○

○

8 word

Description

It is used to obtain the data buffered on the module, which is suitable for expansion modules that have analog input and support data buffering function. The buffered data collected through this command will not be limited by the program scan cycle, but will be collected based on the sampling cycle set by the module.

FUN115P

DBUF

Data Buffering

FUN115P

DBUF

Example

The data buffer function can be controlled through the relay, and the digital operation value can be stored in the data buffer area to observe the change of the digital operation value.

Use methods and instructions

Each buffer point updates the digital operation value to the data buffer area according to the processing time of the A/D conversion mode.

Each channel can store up to 600 points/ch.

Example:

When the cache points are set to 600 and the pre-trigger data points are set to 50:

Fig. 137: Example diagram of the data buffering function

Setting and preset value

Setting

Preset Value

Buffer Points Before Trigger

200

Buffer Points

600

Table 65: Setting of data buffering function

FUN115P

DBUF

Data Buffering

FUN115P

DBUF

The following table shows how to use the data buffer function:

Run-time Relay Control

Data Buffer Relay

Description

Setting

Data Buffer Request Relay

Buffer Request

Off->On: Start buffering

On->Off: Suspend buffering

Data Buffer Trigger Relay

Trigger

Off->On: Trigger data buffer relay

Data Buffer Completion Status Relay

Buffer Completion Data

Off->On:

The specified cache points are completed, and the cache can be read through command 115 (DBUF function).

On->Off:

Data Buffer Request Relay: On -> Off, Off when the buffering is turned off.

Data Buffer Completion Status Relay: On->Off->On, Off when retriggered, until Off->On after the buffer points are completed.

Table 66: Steps to use the data buffering function

After the data buffering is completed, use Fun115 DBUF to read the buffered data stored in the module to the address of the PLC designated register.

7-23-2 Tare Weight Deduction Command

FUN258P

MODCONF

Tare Weight Deduction Command

FUN258P

MODCONF

Symbol

OP: TARESUB

ID: Expansion module ID number (0~N)

CH: The channel position to be deducted (0~N)

SB: The 32BIT value of the tare weight to be deducted

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

V、Z

P0~P9

OP

TARESUB

ID

○

○

○

○

○

○

○

○

○

○

○

○*

○*

0~64

○

CH

○

○

○

○

○

○

○

○

○

○

○

○

○

0~64

○

SB

○

○

○

○

○

○

○

○

○

○

○

○

○

○

FUN258P

MODCONF

Tare Weight Deduction Command

FUN258P

MODCONF

Description

  • To subtract the custom tare weight, you must change the config setting to “digital mode”. In the “light touch mode”, the current gross weight will be regarded as the tare weight directly deducted.
  • Removing the fixed tare weight and recalibrating it may benefit from improved accuracy.
  • When the Tare weight deduction command is enabled, if it is "light touch mode," it is the automatic parameter setting mode subtracting the current scale reading value.
  • When the command of tare weight deducting is enabled, if the command mode is set to "digital", it is the manual parameter setting mode. At this time, the user can set the tare weight to be deducted by himself. When the command to enable tare weight deducting is sent, the command will subtract the corresponding weight according to the parameters set by the user.
  • When RST OFF->ON, the setting before control will be restored.

7-23-3 Tare Weight Offset Command

FUN258P

MODCONF

Tare Weight Offset Command

FUN258P

MODCONF

Symbol

OP: TAREZROFFSET

ID: Expansion module ID number (0~N)

CH: The channel position to be deducted (0~N)

WR: Starting register for offset command setting

Range

Operand

WX

WY

WM

WSM

WS

TMR

CTR

HR

IR

OR

SR

ROR

DR

K

XR

WX0

∣

WX1008

WY0

∣

WY1008

WM0

∣

WM9104

WM9120

∣

WM25584

WS0

∣

WS3088

T0

∣

T1023

C0

∣

C1279

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R35280

∣

R43223

R43224

∣

R47319

D0

∣

D7999

V、Z

P0~P9

OP

TAREZROFFSET

ID

○

○

○

○

○

○

○

○

○

○

○

○*

○*

0~64

○

CH

○

○

○

○

○

○

○

○

○

○

○

○

○

0~64

○

SB

○

○

○

○

○

○

○

○

○

○

○

○

○

○

Description

WR list:

WR+0

INA gain

WR+1

ADC gain

WR+2

digital value, 32 bits

WR+3

FUN258P

MODCONF

Tare Weight Offset Command

FUN258P

MODCONF

Description

  • Remove the fixed tare weight. By setting the Instrumentation amplifier gain and ADC gain, it is possible to improve ADC conversion accuracy.
  • Automatically parameter setting mode set the command mode to 0 and send the command to enable the tare zero function. The module will automatically calculate the appropriate Instrumentation amplifier gain, ADC gain, and Digital value and send it back to the PLC.
  • User manual setting mode, MD=1, send a command to enable the tare zero function, and the command will be accompanied by the Instrumentation amplifier gain, ADC gain and Digital value set by the user. The Instrumentation amplifier gain is 433.92, 216.96 and 108.48, the ADC gain is 1, 2, 4, 8 and 16, and the Digital value setting range is 1~ 56874 (2.1696 V).
  • The formula for calculating fixed weight,

  • The suggested formula for ADC/INA Gain setting,

*The tare weight offset command is only supported by the LCR module, not by the LC.

7-24 Floating Point Instructions (FUN200~220)

7-24-1 CONVERSION OF INTEGER TO FLOATING POINT NUMBER

FUN200D P

I🡪F

CONVERSION OF INTEGER TO FLOATING POINT NUMBER

FUN200D P

I🡪F

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

S: Starting register of Integer to be converted

D: Starting register to store the result of conversion

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

S and D operands can be combined with V, Z, P0~P9 indicators for indirect addressing applications

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

16/32-bit

+/-number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

D

○

○*

○*

○

Description

  • 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).
  • When the execution control "EN"=1 or from 0→1 (P instruction), the integer value data in the S register is converted into floating-point format data, and then stored in the D register.

FUN200D P

I🡪F

CONVERSION OF INTEGER TO FLOATING POINT NUMBER

FUN200D P

I🡪F

Example

Ladder diagram

ST

Generate corresponding tags in the label first ->

IF X0 Then

ItoF( S:= R0, D=> Tag_FlD0);

END_IF

    • R0 = 200 → X0=
    • After I > F Conversion → DD0 = 4348000H

7-24-2 CONVERSION OF FLOATING POINT NUMBER TO INTEGER

FUN201D P

F🡪I

CONVERSION OF FLOATING POINT NUMBER TO INTEGER

FUN201D P

F🡪I

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

S: Starting register of Integer to be converted

D: Starting register to store the result of conversion

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

S and D operands can be combined with V, Z, P0~P9 indicators for indirect addressing applications

Range

Operand

HR

IR

OR

ROR

DR

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

V, Z

P0 ~ P9

S

○

○

○

○

○

○

D

○

○*

○*

○

Description

  • 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)
  • When the execution control "EN"=1 or from 0→1 (P command), the floating-point data in the S register is converted into integer format data and stored in the D register.
  • 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.
  • Nearest INT (Alt+N) rounds a floating-point number to the nearest integer.

FUN201D P

F🡪I

CONVERSION OF FLOATING POINT NUMBER TO INTEGER

FUN201D P

F🡪I

Example

Ladder diagram

ST

Generate corresponding tag in the label first ->

IF X2 Then

FtoI( S:= Tag_FlR20, D=> D10);

END_IF

  • DR20 = 123.45 → X2=
  • After F > I Conversion → D10 = 007BH

7-24-3 FLOATING POINT NUMBER ADDITION

FUN202 P

FADD

FLOATING POINT NUMBER ADDITION

FUN202 P

FADD

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

Sa: Augend

Sb: Addend

D: Destination register to store the results of the addition

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

Sa, Sb, D may combine with V, Z, P0~P9 to serve indirect addressing

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

D

○

○

○

○

Description

  • 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-P. 118 (Numbering System).
  • When addition control "EN"=1 or from 0→1 (P instruction), perform floating-point addition operation on Sa and Sb and write the result into D. If the execution result exceeds the expressible range of floating point numbers (+-3.4*10 38)", the error flag "ERR" is set to 1, and the value of the D register is an invalid value, which should be ignored.

FUN202 P

FADD

FLOATING POINT NUMBER ADDITION

FUN202 P

FADD

Example

Ladder diagram

ST

Generate corresponding tag in the label first ->

IF X0 Then

Tag_FlR20 := Tag_FlR10 + Tag_FlR0 ;

END_IF

  • When X0=ON, performs the addition of the data specified at Sa and Sb:

7-24-4 FLOATING POINT NUMBER SUBTRACTION

FUN203 P

FSUB

FLOATING POINT NUMBER SUBTRACTION

FUN203 P

FSUB

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

Sa: Minuend

Sb: Subtrahend

D: Destination register to store the results of the subtraction

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

Sa, Sb, D may combine with V, Z, P0~P9 to serve indirect addressing.

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

D

○

○*

○*

○

Description

  • 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).
  • When addition control "EN"=1 or from 0→1 (P instruction), perform floating-point addition operation on Sa and Sb and write the result into D. If the execution result exceeds the expressible range of floating point numbers (+-3.4*10 38)", the error flag "ERR" is set to 1, and the value of the D register is an invalid value, which should be ignored.

FUN203 P

FSUB

FLOATING POINT NUMBER SUBTRACTION

FUN203 P

FSUB

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF X0 Then

Tag_FlR10 := Tag_FlR0 – Tag_FlR4 ;

END_IF

  • When X0=ON, performs the subtraction of the data specified at Sa and Sb

7-24-5 FLOATING POINT NUMBER MULTIPLICATION

FUN204 P

FMUL

FLOATING POINT NUMBER MULTIPLICATION

FUN204 P

FMUL

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

Sa: Multiplicand

Sb: Multiplier

D: Destination register to store the results of the multiplication

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

Sa, Sb, D may combine with V, Z, P0~P9 to serve indirect addressing

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

D

○

○*

○*

○

Description

  • 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)-P.118.
  • When addition control "EN"=1 or from 0→1 (P instruction), perform floating-point addition operation on Sa and Sb and write the result into D. If the execution result exceeds the expressible range of floating point numbers (+-3.4*10 38)", the error flag "ERR" is set to 1, and the value of the D register is an invalid value, which should be ignored.

FUN204 P

FMUL

FLOATING POINT NUMBER MULTIPLICATION

FUN204 P

FMUL

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF M10 Then

Tag_FlR14 := Tag_FlR10 * Tag_FlR12 ;

END_IF

OR

IF M10 Then

FMUL( Sa:= Tag_FlR10, Sb:= Tag_FlR12, D:= Tag_FlR14);

END_IF

When M10= Performs the multiplication of the data specified at Sa and Sb :

7-24-6 FLOATING POINT NUMBER DIVISION

FUN205 P

FDIV

FLOATING POINT NUMBER DIVISION

FUN205 P

FDIV

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

Sa: Dividend

Sb: Divisor

D: Destination register to store the results of the division

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

Sa, Sb, D may combine with V, Z, P0~P9 to serve indirect addressing

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

D

○

○*

○*

○

Description

  • 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)-P.118.
  • When addition control "EN"=1 or from 0→1 (P instruction), perform floating-point addition operation on Sa and Sb and write the result into D. If the execution result exceeds the expressible range of floating point numbers (+-3.4*10 38)", the error flag "ERR" is set to 1, and the value of the D register is an invalid value, which should be ignored.

FUN205 P

FDIV

FLOATING POINT NUMBER DIVIDION

FUN205 P

FDIV

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF X5 Then

Tag_FlR4 := Tag_FlR0 / Tag_FlR2 ;

END_IF

OR

IF X5 Then

FDIV( Sa:= Tag_FlR0, Sb:= Tag_FlR2, D:= Tag_FlR4);

END_IF

  • When X5=ON, performs the division of the data specified at Sa and Sb :

7-24-7 FLOATING POINT NUMBER COMPARE

FUN206 P

FCMP

FLOATING POINT NUMBER COMPARE

FUN206 P

FCMP

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

Sa: The register to be compared

Sb: The register to be compared

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

Sa, Sb may combine with V, Z, P0~P9 to serve indirect addressing.

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

Sb

○

○

○

○

○

○

○

Description

  • 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)-P.118.
  • 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.

FUN206 P

FCMP

FLOATING POINT NUMBER COMPARE

FUN206 P

FCMP

Example

Ladder diagram

ST

  • When X0=ON, compares the data of Sa and Sb:

  • From the above example, we first assume the data of DR0 is 200.1 and DR2 is 200.2, compare the data when X0 =1 by executing the CMP instruction. The FO0 and FO1 are set to 0 and FO2 (a<b) is set to 1 since a<b.
  • 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-24-8 FLOATING POINT NUMBER ZONE COMPARE

FUN207 P

FZCP

FLOATING POINT NUMBER ZONE COMPARE

FUN207 P

FZCP

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

S: Register for zone comparison

SU: The upper limit value

SL: The lower limit value

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

S, SU, SL may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

Su

○

○

○

○

○

○

○

S1

○

○

○

○

○

○

○

Description

  • 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)-P.118.
  • 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.
  • 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.

FUN207 P

FZCP

FLOATING POINT NUMBER ZONE COMPARE

FUN207 P

FZCP

Example

Ladder diagram

ST

IF X0 THEN

FZCP( S:= R10, Su:= R12, Sl:= R14, INZ=> Y0, S_Gt_U=> M0, S_Less_L=> M1, ERR=> M2);

END_IF

  • The instruction compares the value of DR10 with the upper and lower limit zones formed by DR12 and DR14. If the values of DR10~DR14 are as shown in the diagram at bottom left, then the result can then be obtained as at the right of this diagram.
  • If want to get the status of out side the zone, then OUT NOT Y0 may be used, or an OR operation between the two outputs S>U and S<L may be carried out, and move the result to Y0.

X0= 🡪 FLOATING ZONE COMPARE 🡪 Y0 = 1

Results of execution

7-24-9 FLOATING POINT NUMBER SQUARE ROOT

FUN208 P

FSQR

FLOATING POINT NUMBER SQUARE ROOT

FUN208 P

FSQR

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

S: Source register to be taken square root

D: Register for storing result

(Square root value)

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

S, D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

Sa

○

○

○

○

○

○

○

Sb

○

○*

○*

○

Description

  • 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)-P.118.
  • When the operation control "EN"=1 or from 0→1 (P instruction), take the square root value of the S value or the content value of the temporary register designated by S and store it in the temporary register designated by D.
  • If the value of S is negative, then the error flag "ERR" will be set to 1, and do not execute the operation.

FUN208 P

FSQR

FLOATING POINT NUMBER SQUARE ROOT

FUN208 P

FSQR

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF R_TRIG( S:= X0 ) Then

FSQR( S:= 2520.04, D:=Tag_FlD0 );

END_IF

When X0= ,take the square root of S :

7-24-10 SIN TRIGONOMETRIC INSTRUCTION

FUN209 P

FSIN

SIN TRIGONOMETRIC INSTRUCTION

FUN209 P

FSIN

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

S: Source register to be taken SIN

D: Register for storing result

(SIN value)

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

S, D may combine with V, Z, P0~P9 to serve indirect address application.

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

D

○

○*

○*

○

Description

  • 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)-P.118.
  • 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.
  • 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.

FUN209 P

FSIN

SIN TRIGONOMETRIC INSTRUCTION

FUN209 P

FSIN

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF R_TRIG( S:= X0 ) Then

FSIN( S:= 3000, D:= Tag_FlR100);

END_IF

  • In the example above, when X0=ON, store the value of in DR100.

7-24-11 COS TRIGONOMETRIC INSTRUCTION

FUN210 P

FCOS

COS TRIGONOMETRIC INSTRUCTION

FUN210 P

FCOS

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

S: Source register to be taken COS

D: Register for storing result (COS value)

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

S, D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

D

○

○*

○*

○

Description

  • 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).
  • 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.
  • 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.

FUN210 P

FCOS

COS TRIGONOMETRIC INSTRUCTION

FUN210 P

FCOS

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF R_TRIG( S:= X0 ) Then

FCOS( S:= R0, D:= Tag_FlR200);

END_IF

  • In the example above, when X0=ON, store the value of in DR200.

7-24-12 TAN TRIGONOMETRIC INSTRUCTION

FUN211 P

FTAN

TAN TRIGONOMETRIC INSTRUCTION

FUN211 P

FTAN

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

S: Source register to be taken TAN

D: Register for storing result (TAN value)

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

S, D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

D

○

○*

○*

○

Description

  • 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).
  • When the operation control "EN"=1 or from 0→1 (P instruction), the S value or the content value of the temporary register designated by S is taken from the TAN function and stored in the temporary register designated by D. The effective range of S is -18000~+18000, the unit is 0.01 degree.
  • 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.

FUN211 P

FTAN

TAN TRIGONOMETRIC INSTRUCTION

FUN211 P

FTAN

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF R_TRIG( S:= M0 ) Then

FTAN( S:= R0, D:= Tag_FlD50);

END_IF

  • In the example above, when M0= store the value of TAN∠45 into DD50.

7-24-13 CHANGE SIGN OF THE FLOATING POINT NUMBER

FUN212 P

FNEG

CHANGE SIGN OF THE FLOATING POINT NUMBER

FUN212 P

FNEG

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

D: Register to be changed sign

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

HR

IR

OR

ROR

DR

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

V, Z

P0 ~ P9

D

○

○

○

○

○

○

Description

  • 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).。
  • 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.
  • If value of D was originally negative, the result of taking a negative number will become a positive number.

FUN212 P

FNEG

CHANGE SIGN OF THE FLOATING POINT NUMBER

FUN212 P

FNEG

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF R_TRIG( S:= X0 ) Then

Tag_FlR0 := – Tag_FlR0;

END_IF

The instruction at left negates the value of the DR0 register, and stores it back to DR0.

7-24-14 FLOATING POINT NUMBER ABSOLUTE VALUE

FUN213 P

FABS

FLOATING POINT NUMBER ABSOLUTE VALUE

FUN213 P

FABS

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

D: Register to be taken absolute value

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

D may combine with V, Z, P0~P9 to serve indirect address application

Range

Operand

HR

IR

OR

ROR

DR

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

V, Z

P0 ~ P9

D

○

○

○

○

○

○

Description

  • 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).
  • 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.

FUN213 P

FABS

FLOATING POINT NUMBER ABSOLUTE VALUE

FUN213 P

FABS

Example

Ladder diagram

ST

  • This instruction calculates the absolute value of the DR0 register, and stores it back in DR0.

7-24-15 FLOATING POINT ARC SINE FUNCTION

FUN218 P

FASIN

FLOATING POINT ARC SINE FUNCTION

FUN218 P

FASIN

Symbol

※Because floating-point numbers occupy two registers, when using indirect addressing, it should be noted that odd-numbered registers cannot be used.

D:\patrick\說明書翻譯\圖\218.png

S: Source data or register to be calculated the arc sine value.

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

D: Register for storing the result.

S, D may combine with V, Z, P0~P9 to serve indirect address application.

MD: In order to make the user more intuitive in use, MD can choose the output mode:

MD is 0: the output value is the radius, and the output is a floating point number (32bit).

MD is 1: the output value is an angle, and the output is a positive integer (16bit).

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

D

○

○*

○*

○

MD

0,1

Description

  • 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).
  • When the operation control "EN"=1 or from 0→1 (P instruction), the S value or the temporary register content value designated by S takes the arc sine function value (unit is Radian) and stores it in D specified register.
  • Range of S data: -1~ +1; range of D value: -π/2 ~ π/2 (Unit in radian)
  • If the value of S exceeds the valid range, or the indirect addressing is wrong, the error flag "ERR" is set to 1, and the contents of the register designated by D will not be updated.
  • All floating point instructions can’t be executed in interrupt service routine.

FUN218 P

FASIN

FLOATING POINT ARC SINE FUNCTION, sin-1

FUN218 P

FASIN

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF M0 Then

FSIN( S:= R0, D:= Tag_FlR4);

FASIN_deg( S:= Tag_FlR4, D:= R6);

END_IF

  • When M0 = 1, calculate the arc sine value of DR4, then store the degree (MD=1) to DR6.

D:\patrick\說明書翻譯\圖\擷取.PNG

7-24-16 FLOATING POINT ARC COSINE FUNCTION

FUN219 P

FACOS

FLOATING POINT ARC COSINE FUNCTION

FUN219 P

FACOS

Symbol

※Because floating-point numbers occupy two temporary registers, when using indirect addressing, it should be noted that odd-numbered temporary registers cannot be used.

D:\patrick\說明書翻譯\圖\219.png

S: Source data or register to be calculated the arc cosine value.

The register used by the operand must be an even address. For example, R8 is legal, but R7 is not.

D: Register for storing the result.

S, D may combine with V, Z, P0~P9 to serve indirect address application.

MD: In order to make the user more intuitive in use, MD can choose the output mode:

MD is 0: the output value is the radius, and the output is a floating point number (32bit).

MD is 1: the output value is an angle, and the output is a positive integer (16bit).

Range

Operand

HR

IR

OR

ROR

DR

K

XR

R0

∣

R34767

R34768

∣

R34895

R35024

∣

R35151

R43224

∣

R47319

D0

∣

D7999

floating point number

V, Z

P0 ~ P9

S

○

○

○

○

○

○

○

D

○

○*

○*

○

MD

0,1

Description

  • 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).
  • When the operation control "EN"=1 or from 0→1 (P instruction), the S value or the temporary register content value designated by S takes the arc cosine function value (unit is Radian) and stores it in D specified register.
  • Range of S data: -1~ +1; range of D value: -π/2 ~ π/2 (Unit in radian)
  • If the value of S exceeds the valid range, or the indirect addressing is wrong, the error flag "ERR" is set to 1, and the contents of the register designated by D will not be updated.
  • All floating point instructions can’t be executed in interrupt service routine.

FUN219 P

FACOS

FLOATING POINT ARC COSINE FUNCTION

FUN219 P

FACOS

Example

Ladder diagram

ST

Generate corresponding tag in the label first

->

IF M0 Then

FCOS( S:= R0, D:= Tag_FlR4);

FACOS_deg( S:= Tag_FlR4, D:= R6);

END_IF

  • When M0 = 1, calculate the arc cosine value of DR4, then store the degree (MD=1) to DR6.

D:\patrick\說明書翻譯\圖\擷取.PNG

Was this page helpful?

Tip: press ← → to switch chapters, Ctrl+K to search