Delta EtherCAT Operating instructions

www.deltaww.com
Delta EtherCAT
Programming Guide
Industrial Automation Headquarters
Delta Electronics, Inc.
Taoyuan Technology Center
No.18, Xinglong Rd., Taoyuan City,
Taoyuan County 33068, Taiwan
TEL: 886-3-362-6301 / FAX: 886-3-371-6301
Asia
Delta Electronics (Jiangsu) Ltd.
Wujiang Plant 3
1688 Jiangxing East Road,
Wujiang Economic Development Zone
Wujiang City, Jiang Su Province, P.R.C. 215200
TEL: 86-512-6340-3008 / FAX: 86-769-6340-7290
Delta Greentech (China) Co., Ltd.
238 Min-Xia Road, Pudong District,
ShangHai, P.R.C. 201209
TEL: 86-21-58635678 / FAX: 86-21-58630003
Delta Electronics (Japan), Inc.
Tokyo Ofce
2-1-14 Minato-ku Shibadaimon,
Tokyo 105-0012, Japan
TEL: 81-3-5733-1111 / FAX: 81-3-5733-1211
Delta Electronics (Korea), Inc.
1511, Byucksan Digital Valley 6-cha, Gasan-dong,
Geumcheon-gu, Seoul, Korea, 153-704
TEL: 82-2-515-5303 / FAX: 82-2-515-5302
Delta Electronics Int’l (S) Pte Ltd.
4 Kaki Bukit Ave 1, #05-05, Singapore 417939
TEL: 65-6747-5155 / FAX: 65-6744-9228
Delta Electronics (India) Pvt. Ltd.
Plot No 43 Sector 35, HSIIDC
Gurgaon, PIN 122001, Haryana, India
TEL : 91-124-4874900 / FAX : 91-124-4874945
Americas
Delta Products Corporation (USA)
Raleigh Ofce
P.O. Box 12173,5101 Davis Drive,
Research Triangle Park, NC 27709, U.S.A.
TEL: 1-919-767-3800 / FAX: 1-919-767-8080
Delta Greentech (Brasil) S.A.
Sao Paulo Ofce
Rua Itapeva, 26 - 3° andar Edicio Itapeva One-Bela Vista
01332-000-São Paulo-SP-Brazil
TEL: 55 11 3568-3855 / FAX: 55 11 3568-3865
Europe
Delta Electronics (Netherlands) B.V.
Eindhoven Ofce
De Witbogt 20, 5652 AG Eindhoven, The Netherlands
TEL : +31 (0)40-8003800 / FAX : +31 (0)40-8003898
*We reserve the right to change the information in this manual without prior notice.
Delta EtherCAT Programming Guide

March, 2017
Table of Contents
IntroductiontoAPILibrary
1.1 How to use function libraries? ···············································································1-2
1.2 Start a new project······························································································1-2
1.2.1 Using VC······································································································1-2
1.2.2 Using VB······································································································1-2
1.2.3 Using VB.Net ································································································1-2
1.2.4 Using C#······································································································1-3
EtherCATIntroduction
2.1 Maximum number of the slave device·····································································2-2
2.2 Initialize RTX runtime environment·········································································2-3
2.3 Introduction to RTSS Task Manager ·······································································2-4
EtherCATOperationExample
3.1 EtherCAT Initialization ·························································································3-3
3.1.1 Function list ··································································································3-3
3.1.2 Application examples······················································································3-3
3.2 Motion control of homing······················································································3-6
3.2.1 Function list ··································································································3-6
3.2.2 Application examples······················································································3-6
3.3 Torque control····································································································3-9
3.3.1 Function list ··································································································3-9
3.3.2 Application examples······················································································3-9
3.4 Constant speed control······················································································3-12
3.4.1 Function list ································································································3-12
3.4.2 Application examples····················································································3-12
3.5 Motion control in PP mode··················································································3-16
3.5.1 Function list ································································································3-16
3.5.2 Application examples····················································································3-16
3.6 Motion control in CSP mode ···············································································3-20
3.6.1 Function list ································································································3-20
3.6.2 Application examples····················································································3-21
3.7 EtherCAT Slave IO control (digital input)································································3-38

March, 2017
3.7.1 Function list ································································································3-38
3.7.2 Application examples····················································································3-38
3.8 EtherCAT Slave IO control (digital output)······························································3-40
3.8.1 Function list ································································································3-40
3.8.2 Application examples····················································································3-40
3.9 Application of EtherCAT analog input module (R1-EC-8124)······································3-42
3.9.1 Function list ································································································3-42
3.9.2 Application examples····················································································3-42
3.10 Application of EtherCAT analog output module (R1-EC-9144)···································3-44
3.10.1 Function list·······························································································3-44
3.10.2 Application examples···················································································3-44
3.11 Application of EtherCAT Compare function for PCI card (PCI-L221-B1)·······················3-47
3.11.1 Function list·······························································································3-47
3.11.2 Application examples···················································································3-48
API List of Dynamic-Link Library
4.1 Data Type and Setting Range ···············································································4-2
4.2 API list and descriptions·······················································································4-2
EtherCATMasterConfiguration
5.1 _ECAT_Master_Set_CycleTime·············································································5-3
5.2 _ECAT_Master_Get_CycleTime ············································································5-4
5.3 _ECAT_Master_NodeID_Alias_Enable····································································5-5
5.4 _ECAT_Get_SerialNo··························································································5-6
5.5 _ECAT_Master_Get_DLL_SeqID···········································································5-7
5.6 _ECAT_Autoconfig_Open_File··············································································5-8
5.7 _ECAT_Autoconfig_Save_File ··············································································5-9
5.8 _ECAT_Autoconfig_Set_Slave_DCTime································································5-10
5.9 _EACT_Autoconfig_Clear_ConfigFile ··································································· 5-11
5.10 _ECAT_Autoconfig_Set_NodeID_Alias································································5-12
5.11 _ECAT_Autoconfig_Get_NodeID_Alias································································5-14
5.12 _ECAT_Autoconfig_Save_NodeID_Alias ·····························································5-15
MasterInitialization
6.1 _ECAT_Master_Open ·························································································6-3
6.2 _ECAT_Master_Initial··························································································6-4
6.3 _ECAT_Master_Reset·························································································6-5
6.4 _ECAT_Master_Close·························································································6-6
6.5 _ECAT_Master_Get_CardSeq ··············································································6-7

March, 2017
6.6 _ECAT_Master_Get_SlaveNum ············································································6-8
6.7 _ECAT_Master_Get_Slave_Info············································································6-9
6.8 _ECAT_Master_Get_DC_Status·········································································· 6-11
6.9 _ECAT_Master_Get_Connect_Status···································································6-12
6.10 _ECAT_Master_Get_Api_BufferLength································································6-13
6.11 _ECAT_Master_Get_Cycle_SpendTime·······························································6-14
6.12 _ECAT_Master_Check_Initial_Done ···································································6-15
6.13 _ECAT_Master_Get_Initial_ErrorCode ································································6-16
6.14 _ECAT_Master_Check_Working_Counter····························································6-17
6.15 _ECAT_Master_Get_Return_Code_Message·······················································6-18
EtherCAT CoE Standard Communication
7.1 _ECAT_Slave_SDO_Send_Message ·····································································7-3
7.2 _ECAT_Slave_SDO_Read_Message ·····································································7-4
7.3 _ECAT_Slave_SDO_Quick_Send_Message ····························································7-5
7.4 _ECAT_Slave_SDO_Quick_Read_Message····························································7-6
7.5 _ECAT_Slave_SDO_Read_Response····································································7-7
7.6 _ECAT_Slave_SDO_Wait_All_Done·······································································7-8
7.7 _ECAT_Slave_SDO_Get_ErrorCode······································································7-9
7.8 _ECAT_Slave_SDO_Check_Done······································································· 7-11
7.9 _ECAT_Slave_PDO_Get_OD_Data ·····································································7-12
7.10 _ECAT_Slave_PDO_Set_OD_Data····································································7-13
7.11 _ECAT_Slave_PDO_Get_Information ·································································7-14
7.12 _ECAT_Slave_PDO_Get_Detail_Mapping ···························································7-15
7.13 _ECAT_Slave_PDO_Get_Rx_Data ····································································7-16
7.14 _ECAT_Slave_PDO_Get_Tx_Data·····································································7-17
7.15 _ECAT_Slave_PDO_Set_Tx_Data ·····································································7-18
7.16 _ECAT_Slave_PDO_Set_Tx_Detail_Data····························································7-19
General Operation of Motion Axis
8.1 _ECAT_Slave_Motion_Set_Svon···········································································8-3
8.2 _ECAT_Slave_Motion_Ralm·················································································8-4
8.3 _ECAT_Slave_Motion_Sd_Stop ············································································8-5
8.4 _ECAT_Slave_Motion_Emg_Stop··········································································8-6
8.5 _ECAT_Slave_Motion_Set_Alm_Reaction·······························································8-7
8.6 _ECAT_Slave_Motion_Set_Position·······································································8-8
8.7 _ECAT_Slave_Motion_Set_Command····································································8-9
8.8 _ECAT_Slave_Motion_Set_MoveMode ··················································8-10
8.9 _ECAT_Slave_Motion_Get_MoveMode·································································8-11
8.10 _ECAT_Slave_Motion_Get_ControlWord·····························································8-12

March, 2017
8.11 _ECAT_Slave_Motion_Get_StatusWord ······························································8-14
8.12 _ECAT_Slave_Motion_Get_Mdone ····································································8-16
8.13 _ECAT_Slave_Motion_Get_Position···································································8-17
8.14 _ECAT_Slave_Motion_Get_Command································································8-18
8.15 _ECAT_Slave_Motion_Get_Target_Command······················································8-19
8.16 _ECAT_Slave_Motion_Get_Actual_Position·························································8-20
8.17 _ECAT_Slave_Motion_Get_Actual_Command······················································8-21
8.18 _ECAT_Slave_Motion_Get_Current_Speed ·························································8-22
8.19 _ECAT_Slave_Motion_Get_Torque ····································································8-23
8.20 _ECAT_Slave_Motion_Get_Buffer_Length···························································8-24
8.21 _ECAT_Slave_Motion_Set_TouchProbe_Config····················································8-25
8.22 _ECAT_Slave_Motion_Set_TouchProbe_QuickStart ··············································8-28
8.23 _ECAT_Slave_Motion_Set_TouchProbe_QuickDone··············································8-30
8.24 _ECAT_Slave_Motion_Set_TouchProbe_Disable ··················································8-32
8.25 _ECAT_Slave_Motion_Get_TouchProbe_Status····················································8-33
8.26 _ECAT_Slave_Motion_Get_TouchProbe_Position ·················································8-35
Cyclic Synchronous Position Mode (CSP)
9.1 _ECAT_Slave_CSP_Start_Move········································································ 9-5
9.2 _ECAT_Slave_CSP_Start_V_Move ·····································································9-7
9.3 _ECAT_Slave_CSP_Start_Arc_Move···································································9-8
9.4 _ECAT_Slave_CSP_Start_Arc2_Move ·······························································9-10
9.5 _ECAT_Slave_CSP_Start_Arc3_Move ·······························································9-12
9.6 _ECAT_Slave_CSP_Start_Spiral_Move······························································9-14
9.7 _ECAT_Slave_CSP_Start_Spiral2_Move ····························································9-15
9.8 _ECAT_Slave_CSP_Start_Sphere_Move····························································9-17
9.9 _ECAT_Slave_CSP_Start_Heli_Move ································································9-18
9.10 _ECAT_Slave_CSP_Start_Multiaxes_Move ·························································9-20
9.11 _ECAT_Slave_CSP_Start_Msbrline_Move···························································9-21
9.12 _ECAT_Slave_CSP_Set_Gear··········································································9-25
9.13 _ECAT_Slave_CSP_Set_Softlimit······································································9-26
9.14 _ECAT_Slave_CSP_TargetPos_Change ·····························································9-27
9.15 _ECAT_Slave_CSP_Velocity_Change ································································9-28
9.16 _ECAT_Slave_CSP_Feedrate_Overwrite·····························································9-29
9.17 _ECAT_Slave_CSP_Speed_Continue_Enable······················································9-33
9.18 _ECAT_Slave_CSP_Speed_Continue_Set_Mode ·················································9-34
9.19 _ECAT_Slave_CSP_Speed_Continue_Set_Combine_ Ratio····································9-37
9.20 _ECAT_Slave_CSP_Scurve_Rate······································································9-38
9.21 _ECAT_Slave_CSP_Liner_Speed_Master ···························································9-39
9.22 _ECAT_Slave_CSP_Mask_Axis ········································································9-41

March, 2017
9.23 _ECAT_Slave_CSP_Sync_Config······································································9-42
9.24 _ECAT_Slave_CSP_Sync_Move ·······································································9-43
9.25 _ECAT_Slave_CSP_Start_Mabrline_Move···························································9-44
9.26 _ECAT_Slave_CSP_Start_2Segment_Move ························································9-46
9.27 _ECAT_Slave_CSP_Start_PVT_Move ································································9-48
9.28 _ECAT_Slave_CSP_Start_PVTComplete_Move ···················································9-50
9.29 _ECAT_Slave_CSP_Virtual_Set_Enable ·····························································9-52
9.30 _ECAT_Slave_CSP_Virtual_Set_Command·························································9-53
9.31 _ECAT_Slave_CSP_Get_SoftLimit_Status···························································9-54
9.32 _ECAT_Slave_CSP_Pitch_Set_Interval·······························································9-55
9.33 _ECAT_Slave_CSP_Pitch_Set_Mode·································································9-56
9.34 _ECAT_Slave_CSP_Pitch_Set_Org ···································································9-57
9.35 _ECAT_Slave_CSP_Pitch_Set_Rel_Table ···························································9-58
9.36 _ECAT_Slave_CSP_Pitch_Set_Abs_Table···························································9-59
9.37 _ECAT_Slave_CSP_Pitch_Set_Enable ·······························································9-60
Cyclic Synchronous Velocity Mode (CSV)
10.1 _ECAT_Slave_CSV_Start_Move········································································10-2
10.2 _ECAT_Slave_CSV_Multi_Start_Move································································10-3
Cyclic Synchronous Torque Mode (CST)
11.1 _ECAT_Slave_CST_Start_Move········································································11-2
11.2 _ECAT_Slave_CST_Multi_Start_Move································································ 11-3
Homing
12.1 _ECAT_Slave_Home_Config ············································································12-3
12.2 _ECAT_Slave_Home_Move············································································ 12-19
12.3 _ECAT_Slave_Home_Status··········································································· 12-20
EtherCAT Profile Position Mode (PP)
13.1 _ECAT_Slave_PP_Start_Move··········································································13-3
13.2 _ECAT_Slave_PP_Advance_Config ···································································13-4
EtherCAT Profile Velocity Mode (PV)
14.1 _ECAT_Slave_PV_Start_Move··········································································14-3
14.2 _ECAT_Slave_PV_Advance_Config ···································································14-4

March, 2017
InverterMotionControl
15.1 _ECAT_Slave_VL_Start_Move··········································································15-2
EtherCAT Profile Torque Mode (PT)
16.1 _ECAT_Slave_PT_Start_Move··········································································16-3
16.2 _ECAT_Slave_PT_Advance_Config ···································································16-4
GroupMotionControl
17.1 _ECAT_Slave_User_Motion_Control_Set _Enable_Mode········································17-3
17.2 _ECAT_Slave_User_Motion_Control_Get_Enable_Mode········································17-5
17.3 _ECAT_Slave_User_Motion_Control_Set_Type ····················································17-6
17.4 _ECAT_Slave_User_Motion_Control_Set_Data ····················································17-8
17.5 _ECAT_Slave_User_Motion_Control_Clear_Data··················································17-9
17.6 _ECAT_Slave_User_Motion_Control_Get_DataCnt ············································· 17-10
17.7 _ECAT_Slave_User_Motion_Control_Ralm························································ 17-11
17.8 _ECAT_Slave_User_Motion_Control_Svon························································ 17-12
17.9 _ECAT_Slave_User_Motion_Control_Get_Alm ··················································· 17-13
OperationofDI/DOModule
18.1 _ECAT_Slave_DIO_Get_Input_Value··································································18-3
18.2 _ECAT_Slave_DIO_Get_Output_Value ·······························································18-4
18.3 _ECAT_Slave_DIO_Set_Output_Value································································18-5
18.4 _ECAT_Slave_DIO_Get_Single_Input_Value························································18-6
18.5 _ECAT_Slave_DIO_Get_Single_Output_Value ·····················································18-7
18.6 _ECAT_Slave_DIO_Set_Single_Output_Value······················································18-8
18.7 _ECAT_Slave_DIO_Set_Output_Error_Mode ·······················································18-9
18.8 _ECAT_Slave_DIO_Set_Output_Error_Value ····················································· 18-10
OperationofAI/AOModule
19.1 _ECAT_Slave_AIO_Get_Input_Value··································································19-3
19.2 _ECAT_Slave_AIO_Set_Output_Value································································19-4
19.3 _ECAT_Slave_AIO_Get_Output_Value ·······························································19-5
Operation of Pulse Module (For R1-EC5621D0 Series)
20.1 _ECAT_Slave_R1_EC5621_Set_Output_Mode·····················································20-3
20.2 _ECAT_Slave_R1_EC5621_Set_Input_Mode·······················································20-4
20.3 _ECAT_Slave_R1_EC5621_Set_ORG_Inverse ····················································20-5
20.4 _ECAT_Slave_R1_EC5621_Set_QZ_Inverse·······················································20-6

March, 2017
20.5 _ECAT_Slave_R1_EC5621_Set_Home_SpMode··················································20-7
20.6 _ECAT_Slave_R1_EC5621_Set_MEL_Inverse·····················································20-8
20.7 _ECAT_Slave_R1_EC5621_Set_PEL_Inverse······················································20-9
20.8 _ECAT_Slave_R1_EC5621_Set_Svon_Inverse ·················································· 20-10
20.9 _ECAT_Slave_R1_EC5621_Set_Home _Slow_Down ·········································· 20-11
20.10 _ECAT_Slave_R1_EC5621_Get_IO_Status ····················································· 20-12
20.11 _ECAT_Slave_R1_EC5621_Get_Single_IO_Status············································ 20-13
Operation of Pulse Module (ForR1-ECx62xD0Series)
21.1 _ECAT_Slave_R1_ECx62x_Set_Output_Mode·····················································21-3
21.2 _ECAT_Slave_R1_ECx62x_Set_Input_Mode ·······················································21-4
21.3 _ECAT_Slave_R1_ECx62x_Set_ORG_Inverse·····················································21-5
21.4 _ECAT_Slave_R1_ECx62x_Set_QZ_Inverse ·······················································21-6
21.5 _ECAT_Slave_R1_ECx62x_Set_Home_SpMode ··················································21-7
21.6 _ECAT_Slave_R1_ECx62x_Set_MEL_Inverse ·····················································21-8
21.7 _ECAT_Slave_R1_ECx62x_Set_PEL_Inverse······················································21-9
21.8 _ECAT_Slave_R1_ECx62x_Set_Svon_Inverse··················································· 21-10
21.9 _ECAT_Slave_R1_ECx62x_Set_Home_Slow_Down············································ 21-11
21.10 _ECAT_Slave_R1_ECx62x_Get_IO_Status······················································ 21-12
21.11 _ECAT_Slave_R1_ECx62x_Get_Single_IO_Status············································ 21-13
Operation of Delta Servo System
22.1 _ECAT_Slave_DeltaServo_Write_Parameter························································22-3
22.2 _ECAT_Slave_DeltaServo_Read_Parameter························································22-4
22.3 _ECAT_Slave_DeltaServo_Read_Parameter_Info·················································22-5
22.4 _ECAT_Slave_DeltaServo_Set_Velocity_Limit······················································22-6
22.5 _ECAT_Slave_DeltaServo_Set_Compare_Enable·················································22-7
22.6 _ECAT_Slave_DeltaServo_Get_Compare_Enable·················································22-8
22.7 _ECAT_Slave_DeltaServo_Set_Compare_Config··················································22-9
Analog Input Settings (For R1-EC8124D0)
23.1 _ECAT_Slave_R1_EC8124_Set_Input _RangeMode ·············································23-3
23.2 _ECAT_Slave_R1_EC8124_Set_Input _ConvstFreq_Mode·····································23-4
23.3 _ECAT_Slave_R1_EC8124_Set_Input_Enable·····················································23-5
23.4 _ECAT_Slave_R1_EC8124_Get_Input _RangeMode·············································23-6
23.5 _ECAT_Slave_R1_EC8124_Set_Input _AverageMode···········································23-7
AnalogOutputSettings(ForR1-EC9144D0Series)
24.1 _ECAT_Slave_R1_EC9144_Set_Output _RangeMode···········································24-3

March, 2017
24.2 _ECAT_Slave_R1_EC9144_Set_Output_Enable···················································24-4
24.3 _ECAT_Slave_R1_EC9144_Get_Output _ReturnCode···········································24-5
Auto Recording Function ofMotionAxis
25.1 _ECAT_Slave_Record_Set_Type·······································································25-3
25.2 _ECAT_Slave_Record_Set_Enable····································································25-4
25.3 _ECAT_Slave_Record_Get_Cnt ········································································25-5
25.4 _ECAT_Slave_Record_Read_Data ····································································25-6
25.5 _ECAT_Slave_Record_Clear_Data ····································································25-7
25.6 _ECAT_Slave_Record_Multi_Set_Enable····························································25-8
25.7 _ECAT_Slave_Record_Multi_Clear_Data ····························································25-9
OperationofLocalDigitalI/O
26.1 _ECAT_GPIO_Set_Output················································································26-3
26.2 _ECAT_GPIO_Get_Output ···············································································26-4
26.3 _ECAT_GPIO_Get_Input··················································································26-5
High-Speed Pulse Compare Function
27.1 _ECAT_Compare_Set_Channel_Position ····························································27-4
27.2 _ECAT_Compare_Get_Channel_Position····························································27-5
27.3 _ECAT_Compare_Set_Ipulser_Mode··································································27-6
27.4 _ECAT_Compare_Set_Channel_Direction ···························································27-7
27.5 _ECAT_Compare_Set_Channel_Trigger_Time ·····················································27-8
27.6 _ECAT_Compare_Set_Channel_One_Shot··························································27-9
27.7 _ECAT_Compare_Set_Channel_Source···························································· 27-10
27.8 _ECAT_Compare_Set_Channel_Enable···························································· 27-11
27.9 _ECAT_Compare_Channel0_Position······························································· 27-12
27.10 _ECAT_Compare_Set_Channel0_Trigger _By_GPIO ········································· 27-13
27.11 _ECAT_Compare_Set_Channel1_Output_Enable·············································· 27-14
27.12 _ECAT_Compare_Set_Channel1_Output_Mode················································ 27-15
27.13 _ECAT_Compare_Get_Channel1_IO_Status···················································· 27-17
27.14 _ECAT_Compare_Set_Channel1_GPIO_Out···················································· 27-18
27.15 _ECAT_Compare_Set_Channel1_Position_Table ·············································· 27-19
27.16 _ECAT_Compare_Set_Channel1_Position _Table_Level····································· 27-21
27.17 _ECAT_Compare_Get_Channel1_Position _Table_Count···································· 27-24
27.18 _ECAT_Compare_Set_Channel_Polarity ························································· 27-25
27.19 _ECAT_Compare_Reuse_Channel1_Position _Table ········································· 27-26
27.20 _ECAT_Compare_Reuse_Channel1_Position _Table_Level································· 27-27

March, 2017
Information of EtherCAT Dynamic-Link Library (DLL)
28.1 _ECAT_Master_Get_DLL_Path ·········································································28-2
28.2 _ECAT_Master_Get_DLL_Version ·····································································28-3
28.3 _ECAT_Master_Get_DLL_Path_Single ·······························································28-4
28.4 _ECAT_Master_Get_DLL_Version_Single····························································28-5
Security of Software Protection
29.1 _ECAT_Security_Check_Verifykey ·····································································29-2
29.2 _ECAT_Security_Get_Check_Verifykey_State······················································29-3
29.3 _ECAT_Security_Write_Verifykey·······································································29-4
29.4 _ECAT_Security_Get_Write_Verifykey_State························································29-5
29.5 _ECAT_Security_Check_UserPassword······························································29-6
29.6 _ECAT_Security_Get_Check_UserPassword _State··············································29-7
29.7 _ECAT_Security_Write_UserPassword ·······························································29-8
29.8 _ECAT_Security_Get_Write_UserPassword_State ················································29-9
OperatingMRAMonPAC
30.1 _ECAT_Master_MRAM_Write_Word_Data···························································30-2
30.2 _ECAT_Master_MRAM_Read_Word_Data ··························································30-3
30.3 _ECAT_Master_MRAM_Write_DWord_Data·························································30-4
30.4 _ECAT_Master_MRAM_Read_DWord_Data ························································30-5
Retentive Digital Output of the Module (For 70E2 Series)
31.1 _ECAT_Slave_R1_EC70E2_Set_Output_Enable ··················································31-2
Retentive Digital Output of the Module (For 70X2 Series)
32.1 _ECAT_Slave_R1_EC70X2_Set_Output_Enable ··················································32-2
MPG Operation (For R1-EC5614D0 Series)
33.1 _ECAT_Slave_R1_EC5614_Set_MJ_Config ························································33-3
33.2 _ECAT_Slave_R1_EC5614_Set_MJ_Enable························································33-5
33.3 _ECAT_Slave_R1_EC5614_Get_IO_Status·························································33-6
33.4 _ECAT_Slave_R1_EC5614_Get_MPG_Counter ···················································33-7
Error Code Description
34.1 List of error code ····························································································34-2
34.2 Error code description···················································································· 34-10

March, 2017
(This page is intentionally left blank.)

March, 2017 1-1
Introduction to
API Function Library
This chapter introduces APIs of EtherCAT dynamic-link library (DLL). Users can
perform various functions through calling these API libraries. The contents below
provide instructions on how to import API libraries into your developing environment.
1.1 How to use function libraries?······························································· 1-2
1.2 Start a new project············································································· 1-2
1.2.1 Using VC ··················································································· 1-2
1.2.2 Using VB ··················································································· 1-2
1.2.3 Using VB.Net·············································································· 1-2
1.2.4 Using C# ··················································································· 1-3

Introduction to API Function Library EtherCAT Programming Guide
1-2 March, 2017
1
1.1 How to use function libraries?
When the installation program is completed, two function libraries will be found in the folder
named “lib”. They can be used in Visual Studio C and Borland C++ respectively.
Function library Development environment
EtherCatDll.lib Visual Studio C++
BCBEtherCAT_DLL.lib Borland C++Builder 6
1.2 Start a new project
1.2.1 Using VC
(1) Place following instructions in the user-built project:
#include “EtherCat_DLL.h”
#include “EtherCat_DLL_Err.h”
(2) Select Project / Setting / Link in Visual C development environment.
Then, type “..\lib\EtherCat_DLL.lib” in Object / Library modules
(3) Setup completed. Users can start to operate EtherCAT DLL with API.
1.2.2 Using VB
Place “EtherCat_DLL.bas” and “EtherCat_DLL_Err.bas” in the project created by users to control
EtherCAT DLL with API.
1.2.3 Using VB.Net
Place “EtherCat_DLL.vb” and “EtherCat_DLL_Err.vb” in the project created by users to control
EtherCAT DLL with API.

EtherCAT Programming Guide Introduction to API Function Library
March, 2017
1-3
1
1.2.4 Using C#
Place “EtherCat_DLL.cs” and “EtherCat_DLL_Err.cs” in user-built project to control EtherCAT
DLL with API.
Note: For C# projects, please tick the Enable native code debugging option in the Debug tab. See figure
below. Serious errors (i.e. blue screen) will occur if this option is not ticked.
Figure 1.2.4.1 Settings for C# project

Introduction to API Function Library EtherCAT Programming Guide
1-4 March, 2017
1
(This page is intentionally left blank.)

March, 2017 2-1
EtherCAT Introduction
This chapter introduces the setting for applying Delta EtherCAT function library,
including the suggested maximum slave number for connection, initialization of RTX
operating system and the description on how to check if the EtherCAT associated DLL
can operate normally in RTS. Please see the contents below for more information.
2.1 Maximum number of the slave device ····················································2-2
2.2 Initialize RTX runtime environment························································2-3
2.3 Introduction to RTSS Task Manager······················································2-4

EtherCAT Introduction EtherCAT Programming Guide
2-2 March, 2017
2
2.1 Maximum number of the slave device
Delta EtherCAT master has two types of operation system, RTX real-time operating system from
PAC and EtherCAT PCI motion card. Since the operational efficiency among both differs from
one another, the connected slave number is different.
When EtherCAT master runs in RTX real-time operating system, the default of its communication
cycle is 1 ms (1K) and can connect up to remote modules and 64 motion axes, including servo
drives and pulse modules. There is no limitation on quantity of the device that connects to
EtherCAT master. However, if the communication cycle is shorter, the suggested maximum
number of the connected slave will be reduced in accordance with proportion. Please refer to
table 2.1.1 below for the suggested maximum slave quantity to avoid communication instability.
When EtherCAT master runs in PCI motion card, it can connect 64 remote modules and 32
motion axes at most with the default communication cycle 1 ms (1K). Please refer to table 2.1.2.
EtherCAT master runs in RTX real-time operating system of Delta PAC
Communication cycle (ms) Max. number of the connected
remote module (1 ms) Max. number of the connected
motion axis (1 ms)
4 ms 100 64
2 ms 100 64
1 ms 100 64
0.5 ms 50 32
0.25 ms 25 16
0.125 ms 22 8
Table 2.1.1 Suggested number of the slave
EtherCAT master runs in Delta PCI EtherCAT motion card
Communication cycle (ms) Max. number of the connected
remote module (1 ms) Max. number of the connected
motion axis (1 ms)
4 ms 64 32
2 ms 64 32
1 ms 64 32
0.5 ms 32 16
0.25 ms 16 8
0.125 ms 8 4
Table 2.1.2 Suggested number of the slave

EtherCAT Programming Guide EtherCAT Introduction
March, 2017
2-3
2
2.2 Initialize RTX runtime environment
For running the real-time operating system uploaded by synchronous function of EtherCAT
communication, RTX has one CPU and one Ethernet communication port. If you are applying a
Delta EtherCAT motion card, such as PCI-L221PPI, then there is nothing to do with RTX system.
When the host computer has started up, the RTX runtime environment will not be automatically
loaded into the system. It will start running only after instructions related to EtherCAT initialization
API are executed. Or, you can also manually enable RTX. See the steps below.
Once RTX is enabled, you can start to use other related functions and APIs in EtherCAT dynamic
link library.
(1) Open [RTX Properties]
File location: [Start] > [All programs] > [IntervalZero] > [RTX 2012] > [RTX Properties]
(2) Enable RTX devices
After opening [RTX Properties], select the Control tab and check the Driver status. If the driver
status shows “Stopped”, press the Start key to have the RTX devices start running.
Figure 2.2.1 RTX devices in Stopped status

EtherCAT Introduction EtherCAT Programming Guide
2-4
March, 2017
2
(3) Check the status of RTX devices
When the status of RTX devices shows “Running”, the user can start to use EtherCAT related
functions.
Figure 2.2.2 RTX devices in Running status
2.3 Introduction to RTSS Task Manager
RTSS Task Manager can be used to check whether the EtherCAT associated files
(ECAT_RTX_RTDLL.rtdll, ECAT_STACK_RTDLL.rtdll) are operating normally in RTX.
Figure 2.3.1
Interface of RTSS Task Manager

EtherCAT Programming Guide EtherCAT Introduction
March, 2017
2-5
2
If there is any file missing in Task Manager, users can reload the missing file.
(1) Click the Start Task key, and the RtssRun window will pop out.
Figure 2.3.2 RtssRun window
(2) Click Browse and select the missing file, which is placed in C:\Windows\system32\.
Figure 2.3.3 Select the missing file
Table of contents
Other Delta Control System manuals