DELTA IA-OSW AX Series Standard Instructions Manual-V1.6.0 ENG 20240329
DELTA IA-OSW AX Series Standard Instructions Manual-V1.6.0 ENG 20240329
DELTA IA-OSW AX Series Standard Instructions Manual-V1.6.0 ENG 20240329
Asia EMEA
Delta Electronics (Shanghai) Co., Ltd. Delta Electronics (Netherlands) B.V.
No.182 Minyu Rd., Pudong Shanghai, P.R.C. Sales: [email protected]
Post code : 201209 Marketing: [email protected]
TEL: +86-21-6872-3988 / FAX: +86-21-6872-3996 Technical Support: [email protected]
Customer Service: 400-820-9595 Customer Support: [email protected]
Service: [email protected]
Delta Electronics (Japan), Inc. TEL: +31(0)40 800 3900
Industrial Automation Sales Department
2-1-14 Shibadaimon, Minato-ku Delta Electronics (Netherlands) B.V.
Tokyo, Japan 105-0012 Automotive Campus 260, 5708 JZ Helmond, The Netherlands
TEL: +81-3-5733-1155 / FAX: +81-3-5733-1255 Mail: [email protected]
TEL: +31(0)40 800 3900
Delta Electronics (Korea), Inc. Delta Electronics (Netherlands) B.V.
1511, 219, Gasan Digital 1-Ro., Geumcheon-gu,
Coesterweg 45, D-59494 Soest, Germany
Seoul, 08501 South Korea
Mail: [email protected]
TEL: +82-2-515-5305 / FAX: +82-2-515-5302
TEL: +49 2921 987 238
Delta Energy Systems (Singapore) Pte Ltd. Delta Electronics (France) S.A.
4 Kaki Bukit Avenue 1, #05-04, Singapore 417939 ZI du bois Challand 2, 15 rue des Pyrénées,
TEL: +65-6747-5155 / FAX: +65-6744-9228 Lisses, 91090 Evry Cedex, France
Mail: [email protected]
Delta Electronics (India) Pvt. Ltd. TEL: +33(0)1 69 77 82 60
Plot No.43, Sector 35, HSIIDC Gurgaon,
PIN 122001, Haryana, India Delta Electronics Solutions (Spain) S.L.U
TEL: +91-124-4874900 / FAX: +91-124-4874945 Ctra. De Villaverde a Vallecas, 265 1º Dcha Ed.
Hormigueras – P.I. de Vallecas 28031 Madrid
Delta Electronics (Thailand) PCL. TEL: +34(0)91 223 74 20
909 Soi 9, Moo 4, Bangpoo Industrial Estate (E.P.Z), Carrer Llacuna 166, 08018 Barcelona, Spain
Pattana 1 Rd., T.Phraksa, A.Muang, Mail: [email protected]
Samutprakarn 10280, Thailand Digitized Automation for a Changing World
TEL: +66-2709-2800 / FAX: +66-2709-2827 Delta Electronics (Italy) S.r.l.
Via Meda 2–22060 Novedrate(CO)
Delta Electronics (Australia) Pty Ltd.
Unit 2, Building A, 18-24 Ricketts Road,
Mount Waverley, Victoria 3149 Australia
Piazza Grazioli 18 00186 Roma Italy
Mail: [email protected]
TEL: +39 039 8900365
DIADesigner - AX Series Standard
Instructions Manual
Mail: [email protected]
Delta Energy System LLC
TEL: +61-1300-335-823 / +61-3-9543-3720
Vereyskaya Plaza II, office 112 Vereyskaya str.
17 121357 Moscow Russia
Americas Mail: [email protected]
TEL: +7 495 644 3240
Delta Electronics (Americas) Ltd.
5101 Davis Drive, Research Triangle Park, NC 27709, U.S.A. Delta Greentech Elektronik San. Ltd. Sti. (Turkey)
TEL: +1-919-767-3813 / FAX: +1-919-767-3969 Şerifali Mah. Hendem Cad. Kule Sok. No:16-A
34775 Ümraniye – İstanbul
Delta Electronics Brazil Ltd. Mail: [email protected]
Estrada Velha Rio-São Paulo, 5300 Eugênio de TEL: + 90 216 499 9910
Melo - São José dos Campos CEP: 12247-004 - SP - Brazil
TEL: +55-12-3932-2300 / FAX: +55-12-3932-237 Eltek Dubai (Eltek MEA DMCC)
OFFICE 2504, 25th Floor, Saba Tower 1,
Delta Electronics International Mexico S.A. de C.V. Jumeirah Lakes Towers, Dubai, UAE
Gustavo Baz No. 309 Edificio E PB 103 Mail: [email protected]
Colonia La Loma, CP 54060 TEL: +971(0)4 2690148
Tlalnepantla, Estado de México
TEL: +52-55-3603-9200
*We reserve the right to change the information in this manual without prior notice. DIAS-Manual-0025-EN
2023/05/11 www.deltaww.com
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l Re v is i on H is t or y
Revision History
Version Revision Date
1st The first version was published. 10/30/2020
1. Updated CH3:
• Added supported products AX-364E & AX-324N for DFB_Capture,
DFB_Compare, DFB_HCnt, DFB_HTmr, DFB_PresetValue,
DFB_Sample
• Updated library DL_BuiltInIO_AX3.library for DFB_Capture,
DFB_Compare, DFB_HCnt, DFB_HTmrr, DFB_PresetValue,
DFB_Sample
• Updated “dwTimerValue” unit
2. Updated CH4:
• Added supported product AX-364E for DFB_EcGetAllSlaveAddr,
DFB_EcGetSlaveCount, DFB_EtherCATLink_Diag,
DFB_GetAllECATSlaveInfo, DFB_GetECATMasterError,
DFB_GetECATMasterState, DFB_ResetECATMaster,
DFB_ResetECATSlave
3. Updated CH6:
• Added supported products AX-364E, AX-300, and AX-324N for
DFB_From, DFB_To
4. Updated CH7:
• Added supported products AX-364E,AX-300, and AX-324N for
DFB_ModbusComChannel, DFB_ModbusRequest,
DFB_ModbusRequest2
2nd 02/28/2021
“DFB_MR_ERROR“ update
• Added DFB_SLAVE_DEVICE_FAILURE, DFB_ACKNOWLEDGE,
DFB_SLAVE_DEVICE_BUSY, DFB_GATEWAY_PATH_UNAVAILABLE,
DFB_GATEWAY_DEVICE_FAILED_TO_RESPOND
• Removed DFB_NO_MDBSCOM_CONFIG
• Updated DFB_ILLEGAL_DATA_VALUE
5. Updated CH8:
• Added supported products AX-364E, AX-300, and AX-324N for
DFB_TCP_Client, DFB_TCP_Server, DFB_UDP_Socket,
DFB_ModbusTCPChannel, DFB_ModbusTCPRequest
“DFB_MR_ERROR“ update
• Added DFB_SLAVE_DEVICE_FAILURE, DFB_ACKNOWLEDGE,
DFB_SLAVE_DEVICE_BUSY, DFB_GATEWAY_PATH_UNAVAILABLE,
DFB_GATEWAY_DEVICE_FAILED_TO_RESPOND,
DFB_INVALID_FUNCTION_CODE, DFB_NO_ETHERNET_CONFIG
• Removed DFB_NO_MDBSETH_CONFIG
• Updated DFB_ILLEGAL_DATA_VALUE,
DFB_MEMORY_NOT_ENOUGH
6. Updated CH9:
• Added supported products AX-364E, AX-300, and AX-324N for
DFB_MemoryRead, DFB_MemoryWrite
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l Re v is i on H is t or y
TOC
P1 Preface .......................................................................................................................... 1
P1.1 Introduction ............................................................................................................ 2
P1.1.1 Applicable Products ............................................................................................... 2
P1.1.2 Associated Manuals ............................................................................................... 2
Chapter 1 Move Instructions .............................................................................................. 3
1.1 DFC_NIBMOV .......................................................................................................... 4
1.2 DFC_XCH ................................................................................................................ 7
1.3 DFC_Clear ............................................................................................................... 9
1.4 Error Code and Troubleshooting ............................................................................... 11
Chapter 2 Comparison Instructions................................................................................... 12
2.1 DFC_CMP .............................................................................................................. 13
2.2 DFC_UCMP ............................................................................................................ 15
2.3 DFC_LRCMP .......................................................................................................... 17
2.4 DFC_ZCP .............................................................................................................. 19
2.5 DFC_UZCP ............................................................................................................ 21
2.6 DFC_LRZCP ........................................................................................................... 23
Chapter 3 Timers and Counters Instructions ...................................................................... 25
3.1 DFB_Capture ......................................................................................................... 26
3.2 DFB_Compare ....................................................................................................... 35
3.3 DFB_HCnt ............................................................................................................. 42
3.4 DFB_HTmr ............................................................................................................ 48
3.5 DFB_PresetValue.................................................................................................... 52
3.6 DFB_Sample.......................................................................................................... 57
3.7 Error Codes and Troubleshooting .............................................................................. 61
Chapter 4 EtherCAT Network Instructions .......................................................................... 65
4.1 DFB_EcGetAllSlaveAddr .......................................................................................... 66
4.2 DFB_EcGetSlaveCount ............................................................................................ 70
4.3 DFB_EtherCATLink_Diag ......................................................................................... 73
4.4 DFB_GetAllECATSlaveInfo ....................................................................................... 78
4.5 DFB_GetECATMasterError........................................................................................ 82
4.6 DFB_GetECATMasterState ....................................................................................... 85
4.7 DFB_ResetECATMaster ............................................................................................ 88
4.8 DFB_ResetECATSlave.............................................................................................. 92
4.9 Error Codes and Troubleshooting .............................................................................. 96
Chapter 5 Checksum Instructions ..................................................................................... 97
5.1 DFC_LRC8 ............................................................................................................. 98
5.2 DFC_LRC16 .......................................................................................................... 100
5.3 DFC_LRC32 .......................................................................................................... 102
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l TO C
Chapter 9 Instructions for Reading and Writing a Memory Card ........................................... 275
9.1 DFB_MemoryRead ................................................................................................. 276
9.2 DFB_MemoryWrite ................................................................................................ 279
9.3 Error Codes and Troubleshooting ............................................................................. 283
Chapter 10 High Speed Output Instructions........................................................................ 286
10.1 DFB_PWM ............................................................................................................ 287
10.2 Error Codes and Troubleshooting ............................................................................. 291
Chapter 11 Additional Instructions .................................................................................... 292
11.1 DFC_LogGetSize ................................................................................................... 293
11.2 DFB_LogDump ...................................................................................................... 295
11.3 Error Codes and Troubleshooting ............................................................................. 298
Chapter 12 SNTP Instructions ........................................................................................... 302
12.1 SNTPGetUTCTime .................................................................................................. 303
12.2 SNTPServer .......................................................................................................... 306
12.3 Error Codes .......................................................................................................... 308
Chapter 13 Util Library Instructions ................................................................................... 309
13.1 SeparateDateTime ................................................................................................. 310
13.2 Error Codes .......................................................................................................... 312
Chapter 14 MEMUtils Library Instructions ........................................................................... 313
14.1 MemCpy .............................................................................................................. 314
14.2 MemSet ............................................................................................................... 316
14.3 Error Codes .......................................................................................................... 318
Chapter 15 SysTimeRtc Library Instructions ......................................................................... 319
15.1 SysTimeRtcHighResGet .......................................................................................... 320
15.2 SysTimeRtcConvertHighResToDate .......................................................................... 322
15.3 Error Codes .......................................................................................................... 324
Chapter 16 DL_SysInfo Library Instructions ......................................................................... 325
16.1 DFC_GetPLCErrorID............................................................................................... 326
16.2 DFC_ReadBatteryLowStatus ................................................................................... 328
16.3 DFB_HWInfo......................................................................................................... 330
16.4 Error Codes .......................................................................................................... 333
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l P r ef ac e
P1 Preface
1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l P r ef ac e
P1.1 Introduction
Thank you for purchasing our product. The AX series motion controller provides a high-level motion control system
based on CODESYS to integrate the control function of PLCs and Motion Control.
This manual introduces Delta self-developed function blocks and functions for customers to perform PLC application
development.
P1.1.1 Applicable Products
2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
1.1 DFC_NIBMOV
DFC_NIBMOV: Data shift.
DFC_NIBMOV(
pSrc:= ,
wSrcStartPos:= ,
FC DFC_NIBMOV pDst:= ,
wDstStartPos:= ,
wNum:= ,
ErrorID=> );
• Inputs
Setting Value
Name Function Data Type
(Default value)
Memory address of source
pSrc POINTER TO BYTE Memory address (0)
variables
Start address for source
wSrcStartPos variable shift WORD* Positive integer (0)
(Unit: Nibble)
Memory address of target
pDst POINTER TO BYTE Memory address (0)
variables
Start address for storing
wDstStartPos target variable WORD* Positive integer (0)
(Unit: Nibble)
The data length for data
1–256
wNum shift WORD*
Positive integer (0)
(Unit: Nibble)
*Note: The variable types BYTE and WORD can be used for inputs.
• Outputs
Output Range
Name Function Data Type
(Default value)
Instruction running result
DFC_NIBMOV (The parameter is BOOL True/False (False)
returned)
ErrorID Error code DL_MOV_ERROR DL_MOV_ERROR(DFC_NO_ERROR)
4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
• Function
After running this Function, the value of variable1 (pSrc) will be copied to variable2 (pDst), while the length of copied
data is determined by wNum input. (Unit: Nibble)
• Programming Example
Example 1
In this example, FC instruction (DFC_NIBMOV) is used for shifting the content of wVar0 (pSrc) to the
variable wVar1 (pDst).
Since wSrcStartPos=2, wNum=2 and wDstStartPos=0, two consecutive Nibbles (Length=2), which start
from Nibble2 of variable wVar0 (pSrc), are shifted to the address Nibble0 inside the memory of wVar1
(pDst).
5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
Example 2
In this example, FC instruction (DFC_NIBMOV) is used for shifting the content of ar_wVar0 (pSrc) to the
variable ar_wVar1 (pDst).
Since wSrcStartPos=3, wNum=2 and wDstStartPos=0, two consecutive Nibbles (Length=2), which start
from Nibble3 of variable ar_wVar0 (pSrc), are shifted to the address Nibble0 inside the memory of ar_wVar1
(pDst).
• Supported Products
AX series
• Library
DL_Mov.library
6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
1.2 DFC_XCH
DFC_XCH: Data exchange between two variables.
DFC_XCH(
pSrc1:= ,
FC DFC_XCH pSrc2:= ,
dwNum:= ,
ErrorID=> );
• Inputs
Setting Value
Name Function Data Type
(Default value)
Memory address of
pSrc1 POINTER TO BYTE Memory address (0)
variable1
Memory address of
pSrc2 POINTER TO BYTE Memory address (0)
variable2
The length of data for 1–65535
dwNum DWORD*
exchange.(Unit: Byte) Positive integer(0)
*Note: The variable types BYTE, WORD and DWORD can be used for dNum input.
• Outputs
Output Range
Name Function Data Type
(Default value)
Instruction running result
DFC_XCH (This parameter is BOOL True/False (False)
returned)
ErrorID Error code DL_MOV_ERROR DL_MOV_ERROR(DFC_NO_ERROR)
• Function
After running this Function, the value of variable1 (pSrc1) will be copied to variable2 (pSrc2), while the length
of copied data is determined by dwNum input.
7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
• Programming Example
In this example, Function (DFC_XCH) is used for exchanging contents of two variables.
Since the data length for data exchange is set to one Byte (Length=1), low-byte of variable1 and 2 will be
switched after running Function (DFC_XCH).
• Supported Products
AX series
• Library
DL_Mov.library
8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
1.3 DFC_Clear
DFC_Clear: Clear the value of the variable.
DFC_Clear(
In:= ,
FC DFC_Clear
ErrorID=>
);
• Inputs
Setting Value
Name Function Data Type
(Default value)
• Outputs
Output Range
Name Function Data Type
(Default value)
Instruction running result
DFC_Clear (This parameter is BOOL True/False (False)
returned)
ErrorID Error code DL_MOV_ERROR DL_MOV_ERROR(DFC_NO_ERROR)
• Function
1. This function is supported with DL_Mov V1.0.6.1 or later.
2. When this instruction is running, the value of the variable (In) is cleared to 0, instead of the initial value
declared by the variable.
3. Supported variable types:
9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
POINTER
REFERENCE
BOOL Bit strings Integers
Numbers dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In
Support an enumeration, array, array element, struct, or struct member.
• Programming Example
This example uses DFC_Clear to clear the variable value.
1. Declare Structure
2. When bCallFunction is True, clear the value entered by DFC_Clear of the variable.
• Supported Products
AX series
• Library
DL_Mov.library
10
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 1
11
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
12
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
2.1 DFC_CMP
DFC_CMP: Comparison between LINT variables.
DFC_CMP(
FC DFC_CMP liSrc1:= ,
liSrc2:= )
• Inputs
Setting Value
Name Function Data Type
(Default value)
LINT:-263–263-1
liSrc1 Variable1 LINT*
(0)
LINT:-263–263-1
liSrc2 Variable2 LINT*
(0)
*Note: The variable types SINT, INT, DINT and LINT can be used for inputs.
• Outputs
Output Range
Name Function Data Type
(Default value)
1:liSrc1 = liSrc2
Instruction running result
2:liSrc1 < liSrc2
DFC_CMP (The parameter is WORD
3:liSrc1 > liSrc2
returned)
(0)
• Function
The FC instruction is used to compare the values in variable 1 with that in variable 2.
• Programing Example
This example use FC instruction (DFC_CMP) to do comparison between two variable values.
Since variable1 (liVar0) is smaller than variable2 (liVar1), the calculation result (wVar0) would be 2.
13
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
• Supported Products
AX series
• Library
DL_Comparison.library
14
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
2.2 DFC_UCMP
DFC_UCMP: Comparison between ULINT variables.
DFC_UCMP(
FC DFC_UCMP lwSrc1:= ,
lwSrc2:= )
• Input
Setting Value
Name Function Data Type
(Default Value)
ULINT/LWORD:0–264-1
lwSrc1 Variable 1 ULINT/LWORD*
(0)
ULINT/LWORD:0–264-1
lwSrc2 Variable 2 ULINT/LWORD*
(0)
*Note: The variable types USINT, UINT, UDINT, ULINT, BYTE, WORD, DWORD and LWORD can be used for inputs.
• Output
Output Range
Name Function Data Type
(Default Value)
1:lwSrc1 = lwSrc2
Instruction running result
2:lwSrc1 < lwSrc2
DFC_UCMP (The parameter is WORD
3:lwSrc1 > lwSrc2
returned)
(0)
• Function
The FC instruction is used to compare the values in variable 1(lwSrc1) with that in variable 2(lwSrc2).
• Programming Example
This example use FC instruction (DFC_UCMP) to do comparison between two variable values.
15
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
Since variable1 (uiVar0) is smaller than variable2 (uiVar1), the calculation result (wVar0) would be 2.
• Supported Products
AX series
• Library
DL_Comparison.library
16
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
2.3 DFC_LRCMP
DFC_LRCMP: Comparison between LREAL variables.
DFC_LRCMP(
FC DFC_LRCMP lrSrc1:= ,
lrSrc2:= )
• Input
Setting Value
Name Function Data Type
(Default Value)
LREAL:-1.7976931348623157E+308–
lrSrc1 Variable 1 LREAL* 1.7976931348623157E+308
(0)
LREAL:-1.7976931348623157E+308–
lrSrc2 Variable 2 LREAL* 1.7976931348623157E+308
(0)
*Note: The variable types REAL and LREAL can be used for inputs.
• Output
Output Range
Name Function Data Type
(Default Value)
1:lrSrc1 = lrSrc2
Instruction running result
2:lrSrc1 < lrSrc2
DFC_LRCMP (The parameter is WORD
3:lrSrc1 > lrSrc2
returned)
(0)
• Function
The FC instruction is used to compare the values in variable 1(lrSrc1) with that in variable 2(lrSrc2).
• Programming Example
This example use FC instruction (DFC_LRCMP) to do comparison between two variable values.
17
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
Since variable1 (lrVar0) is smaller than variable2 (lrVar1), the calculation result (wVar0) would be 2.
• Supported Products
AX series
• Library
DL_Comparison.library
18
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
2.4 DFC_ZCP
DFC_ZCP: Compares a range with a value of LINT variable.
DFC_ZCP(
liLowbound:= ,
FC DFC_ZCP
liHighbound:= ,
liSrc:= );
• Input
Setting Value
Name Function Data Type
(Default Value)
LINT:-263–263-1
liLowbound Lower value LINT*
(0)
LINT:-263–263-1
liHighbound Upper value LINT*
(0)
LINT:-263–263-1
liSrc Variable LINT*
(0)
*Note: The variable types SINT, INT, DINT and LINT can be used for inputs.
• Output
Output Range
Name Function Data Type
(Default Value)
1:liSrc < Lower value
Instruction running result
2: Lower value < liSrc < Upper value
DFC_ZCP (The parameter is WORD
3:liSrc > Upper value
returned)
(0)
• Function
This FC instruction is used to compare the values in variable (liSrc) with the upper and lower value of the range.
• Programming Example
This example use FC instruction (DFC_ ZCP) to compare variable values with the upper and lower value.
19
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
Since the value in variable (liVar0) is larger than the upper value (H_liVar), the calculation result (wVar0) is 3.
• Supported Products
AX series
• Library
DL_Comparison.library
20
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
2.5 DFC_UZCP
DFC_UZCP: Compares a range with a value of ULINT variable.
DFC_UZCP(
lwLowbound:= ,
FC DFC_UZCP
lwHighbound:= ,
lwSrc:= );
• Input
Setting Value
Name Function Data Type
(Default Value)
ULINT/LWORD:0–264-1
lwLowbound Lower value ULINT/LWORD*
(0)
ULINT/LWORD:0–264-1
lwHighbound Upper value ULINT/LWORD*
(0)
ULINT/LWORD:0–264-1
lwSrc Variable ULINT/LWORD*
(0)
*Note: The variable types USINT, UINT, UDINT, ULINT, BYTE, WORD, DWORD, and LWORD can be used for inputs.
• Output
Output Range
Name Function Data Type
(Default Value)
1:lwSrc < Lower value
Instruction running result
2: Lower value < lwSrc < Upper value
DFC_UZCP (The parameter is WORD
3:lwSrc > Upper value
returned)
(0)
• Function
The FC instruction is used to compare the values in variable (lwSrc) with the upper and lower value of the range.
• Programming Example
This example use FC instruction (DFC_ UZCP) to compare variable values with the upper and lower value.
21
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
Since the value in variable (ulVar0) is larger than the upper value (H_ulVar), the calculation result (wVar0) is 3.
• Supported Products
AX Series
• Library
DL_Comparison.library
22
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
2.6 DFC_LRZCP
DFC_LRZCP: Compares a range with a value of LREAL variable.
DFC_LRZCP(
lrLowbound:= ,
FC DFC_LRZCP
lrHighbound:= ,
lrSrc:= );
• Input
Setting Value
Name Function Data Type
(Default Value)
LREAL:-1.7976931348623157E+308–
lrLowbound Lower value LREAL* 1.7976931348623157E+308
(0)
LREAL:-1.7976931348623157E+308–
lrHighbound Upper value LREAL* 1.7976931348623157E+308
(0)
LREAL:-1.7976931348623157E+308–
lrSrc Variable LREAL* 1.7976931348623157E+308
(0)
*Note: The variable types REAL and LREAL can be used for inputs.
• Output
Output Range
Name Function Data Type
(Default Value)
1:lrSrc < Lower value
Instruction running result
2: Lower value < lrSrc < Upper value
DFC_LRZCP (The parameter is WORD
3:lrSrc > Upper value
returned)
(0)
• Function
The FC instruction is used to compare the values in variable (lrSrc) with the upper and lower value of the range.
• Programming Example
This example use FC instruction (DFC_LRZCP) to compare variable values with the upper and lower value.
23
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 2
Since the value in variable (lrVar0) is smaller than the upper value (H_lrVar) and larger than the lower value
(L_lrVar), the calculation result (wVar0) is 2.
• Supported Products
AX series
• Library
DL_Comparison.library
24
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
The instructions in this chapter are applicable to HSIOs with built-in I/O on the host. You can
use the instructions to get the signal sampling or signal measurement.
25
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3.1 DFB_Capture
DFB_Capture captures the commanded pulses of the specified high-speed counter according to the designated
external trigger device.
DFB_Capture_instance(
Capture :=,
Counter :=,
bEnable :=,
uiMaskValue :=,
diDeltaMin :=,
diDeltaMax :=,
bEdgeSelect :=,
bCycle :=,bValid =>,
FB DFB_Capture
bBusy =>,
bError =>,
ErrorID =>,
bCapFlag =>,
diCapValue =>,
diCapValuePrevious =>,
diDelta =>,
bCapLenBeyondFlag =>,
dwCapLenBeyondCount =>);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Designate the
source of the DFB_ DFB_COUNTER_REF
Counter -
specified high- COUNTER_REF*1 (Cannot be null.)
speed counter.
Run the instruction
True/False
bEnable when bEnable BOOL -
(False)
changes to True.
When bEnable shifts to True,
Define the mask Positive number or
uiMaskValue UINT the setting parameters of
range of Capture. 0(0)
uiMaskValue will be updated.
Define the
minimum Positive number,
When bEnable shifts to True
diDeltaMin*3 difference DINT negative number or
and Busy is False
between each 0(0)
Capture*2.
Define the
maximum Positive number,
When bEnable shifts to True
diDeltaMax*3 difference DINT negative number or
and Busy is False
between each 0(0)
Capture*2.
26
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Define the rising When b Eable is rising edge,
True/False
bEdgeSelect edge or falling BOOL update the parameter of
(False)
edge capture bEdgeSelect
Define whether When b Eable is rising edge,
True/False
bCycle*3 capture values BOOL update the parameter of
(False)
continuously bCycle
*Note:
1. DFB_Counter_REF (FB): As the I/O interface of the high-speed counter to perform actions include parameter
adjustment and the driver.
2. uiMaskValue is in the DL_BuiltInIO library, and UINT is changed to UDINT after v1.0.5.0.
3. Once diDeltaMin and diDeltaMax are set to 0, the system will not check whether the capture range is
appropriate or not.
• Output
Output Range(Default
Name Function Data Type
value)
True when the output
bValid BOOL True/False (False)
value is valid
True when the instruction
bBusy BOOL True/False (False)
is enabled
bError True if an error occurs BOOL True/False (False)
Indicates the error code if DFB_HSIO_ERROR
ErrorID DFB_HSIO_ERROR*
an error occurs. (DFB_HSIO_NO_ERR)
Indicates that the current
Capture is valid.
bCapFlag (The flag shifts to True for BOOL True/False (False)
one scan cycle and will be
reset immediately)
Positive number, negative
diCapValue The captured value DINT
number or 0(0)
The previous captured Positive number, negative
diCapValuePrevious DINT
value number or 0(0)
The difference between
Positive number, negative
diDelta the previous and the DINT
number or 0(0)
current captured values.
Indicates that a capture is
failed.
bCapLenBeyondFlag (The flag shifts to True for BOOL True/False (False)
one scan cycle and will be
reset immediately)
Counts the number of the
dwCapLenBeyondCount DWORD Positive number or 0(0)
failed Capture.
27
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
• Timing Diagram
bEnable
bValid
bBusy
bError
• In-Outs
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Refer to the
source of the DFB_CAPTURE_REF DFB_CAPTURE_REF When bEnable shifts to True and
Capture
specified high- (FB)* (Cannot be null.) bBusy is False.
speed capture
28
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
*Note: DFB_CAPTURE_REF (FB): The I/O function block of the high-speed counter which contains parameter
adjustment and the driver.
• Function
bEdgeSelect
This feature is supported on AX-3 series with firmware version V1.0.5.0 or later and with lilbrary
DL_BuiltInIO V1.1.0.2 or later.
uiMaskValue
Refer to the following figure for the function description of uiMaskValue input.
1. Set uiMaskValue to 500 and bEnable to True, then Capture function is enabled. At the same time,
the output bValid is True and the first captured value would be the center value of the mask range. In
addition, the next capture action will be invalid if the next captured value is within the mask range.
2. In the figure below, the 1st capture happens in a -500~500 range and the captured value changes
from 0 to 1500.
3. The captured value 1500 becomes the new center of mask range. Therefore, the next captured
value which locates from 1000 to 2000 (1000 < diCapValue < 2000) will be invalid. So when the 2nd
capture is triggered (in the mask range), the captured value would remain as 1500.
4. Since the 3rd capture is triggered outside of the mask range, the captured value would be updated to
4000.
diDeltaMin,diDeltaMax,bCapLenBeyondFlag,dwCapLenBeyondCount
DeltaMin/DeltaMax define the minimum and maximum distance between each Capture, while
CapLenBeyondFlag and CapLenBeyondCount represent the error flag and the number of the failed
Capture.
1. The function of diDeltaMin/diDeltaMax is to judge if a trigger mark is missed and the Capture is not
Run. For example, if the value of DeltaMin is 1000 and DeltaMax is 1300, when the detected
distance between 2 Capture exceeds 1000~1300, the system will flag this situation as trigger mark
missing.
2. When a mark missing condition occurs, CapLenBeyondFlag shifts to Ture for one scan cycle and
will be reset immediately. At the same time dwCapLenBeyondCount counts 1.
29
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3. Refer to the below diagram for the explanation of these inputs and outputs:
The mask range is between -500~500 and the 1st Capture occurs at 900.
The 2nd Capture occurs at 2500. Because DeltaMax is set to 1300 and DeltaMin is set to
1000 (1000-1300), the detected distance between two captures has exceeded the range of
1000~1300. Therefore, a trigger mark missing condition is flagged for a scan cycle, while
bCapLenBeyondFlag remains as TRUE.
The 3rd Capture occurs at 3700. Because the difference between 3700 and the previous
captured value 2500 is 1200, which is within the range of 1000~1300 (DeltaMin/DeltaMax),
also 3700 is out of the mask range 2000~3000, the captured value changes to 3700 in this
case, and bCapLenBeyondFlag will not change to True.
bEdgeSelect
EdgeSelect defines whether the DI signal is the rising edge triggered or the falling-edge triggered to
capture the signal. This function is only applicable to AX-332E models.
1. When EdgeSelect=False, the capture is triggered when DI generates the rising edge signal, and
when EdgeSelect=True, the capture is triggered when DI generates the fallingr edge signal.
2. Refer to the below diagram for the explanation of these inputs and outputs:
When EdgeSelect=False:
When EdgeSelect+True
30
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
bCycle
The Cycle setting determines whether the Capture function block will capture values continuously. This
function is only applicable to the AX-332El.
1. When Cycle=False, the Capture function block can only capture the value once triggered by DI.
When Cycle=True, the Capture function block can capture multiple values for multiple times.
2. Refer to the below diagram for the explanation of these inputs and outputs:
When Cycle=False
When Cycle=True
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and the Capture will stop. You
can refer to ErrorID (Error Code) to address the problem.
31
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
• Programming Example
This example uses DFB_HCnt and DFB_Capture in AX-308E to perform the Capture function.
1. As the following figure shows, select a Counter and a Capture for Hardware IO Configuration in
BuiltIn_IO and set the trigger source of Capture to a signal input on the hardware (e.g. IN15).
2. Enable the FB DFB_Capture (bEnable=True) after using the FB DFB_HCnt to activate the high-speed
counter (bEnable=True) in the POU, then the present counter value would be captured and shown on
the diCapValue output of DFB_Capture after the external signal (IN15) being triggered.
32
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3. Refer to AX-3 series operational manual for more details related to the settings and operation of
Hardware IO Configuration.
This example uses DFB_HCnt and DFB_Capture in AX-308E to capture the high-speed counter.
1. As the following figure shows, select a Counter and a Capture for Hardware IO Configuration in BuiltIn_IO
and set the trigger source of Capture to a signal input on the hardware (e.g. IN0).
2. Enable the FB DFB_Capture (bEnable=True) after using the FB DFB_HCnt to activate the high-speed
counter (bEnable=True) in the POU, then the present counter value would be captured and shown on the
diCapValue output of DFB_Capture after the external signal (IN0) being triggered.
3. Refer to AX-3 Series Operation Manual for more details related to the settings and operation of Hardware
IO Configuration.
33
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
• Supported Products
• Library
DL_BuiltInIO.library
Note: From version 1.0.5.0, library DL_BuiltInIO_AX3 is changed to DL_BuiltInIO.
34
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3.2 DFB_Compare
DFB_Compare compares the designated source value and the setting value and then to Set or Reset the desired
device when the comparison result is True or False.
DFB_Compare_instance(
Compare :=,
Counter :=,
bEnable :=,
Mode :=,
OutputAction :=,
wRefreshCycle :=,
FB DFB_Compare
diCmpValue :=,
diTablePosition :=,
uiTableSize :=,
bValid =>,
bBusy =>,
bError =>,
ErrorID =>);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Designates the DFB_
DFB_COUNTER_REF
Counter source of high- COUNTER_ -
(Cannot be null.)
speed counter. REF*1
Run the
instruction when True/False
bEnable BOOL -
bEnable changes (False)
to True.
0:Equal(=)
DFB_ 1:Bigger_Equal(≧) When bEnable shifts
Comparison
Mode COMPARE_ to True and bBusy is
condition 2:Smaller_Equal(≦)
MODE*2 False.
(Equal)
35
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Specify the When bEnable is
diTablePosition*4 compare value ARRAY OF DINT rising edge and bBusy
array is False.
Specify the When bEnable is
Positive number 0 to 256
diTableSize*4 compare value DINT rising edge and bBusy
(0)
array scope is False.
*Note:
1. DFB_Counter_REF (FB): As the I/O interface of the high-speed counter to perform actions include parameter
adjustment and the driver.
2. DFB_COMPARE_MODE: Enumeration (Enum).
3. Except for AX-332E, other AX-3 series with DL_BuiltInIO_AX3 version V1.0.4.2 or later also supports this
function.
4. This parameter is only applicable to AX-332E.
5. In AX-332E, diCmpValue will not refer to the value of this variable for comparison.
• Output
Output Range(Default
Name Function Data Type
value)
bValid True when the output value is valid BOOL True/False (False)
True when the instruction is
bBusy BOOL True/False (False)
enabled
bError True if an error occurs BOOL True/False (False)
Indicates the error code if an error DFB _HSIO_ERROR
ErrorID DFB_HSIO_ERROR*
occurs. (DFB _HSIO_NO_ERR)
*Note: DFB _HSIO_ERROR: Enumeration (Enum)
• Timing Diagram
36
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
bEnable
bValid
bBusy
bError
• In/ Outs
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Reference to the
source of high- DFB_COMPARE_REF DFB_COMPARE_REF When bEnable shifts to
Compare
speed (FB)* (Cannot be null.) True and bBusy is False
comparator.
*Note: DFB_COMPARE_REF (FB): As the I/O interface of the high-speed comparator to perform actions include
parameter adjustment and the driver.
• Function
1. Cannot run this function block in Ethercat Task in AX-332, or it will affect update cycle of other device in
Ethercat.
2. When the comparison result is True (Counter Value = diCmpValue), DFB_Compare will outputs the results
according to the settings of HW IO configuration in BuiltIn IO.
3. When bValid output of DFB_Compare is True, the comparator would continue to compare on the high-speed
counter values. In case that the comparison condition is fulfilled and the output result is given according to the
settings, the device would remain at a high-level signal and would not retrigger the output (True False
True) after the condition is fulfilled once again. If you need to reset the output device and change the high-level
signal to low, find the following methods.
Define the variable at the output of Compare via I/O mapping in DIO, then set the output variable to
falling-edge in the POU programming area so as to reset the output device.
Use the setting of wRefreshCycle to change the high-level signal to low automatically after the PLC
keeps it at a high-level signal for a period of time.
Either ways, the purpose of changing from high-level signals to low can be reached. However, the comparison
conditions must be fulfilled again if you intend to make the output back to high-level.
4. The output device status can be refreshed by using the input wRefreshCycle. For example, set the value of
wRefreshCycle to 10000(Unit: 0.1ms), then the designated output device will be pulled to a low level by the
controller after the condition is fulfilled and remains a high-level output for one second. If wRefreshCycle is set
to zero, the output device would keep at a high level without being reset.
37
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
5. diTablePosition is the numerical array to be compared, and diTableSize is the number of values to be
compared. For example, the size of the diTablePosition array is 256, if diTableSize=100 is set, the 0-99
elements of the array will be set as the values to be compared. The timing diagram is as follows:
If comparing multiple value at the same time, the following two situations will affect the ouput of Do.
Case1: In the process of Do output, other value of diTablezpodtion is compared, the value will not generate Do
output. The output will be the Do output of the current value. Refer the following diagram for the timing and
parameter:
38
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
Case2: When comparing multiple values of diTablePosion at the same time, the defined Do output time is the
time of of one cycle of wRefreshCycle. Refer the following diagram for the timing and parameter:
OutputAction is an output variable that define the action of the output device once the comparison condition is met.
When it is set to SET, the ouput device will be set to high level. When it is set to RESET, the output device will be
set to low level.
Only support AX-332E version 1.0.4.2 or later.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and the Capture will stop. You
can refer to ErrorID (Error Code) to address the problem.
• Programming Example
This example uses DFB_HCnt and DFB_Compare in AX-308E to perform the Compare function.
1. As the following figure shows, select a Counter and a Compare for Hardware IO Configuration in
BuiltIn_IO and set a signal output on the hardware as the output device of Compare (e.g. OUT3).
39
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
2. Run the function block DFB_Compare after enable the high-speed counter by using DFB_HCnt in the
POU as shown in follows. At the same time, the output device (OUT3) will output the signal once the
comparison condition is fulfilled (DFB_HCnt_0.diCounterValue = DFB_Compare_0.diCmpValue).
3. Refer to AX-3 series operational manual for more details related to the settings and operation of
Hardware IO Configuration.
This example uses DFB_HCnt and DFB_Compare in AX-332E to perform the Compare function.
1. As the following figure shows, select a Counter and a Compare for Hardware IO Configuration in
BuiltIn_IO and set a signal output on the hardware as the output device of Compare (e.g. OUT1).
2. Run the function block DFB_Compare after enable the high-speed counter by using DFB_HCnt in the
POU as shown in follows. At the same time, the output device (OUT1) will output the signal once the
comparison condition is fulfilled (DFB_HCnt_0.diCounterValue = DFB_Compare_0.diCmpValue).
40
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3. Refer to AX-3 series operational manual for more details related to the settings and operation of
Hardware IO Configuration.
• Supported Products
• Library
DL_BuiltInIO_AX3.library
Note: From version 1.0.5.0, library DL_BuiltInIO_AX3 is changed to DL_BuiltInIO.
41
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3.3 DFB_HCnt
DFB_HCnt enables the specified high speed counter according to the specified parameters and monitors the counter
value.
DFB_HCnt_instance(
Counter :=,
bEnable :=,
bTrigerMode :=,
FB DFB_HCnt bValid =>,
bBusy =>,
bError =>,
ErrorID =>,
diCounterValue =>);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction
True/False
bEnable when bEnable BOOL -
(False)
changes to True.
Define the high-
True/False When bEnable is rising edge,
xUD_Select*2 speed counter to BOOL
(False) update parameter of xUD_Select.
count up or down
Define the capture
is triggered by True/False When bEnable is rising edge,
bTriggerMode*2 BOOL
rising edge or (False) update parameter of tiggerMode.
falling edge
*Note:
1. DFB_HSIO_ERROR: Enumeration (Enum)
2. Only applicable to AX-332.
• Output
Output Range
Name Function Data Type
(Default value)
True when the output
bValid BOOL True/False (False)
value is valid.
True when the instruction
bBusy BOOL True/False (False)
is enabled.
bError True if an error occurs. BOOL True/False (False)
Indicates the error code if DFB_HSIO_ERROR
ErrorID DFB_HSIO_ERROR*
an error occurs. (DFB_HSIO_NO_ERR)
The present counter value Positive number, negative
diCounterValue DINT
of the counter number or 0(0)
42
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
• Timing Diagram
bEnable
bValid
bBusy
bError
• In/ Outs
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Reference to the
source of DFB_COUNTER_REF DFB_COUNTER_REF When bEnable shifts to True
Counter
specified high- (FB)* (Cannot be null.) and Busy is False.
speed counter.
*Note: DFB_Counter_REF (FB): As the I/O interface of the high-speed counter to perform actions include
parameter adjustment and the driver.
• Function
1. When the input bEnable is True, the counter would start calculating pulses to the corresponding input
points based on the Counter configuration of HW IO configuration in BuiltIn IO.
2. The counter value is given through the output diCounterValue during the counting process.
43
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3. bTriggerMode defines whether the DI signal is triggered by the rising edge or the falling edge for high-
speed counting. It is only applicable to AX-332E. When EdgeSelect=False, high-speed counting is
triggered when DI generates the rising edge signal; when EdgeSelect=True, high-speed counting is
triggered when DI generates the falling edge signal. This function is only available when the
corresponding input Counter setting mode is MODE_UD/ MODE_UDR/ MODE_UDRE/MODE_UDRE2.
4. xUD_Select defines whether to count up or count down when the external DI signal triggers counting.It
is only applicable to AX-332E. When xUD_Select=False, the DI signal is triggered to count up, and when
xUD_Select=True, the DI signal is triggered to count down. This function is only available when the
corresponding input Counter setting mode is MODE_UD/ MODE_UDR/ MODE_UDRE.
Refer the following timing diagram for bTriggerMode and xUD_Select:bTriggerMode=False
xUD_Select=False
bTriggerMode=True
xUD_Select=False
bTriggerMode=False
xUD_Select=True
44
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
bTriggerMode=True
xUD_Select=True
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and Capture will stop. You can
refer to ErrorID (Error Code) to address the problem.
• Programming Example
This example uses DFB_HCnt in AX-308 to perform the Count function.
1. As the following figure shows, select a Counter (Counter 2) in Hardware IO Configuration and you will
see the input points (e.g. IN 0, IN 1, IN 2) matched to the corresponding encoder A, B, Z phase outputs,
which the wiring should follows the configuration so as to perform the normal function of high speed
counting.
45
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
2. After using the FB DFB_HCnt in the POU to activate the high-speed counter(bEnable=True), it starts
receiving and counting the pulses from the external signals(IN 0, IN 1) based on the counting mode set
in Counter Configuration, then the counter value would be displayed in the output diCounterValue. In
addition, you should make sure that the mode of sending pulses from the external signal source matches
the counting mode so as to get the correct counter values.
3. Refer to AX-3 series Operation Manual for more details related to the settings and operation of Hardware
IO Configuration and Counter Configuration.
1. As the following figure shows, select a Counter (Counter 0) in Hardware IO Configuration and you will
see the input points (e.g. A+A-/B+B-/C+C-)) matched to the corresponding encoder A, B, Z phase
outputs, which the wiring should follows the configuration so as to perform the normal function of high
speed counting.
46
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
2. After using the FB DFB_HCnt in the POU to activate the high-speed counter(bEnable=True), it starts
receiving and counting the pulses from the external signals(A+A-/B+B-) based on the counting mode set
in Counter Configuration, then the counter value would be displayed in the output diCounterValue. In
addition, you should make sure that the mode of sending pulses from the external signal source matches
the counting mode so as to get the correct counter values.
3. Refer to AX-3 series operational manual for more details related to the settings and operation of
Hardware IO Configuration and Counter Configuration.
• Supported Products
• Library
DL_BuiltInIO_AX3.library
47
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3.4 DFB_HTmr
DFB_HTmr enables the specified high speed timer channel according to the specified parameters and monitors and
timed value.
DFB_HTmr_instance(
Timer :=,
bEnable :=,
TriggerMode :=,
FB DFB_HTmr bValid =>,
bBusy =>,
bError =>,
ErrorID =>,
dwTimerValue =>);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction
True/False
bEnable when bEnable BOOL -
(False)
changes to True.
0:UP_DOWN
DFB_TIMER_ When bEnable shifts to True and
TriggerMode Timing mode settings. 1:UP_UP
MODE * bBusy is False.
(UP_DOWN)
*Note: DFB_TIMER_MODE: Enumeration (Enum)
Up-Down mode:
Up-Up mode:
• Output
48
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
Output Range(Default
Name Function Data Type
value)
True when the output
bValid BOOL True/False (False)
value is valid.
True when the instruction
bBusy BOOL True/False (False)
is enabled.
bError True if an error occurs. BOOL True/False (False)
Indicates the error code if DFB_HSIO_ERROR
ErrorID DFB_HSIO_ERROR*
an error occurs. (DFB_HSIO_NO_ERR)
Timed value (Unit:
dwTimerValue DWORD Positive number or 0(0)
0.01us)
*Note: DFB_HSIO_ERROR: Enumeration (Enum)
• Timing Diagram
bEnable
bValid
bBusy
bError
• In/ Outs
49
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Reference to the
source of the DFB_TIMER_REF DFB_TIMER_REF When bEnable shifts to True and
Timer
specified high- (FB)* (Cannot be null.) Busy is False
speed timer.
*Note: DFB_TIMER_REF (FB): As the I/O interface of the high-speed timer to perform actions include parameter
adjustment and the driver.
• Function
1. When the input bEnable is True, the timer would start calculating pulses to the corresponding input
points based on the Timer configuration of HW IO configuration in BuiltIn IO.
2. The counter value is given through the output dwTimerValue during the counting process.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and the Capture will stop. You
can refer to ErrorID (Error Code) to address the problem.
• Programming Example
This example demonstrates the function performed by DFB_HTmr.
1. As the following figure shows, select a Timer (Timer 2) in Hardware IO Configuration and you will see
the input point (IN 0) matched to the corresponding timer input channel, which the wiring should follows
the configuration so as to perform the normal function of high speed timing.
50
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
2. After using the FB DFB_HTmr in the POU to activate the high-speed timer(bEnable=True), it starts
receiving and counting the pulses from the external signals(IN 0) based on the timing mode set in Timer
Configuration, then the timed value would be displayed in the output dwTimerValue.
3. Refer to AX-3 Series Operation Manual for more details about Hardware IO Configuration.
• Supported Products
• Library
DL_BuiltInIO.library
Note: From version 1.0.5.0, library DL_BuiltInIO_AX3 is changed to DL_BuiltInIO.
51
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3.5 DFB_PresetValue
DFB_PresetValue is the application function block for high-speed counters, its role is to reset the current counter
value back to the default value.
DFB_PresetValue_instance(
Counter :=,
bExecute :=,
TriggerType :=,
diPresetValue :=,
FB DFB_PresetValue
bDone =>,
bBusy =>,
bCommandAborted =>,
bError =>,
ErrorID =>);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the
instruction
True/False
bExecute when bEnable BOOL -
(False)
changes to
True.
Define when 0:RUN_TRIGGER When bExecute
the default DFB_PRESET_TRIGGER_
TriggerType 1:EXTERNAL_TRIGGER shifts to True and
value would be TYPE *
(RUN_TRIGGER) bBusy is False.
preset.
The preset
When bExecute
counter value Positive number,
diPresetValue DINT shifts to True and
for high speed negative number or 0(0)
bBusy is False
counters.
• Output
Output Range(Default
Name Function Data Type
value)
The default value of the
bDone BOOL True/False (False)
counter has been changed.
True when the instruction is
bBusy BOOL True/False (False)
enabled
52
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
Output Range(Default
Name Function Data Type
value)
True when the instruction is
bCommandAborted interrupted before it’s BOOL True/False (False)
completed
bError True when an error occurs BOOL True/False (False)
DFB_HSIO_ERROR
ErrorID Error codes DFB_HSIO_ERROR*
(DFB_HSIO_NO_ERR)
*Note: DFB_HSIO_ERROR: Enumeration (Enum)
• Timing Diagram
1. 2. 3. 4.
bExecute
bDone
bBusy
bCommandAbort
bError
External Trigger
1. TriggerType = 0(RUN_TRIGGER)
2. TriggerType = 1(EXTERNAL_TRIGGER)
3. bCommandAborted = TRUE
4. bError = TRUE
• In/ Outs
53
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Reference
to the
DFB_COUNTER_REF DFB_COUNTER_REF When bExecute shifts to True
Counter source of
(FB)* (Cannot be null.) and bBusy is False
high-speed
counter.
*Note: DFB_COUNTER_REF (FB): As the I/O interface of the high-speed counter to perform actions include
parameter adjustment and the driver
• Function
1. When TriggerType = RUN_TRIGGER, the counter value would be set back to the default value right after
activating the function block.
2. When TriggerType = EXTERNAL_TRIGGER, the counter value would not be set back to the default until
the Z phase signal of the counter rises.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and the Capture will stop. You
can refer to ErrorID (Error Code) to address the problem.
• Programming Example
This example demonstrates the function performed by DFB_HCnt and DFB_PresetValue.
1. As the following figure shows, select a Counter (Counter 2) in Hardware IO Configuration and you will see
the input points (e.g. IN 0, IN 1, IN 2) matched to the corresponding encoder A, B, Z phase outputs, which
the wiring should follows the configuration so as to perform the normal function of high-speed counting.
2. After using the FB DFB_HCnt in the POU to activate the high-speed counter(bEnable=True), it starts
receiving and counting the pulses from the external signals(IN 0, IN 1) based on the counting mode set in
Counter Configuration, then the counter value would be displayed in the output diCounterValue. In addition,
you should make sure that the mode of sending pulses from the external signal source matches the
counting mode so as to get the correct counter values.
54
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3. If you want to use external signal as the trigger, check the box of External trigger in Counter Configuration
as the following figure shows.
4. Then the input bExecute of DFB_PresetValue shifts to True and the FB DFB_PresetValue would wait for
the Z phase of high-speed counter to trigger the Default value function. After the counter value being set
to the default (DFB_HCnt.diCounterValue = fb), the output bDone will shift from False to True.
5. Refer to AX-3 Series Operation Manual for more details of Counter Configuration.
55
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
• Supported Products
• Library
DL_BuiltInIO.library
Note: From version 1.0.5.0, library DL_BuiltInIO_AX3 is changed to DL_BuiltInIO.
56
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
3.6 DFB_Sample
DFB_Sample is the application function block for high-speed counters, its role is to read the increasing and
decreasing number of the counter value during the sampling period.
DFB_Sample_instance(
Counter :=,
bEnable :=,
wSampleTime :=,
FB DFB_Sample bValid =>,
bBusy =>,
bError =>,
ErrorID =>
diSampleValue =>);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the
instruction when True/False
bEnable BOOL -
bEnable changes (False)
to True.
When bEnable shifts
Sampling period 10~65535
wSampleTime WORD to True and bBusy is
(Unit: 1ms) (0) False
• Output
Output Range(Default
Name Function Data Type
value)
True when the output value is
bValid BOOL True/False (False)
valid
True when the instruction is
bBusy BOOL True/False (False)
enabled
bError True if an error occurs BOOL True/False (False)
Indicates the error code if an DFB_HSIO_ERROR
ErrorID DFB_HSIO_ERROR*
error occurs. (DFB_HSIO_NO_ERR)
Increasing number of the
Positive number, negative
diSampleValue counter value during each DINT
number or 0(0)
sampling period
*Note: DFB_HSIO_ERROR: Enumeration (Enum)
57
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
• Timing Diagram
bEnable
bValid
bBusy
bError
• In/ Outs
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Reference
to the
DFB_COUNTER_REF DFB_COUNTER_REF When bEnable shifts to True
Counter source of
(FB)* (Cannot be null.) and bBusy is False.
high-speed
counter.
*Note: DFB_COUNTER_REF (FB): As the I/O interface of the high-speed counter to perform actions include
parameter adjustment and the driver.
• Function
0 4 8 12 16
時間 ms
diSampleValue = 6 diSampleValue = 4 diSampleValue = 2 diSampleValue = -4
diCounterValue =12 diCounterValue =18 diCounterValue =22 diCounterValue =24 diCounterValue =20
58
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
2. When wSampleTime is shorter than the pulse period, the increasing number (diSampleValue) would be
shown between 0 and 1 for each SampleTime.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and the Capture will stop.
You can refer to ErrorID (Error Code) to address the problem.
• Programming Example
This example uses DFB_HCnt and DFB_Sample to perform pulse counting during the sampling period.
As the following figure shows, select a Counter (Counter 2) in Hardware IO Configuration and you will see the
input points (e.g. IN 0, IN 1, IN 2) matched to the corresponding encoder A, B, Z phase outputs, which the wiring
should follows the configuration so as to perform the normal function of high speed counting.
1. After using the FB DFB_HCnt in the POU to activate the high-speed counter(bEnable=True), it starts
receiving and counting the pulses from the external signals(IN 0, IN 1) based on the counting mode set
in Counter Configuration, then the counter value would be displayed in the output diCounterValue. In
addition, you should make sure that the mode of sending pulses from the external signal source
matches the counting mode so as to get the correct counter values.
59
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
2. After enabling DFB_Sample in the POU (bEnable=True), the FB starts counting the increasing number
3. Refer to AX-3 Series Operation Manual for more details related to the settings and operation of Counter
Configuration.
• Supported Products
• Library
DL_BuiltInIO.library
Note: From version 1.0.5.0, library DL_BuiltInIO_AX3 is changed to DL_BuiltInIO.
60
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
61
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
62
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
63
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 3
64
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
The instructions in this chapter only applies to EtherCAT. Use the instructions to read or set EtherCAT information
and parameters.
65
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
4.1 DFB_EcGetAllSlaveAddr
DFB_EcGetAllSlaveAddr gets all the slave addresses.
FB DFB_EcGetAllSlaveAddr
ST Language
DFB_EcGetAllSlaveAddr (
bExecute :=,
bDone =>,
bBusy =>,
bError =>,
ErrorID =>,
AddrArray =>,
uSlaves =>, );
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
• Output
Output Range
Name Function Data Type
(Default value)
The running of FB is
bDone BOOL True/False (False)
completed.
True when the
bBusy BOOL True/False (False)
instruction is enabled
bError True if an error occurs BOOL True/False (False)
Indicates the error code DFB_ECAT_Diag_ERROR
ErrorID DFB_ECAT_Diag_ERROR*
if an error occurs. (DFB_ECAT_Diag_NO_ERROR)
AddrArray Slave address array UINT[1..128] (0)
uSlaves The number of slaves UINT 0~128(0)
66
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Timing Diagram
bExecute
bBusy
bDone
bError
• Function
When bExecute shifts to True, the output AddrArray gives the addresses of all the EtherCAT slaves in the project
tree, which supports up to 128 stations. Therefore, the maximum number of slave addresses output by AddrArray
would be 128 given by the output uSlaves.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and Capture will stop. You can
refer to ErrorID (Error Code) to address the problem.
67
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Programming Example
The following example demonstrates the behavior of DFB_EcGetAllSlaveAddr.
2. After the input bExecute of DFB_EcGetAllSlaveAddr bExecute shifts to True, the output of AddrArray is
shown as below and the output value of uSlaves is 7.
68
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Supported Products
• Library
DL_EtherCAT_Diag.library
69
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
4.2 DFB_EcGetSlaveCount
DFB_EcGetSlaveCount gets the number of slaves that are connected to the master.
FB DFB_EcGetSlaveCount
ST Language
DFB_EcGetSlaveCount (
bExecute :=,
bDone =>,
bBusy =>,
bError =>,
ErrorID =>,
uSlaves =>,
);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction
True/False
bExecute when bExecute BOOL -
(False)
changes to True.
• Output
Output Range
Name Function Data Type
(Default value)
The running of FB is
bDone BOOL True/False (False)
completed.
True when the
bBusy BOOL True/False (False)
instruction is enabled
bError True if an error occurs BOOL True/False (False)
Indicates the error DFB_ECAT_Diag_ERROR
ErrorID DFB_ECAT_Diag_ERROR*
code if an error occurs. (DFB_ECAT_Diag_NO_ERROR)
uSlaves The number of slaves UINT 0~128(0)
*Note: DFB_ECAT_Diag_ERROR: Enumeration (Enum)
70
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Timing Diagram
bExecute
bBusy
bDone
bError
• Function
When bExecute shifts to True, the output uSlaves gives the number of EtherCAT slaves in the project tree.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and Capture will stop. You can
refer to ErrorID (Error Code) to address the problem.
• Programming Example
1. The following example demonstrates the behavior of DFB_EcGetSlaveCount.
71
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
3. When the input bExecute of DFB_EcGetSlaveCount shifts to True, the output value of uSlaves is 7.
• Supported Products
• Library
DL_EtherCAT_Diag.library
72
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
4.3 DFB_EtherCATLink_Diag
DFB_EtherCATLink_Diag is used to display all the EtherCAT slave diagnostics.
FB DFB_EtherCATLink_Diag
ST Language
DFB_EtherCATLink_Diag (
bEnable :=,
bValid =>,
bError =>,
ErrorID =>,
StationNode =>
uSlaves =>
);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction
True/False
bEnable when bEnable BOOL -
(False)
changes to True.
• Output
Output Range
Name Function Data Type
(Default value)
True when the
bValid BOOL True/False (False)
instruction is running.
True if an error
bError BOOL True/False (False)
occurs.
Indicates the error
DFB_ECAT_Diag_ERROR
ErrorID code if an error DFB_ECAT_Diag_ERROR*1
(DFB_ECAT_Diag_NO_ERROR)
occurs.
Slave addresses and
StationNode structure array of StationStatus [1..128] *2 *3 StationStatus
slave status.
uSlaves Number of Slaves UINT 0–65535
*Note:
73
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
Setting Value
Name Function Data Type
(Default value)
StationAddress Slave station address UINT (0)
True: Connected and functioning properly.
Connection status of
Node BOOL False: Abnormal connection status.
slave stations
(False)
True: Physical connection status normal
Slave physical
LinkStatus BOOL False: Physical connection status abnormal
connection status
(False)
3. The array includes all the slave addresses and connection status, which starts from the first slave station.
(Supports up to 128 stations) In addition, if the value of StationAddress is shown as 0 in the struct array after
bEnable is rising edge triggered, it indicates that the slave station does not exist.
• Timing Diagram
bEnable
bValid
bError
ErrorID
• Function
When bEnable shifts to True, StationAddress and Node output from StationAddress are in array type to show all
the slave addresses and status with the support up to 128 slave stations. If the value of StationAddress is shown
74
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
as 0 in the struct array after bEnable is rising edge triggered, it indicates that the slave station does not exist. An
error will be reported by the function block if EtherCAT master is not found when bEnable shifts to True.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and Capture will stop. You can
refer to ErrorID (Error Code) to address the problem.
• Programming Example
The following example demonstrates the behavior of DFB_EtherCATLink_Diag.
1. There’s a total of two EtherCAT slave stations in the Device tree and the connection status shows PASS.
2. After bEnable of DFB_EtherCATLink_Diag shifts to True, the output uSlave shows 2, indicating that
there are two EtherCAT slaves in total. The array of StationNode index 1 to 2 shows the two slave
addresses, statuses, and physical connection statuses, and the StationAddress of StationNode shows 0
from index 3.
75
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
3. Disconnect the cable for internet connection between slave station 1 and 2 and you can see the status
of slave 2 is shown to be Fail in the device tree.
4. Now, StationNode index 2 Node and LinkStatus of DFB_EtherCATLink_Diag are False respectively.
76
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
5. If connecting the physical network of Slave 1 and Slave 2, StationNode index 2 Node and LinkStatus of
DFB_EtherCATLink_Diag will be False and True respectively.
• Supported Products
• Library
DL_EtherCAT_Diag.library
77
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
4.4 DFB_GetAllECATSlaveInfo
DFB_GetAllECATSlaveInfo gets all the slaves’ information.
FB DFB_GetAllECATSlaveInfo
ST Language
DFB_GetAllECATSlaveInfo (
bExecute :=,
bDone =>,
bBusy =>,
bError =>,
ErrorID =>,
slaveInfoArray =>,
uSlaves =>,);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction
True/False
bExecute when bExecute BOOL -
(False)
changes to True.
• Output
Output Range
Name Function Data Type
(Default value)
The running of FB is
bDone BOOL True/False (False)
completed.
True when the
bBusy BOOL True/False (False)
instruction is enabled
True if an error
bError BOOL True/False (False)
occurs
Indicates the error
DFB_ECAT_Diag_ERROR
ErrorID code if an error DFB_ECAT_Diag_ERROR*1
(DFB_ECAT_Diag_NO_ERROR)
occurs.
Slave information ECATSlaveInfo
slaveInfoArray ECATSlaveInfo
array. [1..128] *2
78
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
Output Range
Name Function Data Type
(Default value)
The number of
uSlaves UINT 0~128(0)
slaves
*Note:
1. DFB_ECAT_Diag_ERROR: Enumeration(Enum)
2. slaveInfoArray: Structure(STRUCT)。
Output Range
Name Function Data Type
(Default value)
vendorId Slave vendor id UDINT (0)
productCode Slave product code UDINT (0)
revisionNo Slave revision number UDINT (0)
serialNo Slave serial number UDINT (0)
slaveInfoArray When bExecute shifts to True When bExecute shifts from True to False
uSlaves When bExecute shifts to True When bExecute shifts from True to False
• Timing Diagram
bExecute
bBusy
bDone
bError
• Function
79
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
When bExecute shifts to True, slaveInfoArray gives the information of all the EtherCAT slaves in the device tree,
which includes vendor id, product code, revision number and serial number. Support up to 128 stations as well
as the maximum number of slaves and the corresponding information output from uSlaves and slaveInfoArray.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and Capture will stop. You can
refer to ErrorID (Error Code) to address the problem.
• Programming Example
1. There’re two EtherCAT slave stations in the device tree, both are ASDA_A2.
2. Double-click on the target ASDA_A2 in the device tree to view its slave information.
80
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
3. The input bExecute of DFB_GetAllECATSlaveInfo bExecute shifts to True, then the output of
slaveInfoArray is shown as below and the output value of uSlaves is 2.
• Supported Products
• Library
DL_EtherCAT_Diag.library
81
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
4.5 DFB_GetECATMasterError
DFB_GetECATMasterError gets the error code of failed EtherCAT network connection.
FB DFB_GetECATMasterError
ST Language
DFB_GetECATMasterError (
bEnable :=,
bBusy =>,
bError =>,
ErrorID =>,
EtherCATErrorId =>
);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction when True/False
bEnable BOOL -
bEnable changes to True. (False)
• Output
Output Range
Name Function Data Type
(Default value)
True when the instruction is
bBusy BOOL True/False (False)
enabled
bError True if an error occurs. BOOL True/False (False)
Indicates the error code if an DFB_ECAT_Diag_ DFB_ECAT_Diag_ERROR
ErrorID
error occurs. ERROR*1 (DFB_ECAT_Diag_NO_ERROR)
EtherCATErrorId EtherCAT error codes ETC_LASTERROR*2 ETC_LASTERROR(NO_ERROR)
*Note:
82
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Timing Diagram
bEnable
bBusy
bError
ErrorID
• Function
When bEnable shifts to True, the output EtherCATErrorId gives the error codes of failed EtherCAT network
connection during each cycle. If there’s no error, the output would be displayed as NO_ERROR. For more details
of error codes, Refer to the content of ETC_LASTERROR_STATE in the Library.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and Capture will stop. You can
refer to ErrorID (Error Code) to address the problem.
• Programming Example
The following example demonstrates the behavior of DFB_GetECATMasterError.
1. If the EtherCAT connection is normal without any existing errors, the output content of EtherCATErrorId
would be shown as NO_ERROR after the input bEnable of DFB_GetECATMasterError shifts to True.
83
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
2. Remove the network connection between the master and the slave, then the output content of
EtherCATErrorId would be shown as NO_COMM.
• Supported Products
• Library
DL_EtherCAT_Diag.library
84
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
4.6 DFB_GetECATMasterState
DFB_GetECATMasterState gets the connection status of EtherCAT Master.
FB DFB_GetECATasterState
ST Language
DFB_GetECATMasterState (
bEnable :=,
bBusy =>,
bError =>,
ErrorID =>,
bStatus =>,);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction
True/False
bEnable when bEnable BOOL -
(False)
changes to True.
• Output
Output Range
Name Function Data Type
(Default value)
True when the
bBusy BOOL True/False (False)
instruction is enabled
bError True if an error occurs BOOL True/False (False)
Indicates the error code DFB_ECAT_Diag_ERROR
ErrorID DFB_ECAT_Diag_ERROR*
if an error occurs. (DFB_ECAT_Diag_NO_ERROR)
EtherCAT master
bStatus BOOL True/False (False)
communication status
85
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Timing Diagram
bEnable
bBusy
bError
ErrorID
• Function
When bEnable shifts to True, the function block performs cyclical status updates of EtherCAT master
communication.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and the Capture will stop. You
can refer to ErrorID (Error Code) to address the problem.
• Programming Example
The following example demonstrates the behavior of DFB_GetECATMasterState.
1. The connection status of EtherCAT master shows PASS in the device tree.
86
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
2. When the input bEnable of DFB_GetECATMasterState shifts to True, the output of bStatus is displayed
as True.
3. Remove the network connection between the master and the slave, and the current connection status of
EtherCAT master would show Fail in the device tree.
• Supported Products
• Library
DL_EtherCAT_Diag.library
87
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
4.7 DFB_ResetECATMaster
DFB_ResetECATMaster resets the EtherCAT master, which has errors in connection.
FB DFB_ResetECATMaster
ST Language
DFB_ResetECATMaster (
bExecute :=,
bDone =>,
bBusy =>,
bError =>,
ErrorID =>,);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction
True/False
bExecute when bExecute BOOL -
(False)
changes to True.
• Output
Output Range
Name Function Data Type
(Default value)
The running of FB is
bDone BOOL True/False (False)
completed.
True when the
bBusy BOOL True/False (False)
instruction is enabled
bError True if an error occurs BOOL True/False (False)
Indicates the error code DFB_ECAT_Diag_ERROR
ErrorID DFB_ECAT_Diag_ERROR*
if an error occurs. (DFB_ECAT_Diag_NO_ERROR)
88
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Timing Diagram
bExecute
bBusy
bDone
bError
• Function
When bExecute shifts to True and the connection status of EtherCAT master shows Fail, the function block would
perform reset action.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and Capture will stop. You can
refer to ErrorID (Error Code) to address the problem.
• Programming Example
The following example demonstrates the behavior of DFB_ResetECATMaster.
1. The connection status of EtherCAT master shows PASS in the device tree.
89
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
2. Remove the network connection between the master and the slave, and the current connection status of
EtherCAT master would show Fail in the device tree.
3. To restore the network connection between the master and the slave, shift the input bExecute of
DFB_ResetECATMaster to True.
4. The network connectivity has been recovered after the output bDone shifting to True.
90
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Supported Products
• Library
DL_EtherCAT_Diag.library
91
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
4.8 DFB_ResetECATSlave
DFB_ResetECATSlave resets the EtherCAT slave, which has errors in connection.
FB DFB_ResetECATSlave
ST Language
DFB_ResetECATSlave(
bExecute :=,
uiSlaveAddr :=,
tTimeout :=,
bDone =>,
bBusy =>,
bError =>,
ErrorID =>,
);
• Input
Setting Value
Name Function Data Type Timing for Updating
(Default value)
Run the instruction
True/False
bExecute when bExecute changes BOOL -
(False)
to True.
When bExecute is
Reset the slave
uiSlaveAddr UINT Positive number (0) rising edge triggered
address.
and Busy is False
When bExecute is
Slave resets the time-
tTimeout TIME Positive number (0) rising edge triggered
out.
and Busy is False
• Output
Output Range
Name Function Data Type
(Default value)
The running of FB is
bDone BOOL True/False (False)
completed.
True when the
bBusy BOOL True/False (False)
instruction is enabled
bError True if an error occurs BOOL True/False (False)
92
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
• Timing Diagram
bExecute
bBusy
bDone
bError
• Function
When bExecute shifts to True, the function block starts searching for the target slave station and resets the
EtherCAT slave, if the status of target slave shows Fail. If the input value of uiSlaveAddr is 0, the function block
would reset all the slave stations which have errors in connection.
• Troubleshooting
If an error occurs during the running of the instruction, bError will change to True and the Capture will stop. You
can refer to ErrorID (Error Code) to address the problem.
• Programming Example
93
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
1. There’s a total of 8 EtherCAT slave stations in EtherCAT_Master_SoftMotion and all their connection
status shows PASS.
2. Remove the network connection of slave 4 and 5, and the current connection status of EtherCAT slave
starting from slave 5 would show Fail in the device tree.
94
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
3. To restore the network connection of slave 4 and 5, enter 1005 to the input uiSlaveAddr and shift the
input bExecute to True.
4. The network connectivity of slave 5 has been recovered after the output bDone of the FB shifting to
True.
5. All the slave stations would be reset if you enter 0 to the input uiSlaveAddr.
• Supported Products
• Library
DL_EtherCAT_Diag.library
95
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 4
96
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 5
97
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 5
5.1 DFC_LRC8
DFC_LRC8: LRC (8-bit) checksum calculation.
DFC_LRC8(
pSrc:= ,
FC DFC_LRC8
wLen:= ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
The start address for
pSrc POINTER TO BYTE Memory address 1~256 (0)
LRC calculation
The data length for
wLen DWORD* (0)
LRC calculation
*Note 1: The variable type BYTE and WORD can be used for dwLen input.
*Note 2: The memory address given by the pSrc exceeds the usable range,
it may cause controller exceptions, such as %I, %Q and %M.
• Output
• Function
After running the FC instruction, begins to calculate LRC (8-bit) checksum from the start memory address (pSrc).
The calculation scope is determined by the input wLen.
98
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 5
• Programming Example
The example uses FC instruction (DFC_LRC8) to perform calculating the LRC (8-bit) checksum.
The checksum calculation scope is 6(dwLen = 6), therefore, the FC instruction(DFC_LRC8) will starts calculating
checksums of six consecutive BYTE data from the memory address input to pSrc(ar_byVar0[0]) and will result
in a checksum value of 16#CF.
Note: In library version 1.0.0.1, change the input from dwLen to wLen.
• Supported Products
AX series
• Library
DL_LRC.library
99
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 5
5.2 DFC_LRC16
DFC_LRC16: LRC (16-bit) checksum calculation.
DFC_LRC16(
pSrc:= ,
FC DFC_LRC16
dwLen:= ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
The start address for
pSrc POINTER TO BYTE Memory address 1~512 (0)
LRC calculation
The data length for
wLen DWORD* (0)
LRC calculation
*Note 1: The variable type BYTE and WORD can be used for dwLen input.
*Note 2: The memory address given by the pSrc exceeds the usable range,
it may cause controller exceptions, such as %I, %Q and %M.
• Output
• Function
After running the FC instruction, begins to calculate LRC (16-bit) checksum from the start memory address pSrc.
The calculation scope is determined by the input wLen.
• Programming Example
The example uses FC instruction (DFC_LRC16) to perform calculating the LRC (16-bit) checksum.
10 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 5
The checksum calculation scope is 6(dwLen = 6), therefore, the FC instruction(DFC_LRC16) will starts
calculating checksums of six consecutive BYTE data from the memory address input to pSrc(ar_byVar0[0]) and
will result in a checksum value of 16#CFCB.
Note: In library version 1.0.0.1, change the input from dwLen to wLen.
• Supported Products
AX series
• Library
DL_LRC.library
10 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 5
5.3 DFC_LRC32
DFC_LRC32: LRC (32-bit) checksum calculation.
DFC_LRC32(
pSrc:= ,
FC DFC_LRC32
wLen:= ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
The start address for
pSrc POINTER TO BYTE Memory address 1–512 (0)
LRC calculation
The data length for
dwLen DWORD* (0)
LRC calculation
*Note 1: The variable type BYTE and WORD can be used for dwLen input.
*Note 2: The memory address given by the pSrc exceeds the usable range,
it may cause controller exceptions, such as %I, %Q and %M.
• Output
• Function
After running this FC instruction, begins to calculate LRC (32-bit) checksum from the start memory address pSrc.
The calculation scope is determined by the input wLen.
10 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 5
• Programming Example
The example uses FC instruction (DFC_LRC32) to perform calculating the LRC (32-bit) checksum.
The checksum calculation scope is 4(dwLen = 4), therefore, the FC instruction(DFC_LRC32) will starts
calculating checksums of four consecutive BYTE data from the memory address input to pSrc(ar_byVar0[0]) and
will result in a checksum value of 16#3935312E.
Note: From library version 1.0.0.1, change the input from dwLen to wLen.
• Supported Products
AX series
• Library
DL_LRC.library
10 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 5
10 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
10 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.1 DFB_From
DFB_From: Read the CR data in the module.
DFB_From(
bExecute:= ,
byRemoteID:= ,
byLocalID:= ,
wCRAddr:= ,
FB DFB_ From iLength:= ,
pVal:= ,
bDone=> ,
bBusy=> ,
bError=> ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
Run the function block.
bExecute BOOL True/False (False)
(Rising-edge triggered)
0: CPU
The CPU or remote
byRemoteID* BYTE 1~15: Remote module
module ID
(0)
byLocalID Expansion module ID BYTE 0–31
The CR data positon in
wCRAddr WORD (0)
the module.
1~8
iLength The CR data length INT
(0)
pVal The CR data to read. POINTER TO WORD
• Output
10 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
• Function
• Programming Example
This example uses DFB_From to read the value of CR1 in the second module on the right side of the CPU and
store the value in the variable (wVar) of the controller.
10 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3
10 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.2 DFB_To
DFB_To: Write a value to the CR data in the module.
DFB_To(
bExecute:= ,
byRemoteID:= ,
byLocalID:= ,
wCRAddr:= ,
FB DFB_ To iLength:= ,
pVal:= ,
bDone=> ,
bBusy=> ,
bError=> ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
Run the function block.
bExecute BOOL True/False (False)
(Rising-edge triggered)
0: CPU
The CPU or remote
byRemoteID* BYTE 1~15: Remote module
module ID
(0)
byLocalID Expansion module ID BYTE 0–31
The CR data positon in
wCRAddr WORD (0)
the module
1~8
iLength The CR data length INT
(0)
The CR data to be
pVal POINTER TO WORD
written
• Output
10 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
• Function
• Programming Example
This example uses DFB_ To to write the value of variable (wVar) to CR1 in the second module on the right side
of the CPU.
11 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Supported Products
AX-3 series
Library
DL_ASModuleAPI_AX3
111
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.3 DFB_DLCCAL
DFB_DLCCAL: AS02LC weighing module weight calibration instruction
DFB_DLCCAL(
bEnable:= ,
byRemoteID:= ,
byLocalID:= ,
usiChannelNo:= ,
bTrigger:= ,
iTPoint:= ,
FB DFB_DLCCAL
aTWeight:= ,
bDone=> ,
bBusy=> ,
iCPoint=> ,
bTriggerDone=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
0: CPU
The CPU or remote
byRemoteID* BYTE 1~15: Remote module
module ID
(0)
byLocalID Expansion module ID BYTE 0–31(0)
usiChannelNo Specify channel number USINT 1–2(1)
Trigger single-point
bTrigger BOOL True/False (False)
calibration
Total number of calibration
iTPoint INT 2~20(2)
points
ARRAY[0..19]
aTWeight Calibration weight value 1.0E-44~3.402823E+38(0)
OF REAL
• Output
11 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bExecute
iTPoint
2
iCPoint
0 1 2
bTrigger
bTriggerDone
bDone
bError
• Function
• Programming Example
11 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
This example uses the FB instruction (DFB_DLCCAL) to calibrate the first channel in the first module on the
right of CPU.
• Supported Products
AX-3 series
Library
DL_ASModuleAPI_AX3.library
11 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.4 DFB_DLCWEI
DFB_DLCWEI: AS02LC weighting module weight measurement instruction
DFB_DLCWEI(
bEnable:= ,
byRemoteID:= ,
byLocalID:= ,
usiChannelNo:= ,
rStable:= ,
bZeroS:= ,
FB DFB_DLCWEI
bTareS:= ,
bBusy=> ,
rTareW=> ,
rWeight=> ,
iStatus=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
0: CPU
The CPU or remote
byRemoteID* BYTE 1~15: Remote module
module ID
(0)
byLocalID Expansion module ID BYTE 0–31(0)
usiChannelNo Specify channel number USINT 1–2(1)
Set the weight stability
rStable REAL 0.0~100000.0 (0)
range
bZeroS Set the weight to zero flag BOOL True/False (False)
bTareS Set the tare weight flag BOOL True/False (False)
• Output
11 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
*Note: iStatus is the common status code of this instruction integrating the LC module. Its statuses are as follows:
Value 0 1 2 3 4 5
Continuously update the weight value When bEnable shifts to False, clear to
rWeight
when bEnable is TRUE. zero.
Continuously update the status when When bEnable shifts to False, clear to
iStatus
bEnable is TRUE. zero.
bError When an error occurs during the running or
When bEnable shifts to False
ErrorCode there are incorrect input values
• Timing Diagram
bEnable
bZeroS
bTareS
rTareW
0 10 0 20
rWeight
0 10 0 10 20 0 100
iStatus
0 1 0 1 0 1
11 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Function
11 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
12. rWeight is the weight value after deducting the tare weight. Users can monitor if rTareW has a value to
determine whether the tare function is activated. When the value is 0, it represents that the tare weight
has not been set.
• Programming Example
After completing DLCCAL calibration, the DLCWEI instruction can used to perform weight measurement.
1. Weight measurement: Place 500g weights on the weight platform. When bEnable is On, rWeight
displays the current weight 500.0.
2. Tare weight setting:
Place package material on the weight platform (e.g. 100 g). Now, rWeight shows that the current
weight is 100.0.
When bTareS is ON, the rWeight weight will be transferred to rTareW, and then the rWeight weight
will be cleared.
When rWeight = 0.0 (maybe a little unstable) and rTareW = 100.0, the tare weight setting is
complete.
3. Clear tare weight setting:
When bTareS is OFF, the rTareW weight will be back to rWeight, and then the rTareW weight will
be cleared.
When rWeight = 100.0 and rTareW = 0.0, tare weight setting is cleared.
4. Weight stability range setting (Stability checking function):
Before bEnable is ON, set rStable = 10.0.
After placing 500g weights and setting bEnable to ON, when the measurement range is between
490~510g, iStatus = 1 (Weight is stable).
• Supported Products
AX-3 series
Library
DL_ASModuleAPI_AX3.library
11 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.5 DFB_DPUCONF
DFB_DPUCONF: parameter setting of PU module output control
DFB_DPUCONF(
bEnable:= ,
byLocalID:= ,
iAxis:= ,
iMode:= ,
iStartSpeed:= ,
iAccTime:= ,
FB DFB_DPUCONF iDecTime:= ,
diMaxSpeed:= ,
iZ_no:= ,
iOffset:= ,
bDone=> ,
bBusy=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
byLocalID Expansion module ID BYTE 0–31(0)
iAxis Output axis number INT 1~4(1)
iMode Output mode setting INT 0~3(1)
iStartSpeed Start/End speed INT 0~10000 Hz(100)
iAccTime Acceleration time INT 0~10000 ms(100)
iDecTime Deceleration time INT 0~10000 ms(100)
Maximum output AS02PU:100~200000 Hz(100K)
diMaxSpeed DINT
frequency AS04PU:100~100000 Hz(100K)
Homing function and find
iZ_no the number of z-phase INT -100~100 times(0)
signals
Homing function is done,
and the z-phase is found,
iOffset INT -10000~10000 numbers(0)
then output the offset
position.
• Output
12 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bDone
bBusy
bError
• Function
12 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
bError flag will be set to ON. The combination of the axis number and the corresponding output points is
as follows:
PU Module Name Axis1 Combination Axis2 Combination Axis3 Combination Axis4 Combination
AS02PU Y0.0 / Y0.1 Y0.2 / Y0.3 NA NA
AS04PU Y0.0 / Y0.1 Y0.2 / Y0.3 Y0.4 / Y0.5 Y0.6 / Y0.7
5. iMode selects parameters for the output mode of setting the output axis, and the setting values are as
shown in the following table:
Output Mode
Mode Note
Value
Single-point pulse output (even-point
N For example: Y0.0 or Y0.2 output
output only)
For example: Y0.0 is pulse, Y0.1 is direction. When
Pulse (even points) + Direction (odd
1 the direction is positive, Y0.1 is OFF; when the
points)
direction is negative, Y0.1 is ON.
For example: Y0.0 is CW (Positive direction), and
2 CW (even points) + CCW (odd points)
Y0.1 is CCW (negative direction).
For example: Y0.0 is A, and Y0.1 is B. When A is
A-phase (even points) + B-phase (odd ahead of B, it represents positive direction output;
3
points) when B is ahead of A, it represents negative direction
output.
Automatically change to mode 1
Others -
(Default)
6. iStartSpeed~iOffset are non-power outage persistence value. If the setting value is out of range, bError
will be reported.
7. bDone is the output axis of the specified PU module, and is the parameter setting completion flag.
When the flag is ON, it represents that parameter setting is successful. Users can perform the
subsequent positioning output function according to the flag status. The bDone flag clearance needs to
be Run by users, and this instruction will set this flag once when the setting is done.
8. bError is the output axis of the specified PU module, and is the parameter error flag. Because most of
parameter ranges are automatically filtered by PLC, if this error flag occurs, it means that there is no
specified PU module, the PU module number is incorrect, or the output axis number is incorrect.
9. This parameter setting instruction is pulse running instruction. Even if the A contact method is used for
the user conditional contact, this instruction will set the parameters of the PU module at the time when
it’s started. Therefore, when the axis parameters are changed, restart the instruction and reset the
parameters.
12 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
10. Because the parameter setting is ordered through the module communication, Check the bDone or
bError flags of the setting results each time the parameters are modified, and then perform the related
output action.
• Programming Example
The following example shows hoe to Run the DFB_DPUCONF function block to set the parameter setting of
the PU output module.
1. Delta_LocalBus_Master configures an AS02PU_A.
2. Use the DFB_DPUCONF function block to set the first axis parameter of the 02PU module on the right.
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
12 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.6 DFB_PUSTAT
DFB_PUSTAT: PU module output status read-back
DFB_PUSTAT(
bEnable:= ,
byLocalID:= ,
iAxis:= ,
bZeroSet:= ,
FB DFB_ PUSTAT bBusy=> ,
diCurrentPosi=> ,
bMoving=> ,
bPause=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
byLocalID Expansion module ID BYTE 0–31(0)
iAxis Output axis number INT 1~4(1)
The current output
BOOL True/False (False)
bZeroSet location is cleared to 0.
• Output
12 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bBusy
bError
• Function
12 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
the target position of the specified output. If users resume the output, this flag will be automatically
cleared. Note: When the bPause flag is ON, the bMoving flag becomes OFF.
8. BError is the specified PU module and is the read error flag (Read-only). When the error occurs, Refer
to ErrorCode description.
• Programming Example
This example shows how to Run the DFB_PUSTAT function block to set the current output position of the first
axis of the PU output module.
2. Use the DFB_PUSTAT function block to set the current output position of the first axis of the 02PU
module.
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
12 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.7 DFB_DPUPLS
DFB_DPUPLS: PU module pulse output (No acceleration/deceleration)
DFB_DPUPLS(
bEnable:= ,
byLocalID:= ,
iAxis:= ,
diTarPulse:= ,
FB DFB_DPUPLS
diTarSpeed:= ,
bDone=> ,
bBusy=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
byLocalID Expansion module ID BYTE 0–31(0)
iAxis Output axis number INT 1~4(1)
diTarPulse Target output number DINT -2,147,483,648~ 2,147,483,648(0)
Target output frequency AS02PU: -200K~200K(0)
diTarSpeed DINT
(Unit: Hz) AS04PU: -100K~100K(0)
• Output
12 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bDone
bBusy
bError
• Function
12 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
7. When the target speed of diTarSpeed is positive (>0), it means that the output point of “positive
direction” is OFF; when the target speed of diTarSpeed is negative (<0), it means that the output point
of “negative direction” is ON; when the target speed of diTarSpeed is 0, it means that after outputting a
complete running pulse, it enters the pause output status.
8. This output instruction does not provide the acceleration/deceleration function. For
acceleration/deceleration function requirement, use the DPUDRI instruction.
9. This output instruction can be used for changing speed. When the instruction is running output, users
can change the target frequency value of diTarSpeed to achieve the purpose of changing the output
speed.
10. When the output has reached the specified diTarPulse pulse number, the bDone completion flag will be
set to ON. The bDone flag clearance needs to be Run by users, and this instruction will set this flag
once when the setting is done
11. If any error situation occurs during output startup, the bError error flag will be set to ON. Users can
refer to ErrorCode for troubleshooting.
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
12 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.8 DFB_DPUDRI
DFB_DPUDRI: PU module relative positioning output (With acceleration/deceleration)
DFB_DPUDRI(
bEnable:= ,
byLocalID:= ,
iAxis:= ,
diRTarPosi:= ,
FB DFB_DPUDRI
diTarSpeed:= ,
bDone=> ,
bBusy=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
byLocalID Expansion module ID BYTE 0–31(0)
iAxis Output axis number INT 1~4(1)
Number of relative
diRTarPosi DINT -2,147,483,648~ 2,147,483,648(0)
positioning outputs
Target output frequency AS02PU: -200K~200K(0)
diTarSpeed DINT
(Unit: Hz) AS04PU: -100K~100K(0)
• Output
13 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bDone
bBusy
bError
• Function
1. It is suggested that this instruction be placed under Main Task.
2. This function is supported only when AX-3 series firmware version is V1.0.1 and later.
3. byLocalID specifies module numbers. The number of the first module on the right of CPU is 0, the
number of the second module on the right of CPU is 1, and so on. Regardless of any type of modules,
all modules must be counted. The maximum number of modules is 32. This PU dedicated instruction is
only for the PU module on the right of CPU and is not for the PU module on the right of the remote
module. If the specified module is not the PU module, the bError flag will be set to ON.
4. iAxis is the axis number of the specified output PU module. The input values 1~4 respectively represent
the specified PU module axis 1–axis 4 output. If the PU module does not have this axis number, the
bError flag will be set to ON.
5. diRTarPosi is the position of the specified output relative positioning, and the pulse number that can be
input is the signed numbers 32-bit value. When the value is greater than 0, the output is toward the
positive direction (direction output point OFF); when the value is less than 0, the output is toward the
negative direction (direction output point ON); when the value equals 0, this instruction will instantly set
the bDone output completion flag to ON.
6. diTarSpeed is the target speed (Unit: Hz) of the specified output and the frequency value that can be
input is the signed numbers 32-bit value. When the value is less than 0, the instruction will use the 2’s
complement method to convert to a positive integer number; when the values equals to 0, the instruction
will inform the module to enter the pause mode. The actual output will decelerate according to
deceleration slope until the output speed reaches 0, and users set the pause flag (refer to the PUSTAT
instruction). The corresponding diTarSpeed setting range of the module is as follows:
13 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
7. After starting the output, the target frequency can be changed anytime; however, when the frequency is
actually changed, PLC will automatically change the frequency according to the
acceleration/deceleration rate slope set by the DPUCONF instruction.
8. When the output has reached the specified diRTarPosi relative positioning position, the bDone
completion flag will be set to ON. The bDone flag clearance needs to be Run by users, and this
instruction will set this flag once when the setting is done.
9. During the output startup process, if any error situation occurs, the bError flag will be set to ON. Users
can refer to ErrorCode to perform troubleshooting.
10. Acceleration/Deceleration curve of the PU module positioning output instruction is as follows:
The value of the maximum output frequency. Refer to the DPUCONF instruction setting for this
parameter.
The target frequency specified by the PU module output instruction. The target frequency cannot output
the frequency that exceeds the maximum output frequency. The output will be limited to the maximum
output frequency.
Start/End output frequency setting value. Refer to the DPUCONF instruction setting for this parameter.
Acceleration time value. Refer to the DPUCONF instruction setting for this parameter.
Deceleration time value. Refer to the DPUCONF instruction setting for this parameter.
The acceleration/deceleration of the PU module is a fixed slope, so the actual acceleration/deceleration time
will change according to the target frequency of the specified output. The acceleration/deceleration slope
conversion formulas are (1) (maximum output frequency - startup frequency) / acceleration time, and (2)
(maximum output frequency - end frequency) / deceleration time.
• Supported Products
AX-3 series
13 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Library
DL_ASModuleAPI_AX3.library
13 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.9 DFB_DPUDRA
DFB_DPUDRA: PU module absolute positioning output (With acceleration/deceleration)
DFB_DPUDRI(
bEnable:= ,
byLocalID:= ,
iAxis:= ,
diATarPosi:= ,
FB DFB_DPUDRA
diTarSpeed:= ,
bDone=> ,
bBusy=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
byLocalID Expansion module ID BYTE 0–31(0)
iAxis Output axis number INT 1~4(1)
Number of relative
diATarPosi DINT -2,147,483,648~ 2,147,483,648(0)
positioning outputs
Target output frequency AS02PU: -200K~200K(0)
diTarSpeed DINT
(Unit: Hz) AS04PU: -100K~100K(0)
• Output
13 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bDone
bBusy
bError
• Function
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
13 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.10 DFB_DPUZRN
DFB_DPUZRN: PU module homing
DFB_DPUZRN(
bEnable:= ,
byLocalID:= ,
iAxis:= ,
iMode:= ,
FB DFB_DPUZRN diTarSpeed:= ,
iJogSpeed:= ,
bDone=> ,
bBusy=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
byLocalID Expansion module ID BYTE 0–31(0)
iAxis Output axis number INT 1~4(1)
iMode Homing mode selection INT 0~8, 255(0)
AS02PU:-200K~-100 和
• Output
13 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bDone
bBusy
bError
• Function
Note: If the mode selects the required input points that are not matched with the Parameter setting of the PU
module, the homing function may fail.
Note: For the above iMode 1~4, the PU module firmware version V1.02.00, when the action is complete, the
current output position of the axis will not be cleared to 0, and it can be cleared with the PUSTAT instruction.
For the PU module firmware version V1.02.10 and later, when the action is complete, the current output
position will be cleared to 0.
Note: For the above iMode 5~8, the PU module firmware version V1.02.00, when the action is complete, the
current output position is now the output result, and the current position must be modified to the specified
position with the mode 255. For the PU module firmware version V1.02.10 (included) and later, when the
action is complete, the axis current output position will be cleared to 0.
6. When diTarSpeed is selected to be mode is 1~8, it is the highest output speed for specifying to return to
the origin, and this value is the signed numbers 32-bit value. Positive/Negative represents the default startup
direction to fine the origin. For example, positive means that the instruction starts to look for the origin from
the positive direction; the corresponding diTarSpeed setting range of the module is as follows: (If the mode
parameter is specified as 255, the diTarSpeed will become the value of updating the PU module current
position.)
PU Module
When Mode is 1~8, diTarSpeed Setting Range
Name
7. iJogSpeed is the inching output speed when it touches the origin. This value is the signed number 16-
bit value, and the setting value is 1~10,000 Hz.
13 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
8. When the output has reached the specified origin position, the bDone completion flag will be se5t to ON.
This bDone flag clearance needs to be Run by users, and this instruction will set this flag once when the
output is done.
9. During the output startup process, if any error situation occurs, the bError flag will be set to ON. Users
can refer to ErrorCode to perform troubleshooting.
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
13 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.11 DFB_DPUJOG
DFB_DPUJOG: PU module inching output
DFB_DPUJOG(
bEnable:= ,
byLocalID:= ,
iAxis:= ,
FB DFB_DPUJOG
diJogSpeed:= ,
bBusy=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
byLocalID Expansion module ID BYTE 0–31(0)
iAxis Output axis number INT 1~4(1)
AS02PU: -200K~200K(0)
diJogSpeed Inching output frequency DINT
AS04PU: -100K~100K(0)
• Output
14 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bBusy
bError
• Function
1. It is suggested that this instruction be placed under Main Task.
2. This function is supported only when AX-3 series firmware version is V1.0.1 and later.
3. byLocalID specifies module numbers. The number of the first module on the right of CPU is 0, the
number of the second module on the right of CPU is 1, and so on. Regardless of any type of modules,
all modules must be counted. The maximum number of modules is 32. This PU dedicated instruction is
only for the PU module on the right of CPU and is not for the PU module on the right of the remote
module. If the specified module is not the PU module, the bError flag will be set to ON.
4. iAxis is the axis number of the specified output PU module. The input values 1~4 respectively represent
the specified PU module axis 1–axis 4 output. If the PU module does not have this axis number, the
bError flag will be set to ON.
5. diJogSpeed is the output speed of the specified inching, and this value is the signed number 32-bit
value. When the value is greater than 0, it means that the output is toward the positive direction
(Direction output point is OFF); when the value is less than 0, it means that the output is toward the
negative direction (Direction output point is ON); when the value is 0, it means that the output stops. The
corresponding diJogSpeed setting range of the module is as follows:
6. If any error situation occurs during output startup, the bError error flag will be set to ON. Users can refer
to ErrorCode for troubleshooting.
14 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
7. The output timing diagram of the DPUJOG instruction is as follows: (In the timing diagram, Jog_in is the
instruction startup switch, and Busy flag is the flag of bBusy runningning.)
8. When the DPUJOG instruction is deactivated, it can perform other output control after the bBusy flag is
already OFF.
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
14 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.12 DFB_DPUCNT
DFB_DPUCNT: PU module high-speed counter function
DFB_DPUCNT(
bEnable:= ,
byLocalID:= ,
iInputMode:= ,
iPeriod:= ,
FB DFB_DPUCNT bZeroSet:= ,
bBusy=> ,
diInputPulse=> ,
diInputSpeed=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
byLocalID Expansion module ID BYTE 0–31(0)
Encoder input mode and
iInputMode counting frequency INT 1~7(4)
multiplication setting
iPeriod Speed fetch cycle time INT 10~1000(1000)
bZeroSet Counter is cleared to 0. BOOL True/False (False)
• Output
14 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bBusy
bError
• Function
1. It is suggested that this instruction be placed under Main Task.
2. This function is supported only when AX-3 series firmware version is V1.0.1 and later.
3. This instruction is supported only by the AS02PU module.
4. byLocalID specifies module numbers. The number of the first module on the right of CPU is 0, the
number of the second module on the right of CPU is 1, and so on. Regardless of any type of modules,
all modules must be counted. The maximum number of modules is 32. This PU dedicated instruction is
only for the PU module on the right of CPU and is not for the PU module on the right of the remote
module. If the specified module is not the PU module, the bError flag will be set to ON.
5. iInputMode is the encoder source input mode and counting frequency multiplication setting, and its setting
parameters are as follows:
Note: When A-phase is ahead of B-phase, it represents the positive counting. When B-phase is ahead of
A-phase, it represents the negative counting.
6. iPeriod is the cycle time setting value of speed fetching, and the settable range is 10ms–1000ms. If the
value is out of range, it will be set to the minimum/maximum value.
7. diInputPulse displays the entered pulse counting numbers (signed number 32-bit values), which are
outage persistence value. If there is a need to clear it to 0, during the instruction startup, use the bZeroS
setting flag (OFF ON) to perform the clearance.
8. diInputSpeed displays values that each iPeriod time counts (signed number 32-bit values). If users need
to convert the values in Hz, use calculation formulas.
9. When the instruction is activated/ deactivated, it means that CPU needs to inform the high-speed
counter of the module to activate/deactivate. This instruction cannot be used with API1409 DPUMPG at
the same time, otherwise the instructions may activate or deactivate the module counting with each
other.
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
14 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.13 DFB_DMPID
DFB_DMPID: RTD/TC module PID operation
DFB_DMPID(
bEnable:= ,
byRemoteID:= ,
byLocalID:= ,
usiChannelNo:= ,
bUpdate:= ,
bPID_Run:= ,
iSV:= ,
byPID_MODE:= ,
bPID_M_A:= ,
bMOUT_AUTO:= ,
uiAUTO_DBW:= ,
rKc_Kp:= ,
rTi_Ki:= ,
rTd_Kd:= ,
FB DFB_DMPID rTf:= ,
bPID_EQ:= ,
bPID_DE:= ,
bPID_DIR:= ,
iERR_DBW:= ,
iALPHA:= ,
iBETA:= ,
uiMOUT:= ,
iBIAS:= ,
uiCYCLE:= ,
bBusy=> ,
rMV=> ,
rPV=> ,
rI_MV=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
CPU or remote module 0: CPU
byRemoteID*1 BYTE
number 1~15: remote module(0)
14 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Setting Value
Name Function Data Type
(Default value)
bPID_Run Activate PID operation BOOL True/False (False)
iSV Target value INT -32768~32767(0)
TRUE: Manual, MV value will output
according to the MOUT value. When
bPID_M_A PID Auto/Manual mode BOOL PID_MODE is 1, this setting is invalid.
FALSE: Auto, MV value will output
according to the PID formula. (False)
TRUE: Auto, MOUT value changes with
Manual value (MOUT) the MV value.
bMOUT_AUTO BOOL
automatic update mode FALSE: Normal, MOUT value does not
change with the MV value.
When it applies to Auto
tuning, the SV ± dead
uiAUTO_DBW*2 USINT 0~32000(0)
band range does not
operate.
PID calculation formula
bPID_EQ BOOL True/False (False)
selection
PID differential error
bPID_DE BOOL True/False (False)
calculation selection
PID positive negative FALSE: heating operation (E=SV-PV)
bPID_DIR BOOL
direction TRUE: cooling operation (E=PV-SV)
Deviation amount (E)
iERR_DBW INT -32768~32767(0)
ineffective range
Feedforward control
iBIAS INT -32768~32767(0)
output value
*Note:
1. Support only mode0 currently.
2. If the PID parameter write value exceeds the parameter upper limit, only the upper limit value will be written; if
the PID parameter write value is lower than the parameter lower limit, only the lower limit value will be written.
14 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Output
Instruction
bBusy BOOL True/False (False)
running flag
0.0~100.0(0)
lrMV MV output value LREAL
(Unit: 1%)
lrPV Current value LREAL Positive/Negative number or 0(0)
Accumulated
lrI_MV LREAL Positive/Negative number or 0(0)
integral value
FB instruction
bError BOOL True/False (False)
error flag
DFB_AS_MODULE_API DFB_AS_MODULE_API_ERROR
ErrorCode Error code
_ERROR (DFB_NO_ERROR)
14 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Continuously updating the record value when Clear to 0 when bEnable shifts to
lrMV
bBusy is True True.
Continuously updating the record value when Clear to 0 when bEnable shifts to
lrPV
bBusy is True True.
Continuously updating the record value when Continuously updating the record
lrI_MV
bBusy is True value when bValid is True
bError When an error occurs during the running or
When bEnable shifts to False
ErrorCode there are incorrect input values
• Timing Diagram
bEnable
bBusy
bError
• Function
1. It is suggested that this instruction be placed under Main Task.
2. This function is supported only when AX-3 series firmware version is V1.0.1 and later.
3. The instruction is supported only by AS series temperature modules (supported version: AS04RTD-A
V1.04 and later/AS06RTD-A V1.00 and later;AS04TC-A V1.04 and later /AS08TC-A V1.00 and later)
4. byRemoteID specifies that the analog input module should connect to the right of CPU or the right of the
remote module group numbers. The CPU number is 0, the first remote module number is 1, and so on.
The maximum group number is 15.
5. byLocalID specifies module numbers. The number of the first module on the right of CPU is 0, the number
of the second module on the right of CPU is 1, and so on. Regardless of any type of modules, all modules
must be counted. The maximum number of modules is 32.
6. usiChannelNo specifies the channel numbers. The number of channel one is 1, and the number of
channel two is 2.
7. When PID_RUN is TRUE FALSE, the rMV output value will be cleared to 0. If users want the rMV
output value to be kept as the last rMV output value when PID is not working, make bEnable TRUE
FALSE to deactivate the instruction.
8. When bUPDATE’s Enable = True, if you want to modify the parameters related to bPID_RUN–uiCYCLE,
you need to set the bUpdate parameter to ON, and it will be automatically changed to False after a cycle.
9. If the auto adjust parameter function is used (byPID_MODE =1), it will automatically enter the
autocontrol mode when the adjustment is complete (byPID_MODE changes to 0 automatically), and the
debugged rKc_Kp, rTi_Ki, rTd_Kd, rTf, iALPHA, and iBETA parameters will be filled back to the
corresponding parameter variables of the DMPID input. Users can also use the outage persistence
14 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Programming Example
1. When bEnable=TRUE, the instruction is running. When M2=TRUE, the DMPID instruction starts to operate.
When M2=FALSE, MV value is 0 and is sent to D30. When bEnable become OFF, the instruction is not Run,
and the parameter values in the original instruction does not change.
2. The MV output value range is 0.0~100.0. Users need to convert the required control quantity per requirement.
This application example converts to PWM output. Convert the MV output value to the pulse output width
TimeSet2 with a range of 0%~100%, and then multiply the PWM cycle to convert to the time TimeSet1.
3. Input the pulse output width and pulse output cycle to the TON function block, PWM control can be realized in
the specified pulse output device.
Duty cycle = pulse output width/pulse output cycle
15 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
When the PID_MODE control mode is set to 0, it is the autocontrol mode. PID calculation formula is as follows:
Independent Formula & Derivative of E (PID_EQ=False & PID_DE=False)
t
dE E = SV – PV or
MV = K P E + Ki ∫ Edt + K d * + BIAS E = PV – SV
0
dt
ERR_DBW
Kc_Kp
PID-P
>0 PID_MAN
BIAS
+ 0
<=0 +
0 +
Kc_Kp MV_LIMIT
1
MV
Ti_Ki
PID-I
>0
MV_MAX, MV_MIN
+
<=0 +
0 +
Ti_Ki MOUT_AUTO
+ MOUT
0
Td_Kd MOUT
PID-D PID_MAN
>0 1
0
<=0
0 1
Td_Kd, Tf MOUT
15 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Kc_Kp
ERR_DBW Kc_Kp
>0
<=0
0
PID_MAN
BIAS
+ 0
+
+
MV_LIMIT
1
Ti_Ki MV
PID-I
>0
MV_MAX, M V_MIN
<=0
0
Ti_Ki MOUT_AUTO
MOUT
0
Td_Kd MOUT PID_MAN
PID-D
>0 1
0
<=0
0 1
Td_Kd, Tf MOUT
15 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• α, β VALUE:
ALPHA and BETA are used to compensate initial integral when PID starts and the SV target values changes,
the aim of which is to reduce the overshoot phenomenon. As shown in the following figures, ALPHA
parameter is used to slow down the rising overshoot; BETA parameter is used to slow down the falling
overshoot.
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
15 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.14 DFB_DHCCNT
DFB_DHCCNT: This instruction is for AS02HC-A instruction only. Its functions include starting/shutting counter and
setting/modifying counter value.
DFB_DHCCNT(
bEnable:= ,
byLocalID:= ,
usiChannelNo:= ,
bUpdate:= ,
usiAction:= ,
diActionValue:= ,
bBusy=> ,
FB DFB_DHCCNT diCurCnt=> ,
byCurSSI_SingleTurn=> ,
byCurSSI_MultiTurn=> ,
wSSIStatus=> ,
wRefCnt=> ,
bDir=> ,
uiCntStat=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
*Note: usiAction is the action mode setting of the counter, and diActionValue usage descriptions are as below:
15 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
When the counter form is set as Absolute Position, the SSI encoder
counter value will be automatically shifted to the diActionValue vale, and
Note:
1. Reset diCurCnt as 0.
2. Reset iCurrentNo of table compare output instruction
DFB_DHCCMPT.
Reset the current 3. Reset the bMatch1 and bMatch2 flags of compare output instruction
4
counter value diCurCnt DFB_DHCCMP.
Note: When using SSI encoder, and the counter form is set as Absolute
Position, the counter value cannot be reset. However, the iCurrentNo,
bMatch1, and bMatch2 flags will be reset.
Reset diCurCnt current In addition to the above usiAction=4 reset content, compare output
counter value
5 diCurCnt, and reset instructions/specified Y output point of compare output instructions (ON
table compare output OFF) are also reset.
instructions/specified Y
15 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Input/Output Pin
• Output
15 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
DFB_AS_MODULE_
DFB_AS_MODULE_API_
ErrorCode Error code
API_ERROR ERROR (DFB_NO_ERROR)
Note: uiCntStat is counting module action status, and its usage descriptions are as below:
Bit Status
Status Name Note
Number Description
15–11 Reserved Reserved
15 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Bit Status
Status Name Note
Number Description
Cause of error: The change size of two position data exceeds
SSI data
change size 0: Normal protection setting.
7 exceeds
protection 1: Abnormal Clear method: Next data change size is within a reasonable
setting range.
6 Reserved Reserved
Linear count is 0: Normal Cause of error: Linear count exceeds the user set range.
3 higher than the
1: Abnormal Clear method: Linear counter value is back to the upper and
set limit
lower limit.
Linear count is 0: Normal Note: When count exceeds the upper/lower limit, the counter
2 lower than the value remains at the upper/lower limit. When counter value is
set limit 1: Abnormal
back to the upper/lower limit range, the counting resumes.
15 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
When bEnable shifts to true and the When bEnable shifts to false and the
bBusy
function is enabled in the module function is disabled in the module
Continuously update the record when
diCurCnt -
bBusy is True.
Continuously update the record when
byCurSSI_SingleTurn bBusy is True, and the counter form -
is Absolute Position.
Continuously update the record when
byCurSSI_MultiTurn bBusy is True, and the counter form -
is Absolute Position.
Continuously update the record when
wSSIstatus bBusy is True, and the counter form -
is Absolute Position.
Continuously update the record when
wRefCnt bBusy is True, and the counter form -
is Absolute Position.
Continuously update the record when
bBusy is True.
bDir False when the count direction is negative
True when the count direction is
positive
Clear the error when using usiAction
Continuously update the record when clearance function.
uiCntStat
bBusy is True. When the status of the error counting
module is cleared
bError When an error occurs during the
running or there are incorrect input When bEnable shifts to false
ErrorCode values
• Timing Diagram
bEnable
bBusy
bError
• Function
1. It is suggested that this instruction be placed under Main Task.
2. This function is supported with AX-3 firmware V1.0.2 and later.
3. This instruction is only supported by AS Series count module (The supported version is AS02HC-A V1.00
and above).
15 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
4. byLocalID specifies module numbers. The number of the first module on the right of CPU is 0, the number
of the second module on the right of CPU is 1, and so on. Regardless of any type of modules, all modules
must be counted. The maximum number of modules is 32.
5. usiChannelNo specifies the channel numbers. The number of channel one is 1, and the number of
channel two is 2.
6. Complete the usiAction and diActionValue settings before running this instruction. When bEnable is
started for the first time, usiAction and usiAction of HC module will be set once. When usiAction and
diActionValue need to be re-changed during running, set usiAction and diActionValue as new values,
and then set the bUpdate flag to On. When this instruction completes changes, the instruction will clear
bUpdate as Off itself.
7. diCurCnt is to display the current counter value of the specified module count channel.
8. byCurSSI_SingleTurn is absolute SSI encoder Single-Turn Data display (When the counter form is set
as Ring Position, byCurSSI_SingleTurn shows the value after deviation; when setting the counter as
Ring counter, byCurSSI_SingleTurn will show the original SSI encoder value), when the channel mode
is set as incremental encoder, the byCurSSI_SingleTurn will be 0.
9. byCurSSI_MultiTurn is absolute SSI encoder Multi-Turn Data display (When the counter form is set as
Absolute Position, byCurSSI_MultiTurn shows the value after deviation; when setting the counter as Ring
counter, byCurSSI_MultiTurn will show the original SSI encoder value), when the channel mode is set
as incremental encoder, the byCurSSI_MultiTurn will be 0.
10. WSSIstatus is absolute SSI encoder Status Data display. When the channel mode is set as incremental
encoder, wSSIstatus will be 0.
11. wRefCnt is absolute SSI encoder data refresh counter, and its length is 16 bits. When new SSI data is
captured, refresh counter will be incremented by one, and when this counter overflows, it will re-
accumulate from 0. When the channel mode is set as incremental encoder, wRefCnt will be 0.
12. bDir is the count direction display. When it shows On, it represents going in positive direction; when it
shows Off, it represents going in negative direction.
13. If the instruction is closed, the specify channel will stop updating the values of the right half of the
instruction.
• Programming Example
This example uses the FB instruction (DFB_DHCCNT) to read the first channel in the right module (AS02HC)
of the host, and after setting the count parameter to the module, start updating counter value to a new
variable (D4) through the function block.
16 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
16 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Counter value
10000
usiAction 1
diActionValue 10000
diUpdate flag
Counter value N
usiAction 2
diUpdate flag
16 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Counter value
usiAction 3
diAct ionValue 0
diUpdate flag
Counter value
10000
Preset
0 Reset
usiAction 4 6
Match1, Match2,
CurNo
diUpdate flag
• Supported Products
16 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
16 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.15 DFB_DHCCAP
DFB_DHCCAP: This instruction is for HC counting only. Its functions include starting/shutting catcher.
DFB_DHCCAP(
bEnable:= ,
byLocalID:= ,
usiChannelNo:= ,
byTrgSel:= ,
bBusy=> ,
FB DFB_DHCCAP
diCapValue1=> ,
bCapValue1_Complete=> ,
diCapValue2 => ,
bCapValue2_Complete=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run the function block BOOL True/False (False)
Triggered by the digital input Capture function is selected for the external input point function with
0
of the specified channel. the HC device configuration.
• Output
16 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
DFB_AS_MODULE_API_ERROR DFB_AS_MODULE_API_
ErrorCode Error code
ERROR (DFB_NO_ERROR)
When bEnable shifts to true and the When bEnable shifts to false and the
bBusy
function is enabled in the module function is disabled in the module
When bBusy is true and update the
diCapValue1 record when the capture signal is -
established.
When bBusy is true and after the
When bEnable shifts to false
bCapValue1_Complete capture value is updated to
Cleared by users
diCapValue1.
When bBusy is True and updated
diCapValue2 the record when the capture signal is -
established.
When bBusy is true and after the
When bEnable shifts to false
bCapValue2_Complete capture value is updated to
Cleared by users
diCapValue2
• Timing Diagram
16 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
bEnable
bBusy
bError
• Function
16 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Programming Example
This example uses the FB instruction (DFB_DHCCNT) to start the first channel counting function in the right
module (AS02HC) of the host, and use the FB instruction (DFB_DHCCAP) to capture the counter value.
16 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
byTrgSel = 0
11000
Channel 1 8500
Counter
Value 6000
1800
CH1 Z-Phase
Input
bCapValue1_Complete
CH1
*1
bCapValue2_Complete
*2
* 1: bCap Value1_Complete is not cleared to OFF, the captured value still up dates in di CapValue 1.
*2: bCap Value2_Complete is cleared to OFF, the captured value still up dates in CapValue 2.
Programming example: Another channel DHCCMP compares arrival and captures the counter value.
1. Set the byTrgSel parameter of the DHCCAP instruction in channel 1. When M0=ON, the
DHCCAP instruction will starts to wait for compare arrival of the other channel (channel 2).
2. When channel 2 counter value arrives compare value diCompareValue1, and at this time
channel 1 counter value 2000 will immediately output to diCapValue1, and the
bCapValue1_Complete flag will be set to ON.
3. When channel 2 counter value arrives compare value diCompareValue2, and at this time
counter value 8000 will be immediately output to diCapValue2, and the bCapValue2_Complete
flag will be set to ON.
4. Same as Example1, even if the bCapValue1_Complete/bCapValue2_Complete flags are not
cleared to OFF, the new captured values will still output to diCapValue1/ diCapValue2 when
channel 2 has a compare arrival event again.
16 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Timing diagram
byTrgSel = 1
Channel 1 8000
Counter
Value
2000
bMATCH 2 is OFF to ON
CH2 Comp2 on channel 2.
Channel 2
Counter CH2 Comp1
Value bMATCH 1 is OFF to ON
on channel 2.
0
diCapValue1 2000
bCapValue1_Complete
CH1
diCapValue2 8000
bCapValue2_Complete
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
17 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.16 DFB_HCDO
DFB_HCDO: HC module output point control
DFB_HCDO(
bEnable:= ,
byLocalID:= ,
bUpdate:= ,
FB DFB_HCDO iOutputSetting:= ,
bBusy=> ,
iOutputState=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run function block BOOL True/False (False)
byLocalID Expand module number BYTE 0–31(0)
bUpdate Update parameter BOOL True/False (False)
Output point motion
iOutputSetting INT 0~15(0)
setting
• Output
Setting Value
Name Function Data Type
(Default value)
bBusy The FB is running. BOOL True/False (False)
iOutputState Output point status INT 0~15(0)
FB instruction error
bError BOOL True/False (False)
flag
DFB_AS_MODULE_ DFB_AS_MODULE_API_
ErrorCode Error code
API_ERROR ERROR (DFB_NO_ERROR)
17 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bBusy
bError
• Function
b15~b4 b3 b2 b1 b0
NA Y0.3 action Y0.2 action Y0.1 action Y0.0 action
0:OFF
NA
1:ON
b15~b4 b3 b2 b1 b0
NA Y0.3 status Y0.2 status Y0.1 status Y0.0 status
0:OFF
NA
1:ON
17 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
17 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.17 DFB_DHCCMP
DFB_DHCCMP: HC module compare output.
DFB_DHCCMP(
bEnable:= ,
byLocalID:= ,
usiChannelNo:= ,
bUpdate:= ,
diCompareValue1:= ,
iActionValue1:= ,
iY_OutputNo1:= ,
iInterruptNo1:= ,
FB DFB_DHCCMP
diCompareValue2:= ,
iActionValue2:= ,
iY_OutputNo2:= ,
iInterruptNo2:= ,
bBusy=> ,
bMatch1=> ,
bMatch2=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run function block BOOL True/False (False)
byLocalID Expand module number BYTE 0–31(0)
usiChannelNo Channel number USINT 1–2(1)
bUpdate Update parameter flag BOOL True/False (False)
-2, 147, 483, 648–2, 147, 483,
diCompareValue1 Compare value 1 DINT
648(0)
Action of arrival compare
iActionValue1 INT 0–8(0)
value1
Y output point number of
iY_OutputNo1 INT 0–3(0)
arrival compare value1
Arrive compare value1,
iInterruptNo1 External Event interrupts INT 0、400–431(0)
number.
-2, 147, 483, 648–2, 147, 483,
diCompareValue2 Compare value2 DINT
648(0)
Action of arrival compare
iActionValue2 INT 0–8(0)
value2
17 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Setting Value
Name Function Data Type
(Default value)
Y output point number of
iY_OutputNo2 INT 0–3(0)
arrival compare value2
Arrive compare value2,
iInterruptNo2 External Event interrupts INT 0, 400–431(0)
number.
• Output
Setting Value
Name Function Data Type
(Default value)
bBusy The FB is running. BOOL True/False (False)
Arrival compare value1
bMatch1 BOOL True/False (False)
flag
Arrival compare value2
bMatch2 BOOL True/False (False)
flag
FB instruction error
bError BOOL True/False (False)
flag
DFB_AS_MODULE_ DFB_AS_MODULE_API_
ErrorCode Error code
API_ERROR ERROR (DFB_NO_ERROR)
• Timing Diagram
bEnable
bBusy
bError
• Function
17 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
“0 ≤ diCompareValue < ”.
11. Note that compare arrival timing will be different according to the input interfaces “pulse input” or “SSI
input” as shown in the following figure.
17 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Ex. diCompareValue = 5
8
Counting up
7 7 Counting down
6 6
diCompareValue
5 5
4 4
3 3
2 2
1 1
0 0
Counted Value
0 1 2 3 4 5 6 7 8 9 7 6 5 4 3 2 1 0
Pulse Input -
Timing to consider as reaching the target
SSI Input -
Timing to consider as reaching the target
Take diCompareValue = 5 as an example, SSI input compare arrival timing occurs in the counter value
4→5 and 6→5 instantaneous. For pulse input, when counting up, compare arrival timing occurs in the
counter value 5→6 instantaneous; when counting down, compare arrival timing occurs in the counter
Note: There will be a little delay between compare arrival occurrence and iActionValue running. The maximum
delay time is 100us.
13. iY_OutputNo1 and iY_OutputNo2 specify Y output point numbers for compare arrival number 1 and
number 2 respectively. After compare instruction starts, the HCDO instruction will not be able to control
17 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
output point:
14. iInterruptNo1 and iInterruptNo2 are specified interrupt numbers. The functions are as below:
iInterruptNo Action
0 Not to set interrupt
= 00~31, Interrupt_400_ModuleIN0 to Interrupt_431_ModuleIN31 of the
4 corresponding External Event
The corresponding Task will be started when compare arrives.
15. bMatch1 and bMatch2 are the status flag display for the comparison values of compare arrival number1
and number2. When the counter value of the specified channel and number1 compare value & number
compare value arrive, the corresponding bMatch1 or bMatch2 flag will be set to On; When the host
STOP, clear counter, DHCCMP is OFFON, or the bUpdate flag is set, the instruction will clear the
bMatch1 and bMatch2 flags to Off.
16. When the instruction is off, the relevant compare values and the output functions will not be updated.
17. If any error situation occurs during startup, the bError error flag will be set to ON. Users can refer to
ErrorCode for troubleshooting.
2. Set diCompareValue1 to 2000, set iActionValue1 to 3, set iY_OutputNo1 to 0, and set iInterruptNo1
to 0; set diCompareValue2 to 4000, set iActionValue2 to 3, set iY_OutputNo2 to 1, and set
iInterruptNo2 to 0.
3. When setting M0 = ON, DHCCNT counter starts to count. At the same time, set the DHCCMP parameter
for the module, and start to wait for counter compare arrival.
4. When counter values reach diCompareValue1, the bMatch1 flag is set to ON, and Y0.0 is OFFON.
5. Continuous counting until diCompareValue2 is reached, and the bMatch2 flag is set to ON, and Y0.1 is
OFFON.
17 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6. Continuous counting until diCompareValue1 is reached again, Y0.0 is ONOFF; Continuous counting
Timing Diagram
17 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
1. Set diCompareValue1 to 2500, set iActionValue1 to 2, set iY_OutputNo1 to 0 and set iInterruptNo1
to 0; set diCompareValue2 to 5000, set iActionValue2 to 8, set iY_OutputNo2 to 1, and set
iInterruptNo2 to 0.
2. When setting M0 = ON, DHCCNT counter starts to count. At the same time, set the DHCCMP parameter
for the module, and start to wait for counter compare arrival.
3. When counter values reach diCompareValue1, the bMatch1 flag is set to ON, and Y0.0 is set to ON.
4. Continuous counting until diCompareValue2 is reached. Since the action of iActionValue2 = 8 is “clear
the channel counter value + clear iY_OutputNo1 and iY_OutputNo2 specified output point”, counter
value is cleared to 0, bMatch1 and bMatch2 are cleared to False, and Y0.0 & Y0.1 are cleared to OFF.
5. Continuous counting until diCompareValue1 is reached again, the bMatch1 flag will be set to on again,
Y0.0 will be set to ON, and so on.
Timing Diagram
18 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
1. Set diCompareValue1 to 1000, set iActionValue1 to 3, set iY_OutputNo1 to 0,and set iInterruptNo1
to 0; set diCompareValue2 to 3000, set iActionValue2 to 3, set iY_OutputNo2 to 1, and set
iInterruptNo2 to 0.
2. When setting M0 = ON, DHCCNT counter starts to count. At the same time, set the DHCCMP parameter
for the module, and start to wait for counter compare arrival.
3. When counter value reaches diCompareValue1, the bMatch1 flag will be set to ON, and Y0.0 will be
OFFON.
4. When counter value reaches diCompareValue2, the bMatch2 flag will be set to ON, and Y0.1 will be
ONOFF.
5. Then, set new compare value: set diCompareValue1 to 5000, set iActionValue1 to 3, set OutputNo1
to 0, set iInterruptNo1 to 0, set diCompareValue2 to 7000, set iActionValue2 to 6, set iY_OutputNo2
to 1, and set iInterruptNo2 to 0.
6. Set the bUpdate flag to ON. When the setting completes, the bUpdate flag will be automatically cleared
to OFF. At the same time, the bMatch1 and bMatch2 flags will be cleared to OFF.
7. When counter value reaches new compare value diCompareValue1, the bMatch1 flag will be set to
ON, and Y0.0 will be ONOFF.
8. When counter value reaches new compare value diCompareValue2, Y0.1 will be OFFON. Because
iActionValue2 = 6 include Reset, counting value will be cleared to 0. At the same time, the bMatch1
and bMatch2 flags will be cleared to OFF.
Timing Diagram
18 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
New Comp2
New Comp1
Comp2
Comp1
Channel 1
Counter 0
Value
bUpdate Flag
bMATCH1
Y0.0
bMATCH2
Y0.1
1. DHCCMP can also configure compare arrival interruption. Set iInterruptNo1 and iInterruptNo2 to 400
and 401 respectively, and configure two Tasks at the same time. In the tasks, select
Interrupt_400_ModuleIN0 or Interrupt_401_ModuleIN1 for External event as shown in the following
figures.
18 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
18 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.18 DFB_DHCCMPT
DFB_DHCCMPT: Compare the count value of the HC module with the table, and output the action when the
condition is established.
DFB_DHCCMPT(
bEnable:= ,
byLocalID:= ,
usiChannelNo:= ,
bUpdate:= ,
iCompareLength:= ,
aCompareValue:= ,
FB DFB_DHCCMPT
aAction:= ,
aY_OutputNo:= ,
aInterruptNo:= ,
bBusy=> ,
iCurrentNo=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run function block BOOL True/False (False)
byLocalID Expand module number BYTE 0–31 (0)
18 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Setting Value
Name Function Data Type
(Default value)
comparison is complete
and the action condition is
reached
• Output
Setting Value
Name Function Data Type
(Default value)
bBusy The FB is running. BOOL True/False (False)
The number of
conditions and
iCurrentNo actions that has INT 0–10 (0)
been compared so
far.
FB instruction error
bError BOOL True/False (False)
flag
DFB_AS_MODULE_API_ERROR
ErrorCode Error code DFB_AS_MODULE_API_ERROR
(DFB_NO_ERROR)
• Timing Diagram
bEnable
bBusy
bError
• Function
1. It is suggested that this instruction be placed under Main Task.
2. This function is supported with AX-3 firmware V1.0.2 and later.
18 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
3. The output point Y0.0~Y0.3 in this instruction is the output point on the 02HC module.
4. The DHCCMPT instruction is AS02HC-A dedicated instruction. Its compare action is “cyclical” compare
according to the set groups. When the number of comparison step by step reaches the last compare
value, the next compare value will be reset as the first compare value. The DHCCMPT instruction is
limited to be used when the counter counts in only one direction (Changing the direction will cause
incorrect action), and can be set up to 10 compare values. Compare values need to be sorted by
incremental or decremental numbers. For incremental sorting, counter needs to counting up, and only
positive numbers for compare value. For decremental sorting, counter needs to counting down, and only
negative numbers for compare value. When the counting reaches the preset compare value, actions will
be performed to output pint and counter according to users setting, and the request to the host
interrupts.
5. DHCCMPT needs to be used with the DHCCNT instruction. Only when DHCCNT starts, counter value
counts according to the input signal, and perform compare action.
6. Complete iCompareLength, aCompareValue, aAction, aY_OutputNo, and aInterruptNo parameter
setting before running the instruction. bEnable will write the parameter once when it is first started.
7. The parameters of iCompareLength, aCompareValue, aAction, aY_OutputNo, and aInterruptNo can
be changed during running. The changing methods is to set them as new values, and then set the
bUpdate flag to On. When the changing is complete, the instruction will clear the bUpdate flag to Off.
8. byLocalID specifies module numbers. The number of the first module on the right of CPU is 0, the
number of the second module on the right of CPU is 1, and so on. Regardless of any type of modules,
all modules must be counted. The maximum number of modules is 32.
9. usiChannelNo specifies the channel numbers. The number of channel one is 1, and the number of
channel two is 2.
10. iCompareLength is the number of groups of compare tables. Its compare action is cyclical according to
the set group numbers. The group number length can be set to 2–10. When the set value is out of this
range, the instruction will not be run, and the error code shows.
11. aCompareValue is the storage source of the compare vale, and its type is ARRAY[0..9] OF DINT.
Compare values needs to be sorted by incremental or decremental numbers (each compare value
needs to be different). For incremental sorting, counter needs to counting up, and only positive numbers
for compare value. For decremental sorting, counter needs to counting down, and only negative
numbers for compare value.
When selecting the counter form as Linear Counter, each vale in aCompareValue needs to meet
“Minimum counter value < aCompareValue < Maximum counter value”.
When using SSI encoder and the counter form is set as Absolute Position, each value in
12. Note that compare arrival timing will be different according to the input interface “Pulse input” or “SSI
input” as shown in the following figure.
18 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Ex. aCompareValue = 5
8
Cou ntin g up
7 7 Cou ntin g do wn
6 6
aCompareValue
5 5
4 4
3 3
2 2
1 1
0 0
SSI Inp ut -
Timing to con sid er as reaching the target
Take aCompareValue = 5 as an example, SSI input compare arrival timing occurs in the counter value
4→5 and 6→5 instantaneous. For pulse input, when counting up, compare arrival timing occurs in the
counter value 5→6 instantaneous; when counting down, compare arrival timing occurs in the counter
Clear the channel counter value+ all aY_OutputNo Same as aAction = 7 clearance, and clear
8 all specified aY_OutputNo output point.
specify the output point Off.
Note: There will be a little delay between compare arrival occurrence and Action running. The maximum delay time
is 100us.
14. aY_OutputNo is specified output point number. The function is as the following:
18 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
aInterruptNo Action
0 Not to set interruption
= 00~31, Interrupt_400_ModuleIN0 to Interrupt_431_ModuleIN31 of the
4 corresponding External Event
The corresponding Task will be started when compare arrives.
16. iCurrentNo displays the number of the group that currently has compare arrived. For example, when the
counter value is 200, which is lower than the group number 1 in the following compare table, the
iCurrentNo value is 0; when the counter value reaches 1000, which equals to the group number 1 in the
following compare table, the iCurrentNo value is 1.
17. Refer to the following table for the operator description of aCompareValue, aAction, aY_OutputNo,
aInterruptNo, and iCurrentNo. In the table, the iCompareLength value is assumed as 6.
aAction
aCompareValue
ICurrentNo Specified Action after aY_OutputNo aInterruptNo
Source of Value to be
Item Number comparison and Output Number Interruption Number
compared
condition is reached
18. When the instruction is started (bEnable is from Off to On) and the bUpdate flag is set to On to change
the parameter, the instruction will compare all the compare values in the compare table set by users
according to the current counter vale. The group values that are smaller than the current counter value
will Run the compare arrival action. For example, when the instruction starts with the counter value 3500,
the actions numbered 1 ~3 (compare value < current counter value) in the compare table will be Run once
with the compare arrival action (Y0.0=On, Y0.1=On, Y0.0 Toggle (alternating ON/OFF)), and iCurrentNo
will be set to 3.
18 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
19. If bEnable is from On to Off, it means that shutting the table compare output function. iCurrentNo status
display will return to 0. The output point state is not changed by the instruction being off. Counter remains
counting, but no more comparison.
20. If any error situation occurs during startup, the bError error flag will be set to ON. Users can refer to
ErrorCode for troubleshooting.
• Programming Example
1. Set the parameters of the relevant input pins as shown in the following figure (The settings in the
following figure are equivalent to those shown in the following table).
aAction
aCompareValue
ICurrentNo Specified Action after aY_OutputNo aInterruptNo
Source of Value to be
Item Number comparison and Output Number Interruption Number
compared
condition is reached
2. When EN is OFF→ON, the instruction will compare all the compare values in the compare table set by
users. The group values that are smaller than the current counter value will Run the compare arrival
action. Because the counter value is still smaller than the first compare value 1000 when startup. No
compare arrival specified action will be Run, and iCurrentNo is 0 currently.
3. When the counter value reaches 1000, compare arrives the first compare value (If it is pulse input,
compare arrival specified action will be Run when the counter value is 1000→1001).
4. When the counter value reaches 2000, compare arrives the second compare value, Y0.1 is OFFON,
401 interruption program is running, and iCurrentNo=2.
5. When the counter value reaches 3000, compare arrives the third compare value, Y0.2 is OFFON, 402
interruption program is running, and iCurrentNo=3.
18 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6. When the counter value reaches 4000, compare arrives the fourth compare value, Y0.3 is OFFON,
403 interruption program is running, and iCurrentNo=4.
7. Follow this rule to continue compare arrival from the fifth to tenth compare value. At this time
iCurrentNo=10. Because the last comparison has done, next compare vale will be set as the first
compare value 1000.
8. When the ring counter counts to 1000 again, compare arrives the first counter value, Y1.0 is ONOFF,
400 interruption program is running, and iCurrentNo=1. Follow this rule to Run the subsequent
comparison.
• Timing Diagram
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
Channel 1
Counter 0
Value
EN
iCurrenNo 0 1 2 3 4 5 6 7 8 9 10 10 1 2
Y0.0
Y0.1
Y0.2
Y0.3
19 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
19 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.19 DFB_DHCMEAS
DFB_DHCMEAS: HC module frequency and rotation speed measurement
DFB_DHCMEAS(
bEnable:= ,
byLocalID:= ,
usiChannelNo:= ,
bUpdate:= ,
udiPulsePerRev:= ,
FB DFB_DHCMEAS iSamplingTime:= ,
iMovingAvgWindow:= ,
bBusy=> ,
diFrequency=> ,
diRPM=> ,
bError=> ,
ErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
bEnable Run function block BOOL True/False (False)
byLocalID Expand module number BYTE 0–31 (0)
usiChannelNo Channel number USINT 1–2 (1)
bUpdate Update parameter flag BOOL True/False (False)
Counting quantity per
udiPulsePerRev UDINT 1~4294967295 (1)
lap
Sampling period
iSamplingTime INT 1–1000 (1)
(unit: ms)
Average number of
iMovingAvgWindow INT 1–10 (1)
moves
• Output
Setting Value
Name Function Data Type
(Default value)
bBusy The FB is running. BOOL True/False (False)
Average
–2, 147, 483, 648–2, 147, 483,
diFrequency measurement DINT
frequency results 648 (0)
Average rotation
–2, 147, 483, 648–2, 147, 483,
diRPM speed measurement DINT
results 648 (0)
19 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Setting Value
Name Function Data Type
(Default value)
FB instruction error
bError BOOL True/False (False)
flag
DFB_AS_MODULE_API_ERROR
ErrorCode Error code DFB_AS_MODULE_API_ERROR
(DFB_NO_ERROR)
• Timing Diagram
bEnable
bBusy
bError
• Function
1. It is suggested that this instruction be placed under Main Task.
2. This function is supported with AX-3 firmware V1.0.2 and later.
3. The output point Y0.0~Y0.3 in this instruction is the output point on the 02HC module.
4. The DHCMEAS instruction is AS02HC-A dedicated instruction. Its functions are frequency and rotation
speed measurements.
5. DHCMEAS needs to be used with the DHCCNT instruction. Only when DHCCNT is started, the counter
value counts according to input signals, and the measurement results are calculated by the change of the
counter values.
6. Complete setting udiPulsePerRev, iSamplingTime, and iMovingAvgWindow parameters before
running the instruction. bEnable will write the parameter once when it is first started. If users want to
change parameters during running, the change method is to set new values first, and then set the bUpdate
flag to On. When this instruction completes the change, the instruction will clear the bUpdate flag to Off.
19 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
7. byLocalID specifies module numbers. The number of the first module on the right of CPU is 0, the number
of the second module on the right of CPU is 1, and so on. Regardless of any type of modules, all modules
must be counted. The maximum number of modules is 32.
8. usiChannelNo specifies the channel numbers. The number of channel one is 1, and the number of
channel two is 2.
9. udiPulsePerRev is the counter value of one rotation of the encoder, and its setting range is 1–
4294967295 (H’00000001~H’FFFFFFFF).
10. iSamplingTime is sampling period, and its setting range is 1~1000 (unit: ms). According to the setting of
iSamplingTime, diFrequency frequency measurement result output and diRPM rotation speed
measurement result output will have different resolution.
𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝 resolution = 1000 ÷ 𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢 (unit: Hz)
𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝 resolution = 60000 ÷ (𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢 × 𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮)(unit: rev/min)
Because the rotation speed calculation method is based on the CurCnt counter value of the beginning and end
of the sampling period, the following situations need to be excluded when designing sampling periods.
11. iMovingAvgWindow is the average number of times, which performs moving average to measurement
results. Its setting range is 1–10.
12. diFrequency is the result of average measurement frequency (unit: Hz). The calculation method of the
frequency is as below:
CurCnt(t + 𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢) − CurCnt(t)
𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝(Hz) =
𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢(ms) × 10−3
13. diRPM is the result of the average rotation speed measurement (unit: rev/min). The calculation method of
the rotation speed is as below:
( CurCnt(t + 𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢) − CurCnt(t) ) × 60
𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝𝐝(rev/min) =
𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮𝐮 × 𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢𝐢(ms) × 10−3
14. When the instruction is shut off, it means that the measurement function is disabled, and diFrequency &
diRPM will remain the same and no more update.
15. Note that when the counter value is cleared or users change the counter value, the calculation result of
diFrequency and diRPM of the sampling period will be affected.
16. If any error situation occurs during startup, the bError error flag will be set to ON. Users can refer to
ErrorCode for troubleshooting.
19 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
1. Set CH1 Input Interface in AS02HC-A Parameters to “Pulse Input”, set Pulse Type to “A/B phase (2x)”,
and set Counter Type to “Ring counter” as shown in the following figure:
2. Set udiPulsePerRev to 1000, set iSamplingTime to 1000, and set iMovingAvgWindow to 10.
3. When setting M0=ON, the DHCCNT counter starts to count. At the same time, set the DHCMEAS
parameters to the module, and start to measure frequency and rotation speed. The pulse number
counted every 1000ms is displayed in diFrequency and diRPM.
4. When the motor operation frequency is 5kHz, diFrequency shows 5kHz, and diRPM shows 300rev/min.
• Supported products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
19 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.20 DFB_DADLOG
DFB_DADLOG: Analog input module data record.
DFB_DADLOG(
bEnable:= ,
byRemoteID:= ,
byLocalID:= ,
usiChannelNo:= ,
iMode:= ,
iPeriod:= ,
iTotalPoints:= ,
FB DFB_DADLOG
iPostTrigger:= ,
bDone=> ,
bBusy=> ,
aIntegerData=> ,
aFloatData=> ,
iCurPointNo=> ,
bError=> ,
ErrorCode=> );
• Input
• Output
19 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bDone
bBusy
bError
• Funtion
1. This Function is only supported by the AX-3 series firmware version V1.0.3 or above.
2. This command is a dedicated command for analog input modules (AS04AD-A, AS06XA-A, AS02ADH-
A). Function is to enable/disable the recording function, and send the recorded data from the module to
the specified aIntegerData or aFloatData (Determined according to the Format setting in the module
Parameters page).
19 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
3. The specifications of the Record Period and the number of points corresponding to each Model are
described in the following table. For detailed usage, refer to the iMode parameter description.
Model Record Period Number of Records
AS04AD-A Fixed period mode:
Fixed to 500 records
AS06XA-A The setting range is 1~100, and the unit time is fixed at 10ms
Fixed period (Fixed period) mode, trigger start types fixed
period (Fixed period + Trigger Start) mode, trigger position
designation (Fixed period + Trigger position Assign)
recording mode:
Setting range 1~32000, selectable time unit 20us/40us/80us
(Note: The time unit is the sampling period set by
AS02ADH-A HWCONFIG) Can set from 1 to 2000 records
Point Logging mode:
One point is recorded every time the external input point
is triggered, and there is no fixed period; the trigger timing of
the external input point is set by HWCONFIG.
Channel 1 triggers when X0.0 shift to True or False
Channel 2 triggers when X0,1 shift to True or False
4. byRemoteID specifies the group number of the analog input module connected to the right side of the
host or the right side of the remote module, the host number is 0, the number of the first remote module
is 1, and so on, the maximum number of groups is 15.
5. byLocalID specifies the module number. The sequence number of the modules connected to the right
side of the host starts from 0, second module is 1, and so on. Regardless of any type of modules, they
must be counted, and the maximum number of modules is limited to 32 units.
6. usiChannelNo specifies the channel number. Channel 1 is numbered 1, channel 2 is numbered 2.
7. iMode is recording mode. Modes supported by each Model are shown in the table below.
19 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Example:
Set iMode=1, turn on the command bEnable before starting the recording. When the external trigger input
point is triggered, the recording will be Run with the set Record Period immediately, and the bDone flag
will be automatically set to True when the recording is completed. Any operation on the external trigger
input point will not affect the recording until the set total number of records is completed; however, when
the record number has been completed and the bDone flag is True, the external input point can be re-
triggered to start a new record. A round of records does not need to be closed and restarted by bEnable.
Example:
Set iTotalPoints = 2000. The trigger timing of the external input point is set as the rising edge trigger.
19 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
The fixed period + trigger start mode is similar to the fixed period mode, but the recording start timing of
the fixed period mode will be affected by the host scan time and module communication time, causing
delay, refer to below picture. In the Fixed period mode, it is assumed that M0 is the device that controls
the DADLOG command bEnable. When M0 is turned OFF->ON, the module does not start recording
immediately, but with a small delay.
0
Fixed period mode
M0
Host scan time +
Record start
Communication delay
External Trigger
input
Record start
Set iMode=2. Turn on the command bEnable before starting to record. Each time the external trigger
input point is triggered, one record will be recorded. When the set total number of records is reached, the
bDone flag will be automatically set to True; if wish to continue recording after the bDone flag is True, user
must restart the command.
20 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Example:
Set iTotalPoints = 2000, The trigger timing of the external input point is set as the rising edge.
Example:
Set iMode=3, iTotalPoints = 2000, iPostTrigger = 1500, means that the position of the 501st point
(iTotalPoints - iPostTrigger) will be the first data recorded by the current external trigger.
20 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
2. iTotalPoints is the total number of records. This parameter is only valid for AS02ADH-A, and can be set
up to 2000 points; other models are fixed at 500 points regardless of the setting of this parameter.
Model Total Recordm Setting Range
AS04AD-A
The setting is invalid, fixed at 500.
AS06XA-A
AS02ADH-A Can be set, 1~2000 records.
3. iPostTrigger is the points recorded after the trigger occurs. This parameter is used in combination with
the total number of records iTotalPoints to record the data before and after the trigger. This parameter is
only used in Fixed period + Trigger position Assign mode (iMode=3), and is invalid in other modes. Be
cautious that this value should not be greater than the total number of iTotalPoints. If it exceeds, it will
automatically use the iTotalPoints value as Number of Records.
Example:If set iTotalPoints=100, iPostTrigger=200. Since iPostTrigger is greater than the total
number of records, iPostTrigger will be automatically regarded as 100, so only 100 records after the trigger
will be recorded.
Model iPostTrigger Setting Range
AS02ADH-A 0~2000 records (Must not be greater than the total number of iTotalPoints records)
Example:
Set iTotalPoints= 100, iPostTrigger= 700, the 1000 records include the first 300 records and the last 700
records triggered by the external trigger input point.
20 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
1. aIntegerData and aFloatData are specified arrays to store record values. (According to the Format
setting in the parameters page of the module to determine which array to store in, the value in the other
array will be cleared to 0).
2. iCurPointNo is to display the number of records that the module has sent back to the host. When the
record is in progress, the iCurPointNo value may not be displayed in a consistent value due to the
influence of the scanning cycle.
3. bDone is the flag of record completion. When bDone is OFF->ON, it means that all record values have
been transferred to the specified aIntegerData or aFloatData array. The bDone flag will be automatically
initialized to OFF when bEnable changes from OFF->ON.
4. If the command is closed, the specified channel will stop updating the values in the right half of the
command.
5. When any error occurs during startup, the bError error flag will be set to ON. Refer to the error code of
ErrorCode for troubleshooting.
• Supported products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
20 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
6.21 DFB_DADPEAK
DFB_DADPEAK: Analog input module peak record.
DFB_DADPEAK(
bEnable:= ,
byRemoteID:= ,
byLocalID:= ,
usiChannelNo:= ,
bBusy=> ,
FB DFB_DADPEAK
iMaxValue=> ,
iMinValue=> ,
rMaxValue=> ,
rMinValue=> ,
bError=> ,
ErrorCode=> );
• Input
Specify channel
usiChannelNo USINT 1–2(1)
number
Note: Currently only support mode 0.
• Output
20 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Timing Diagram
bEnable
bBusy
bError
• Funtion
1. This Function is only supported with AX-3 series firmware version 1.0.3 or later.
2. AX-3 series firmware version 1.0.7 or later supports AS08AD_B and AS08AD_C modules (v1.0.2 or
later).
3. The DADPEAK command is a dedicated command for analog input modules (AS04AD-A, AS08AD-B,
AS08AD-C, AS06XA-A, AS02ADH-A), and its Function is to enable/disable the module to record the
peak value.
4. byRemoteID specifies the group number of the analog input module connected to the right side of the
host or the right side of the remote module, the host number is 0, the number of the first remote module
is 1, and so on, the maximum number of groups is 15.
5. byLocalID specifies the module number, the sequence number of the modules connected to the right
side of the host, the number of the first module is 0, the number of the second module is 1, and so on,
regardless of any type of modules, they must be counted, and the maximum number of modules is
limited. for 32 units.
6. usiChannelNo specifies the number of the counter channel to be controlled, the number of Channel 1 is
1, and the number of Channel 2 is 2.
7. According to the Format setting in the module Parameters page, determine whether the maximum and
minimum values are placed in iMaxValue and iMinValue or in rMaxValue and rMinValue. The
maximum and minimum values of another Data Type will be cleared to 0.
8. The following describes the maximum and minimum values of INT or REAL type represented by
MaxValue and MinValue.
9. MaxValue and MinValue are the maximum and minimum values respectively. When bEnable is
changed from OFF->ON, MaxValue and MinValue will be initialized to the latest measurement value,
20 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
and then the peak value recording Function will start, and the channel will continue to detect the
maximum and minimum values. value and update to MaxValue and MinValue.
10. If bEnable changes from ON to OFF, it means that the peak value recording function is turned off. At this
time, the content values of MaxValue and MinValue will remain unchanged and will not be updated.
11. When any error occurs during the startup process, the bError flag will be set to ON. Refer to the error
code of ErrorCode for troubleshooting.
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
20 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
DFB_SCMRS(
bEnable:= ,
ComPort:= ,
RxMode:= ,
DFB_ ParaSet:= ,
FB
SCMRS bDone=> ,
bBusy=> ,
bError=> ,
ErrorCode=> ,
uiRcvLen=> );
• Input
Setting Value
Name Function Data Type
(Default value)
Note:
1. DFB_SCMRS_RXMODE: STRUCT
Name Description
No receiving data mode:
NO_RECEIVING(0) After the packet is sent, the receiving task is complete. Then the
completion flag is set to True.
Discontinuous time mode:
When the interval between receiving packets is longer than the
specified time, the receiving task is complete. Then the
DISCONTINUOUS_TIME(1) completion flag is set to True.
The discontinuous time for receiving the packet can be set via
ParaSet.uiDiscontinuousTime.
Name Description
The end character can be set via ParaSet.pSpecificEndChar.
2. DFB_SCMRS_SET_VALUE: STRUCT
Setting Value
Name Function Data Type
(Default value)
The length of packet to be
uiWriteLen sent UINT 0 –200 (0)
(Unit: Byte)
Packet interval
uiDiscontinuousTime UINT 5–3,000 (5)
(Unit: ms)
Memory address of the start
pSpecificStartChar POINTER TO BYTE Memory address (0)
character
Memory address of the end
pSpecificEndChar POINTER TO BYTE Memory address (0)
character
UINT
uiSpecificRxLen Receiving length 1–198 (1)
(Unit: Byte)
20 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Setting Value
Name Function Data Type
(Default value)
T#0ms–T#3000ms(T#100ms)
tTimeout Communication time-out TIME
T#0ms: No time-out
• Output
• Timing Diagram
bEnable
bDone
bBusy
bError
• Function
20 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
3. Before using this function, the communication protocol corresponding to the SCM function card must be set
to SCM RS.
4. ComPort is the communication port number. Up to four AS00SCM can be connected to the right side of the
PLC. If the communication port range is exceeded, the FB will not receive any communication data.
Card1 No. Card2 No.
1st AS00SCM 1 2
2nd AS00SCM 11 12
3rd AS00SCM 21 22
4th AS00SCM 31 32
5. When the condition of ending receiving has the specific character, it is recommended to use ASCII-
encoded communication data. If not, it is recommended to use the communication time-out as a mark to
end.
6. Take the first AS00SCM CARD1 on the right side of AX-3 as an example. FunctionCardOutput(Slave)[0] is
the length of the received data, and FunctionCardOutput(Slave)[0]+1~ FunctionCardOutput(Slave)[0]+n is
the stored received data. Suppose RxMode = SPECIFIC_END_CHAR_2 and ParaSet.PSpecificEndChar =
16#0D0A, the FB will store the data after FunctionCardOutput(Slave)[1] according to the order of receiving.
The data will not be stopped to receive until the two consecutive ending characters are 16#0D and 16#0A.
The length will be entered in FunctionCardOutput(Slave)[0], and then the completion flag will be set to
Done.
7. When the receiving mode is 7, 8, and 9, the corresponding communication interrupt numbers generated by
each communication port are as follows:
32 modules can be connected to the right side of the AX-3 controller, and there are different interrupt
numbers according to the location of the SCM, as shown in the following table:
The Nth
position on 1st 2nd … 31st 32nd
the right
Card1
I400 I401 … I430 I431
interrupt No.
Card2
I432 I433 … I462 I463
interrupt No.
Note: Up to four SCM modules can be connected to the right side of the AX-3.
• Programming Example
Example 1
This example uses DFB_SCMRS and the communication receiving mode is NO_RECEIVING to
send serial communication packets.
21 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Output variable address is based on the output address of the module. %QW7 is the start address
in this example.
Example 2
This example uses DFB_SCMRS and the communication receiving mode is
SPECIFIC_START_CHAR_AND_SPECIFIC_END_CHAR to receive serial communication
packets.
211
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
Output variable address is based on the output address of the module. %QW7 is the start address
in this example.
Example 3
This example uses DFB_SCMRS and the communication receiving mode is
SPECIFIC_END_CHAR_2 to stop receiving packets when the two consecutive ending characters
are 16#0D and 16#0A.
Output variable address is based on the output address of the module. %QW7 is the start address
in this example.
21 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
• Supported Products
AX-3 series
• Library
DL_ASModuleAPI_AX3.library
21 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
21 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
21 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
21 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
21 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
21 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 6
21 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
22 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
7.1 DFB_COMRS
DFB_COMRS: Send and receive communication data via the COM port.
DFB_COMRS (
bExecute:= ,
byComPort:= ,
RxMode:= ,
ParaSet:= ,
FB DFB_COMRS
bDone=> ,
bBusy=> ,
bError=> ,
ErrorId=> ,
uiRcvLen=>);
• Input
Setting Value
Name Function Data Type
(Default value)
Note: You need to configure the settings based on the definitions of COM port numbers varied from model to
model.
DFB_COMRS_MODE
Name Description
22 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
Name Description
COMRS_SET_VALUE
Setting Value
Name Function Data Type
(Default value)
The length of packet to be
uiWriteLen sent UINT 0–1000(0)
(Unit: Byte)
The memory address of
pWriteBuf POINTER TO BYTE --
packet to be sent
22 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
Setting Value
Name Function Data Type
(Default value)
The memory address of
pReadBuf POINTER TO BYTE --
packet to be stored
The memory size of packet
uiReadBufSize to be stored UINT 1–1,000 (100)
(Unit: Byte)
Packet interval
uiDiscontinuousTime UINT 2–3,000 (2)
(Unit: ms)
BYTE
byStartCharAmt Size of the start character 1–255 (1)
(Unit: Byte)
Memory address of the start
pSpecificStartChar POINTER TO BYTE Memory address (0)
character
BYTE
byEndCharAmt Size of the end character 1–255 (1)
(Unit: Byte)
Memory address of the end
pSpecificEndChar POINTER TO BYTE Memory address (0)
character
UINT
uiSpecificRxLen Specified receiving length 1–1000 (1)
(Unit: Byte)
T#0ms–
tTimeout Communication time-out TIME T#49d17h2m47s295ms(T#100ms)
T#0ms: No time-out
• Output
Output Range(Default
Name Function Data Type
value)
bDone FB is completed. BOOL True/False (False)
True when the instruction is
bBusy BOOL True/False (False)
running
bError True if an error occurs BOOL True/False (False)
Indicates the error code if an DFB_COM_ERROR_
ErrorID (DFB_UNDEFINED)
error occurs. CODE
UINT
uiRcvLen The length of the data received (0)
(Unit: Byte)
22 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
• Timing Diagram
• Function
The FB instruction (DFB_COMRS) is used for sending communication data. You must finish the configuration of
COM port of CPU and add Delta_Modbus_Master_COM_Port device before using this instruction (For more
details, refer to chapter 9.2 Serial Port Communication in AX-3 Series Operational Manual).
• Programming Example
This example used DFB_COMRS to send COM communication data.
For AX-3 series controller, the definition of COM port name can be found in Library Manager as shown below.
22 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
• Supported Products
AX series
Note 1: In the AX-8 series, only AX-864E30xE2T is supported.
Note 2: AX-332E (Library firmware version: 1.0.6.0 and later).
• Library
DL_COM.library
Note: From version 1.0.6.0, library DL_COM_AX3 is changed to DL_COM.
22 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
7.2 DFB_ModbusComChannel
DFB_ModbusComChannel: Modbus Slave COM Port Channel control instruction.
DFB_ModbusComChannel(
Slave:= ,
bExecute:= ,
bAbort:= ,
DFB_ iChannelIndex:= ,
FB
ModbusComChannel bBusy=> ,
bDone=> ,
bError=> ,
bAborted=> ,
ModbusError=> );
• In/ Outs
Setting Value
Name Function Data Type
(Default value)
Delta Modbus slave
Slave DFB_ModbusComSlave --
device
• Input
Setting Value
Name Function Data Type
(Default value)
Run the function block.
bExecute BOOL True/False (False)
(Rising-edge triggered)
bAbort No function BOOL --
0–9
iChannelIndex Channel index INT
(0)
• Output
22 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
• Timing Diagram
• Function
When the trigger mode of the Modbus slave channel is set to Application, the Modbus request action will be
triggered by DFB_ModbusComChannel.
Note:
1. For more details of Modbus slave COM port configuration, you can refer to chapter 9.2 Serial
Communication in AX-3 Series Operational Manual.
2. While using, the channel must be set to Enable.
• Programming Example
This example uses DFB_ModbusComChannel to trigger data exchange with Modbus COM port communication.
22 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
*Note: The input of Slave would be the name of Modbus slave device.
• Supported Products
• Library
DL_ModbusComMaster.library
Note: From version 1.0.6.0, library DL_ModbusComMaster_AX3 is changed to DL_ModbusComMaster.
22 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
7.3 DFB_ModbusRequest
DFB_ModbusRequest: Modbus communication commands.
DFB_ModbusRequest(
byComPort:= ,
bExecute:= ,
bAbort:= ,
usiSlaveAddr:= ,
uiFunctionCode:= ,
uiReadOffset:= ,
uiReadLen:= ,
uiWriteOffset:= ,
DFB_
FB uiWriteLen:= ,
ModbusRequest
tTimeout:= ,
pWriteBuf:= ,
pReadBuf:= ,
transmission:= ,
bBusy=> ,
bDone=> ,
bError=> ,
bAborted=> ,
ModbusErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
byComPort*1 COM port number BYTE (0xFF)
Run the function block.
bExecute BOOL True/False (False)
(Rising-edge triggered)
bAbort No function BOOL --
usiSlaveAddr Slave station number USINT 1~247
Supported function codes:
0x01: Read Coils
0x02: Read Discrete Inputs
0x03: Read Holding Registers
0x04: Read Input Registers
uiFunctionCode Modbus function code DFB_MB_FUNC_CODE 0x05: Write Single Coil
0x06: Write Single Register
0x0F: Write Multiple Coils
0x10: Write Multiple Registers
0x17: Read/Write Multiple
Registers (0x03)
The start address of 0–65535
uiReadOffset UINT
memory to be read. (0)
22 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
Setting Value
Name Function Data Type
(Default value)
Coil: 1–1920
The data length of the
uiReadLen UINT Register: 1–120
memory to be read.
(1)
The start address of
uiWriteOffset UINT 0–65535(0)
memory to be written.
Coil: 1–1920
The data length of the
uiWriteLen*5 UINT Register: 1–120
memory to be written
(1)
T#0ms–T#49d17h2m47s295ms
Communication time-
tTimeout*2 TIME 0: No time-out
out
(T#100ms)
The memory address
pWriteBuf POINTER TO BYTE --
of data to be sent.
The memory address
pReadBuf POINTER TO BYTE --
of data to be stored.
0: ASCII
DFB_MB_
Transmission*3 Transmission mode 1: RTU
TRANSMISSION
(ASCII)
*Note:
1. You need to configure the settings based on the definitions of COM port numbers varied from model to model.
2. The time-out should be greater than the Cycle time set in mdbus Task.
3. When the transmission mode is set to RTU, the data bit of Modbus COM port must be set to 8.
4. If uiReadLen is set to 0, the Modbus read command will not be sent.
5. If uiWriteLen is set to 0, the Modbus write command will not be sent.
• Output
23 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
• Timing Diagram
• Function
The FB instruction (DFB_ModbusRequest) is used for sending Modbus communication data. You must finish the
configuration of COM port of CPU and add Delta_Modbus_Master_COM_Port device before using this
instruction. (For more details, refer to chapter 9.2 Serial Port Communication in AX-3 Series Operational Manual.)
• Programming Example
This example uses DFB_ModbusRequest to send Modbus commands for reading a 10-word long data (Holding
Registers) in the slave station (Slave address = 2), which the start address is 0x0000.
• Supported Products
23 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
• Library
DL_ModbusComMaster.library
Note: From version 1.0.6.0, library DL_ModbusComMaster_AX3 is changed to DL_ModbusComMaster.
23 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
7.4 DFB_ModbusRequest2
DFB_ModbusRequest2: Modbus communication commands.
DFB_ModbusRequest2(
bExecute:= ,
bAbort:= ,
byComPort:= ,
usiSlaveAddr:= ,
ModbusCommand:= ,
tResponseTimeout:= ,
uiSendTimeout:= ,
DFB_
FB pSendData:= ,
ModbusRequest2
pRecvData:= ,
transmission:= ,
bDone=> ,
bBusy=> ,
bError=> ,
bAborted=> ,
uiDataLength=> ,
ModbusErrorCode=> );
• Input
Setting Value
Name Function Data Type
(Default value)
Run the function block.
bExecute BOOL True/False (False)
(Rising-edge triggered)
bAbort No function BOOL --
byComPort*1 COM port number BYTE (0xFF)
usiSlaveAddr Slave station number USINT 1~247
DFB_MODBUS_
ModbusCommand Modbus parameter setting --
COMMAND
T#0ms–
T#49d17h2m47s295ms
tResponseTimeout*2 Communication time-out TIME
0: No time-out
(T#100ms)
uiSendTimeout No function UINT (0)
The memory address of data to
pSendData POINTER TO BYTE --
be sent
The memory address of
pRecvData POINTER TO BYTE --
received data to be stored
0: ASCII
DFB_MB_
Transmission*3 Transmission mode 1: RTU
TRANSMISSION
(ASCII)
23 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
*Note:
1. You need to configure the settings based on the definitions of COM port numbers varied from model to
model.
2. The time-out should be greater than the Cycle time set in mdbus Task.
3. When the transmission mode is set to RTU, the data bit of Modbus COM port must be set to 8.
• DFB_MODBUS_COMMAND
• Output
23 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
• Timing Diagram
• Function
The FB instruction (DFB_ModbusRequest2) is used for sending Modbus communication data. You must finish
the configuration of COM port of CPU and add Delta_Modbus_Master_COM_Port device before using this
instruction. (For more details, Refer to chapter 9.2 “Serial Port Communication” in AX-3 Series Operational
Manual.)
• Programming Example
This example uses DFB_ModbusRequest2 to send Modbus commands for reading a 100-WORD long data
(Holding Registers) in the slave station (Slave address = 2), which the start address is 0x0000.
23 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
• Supported Products
• Library
DL_ModbusComMaster.library
Note: From version 1.0.6.0, library DL_ModbusComMaster_AX3 is changed to DL_ModbusComMaster.
23 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
• DFB_COM_ERROR_CODE
• DFB_MB_ERROR_CODE
23 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 7
23 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
24 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
8.1 DFB_TCP_Client
DFB_TCP_Client: TCP socket client instruction.
DFB_TCP_Client(
bEnable:= ,
SocketInfo:= ,
bSend:= ,
bRecvRestart:= ,
bBusy=> ,
FB DFB_ TCP_Client bConnected=> ,
bSent=> ,
bRcvd=> ,
bError=> ,
ErrorID=> ,
Status=> ,
uiRcvdLen=> );
• Input
Setting Value
Name Function Data Type
(Default value)
*1 As soon as this function block is running, TCP connection will start to be created. Once connected, the output
bConnected would be ON.
*2 After the function block is running, it starts receiving data packets. When the data receiving is completed and
stopped, bRcvd would be ON. If you shift bRecvRestart to ON, the FB will restart to receive data.
tcpClientsocketInfo
Setting Value
Name Function Data Type
(Default value)
byIPAddr Server’s IP address ARRAY [0..3] OF BYTE --
24 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
Setting Value
Name Function Data Type
(Default value)
0: Illegal
uiRPort Communication ports UINT 1–65535
on remote device
(0)
0: No time-out
uiTimeout Response time-out UINT 1–65535
(Unit: ms)
(0)
0: No time-out
The time that the
uiKeepAliveTimeout socket keeps alive. UINT 1–65535
(Unit: sec) (0)
True/False (False)
True:
When connection time-out or
failed, it would try to rebuilt the
bReconnect Auto-reconnect BOOL connection automatically.
function
False:
When connection time-out or
failed, the output bError would
be ON.
DFB_SOCK_RECV_MODE
24 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
Name Description
DFB_SOCK_MODE_NO_REC
No receiving data mode.
EVING
Specific data length mode:
DFB_SOCK_MODE_SPECIFI A specific quantity of data is received and the receiving task is completed.
C_LENGTH The data length can be specified via uiSetValue.
(Unit: Byte)
Specific end character mode:
The data received ends with a specific character (1 Byte).
DFB_SOCK_MODE_SPECIFI
The end character can be configured via uiSetValue.
C_SINGLE_CHAR
e.g.: If uiSetValue is set to 16#00000D0A, the end character would be
16#0A.(*1*2)
Specific two end characters mode:
The data received ends with the two specific characters (2 Bytes)
DFB_SOCK_RECV_MODE_D
The end character can be configured via uiSetValue
FB_SOCK_MODE_SPECIFIC
_TWO_CHARS e.g.: If uiSetValue is set to 16#00000D0A, the end characters would be
16#0D0A.
(*1*2)
Specific start character and end character mode:
The data received starts with a specific character, and ends with a specific
DFB_SOCK_RECV_MODE_D character.
FB_SOCK_MODE_SPECIFIC
Both the start and the end character can be configured via uiSetValue.
_START_CHAR_AND_SPECI
FIC_END_CHAR e.g.: If uiSetValue is set to 16#00003A0A, the start character would be 16#3A
and the end character is 16#0A.
(*1*2)
*1: When the length of received data reaches the limit set in pRecvLen, the receiving task would be completed.
*2: The data length includes both start and end characters.
• Output
24 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
DFB_SOCKET_STATUS
• Timing Diagram
24 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Function
Use the FB instruction (DFB_TCP_Client) to create TCP connection so as to send or receive TCP data
packets.
• Programming Example
This example uses the FB instruction (DFB_TCP_Client) and Server (IP address: 192.168.1.111, Port: 25000)
to establish connection and send 200 Bytes packet. It is expected that Server will send back the same 200
Bytes package. After Server has finished sending back the package, 200 Bytes package will be resent.
24 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Supported Products
AX-3, AX-864E30xE2T
24 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Library
DL_EthernetLib.library
Note: From version 1.0.6.0, library DL_ EthernetLib_AX3 is changed to DL_EthernetLib.
24 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
8.2 DFB_TCP_Server
DFB_TCP_Server: TCP socket server instruction
DFB_TCP_Server(
bEnable:= ,
SocketInfo:= ,
bSend:= ,
bRecvRestart:= ,
bBusy=> ,
FB DFB_ TCP_Server bConnected=> ,
bSent=> ,
bRcvd=> ,
bError=> ,
ErrorID=> ,
Status=> ,
uiRcvdLen=> );
• Input
Setting Value
Name Function Data Type
(Default value)
*1 As soon as this function block is running, TCP connection will start to be created. Once connected, the output
bConnected would be ON.
*2 After the function block is running, it starts receiving data packets. When the data receiving is completed and
stopped, bRcvd would be ON. If you shift bRecvRestart to ON, the FB will restart to receive data.
tcpServersocketInfo
Setting Value
Name Function Data Type
(Default value)
The IP address on
byIPAddr Client side allowed to ARRAY [0..3] OF BYTE [0.0.0.0]: No limit.
be connected.
0: Illegal values.
uiLPort Communication ports UINT
on local device 1–65535
24 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
Setting Value
Name Function Data Type
(Default value)
(0)
0: No time-out.
Communication time-
uiTimeout out UINT 1–65535
(Unit: ms) (0)
DFB_SOCK_RECV_MODE
Name Description
DFB_SOCK_MODE_NO_RECEVING No receiving data mode.
DFB_SOCK_MODE_SPECIFIC_LENGTH Specific data length mode:
A specific quantity of data is received and
the receiving task is completed.
The data length can be specified via
uiSetValue.
(Unit: Byte)
DFB_SOCK_MODE_SPECIFIC_SINGLE_CHAR Specific end character mode:
The data received ends with a specific
character (1 Byte).
The end character can be configured via
uiSetValue.
e.g.: If uiSetValue is set to 16#00000D0A,
24 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
*1: When the length of received data reaches the limit set in pRecvLen, the receiving task would be completed.
*2: The data length includes both start and end characters.
• Output
DFB_SOCKET_STATUS
25 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Timing Diagram
25 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Function
Use the FB instruction (DFB_TCP_Server) to create TCP connection so as to send or receive TCP data packets.
• Programming Example
This example uses the FB instruction (DFB_TCP_ Server) to open TCP (Port: 20000) and restrict the IP
address of Client to be 192.168.1.111, while expecting to receive the package of 200 Bytes data length.
After receiving is finished, the same 200 Bytes package will be sent back.
25 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Supported Products
AX-3, AX-864E30xE2T
Note: AX-332E, AX-864E30xE2T (Library firmware version: 1.0.6.0 or later)
• Library
25 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
DL_EthernetLib.library
Note: From version 1.0.6.0, library DL_ EthernetLib_AX3 is changed to DL_EthernetLib.
25 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
8.3 DFB_UDP_Socket
DFB_UDP_Socket: UDP socket instruction
DFB_UDP_Socket(
bEnable:= ,
RemoteInfo:= ,
bSend:= ,
bRecvRestart:= ,
bBusy=> ,
FB DFB_ UDP_Socket
bSent=> ,
bRcvd=> ,
bError=> ,
ErrorID=> ,
Status=> ,
uiRcvdLen=> );
• Input
Connection information of
SocketInfo udpSocketInfo --
socket
Send data packets.
bSend BOOL True/False (False)
(Rising-edge triggered)
Restart to receive data
bRecvRestart packets*2 BOOL True/False (False)
(Rising-edge triggered)
*1 After the function block is running, it starts receiving data packets. When the data receiving is completed and
stopped, bRcvd would be ON. If you shift bRecvRestart to ON, the FB will restart to receive data.
udpSocketInfo
25 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
*1: The values of uiLPort and uiRPort cannot be 0 at the same time.
*2: UDP data packets are not allowed to be sent when uiRPort is set to 0.
DFB_SOCK_RECV_MODE
Name Description
DFB_SOCK_MODE_NO_RECEVING No receiving data mode.
Specific data length mode:
A specific quantity of data is
received and the receiving task
DFB_SOCK_MODE_SPECIFIC_LENGTH is completed.
The data length can be
specified via uiSetValue.
(Unit: Byte)
Specific end character mode:
The data received ends with a
specific character (1 Byte).
The end character can be
configured via uiSetValue.
DFB_SOCK_MODE_SPECIFIC_SINGLE_CHAR e.g.: If uiSetValue is set to
16#00000D0A, the end
character would be
16#0A.(*1*2)
Specific two end characters
mode:
DFB_SOCK_RECV_MODE_DFB_SOCK_MODE_SPECIFIC_TWO_CHARS The data received ends with
the two specific characters (2
Bytes)
The end character can be
25 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
*1: When the length of received data reaches the limit set in pRecvLen, the receiving task would be completed.
*2: The data length includes both start and end characters.
• Output
DFB_SOCKET_STATUS
25 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
25 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Timing Diagram
• Function
Use the FB instruction (DFB_UDP_Socket) to send or receive UDP data packets.
• Programming Example
This example uses the FB instruction (DFB_UDP_Socket) to send 200 the package of 200 Bytes data length
to the device (IP address: 192.168.1.111, Port: 30001) from UDP (Port: 30000). It is expected that the same
package will be replied. After the device has finished returning the same package, 200 Bytes package will be
resent.
25 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Supported Products
AX-3, AX-864E30xE2T
Note: AX-332E, AX-864E30xE2T (Library firmware version: 1.0.6.0 or later)
• Library
DL_EthernetLib.library
Note: From version 1.0.6.0, library DL_ EthernetLib_AX3 is changed to DL_EthernetLib.
26 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
8.4 DFB_ModbusTCPChannel
DFB_ModbusTCPChannel: Modus TCP slave Channel control instruction
DFB_ModbusTCPChannel(
slave:= ,
bExecute:= ,
bAbort:= ,
DFB_ iChannelIndes:= ,
FB
ModbusTCPChannel bBusy=> ,
bDone=> ,
bError=> ,
bAborted=> ,
ModbusError=> );
• In/ Outs
• Input
INT 0–99
iChannelIndex Channel number
(0)
• Output
DFB_MB_ERROR_CODE DL_MB_ERROR_CODE
ModbusError Error codes
(UNDEFINED)
26 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Timing Diagram
• Function
When the trigger mode of the Modbus slave channel is set to Application, the Modbus TCP request action can
be triggered by DFB_ModbusTCPChannel.
Note1: For more details of Modbus TCP slave configuration, Refer to chapter 9.3 “Ethernet Communication” in
AX-3 Series Operational Manual.
Note 2: While using, the channel must be set to Enable.
Note 3: DFB_ModbusTCPChannel and DFB_ModbusTCPRequest instructions can be used in a maximum of
32 groups at the same time.
• Programming Example
26 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Supported Products
• Library
DL_ModbusTCPMaster.library
Note: From version 1.0.6.0, library DL_ModbusTCPMaster _AX3 is changed to DL_ ModbusTCPMaster.
26 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
8.5 DFB_ModbusTCPRequest
DFB_ModbusTCPRequest: Mobus TCP instruction.
DFB_ModbusTCPRequest(
slave:=
bExecute:= ,
bAbort:= ,
usiUnitID:= ,
ModbusCommand:= ,
DFB_
FB pSendData:= ,
ModbusTCPRequest
pRecvData:= ,
bBusy=> ,
bDone=> ,
bError=> ,
bAborted=> ,
ModbusError=> );
• In/ Outs
• Input
Modbus Command
26 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
Coil: 1–1992
The data length of the
uiReadLen UINT Register: 1–124.
memory to be read.
(1)
Coil: 1–1960
The data length of the
uiWriteLen UINT Register: 1–122.
memory to be written
(1)
• Output
DFB_MB_ERROR_CODE DL_MB_ERROR_CODE
ModbusError Error code
(DFB_UNDEFINED)
26 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Timing Diagram
• Function
The FB instruction (DFB_ModbusTCPRequest) is used for sending Modbus communication data. You must
finish the configuration of Delta_Modbus_TCP_Master and Delta_Modus_TCP_Slave before using this
instruction. (For more details, refer to chapter 9.3 Ethernet Communication in AX-3 Series Operational
Manual.)
• Programming Example
This example uses DFB_ModbusTCPRequest to send standard Modbus command (0x17) for reading a
100-word long data in the slave station (Delta_Modbus_TCP_Slave), which the start address is 0x0000,
and writing a data of 100-word long to the start address 0x0100 in the memory.
26 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Supported Products
• Library
DL_ModbusTCPMaster.library
Note: From version 1.0.6.0, library DL_ModbusTCPMaster _AX3 is changed to DL_ ModbusTCPMaster.
26 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
8.6 DFB_SetIPConfig
DFB_SetIPConfig: Set the controller network configuration.
DFB_SetIPConfig (
bExecute:= ,
byLanPort:= ,
strIPAddress:= ,
strSubMask:= ,
FB DFB_SetIPConfig
strGateway:= ,
bDone=> ,
bBusy=> ,
bError=> ,
eErrorID=>);
• Input
• Output
The running of FB is
bDone BOOL True/False (False)
complete.
DFB_SOCKET_ERROR
eErrorID Error code DFB_SOCKET_ERROR
(DFB_SOCK_NO_ERROR)
26 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
bError
When an error occurs during the running
When bExecute shifts to False
ModbusError or there are incorrect input values
• Timing Diagram
• Function
You can set the network configuration of the AX series controller by DFB_SetIPConfig.
Note 1: If the controller has multiple independent network ports, the ports must be set to different domains,
such as 192.168.1.x and 192.168.2.y.
Note 2: If the AX controller network configuration is set by DFB_SetIPConfig, and the input parameter
strGateway is not set or set to 0.0.0.0, the GateWay setting of the AX controller will be cleared.
Note 3: If Enable Gateway and DNS Setting of the network port does not work, you cannot change the
gateway setting by DFB_SetIPConfig.
• Programming Example
In this example, the FB instruction (DFB_SetIPConfig) sets the IP address of the X1 network port of the
controller to 192.168.1.15.
26 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
• Supported Products
• Library
27 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
DFB_SOCK_ERR
Socket connection refused. Make sure the server configuration is correct.
_CONNREFUSED
DFB_SOCK_ERR Socket has not been Wait for Socket being connected.
NOTCONNECTED connected. Make sure the server configuration is correct.
Invalid setting value for data Make sure the input values of uiSendLen and
DFB_INVALID_LENGTH
length uiRecvLen are correct.
DFB_MASK_ERR Invalid Mask setting Make sure the Mask setting is correct.
DFB_GATEWAY_ERR Invalid Gateway setting Make sure the Gateway setting is correct.
• DFB_MB_ERROR_CODE
DFB_NO_ERROR No errors --
27 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
DFB_SALVE_DEVICE_
Check slave settings and
Slave failure
FAILURE statuses.
DFB_SLAVE_DEVICE_
Slave is busy. N/A
BUSY
Check Gateway
DFB_GATEWAY_PATH_UNAVAILABLE Wrong Gateway path configuration, or Gateway is
busy.
DFB_GATEWAY_DEVICE_FAILED_TO_RESPON Check if the slave wires
Slave device in Gateway
function normally as well as
D fails to respond.
the proper wiring.
Check if the duration
set for the time-out is
less than the
No response from slave in
DFB_RESPONSE_TIMEOUT responded time of
time. slave.
Check on the
correctness of the
wiring.
Illegal data values Check on the correctness of
DFB_RESPONSE_CRC_ERROR responded by slave. (Invalid data format responded by
check code) slave.
27 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
Delta_Modbus_TCP_Maste Check if
DFB_NO_MASTER_CONFIG
r device does not exist. Delta_Modbus_TCP_Maste
27 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 8
27 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
27 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
9.1 DFB_MemoryRead
DFB_MemoryRead: Read a memory card.
DFB_MemoryRead(
bExecute:= ,
FileInfo:= ,
FB DFB_MemoryRead bDone=> ,
bBusy=> ,
bError=> ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
Run the function block.
bExecute BOOL True/False (False)
(Triggered when True)
Parameter setting for
FileInfo DFB_READ_FILE_INFO
reading a file.
DFB_READ_FILE_INFO
27 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
• Output
• Timing Diagram
27 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
• Function
Use the FB instruction (DFB_MemoryRead) to store the retrieved memory card data in the controller’s memory.
• Programming Example
This example uses the FB instruction (DFB_MemoryRead) to read the content of Test.csv file in the memory
card and store the data in the controller’s WORD-type array variable (ar_wVar0).
Read the four consecutive data starting from data 0 in the Test.csv file via the FB instruction(DFB_MemoryRead),
then store the retrieved data in the variable array(ar_wVar0), which the result would be ar_wVar0 := [0,1,2,3].
• Supported Products
AX-3 series
• Library
DL_MemRW_AX3.library
27 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
9.2 DFB_MemoryWrite
DFB_MemoryWrite: Write a memory card.
DFB_MemoryWrite (
bExecute:= ,
FileInfo:= ,
FB DFB_MemoryWrite bDone=> ,
bBusy=> ,
bError=> ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
Run the function block.
bExecute BOOL True/False (False)
(Rising-edge triggered)
Parameter setting for
FileInfo DFB_WRITE_FILE_INFO
reading a file
DFB_WRITE_FILE_INFO
27 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
• Output
28 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
• Timing Diagram
• Function
Write the internal data of the controller to the memory card via the FB instruction (DFB_MemoryWrite).
• Programming Example
This example uses the FB instruction (DFB_MemoryWrite) to write the WORD-type array variable to the memory
card.
Suppose that the written data is ar_wVar0: ARRAY [0..3] OF WORD := [0,1,2,10]. After open the .csv file in the
memory card, the content would be displayed as follows.
28 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
• Supported Products
AX-3 series
• Library
DL_MemRW_AX3.library
28 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
28 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
28 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C h a pt er 9
28 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 0
The instructions in this chapter apply to the built-in DO output of the host, and your can generate PWM signals
through the instructions.
28 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 0
10.1 DFB_PWM
DFB_PWM: DFB_PWM is used to generate Pulse-width modulation output signals which is frequency-adjustable.
FB DFB_PWM
ST Language
DFB_PWM_instance (
bEnable:=,
Pin:=,
Period:=
PeriodUnitType:=,
leDuty:=,
bValid =>,
bBusy =>,
bError =>,
ErrorID =>
);
• Input Pins
Setting Value
Name Function Data Type Effective time
(Default value)
Run the
instruction
True/False
bEnable when bEnable BOOL -
(True)
changes from
False to True.
PWM output 0~7 When bEnable is
Pin DFB_PWM_OUTPUT_PIN
pins number (OUT00) TRUE.
MicroSecond or
PWM period When bEnable is
PeriodUnitType DFB_PWM_PERIOD_UNIT MilliSecond
unit TRUE.
(MicroSecond)
MicroSecond :1~65535
When bEnable is
Period PWM period UINT MilliSecond :1~42949
TRUE.
(1)
Continuously
PWM duty
lrDuty LREAL 0~100 (0) effective when
cycle
bEnable is TRUE.
Note: AX-332E only support scope: 0-3
AX-332E only support scope: MicroSecond: 1000-2000, MilliSecond: 1-20
28 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 0
• Output Pins
• Timing Diagram
bEnable
bValid
bBusy
bError
• Function
Will generate a square wave signals of specified frequency and duty cycle which can be used to control
plant that needs to receive continuously changing physical quantities.
This function only supports output contacts.
Firmware needs to be V1.01.0 or later.
• Troubleshooting
28 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 0
If an error occurs during the running of the instruction, Error will change to True, and the axis motion will stop. Refer
to ErrorID (Error Code) to address the problem.
• Programming Example
This programming example uses 8 sets of PWM output sine wave PWM, and the phase of each set is 45
degrees, which will make OUT LED appear water lamp behavior on the machine. The speed and direction are
determined by the size and sign of "F_SIN_Hz" respectively.
Variable Declaration
VAR CONSTANT
M_PI : LREAL := 3.14159265358979323846;
END_VAR
VAR
F_SIN_Hz : LREAL := 0.3;
T_SIN_ms : LREAL;
tms : UDINT := 0;
i : UINT;
PWM : ARRAY[0..7] OF DFB_PWM;
END_VAR
Program
FOR i := 0 TO 7 BY 1 DO
PWM[i].bEnable := TRUE;
PWM[i].Pin := i;
PWM[i].PeriodUnitType := DFB_PWM_PERIOD_UNIT.MicroSecond; //usec
PWM[i].Period := 100;
PWM[i].lrDuty := 100.0*(0.5*SIN(2*M_PI*tms/T_SIN_ms + i*2*M_PI/8)+0.5);
PWM[i]();
END_FOR
T_SIN_ms := TO_DINT(1000/F_SIN_Hz);
tms := tms + 1;
IF tms >= ABS(T_SIN_ms) THEN
tms := 0;
END_IF
• Supported Products
28 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 0
• Library
DL_BuiltInIO.library
Note: From version 1.0.5.0, library DL_BuiltInIO_AX3 is changed to DL_BuiltInIO.
29 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 0
29 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
29 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
11.1 DFC_LogGetSize
DFC_LogGetSize: Read the size of controller’s log files.
DFC_LogGetSize(
FC DFC_LogGetSize dwLogNum:= ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
0: Calculate the current data size of all log
The number of the
dwLogNum* DWORD files in the controller.
target log files.
(0)
*Note: Data types such as BYTE, WORD and DWORD can be used for dwLogNum input. Currently only supports
mode0.
• Output
• Function
After Runs the function (DFC_LogGetSize), the data size of the current log files will be calculated.
• Programming Example
This example uses the FC instruction (DFC_LogGetSize) to read the data size of the current log files of the
controller.
• Supported Products
29 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
• Library
DL_LogDmp_AX3.library
29 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
11.2 DFB_LogDump
DFB_LogDump: Read the log files of the controller.
DFB_LogDump(
bExecute:= ,
pDmpPos:= ,
dwLogNum:= ,
FB DFB_ LogDump dwDmpLength:= ,
bDone=> ,
bBusy=> ,
bError=> ,
ErrorID=> );
• Input
Setting Value
Name Function Data Type
(Default value)
Run the function block.
bExecute (Triggered by the rising- BOOL True/False (False)
edge)
The memory address for POINTER TO
pDmpPos (0)
controller’s storage BYTE
The number of the target 0: Read all the current log files of the
dwLogNum*1 DWORD
log files to read controller (0)
The size of the target log
dwDmpLength*2 DWORD (0)
files to read
*Note:
1. Data types such as BYTE, WORD, and DWORD can be used for dwLogNum input. Currently only supports
mode0.
2. When the input length of dwDmpLength is greater than the length of the pDmpPos data type, an Exception
error will occur.
• Output
29 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
• Timing Diagram
• Function
Use the FB instruction (DFB_LogDump) to read the log files of the controller.
• Programming Example
This example uses the FB instruction (DFB_LogDump) to read the log files in the PLC and store the files in
Byte array variable (ar_byVar) in the ASCII format.
• Supported Products
• Library
29 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
DL_LogDmp_AX3.library
29 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
• DL_LOGDMP_ERROR
29 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
29 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
• DFB_FTP_CLIENT_ERROR
30 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 11
30 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 2
30 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 2
12.1 SNTPGetUTCTime
SNTPGetUTCTime: Read the current time of the NTP/SNTP server.
SNTPGetUTCTime(
xRun:= ,
sSNTPServer:= ,
sOwnIP:= ,
uiSNTPPort:= ,
uiOwnPort:= ,
udiTimeout:= ,
FB SNTPGetUTCTime
eNTPVersion:= ,
xDone=> ,
xBusy=> ,
xError=> ,
eError=> ,
uliTimestamp=> ,
uliReceiveClientTS=> );
• Input
Setting Value
Name Function Data Type
(Default value)
30 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 2
NTP_VERSION
Name Description
V3 NTPv3
V4 NTPv4
• Output
Setting Value
Name Function Data Type
(Default value)
The FB instruction
xDone BOOL Tr u e / F a l s e (False)
running is completed.
The FB instruction is
xBus y BOOL Tr u e / F a l s e (False)
running.
ERROR
eError Error codes ERROR
(NO_ERR)
• Function
The FB instruction (SNTPGetUTCTime) is used for reading the UTC time of the NTP/SNTP server.
• Programming Example
In this example, the FB instruction reads the the SNTP controller (192.168.1.95) UTC time sets this time to the
controller (when bVar = Ture) via the instruction (SystimeRTCSet).
Note: You can use the FC instruction (SeparateDateTime) of Util.Library to convert the timestamp value of the
NTP/SNTP server to IEC time format to confirm the time of its return.
30 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 2
N o t e : When using this function block, you need to add the library name of the function block. (such as
SNTP.SNTPGetUTCTime).
• Supported Products
• Library
30 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 2
12.2 SNTPServer
SNTPServer: Turn on the SNTP service.
SNTPServer(
xActivate:= ,
uiOwnPort:= ,
FB SNTPServer
sOwnIP:= ,
xError=> ,
eError=> );
• Input
Setting Value
Name Function Data Type
(Default value)
Run the function block.
xActive BOOL True/False (False)
(Rising-edge triggered)
The UDP Port number of
uiOwnPort UINT -
the controller
The IP address of the
sOwnIP STRING (255) (0.0.0.0’)
controller
• Output
Setting Value
Name Function Data Type
(Default value)
ERROR
eError Error Code ERROR
(NO_ERR)
• Function
The FB instruction(NTPServer) is used to start the SNTP server of the controller.
• Programming Example
30 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 2
In this example, the FB instruction (NTPServer) starts the SNTP server function of the controller.
Note: When using this function block, you need to add the library name of the function block.(such as
SNTP.SNTPServer).
• Supported Products
• Library
30 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 2
Name Description
NO_ERROR No errors
30 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 3
30 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 3
13.1 SeparateDateTime
SeparateDateTime: Conver the timestamp to IEC time format.
SeparateDateTi
me(uliDateTime:= ,
SeparateDate
FC eWeekDay=> ,
Time
datDate=> ,
todTime=> )
• Input
Setting Value
Name Function Data Type
(Default value)
The timestamp data ULINT
uiDateTime --
that will be converted (sec)
• Output
Setting Value
Name Function Data Type
(Default value)
eWeekDay The weekday for that date WEEKDAY --
datDate Date (Year:Month:Date) DATE --
todTime Time (Hour:Minute:Second) TOD --
WEEKDAY
Name Description
UNKNOWN --
MONDAY Monday
TUESDAY Tuesday
WEDNESDAY Wednesday
THURSDAY Thursday
FRIDAY Friday
SATURDAY Saturday
SUNDAY Sunday
31 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 3
• Function
The FC instruction (SeparateDateTime) is used to convert the timestamp to the IEC time format.
• Programming Example
In this example, the FC command (SeparateDateTime) converts 86,400,000 ms (1 day) to IEC time, and the
converted date is "1970-1-2" and the time is "00:00:00".
• Supported Products
AX-3 series
• Library
Util.library
311
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 3
31 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 4
31 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 4
14.1 MemCpy
MemCpy: Copy the source address to the destination address.
MemCpy(
pbyDest:= ,
FC MemCpy
pbySrc:= ,
dwSize:= );
• Input
Setting Value
Name Function Data Type
(Default value)
The destination
pbyDest POINTER TO BYTE --
address
pbySrc The source address POINTER TO BYTE --
The length of the data 1–4294967295
dwSize DWORD
to be copied Positive integer (0)
• Function
This FC instruction is used to copy the source address (pSrc) value to the specified destination address
(pDest), and the length of the copied data is determined by the input parameter dwSize (in Byte).
• Programming Example
In this example, MemCpy copies the value of Var_1(pbySrc) to the Var_2 (pbyDest) address, and the copy
length is set to 80 in dwSize.
• Supported Products
31 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 4
AX series
• Libray
MEMUtils.library
31 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 4
14.2 MemSet
MemSet: Set the source address range.
MemSet(
pbyBuffer:= ,
FC MemSet
byValue:= ,
dwSize:= )
• Input
Setting Value
Name Function Data Type
(Default value)
pbyBuffer The destination
POINTER TO BYTE --
address
byValue Value POINTER TO BYTE --
The length of the data 1–4294967295
dwSize DWORD
to be set Positive integer (0)
• Function
After running this instruction, byValue is written to the value set by the destination address (pbyBuffer), and
the length of the address is determined by the input parameter dwSize (in bytes).
• Programming Example
Example 1
Use MemSet to write 0(byValue) to the value set by %MW1000 (pbyBuffer). If the length of the
address is 20, the pbyBuffer range is %MW1000~%MW1009.
31 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 4
Example 2
Use MemSet to write 0(byValue) to the value of Var_1(pbyBuffer). The length of the input is
determined by dwSize, and the Array size can be obtained by SIZEOF(Var_1).
• Supported Products
AX series
• Libray
MEMUtils.library
31 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 4
Name Description
NO_ERROR No errors
31 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 5
31 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 5
15.1 SysTimeRtcHighResGet
SysTimeRtcHighResGet: Get the UTC time of the controller.
FC SysTimeRtcHighResGet
ST Language
SysTimeRtcHighResGet(
pTimestamp:=
);
• Input
Setting Value
Name Function Data Type
(Default value)
pTimestamp System time SYSTIME --
SysTimeRtcHighResGet Error code RTS_IEC_RESULT --
• Function
This function is supported in AX-3 series (except for AX-332) controllers with device description version
1.0.4.0 and later.
After running this instruction, the UTC time in the controller is obtained, and then output to the
pTimestamp parameter.
• Programming Example
32 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 5
Use SysTimeRtcHighResGet to output the controller's time to the SysTime variable via pTimestamp.
• Supported Products
AX series
• Libray
SysTimeRtc.library
32 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 5
15.2 SysTimeRtcConvertHighResToDate
SysTimeRtcConvertHighResToDate: Convert the time obtained by SysTimeRtcHighResGet to date info.
FC SysTimeRtcConvertHighResToDate
ST Language
SysTimeRtcConvertHighResToDate(
pTimestamp:= ,
pDate:=
);
• Input
Setting Value
Name Function Data Type
(Default value)
pTimestamp PLC system time SYSTIME --
pDate Date info SYSTIMEDATE --
SysTimeRtcHighResGet Error code RTS_IEC_RESULT --
• Function
When this instruction is running, the controller time obtained by SysTimeRtcHighResGet can be parsed
into date info and output to the pDate parameter.
• Programming Example
Use SysTimeRtcConvertHighResToDate to parse the controller time obtained by SysTimeRtcHighResGet into
date info, and pDate is output to TimeVar.
32 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 5
• Supported Products
AX series
• Libray
SysTimeRtc.library
32 3
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 5
Name Description
NO_ERROR No errors
32 4
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
32 5
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
16.1 DFC_GetPLCErrorID
DFC_GetPLCErrorID: Get the errors of the current controller itself.
FC DFC_GetPLCErrorID
ST Language
DFC_GetPLCErrorID (
);
• Input
Setting Value
Name Function Data Type
(Default value)
Read the current error
DFB_GetPLCErrorID DWORD 0–65535
ID of the PLC.
• Function
This function reads the 16#140E~16#2203 errors of PLC, refer to AX-3 Series Operation Manual A.2
Troubleshooting of CPU Modules for details.
• Programming Example
Use DFC_GetPLCErrorID to read the error ID of the system error.
• Supported Products
32 6
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
• Libray
DL_SysInfo.library
32 7
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
16.2 DFC_ReadBatteryLowStatus
DFC_ReadBatteryLowStatus: Get the current battery status.
FC DFC_ReadBatteryLowStatus
ST Language
DFC_ReadBatteryLowStatus (
);
• Input
Setting Value
Name Function Data Type
(Default value)
Read the current
DFC_
battery status of the DWORD 0–1 (0)
ReadBatteryLowStatus
PLC.
• Function
This function gets whether the system battery status is in low voltage.
0 indicates that the battery is normal.
1 indicates that the battery is abnormal.
• Programming Example
Use DFC_ReadBatteryLowStatus to read whether the system battery status is normal.
• Supported Products
32 8
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
• Libray
DL_SysInfo.library
32 9
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
16.3 DFB_HWInfo
DFB_HWInfo: Get the hardware information of the current PLC.
FB DFB_HWInfo
ST Language
DFB_HWInfo(
bEnable:= ,
bValid=> ,
bBusy=> ,
dwErrorID=> ,
hwinfo=>
);
• Input
Setting Value
Name Function Data Type
(Default value)
Start the FB. True/False
bEnable BOOL
(False)
• Output
Setting Value
Name Function Data Type
(Default value)
True when the parameter to be
bValid BOOL True/False (False)
read is correct
True when the instruction is
bBusy BOOL True/False (False)
running
When an error occurs, the error DFB_HWINFO_ERROR
dwErrorID DFB_HWINFO_ERROR
code is recorded. (DFB_NO_ERROR)
hwinfo System hardware information AX_HWINFO AX_HWINFO*
Note: AX_HWINFO : Struct
AX-332
Name Function Data Type Unit AX-3 AX-5 AX-C
AX-8
Time of the
strBootTime system that has STRING(31) s V V V V
been running
33 0
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
AX-332
Name Function Data Type Unit AX-3 AX-5 AX-C
AX-8
on the current
power-up
Array [0..7]
strCPUFrequency CPU frequency OF MHz V V V V
STRING(11)
CPU Array [0..7]
iCPUTemperature °C V V V
temperature OF INT
Array [0..7]
byCPUUsage CPU usage rate % V V V V
OF BYTE
Launch Array [0..7]
bIsDHCP_GLAN - V V
DHCP_GLAN OF BOOL
CPU memory
wMemSize WORD MB V V V
size
CPU memory
byMemUsage BYTE % V V V
usage
strProductName Product name STRING(31) - V V V V
Product serial
strSerialNumber STRING(31) - V V V V
number
Array [0..3]
strSDPath Micor SD path OF - V V V V
STRING(31)
Array [0..7]
strUDiskPath USB path OF - V V
STRING(31)
• Function
This function gets information about the controller.
• Programming Example
Use DFB_HWInfo to get information about the controller.
33 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
• Supported Products
• Libray
DL_SysInfo.library
33 2
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l C ha pt er 1 6
Name Description
NO_ERROR No errors
33 3
Industrial Automation Headquarters
Delta Electronics, Inc.
Taoyuan Technology Center
No.18, Xinglong Rd., Taoyuan District,
Taoyuan City 330477, Taiwan
TEL: +886-3-362-6301 / FAX: +886-3-371-6301
Asia EMEA
Delta Electronics (Shanghai) Co., Ltd. Delta Electronics (Netherlands) B.V.
No.182 Minyu Rd., Pudong Shanghai, P.R.C. Sales: [email protected]
Post code : 201209 Marketing: [email protected]
TEL: +86-21-6872-3988 / FAX: +86-21-6872-3996 Technical Support: [email protected]
Customer Service: 400-820-9595 Customer Support: [email protected]
Service: [email protected]
Delta Electronics (Japan), Inc. TEL: +31(0)40 800 3900
Industrial Automation Sales Department
2-1-14 Shibadaimon, Minato-ku Delta Electronics (Netherlands) B.V.
Tokyo, Japan 105-0012 Automotive Campus 260, 5708 JZ Helmond, The Netherlands
TEL: +81-3-5733-1155 / FAX: +81-3-5733-1255 Mail: [email protected]
TEL: +31(0)40 800 3900
Delta Electronics (Korea), Inc. Delta Electronics (Netherlands) B.V.
1511, 219, Gasan Digital 1-Ro., Geumcheon-gu,
Coesterweg 45, D-59494 Soest, Germany
Seoul, 08501 South Korea
Mail: [email protected]
TEL: +82-2-515-5305 / FAX: +82-2-515-5302
TEL: +49 2921 987 238
Delta Energy Systems (Singapore) Pte Ltd. Delta Electronics (France) S.A.
4 Kaki Bukit Avenue 1, #05-04, Singapore 417939 ZI du bois Challand 2, 15 rue des Pyrénées,
TEL: +65-6747-5155 / FAX: +65-6744-9228 Lisses, 91090 Evry Cedex, France
Mail: [email protected]
Delta Electronics (India) Pvt. Ltd. TEL: +33(0)1 69 77 82 60
Plot No.43, Sector 35, HSIIDC Gurgaon,
PIN 122001, Haryana, India Delta Electronics Solutions (Spain) S.L.U
TEL: +91-124-4874900 / FAX: +91-124-4874945 Ctra. De Villaverde a Vallecas, 265 1º Dcha Ed.
Hormigueras – P.I. de Vallecas 28031 Madrid
Delta Electronics (Thailand) PCL. TEL: +34(0)91 223 74 20
909 Soi 9, Moo 4, Bangpoo Industrial Estate (E.P.Z), Carrer Llacuna 166, 08018 Barcelona, Spain
Pattana 1 Rd., T.Phraksa, A.Muang, Mail: [email protected]
Samutprakarn 10280, Thailand Digitized Automation for a Changing World
TEL: +66-2709-2800 / FAX: +66-2709-2827 Delta Electronics (Italy) S.r.l.
Via Meda 2–22060 Novedrate(CO)
Delta Electronics (Australia) Pty Ltd.
Unit 2, Building A, 18-24 Ricketts Road,
Mount Waverley, Victoria 3149 Australia
Piazza Grazioli 18 00186 Roma Italy
Mail: [email protected]
TEL: +39 039 8900365
DIADesigner - AX Series Standard
Instructions Manual
Mail: [email protected]
Delta Energy System LLC
TEL: +61-1300-335-823 / +61-3-9543-3720
Vereyskaya Plaza II, office 112 Vereyskaya str.
17 121357 Moscow Russia
Americas Mail: [email protected]
TEL: +7 495 644 3240
Delta Electronics (Americas) Ltd.
5101 Davis Drive, Research Triangle Park, NC 27709, U.S.A. Delta Greentech Elektronik San. Ltd. Sti. (Turkey)
TEL: +1-919-767-3813 / FAX: +1-919-767-3969 Şerifali Mah. Hendem Cad. Kule Sok. No:16-A
34775 Ümraniye – İstanbul
Delta Electronics Brazil Ltd. Mail: [email protected]
Estrada Velha Rio-São Paulo, 5300 Eugênio de TEL: + 90 216 499 9910
Melo - São José dos Campos CEP: 12247-004 - SP - Brazil
TEL: +55-12-3932-2300 / FAX: +55-12-3932-237 Eltek Dubai (Eltek MEA DMCC)
OFFICE 2504, 25th Floor, Saba Tower 1,
Delta Electronics International Mexico S.A. de C.V. Jumeirah Lakes Towers, Dubai, UAE
Gustavo Baz No. 309 Edificio E PB 103 Mail: [email protected]
Colonia La Loma, CP 54060 TEL: +971(0)4 2690148
Tlalnepantla, Estado de México
TEL: +52-55-3603-9200
*We reserve the right to change the information in this manual without prior notice. DIAS-Manual-0025-EN
2023/05/11 www.deltaww.com