- Make sure to connect the PC via ethernet to the first EtherCAT slave device.
- Create a new project (name doesn't matter)
- Go to TwinCAT --> Show Realtime EtherCAT Compatible Devices.
- Select the network card you want to use for EtherCAT, and click Install. Preferably, this should be a compatible device (and would be listed under compatible devices). If there are no compatible devices, just select one of them.
note, it is good practice to dedicate this card to EtherCAT, as it might not be able to do regular network card stuff after installing the new drivers. However, you can (probably) always reinstall the drivers through windows device manager.
- TODO: Link to bit about BIOS settings here...
- In your solution, find IO/Devices hit right-click-->Scan...
- Click OK
- Click OK
- Click Yes
- Click Yes to activate Free Run (we can also toggle this in the toolbar at the top of the screen if we want/need to).
- All devices should show up under the EtherCAT network card device (master device in this case).
It might be helpful to read out some basic device into to debug your system.
- Make sure Free Run is on (top toolbar)
- It might be necessary to Reload Devices if no data is coming in yet (top toolbar)
Inputs are data coming from the devices, like the position, status, warnings etc.
- Click one of the devices, find the Inputs and open the node to view all the inputs
- Find the input you want to read out (e.g. ActualPosition) and double click it.
- Then click the Online Tab and see if you can read out the values.
¶ Commanding Outputs
Outputs are data that we can send to the devices, like control words, commanded position, device limits (e.g. max velocity) etc.
- Click one of the device, find the Outputs and open the node to view all the outputs.
- Find the output you want to command (e.g. Control Word) and double click it.
- Click the online tab. Here you can see what values it is set to and we can also write a new value to it.
- Click Write..., Set a value and click OK
For any device the Inputs and outputs we can use might be different. In [[LinMot MC SW]] there's a basic description of these inputs and outputs for the LinMot devices.
In this sections, some ways you can use these values to debug whats going on with the LinMot devices.
-
Initialize the device and turn it on.
- Set the ControlWord from
0
to 1
to initiate an initialization procedure (according to Dario matlab comments, this takes about .3 seconds).
- After this, the device should be enabled and the motor should be powered. You should now not be able to move the motor.
- The WarnWord now should be
128
(Motor Not Homed)
-
Home the motor
- Set the ControlWord to
2239
- The motor will start homing
- it should move to its homing position (set in the motor wizard)
- Then move to its intial position (set in the motor wizard)
- The WarnWord should turn to
0
if no other errors have occurred and the homing was successful.
-
Move the motor
- Set the ControlWord back to
1
- Set the Motion Command Header to
256
- Set Command Par 2 (Max Velocity) to e.g.
200000
(2e5)
- Set Command Par 3 (Max Acceleration) to e.g.
2000000
(2e6)
- Set Command Par 4 (Max Deceleration) to e.g.
2000000
(2e6)
- Set Command Par 1 (Target Position) to desired position. This should be an INT value where
1=0.1um
, so to convert to meters: *10^7
.
- Then, to actually initiate the movement: Set the Motion Command Header to
257
(as the command wont be executed until a new header is supplied)
- The motor should start to move and stop at the target position (quite quickly)