TwinCAT project setup
This document describes how to configurate the TwinCAT project for Servo_motor demo.
Create a new project
Select File > New > Project.
Select TwinCAT Projects and name this project EtherCAT_Servo.
Click OK.
Scan the subdevices
Right-click on Device > Scan in the Solution Explorer pane.
Select the realtime network interface connected with the SubDevice.
Click OK.
Click Yes to scan for boxes.
Click OK to append linked axis to NC.
Click NO to refuse to activate Free Run mode.
Configure the cycle of NC task
The cycle time of NC task depends on the cycle of slow task on subdevice.
The cycle time of Dual_cores_servo_motor example is 250us.
The cycle time of servo_motor example is 1ms.
Configure the base time of TwinCAT to 250us
Configure the NC task cycle
Configure the NC task cycle to 250us by setting Cycle ticks to 1 for Dual_cores_servo_motor example.
Configure the NC task cycle to 1ms by setting Cycle ticks to 4 for servo_motor example.
Configure the subdevice
Select Box 1(ECAT-SERVO-MOTOR) in the Solution Explorer pane.
Select DC operation mode to DC-Synchron mode in the DC tab.
Activate the Axis 0 in the Slots tab for Motor1.
Select the Axis 0 in the left pane and select the csp - axis in the right pane.
Click < button to activate Axis 0.
Activate the Axis 1 for Motor2 in the Slots tab if the Motor2 is connected.
Select the Axis 1 in the left pane and select the csp - axis in the right pane.
Click < button to activate Axis 1.
TwinCAT NC Axes configuration
Mapping Axis 1 to Motor1.
Select Axis 1 under MOTION > NC-Task 1 SAF > Axes
Click Link TO I/O in the Settings tab.
Select Drive 1 #CHN1 and click OK.
Select the Unit to degree.
Disable Position Log Monitoring in the Parameter tab.
Set the Scaling Factor for Enc
Select Enc node under Axis 1 and then select Parameter tab.
Set Scaling Factor Numerator to 1.
Set Scaling Factor Denominator:
Set Scaling Factor Denominator to 93206.75555 for Dual_cores_servo_motor demo on i.MX943EVK.
Set Scaling Factor Denominator to 22.22222 for servo_motor demo on evkmimxrt1180 or frdmimxrt1186.
Note: the Scaling Factor Denominator is calculated as the resolution of the encoder / 360.
The resolution of the Encoder on Dual_cores_servo_motor example is 25Bits,namely 33554432(2^25).
The resolution of the Encoder on servo_motor example is 8000.
Mapping Axis 2 to Motor2 if the Motor2 is connected
Select Axis 2 under MOTION > NC-Task 1 SAF > Axes
Click Link TO I/O in the Settings tab.
Select Drive 1 #CHN2 and click OK.
Select the Unit to degree.
Disable Position Log Monitoring in the Parameter tab.
Set the Scaling Factor for Enc
Select Enc node under Axis 1 and then select Parameter tab.
Set Scaling Factor Numerator to 1.
Set Scaling Factor Denominator:
Set Scaling Factor Denominator to 93206.75555 for Dual_cores_servo_motor demo on i.MX943EVK.
Set Scaling Factor Denominator to 22.22222 for servo_motor demo on evkmimxrt1180 or frdmimxrt1186.
Note: the Scaling Factor Denominator is calculated as the resolution of the encoder / 360.
The resolution of the Encoder on Dual_cores_servo_motor example is 25Bits,namely 33554432(2^25).
The resolution of the Encoder on servo_motor example is 8000.
Save the project
Click File > Save All