| ApossC SDK V01.15

SDK_Bussystem_EtherCat.mc
Go to the documentation of this file.
1
8 #pragma once
9
10 #include <SysDef.mh>
11 #include "SDK_Bussystem_EtherCat.mh"
12
23 long sdkEtherCATMasterInitialize(void)
24 {
25 long slaveCount = 0;
26
27 ECatMasterCommand(0x1000, 0); // disable Master
28 ECatMasterCommand(0x1000, 1); // start Master
29 ECatMasterInfo(0x1000, 0, slaveCount); // slave count
30
31 print(" ECAT salve count: ",slaveCount);
32 return(slaveCount);
33 }
34
46 long sdkEtherCATMasterDoMapping(void)
47 {
48 print("map input/output");
49 return ECatMasterCommand(0x1000, 2); // Map Input and Output buffers (go to safeop)
50 }
51
52
67 long sdkEtherCATSetupDC(long slaveNo, long cycleTime_ms, long offset_us)
68 {
69 ECatMasterCommand(slaveNo, ( (cycleTime_ms<<8) + (offset_us<<16)));
70
71 return(1);
72 }
73
74
86 long sdkEtherCATMasterStart(void)
87 {
88 long offsetValue;
89 long dcActive = 0;
90
91 Delay(2); //Wait for ECatMasterInfo(0x1000, 12) value to be updated the first time
92
93 ECatMasterInfo(0, 30, dcActive); //is DC configured?
94 print("DC Active: ", dcActive);
95
96 if(dcActive)
97 {
98 print("wait for DC to lock");
99 offsetValue = 100001;
100 while(abs(offsetValue) > 1000)
101 {
102 ECatMasterInfo(0x1000, 12, offsetValue);
103 print("Offset time [ns]: ",offsetValue);
104 Delay(300);
105 }
106 }
107
108 print("wait for op");
109 ECatMasterCommand(0x1000, 3); // request & wait OP state for all slaves
110
111 return(1);
112 }
113
114
115
sdkEtherCATMasterStart
long sdkEtherCATMasterStart(void)
Start an EtherCAT Master.
Definition: SDK_Bussystem_EtherCat.mc:86
sdkEtherCATMasterInitialize
long sdkEtherCATMasterInitialize(void)
Initialization of an EtherCAT master.
Definition: SDK_Bussystem_EtherCat.mc:23
sdkEtherCATSetupDC
long sdkEtherCATSetupDC(long slaveNo, long cycleTime_ms, long offset_us)
Sets the DC cycle for an individual slave.
Definition: SDK_Bussystem_EtherCat.mc:67
SDK_Bussystem_EtherCat.mh
Declaration of the EtherCat functions.
sdkEtherCATMasterDoMapping
long sdkEtherCATMasterDoMapping(void)
Mapping of EtherCAT Master IO Image.
Definition: SDK_Bussystem_EtherCat.mc:46

Data Sheets | Released Software | Software Manuals | Hardware Manuals | Maxon Shop

Maxon Support Center