Difference between revisions of "EtherCAT:EC INSTALL STX CDHD"

From SoftMC-Wiki
Jump to: navigation, search
m
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Languages|EtherCAT:EC_INSTALL_STX_CDHD}}
 
==Description==
 
==Description==
Available Motion OpModes:
+
CDHD drive functionality is configured by calling the subroutine [[EtherCAT:EC_INSTALL_STX_CDHD|EC_INSTALL_STX_CDHD]].<br/>
common shared CDHD_OPMODE_SYNC_VELOCITY as const long = 7
+
This article describes the configuration steps performed by this subroutine.<br/>
common shared CDHD_OPMODE_SYNC_POSITION as const long = 8
+
<br/>
common shared CDHD_OPMODE_VELOCITY as const long = 3
+
{{Note/Important|To configure the CDHD drive, you must globally load the library EC_CDHD.LIB}}
 +
{{Note/Important|This subroutine is invoked automatically by [[:Category:EtherCAT:EC SETUP|EC_SETUP.PRG]] when it detects a STX CDHD}}
 +
 
 
==Input==
 
==Input==
Drive address, Motion OpMode, Micro-Interpolation Method
+
Drive address - Position of the drive in the physical topology, where the first drive is assigned drive address 1, etc...<br/>
 +
Vendor ID - There are a few custom brands of STX CDHD drive, therefore the EtherCAT setup might run into several Vendor ID's<br/>
 +
Motion Opmode - Elaborated below<br/>
 +
Micro Interpolation - Micro Interpolation mode of the drive, this argument is passed as 2 by default<br/>
 
==Output==
 
==Output==
 
None
 
None
Line 11: Line 17:
 
None
 
None
 
==Declaration==
 
==Declaration==
public sub EC_INSTALL_STX_CDHD(byval drive_addr as long, byval motion_opmode as long, byval micro_interpolation as long)
+
public sub EC_INSTALL_STX_CDHD(byval drive_addr as long, byval vendor_id as long, byval motion_opmode as long, byval micro_interpolation as long)
 
==Syntax==
 
==Syntax==
call EC_INSTALL_STX_CDHD(<drive address>, <motion opmode>, <micro interpolation mode>)
+
call EC_INSTALL_STX_CDHD(<drive address>, <vendor_id>, <motion opmode>, <micro interpolation mode>)
 
==Examples==
 
==Examples==
call EC_INSTALL_STX_CDHD(drive_addr, CDHD_OPMODE_SYNC_POSITION, 2)  '  mic_int = 2
+
call EC_INSTALL_STX_CDHD(2, SERVOTRONIX_VENDOR_ID_0X2E1, CDHD_OPMODE_SYNC_POSITION, 2)  '  mic_int = 2
 +
 
 +
==Installation Process==
 +
The first step is creating the PDO mapping. '''Different motion operational modes in the drive use different PDO mappings'''; therefore, before starting the [[:Category:EtherCAT:EC SETUP|EtherCAT setup]] procedure, you must decide whether the system will work in either Synchronous Position Mode or Synchronous Velocity Mode.
 +
 
 +
Once EtherCAT has started, it is not possible to switch between Sync Position and Sync Velocity. Switching modes requires stopping the EtherCAT communication and restarting with a new PDO setup. In most instances, however, Synchronous Position Mode is suitable.
 +
 
 +
The PDO mapping in different operation modes is as follows:<br/>
 +
Sync Position - PCMD is mapped to 0x607A and VCMD is mapped to 0x6081<br/>
 +
Position - PCMD is mapped to 0x60C1<br/>
 +
Sync Velocity - VCMD is mapped to 0x60FF
 +
 
 +
The correct PDO mapping is set by passing the argument <motion_opmode> to the subroutine [[EtherCAT:EC_CDHD_SET_PDOS|EC_CDHD_SET_PDOS]] with one of the following constants:<br/>
 +
CDHD_OPMODE_SYNC_VELOCITY = 7<br/>
 +
CDHD_OPMODE_SYNC_POSITION = 8<br/>
 +
CDHD_OPMODE_VELOCITY = 3<br/>
 +
 
 +
<syntaxhighlight lang="vb">
 +
call EC_CDHD_SET_PDOS(drive_addr, EC_BUSID, EC_ADDRESS_BY_ALIAS, motion_opmode)
 +
</syntaxhighlight>
 +
 
 +
The next step is notifying the EtherCAT master that a specific address contains a motion drive. This is done by calling the subroutine [[EtherCAT:EC_USE_SLAVE|EC_USE_SLAVE]]. The last argument, "TRUE", instructs the ECat master to sync clocks with the drive.
 +
<syntaxhighlight lang="vb">
 +
call EC_USE_SLAVE(drive_addr, SERVOTRONIX_VENDOR_ID_0X2E1, STX_CDHD_PRODUCT_CODE_0X0, "ECAT_AXIS_SLAVE", TRUE)
 +
</syntaxhighlight>
 +
 
 +
Set the Micro-Interpolation mode:
 +
<syntaxhighlight lang="vb">
 +
'  Micro Interpolation
 +
call EC_SDO_WRITE(drive_addr, 0x60C0, 0, 16, micro_interpolation)
 +
</syntaxhighlight>
 +
 
 +
The next step is reading PNUM / PDEN from the drive in order to calculate the [[MC-Basic:axis.POSITIONFACTOR|Position Factor]].
 +
<syntaxhighlight lang="vb">
 +
PNUM = EC_SDO_READ(drive_addr, 0x6092, 1)
 +
Pos_Units[drive_addr] = (PNUM / EC_SDO_READ(drive_addr, 0x6092, 2)) * (EC_SDO_READ(drive_addr, 0x6091, 1) / EC_SDO_READ(drive_addr, 0x6091, 2))
 +
</syntaxhighlight>
 +
 
 +
If the motor is linear, read the pitch, and add it to the position factor calculation.
 +
<syntaxhighlight lang="vb">
 +
if EC_SDO_READ(drive_addr, 0x2024, 0) = 2 then
 +
Pos_Units[drive_addr] = Pos_Units[drive_addr] / EC_SDO_READ(drive_addr, 0x207d, 0)
 +
end if
 +
</syntaxhighlight>
 +
 
 +
Last thing done is creating association between the drive's digital IOs and System Digital IOs. The STX CDHD has 11 digital inputs and 6 digital outputs.<br/>
 +
The association is done as follows:<br/>
 +
Drive's digital inputs 1-11  --->  System digital inputs [drive address * 100] - [drive address * 100  +  10]<br/>
 +
Drive's digital outputs 1-6  --->  System digital outputs [drive address * 100] - [drive address * 100  +  5]<br/>
 +
For example: STX CDHD Drive fourth in topology is assigned with drive address 4.<br/>
 +
Its digital inputs are associated with System digital inputs 400 to 410.<br/>
 +
Its digital outputs are associated with System digital outputs 400 to 405.<br/>
 +
The drive's digital inputs are read as follows:<br/>
 +
?Sys.Din[400][11]<br/>
 +
The drive's digital outputs are set as follows:<br/>
 +
Sys.Dout[400][6] = <6 bits value><br/>
 +
 
 +
The association is done using the subroutine [[EtherCAT:EC_ASSOCIATE_PDO_TO_SYS_DIO|EC_ASSOCIATE_PDO_TO_SYS_DIO]]:<br/>
 +
<syntaxhighlight lang="vb">
 +
' Map Drive digital IOs to system digital IOs
 +
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FD, 0x0, drive_addr*100, 11, 16)  '  16 - inherent offset in 60FD to digital inputs
 +
printu "Drive  # : sys.din. # to sys.din. #" ;drive_addr, drive_addr*100 , drive_addr*100+(11-1)
 +
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FE, 0x1, drive_addr*100, 6, 16)  '  16 - inherent offset in 60FD to digital inputs
 +
printu "Drive  # : sys.dout. # to sys.dout. #";drive_addr, drive_addr*100 , drive_addr*100+(6-1)
 +
 
 +
'set correct digital outputs mask specifically for CDHD
 +
CDHD_OUTPUT_MASK = ((1 SHL CDHD_Num_Of_Digital_Outputs_6) - 1) SHL 16
 +
call EC_SDO_WRITE(drive_addr, 0X60FE, 0X2, 32, CDHD_OUTPUT_MASK)
 +
</syntaxhighlight>
 +
 
 +
For more information, refer to [[EtherCAT:DIGITAL-IOS|DIGITAL-IOS]]
 +
 
 +
<br/>
 
==See Also==
 
==See Also==
 
* [[EtherCAT:EC_USE_SLAVE|EC_USE_SLAVE]]
 
* [[EtherCAT:EC_USE_SLAVE|EC_USE_SLAVE]]
* [[EtherCAT:EC_CDHD_SET_PDOS|EC_CDHD_SET_PDOS]]
+
* [[:Category:EtherCAT:EC SETUP|Setup EtherCAT]]
 +
* [[EtherCAT:DIGITAL-IOS|DIGITAL-IOS]]
 +
* [[EtherCAT:EC_ASSOCIATE_PDO_TO_SYS_DIO|EC_ASSOCIATE_PDO_TO_SYS_DIO]]
 +
<!--  * [[EtherCAT:EC_CDHD_SET_PDOS|EC_CDHD_SET_PDOS]] -->

Latest revision as of 01:32, 8 May 2017

Language: English  • 中文(简体)‎

Description

CDHD drive functionality is configured by calling the subroutine EC_INSTALL_STX_CDHD.
This article describes the configuration steps performed by this subroutine.

IMPORTANT.svgIMPORTANT
To configure the CDHD drive, you must globally load the library EC_CDHD.LIB
IMPORTANT.svgIMPORTANT
This subroutine is invoked automatically by EC_SETUP.PRG when it detects a STX CDHD

Input

Drive address - Position of the drive in the physical topology, where the first drive is assigned drive address 1, etc...
Vendor ID - There are a few custom brands of STX CDHD drive, therefore the EtherCAT setup might run into several Vendor ID's
Motion Opmode - Elaborated below
Micro Interpolation - Micro Interpolation mode of the drive, this argument is passed as 2 by default

Output

None

Return Value

None

Declaration

public sub EC_INSTALL_STX_CDHD(byval drive_addr as long, byval vendor_id as long, byval motion_opmode as long, byval micro_interpolation as long)

Syntax

call EC_INSTALL_STX_CDHD(<drive address>, <vendor_id>, <motion opmode>, <micro interpolation mode>)

Examples

call EC_INSTALL_STX_CDHD(2, SERVOTRONIX_VENDOR_ID_0X2E1, CDHD_OPMODE_SYNC_POSITION, 2) ' mic_int = 2

Installation Process

The first step is creating the PDO mapping. Different motion operational modes in the drive use different PDO mappings; therefore, before starting the EtherCAT setup procedure, you must decide whether the system will work in either Synchronous Position Mode or Synchronous Velocity Mode.

Once EtherCAT has started, it is not possible to switch between Sync Position and Sync Velocity. Switching modes requires stopping the EtherCAT communication and restarting with a new PDO setup. In most instances, however, Synchronous Position Mode is suitable.

The PDO mapping in different operation modes is as follows:
Sync Position - PCMD is mapped to 0x607A and VCMD is mapped to 0x6081
Position - PCMD is mapped to 0x60C1
Sync Velocity - VCMD is mapped to 0x60FF

The correct PDO mapping is set by passing the argument <motion_opmode> to the subroutine EC_CDHD_SET_PDOS with one of the following constants:
CDHD_OPMODE_SYNC_VELOCITY = 7
CDHD_OPMODE_SYNC_POSITION = 8
CDHD_OPMODE_VELOCITY = 3

call EC_CDHD_SET_PDOS(drive_addr, EC_BUSID, EC_ADDRESS_BY_ALIAS, motion_opmode)

The next step is notifying the EtherCAT master that a specific address contains a motion drive. This is done by calling the subroutine EC_USE_SLAVE. The last argument, "TRUE", instructs the ECat master to sync clocks with the drive.

call EC_USE_SLAVE(drive_addr, SERVOTRONIX_VENDOR_ID_0X2E1, STX_CDHD_PRODUCT_CODE_0X0, "ECAT_AXIS_SLAVE", TRUE)

Set the Micro-Interpolation mode:

'  Micro Interpolation
call EC_SDO_WRITE(drive_addr, 0x60C0, 0, 16, micro_interpolation)

The next step is reading PNUM / PDEN from the drive in order to calculate the Position Factor.

PNUM = EC_SDO_READ(drive_addr, 0x6092, 1)
Pos_Units[drive_addr] = (PNUM / EC_SDO_READ(drive_addr, 0x6092, 2)) * (EC_SDO_READ(drive_addr, 0x6091, 1) / EC_SDO_READ(drive_addr, 0x6091, 2))

If the motor is linear, read the pitch, and add it to the position factor calculation.

if EC_SDO_READ(drive_addr, 0x2024, 0) = 2 then
	Pos_Units[drive_addr] = Pos_Units[drive_addr] / EC_SDO_READ(drive_addr, 0x207d, 0)
end if

Last thing done is creating association between the drive's digital IOs and System Digital IOs. The STX CDHD has 11 digital inputs and 6 digital outputs.
The association is done as follows:
Drive's digital inputs 1-11 ---> System digital inputs [drive address * 100] - [drive address * 100 + 10]
Drive's digital outputs 1-6 ---> System digital outputs [drive address * 100] - [drive address * 100 + 5]
For example: STX CDHD Drive fourth in topology is assigned with drive address 4.
Its digital inputs are associated with System digital inputs 400 to 410.
Its digital outputs are associated with System digital outputs 400 to 405.
The drive's digital inputs are read as follows:
?Sys.Din[400][11]
The drive's digital outputs are set as follows:
Sys.Dout[400][6] = <6 bits value>

The association is done using the subroutine EC_ASSOCIATE_PDO_TO_SYS_DIO:

' Map Drive digital IOs to system digital IOs
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FD, 0x0, drive_addr*100, 11, 16)  '  16 - inherent offset in 60FD to digital inputs
printu "Drive  # : sys.din. # to sys.din. #" ;drive_addr, drive_addr*100 , drive_addr*100+(11-1)
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FE, 0x1, drive_addr*100, 6, 16)  '  16 - inherent offset in 60FD to digital inputs
printu "Drive  # : sys.dout. # to sys.dout. #";drive_addr, drive_addr*100 , drive_addr*100+(6-1)

'set correct digital outputs mask specifically for CDHD
CDHD_OUTPUT_MASK = ((1 SHL CDHD_Num_Of_Digital_Outputs_6) - 1) SHL 16
call EC_SDO_WRITE(drive_addr, 0X60FE, 0X2, 32, CDHD_OUTPUT_MASK)

For more information, refer to DIGITAL-IOS


See Also