Difference between revisions of "EtherCAT:EC INSTALL STX CDHD/zh-hans"

From SoftMC-Wiki
Jump to: navigation, search
 
Line 1: Line 1:
{{Languages}}
+
{{Languages|EtherCAT:EC_INSTALL_STX_CDHD}}
 
==描述==
 
==描述==
 
通过调用子程序[[EtherCAT:EC_INSTALL_STX_CDHD|EC_INSTALL_STX_CDHD]]配置CDHD驱动器功能.<br/>
 
通过调用子程序[[EtherCAT:EC_INSTALL_STX_CDHD|EC_INSTALL_STX_CDHD]]配置CDHD驱动器功能.<br/>
Line 16: Line 16:
 
==返回值==
 
==返回值==
 
None
 
None
==描述==
+
==声明==
 
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)
 
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)
 
==格式==
 
==格式==
Line 23: Line 23:
 
call EC_INSTALL_STX_CDHD(2, SERVOTRONIX_VENDOR_ID_0X2E1, 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.
+
第一步是创建PDO映射。 '''驱动器中的不同运动运行模式使用不同的PDO映射''';因此,在启动[[:Category:EtherCAT:EC SETUP|EtherCAT setup]]步骤之前,必须决定系统是工作在位置同步模式还是速度同步模式。
  
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.
+
一旦EtherCAT启动,就不可能在同步位置和同步速度之间切换。 切换模式需要停止EtherCAT通信,并通过新的PDO设置重新启动。 然而,在大多数情况下,同步位置模式是合适的。
  
The PDO mapping in different operation modes is as follows:<br/>
+
不同运行模式下的PDO映射如下:<br/>
Sync Position - PCMD is mapped to 0x607A and VCMD is mapped to 0x6081<br/>
+
位置同步 - PCMD映射到0x607A,VCMD映射到0x6081<br/>
Position - PCMD is mapped to 0x60C1<br/>
+
位置- PCMD 映射到0x60C1<br/>
Sync Velocity - VCMD is mapped to 0x60FF
+
速度同步 - VCMD映射到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/>
+
通过将参数<motion_opmode>传递给子程序[[EtherCAT:EC_CDHD_SET_PDOS|EC_CDHD_SET_PDOS]],使用以下常数之一设置正确的PDO映射:<br/>
 
CDHD_OPMODE_SYNC_VELOCITY = 7<br/>
 
CDHD_OPMODE_SYNC_VELOCITY = 7<br/>
 
CDHD_OPMODE_SYNC_POSITION = 8<br/>
 
CDHD_OPMODE_SYNC_POSITION = 8<br/>
Line 42: Line 42:
 
</syntaxhighlight>
 
</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.
+
下一步是通知特定地址包含一个运动驱动器的EtherCAT主站。 这是通过调用子程序[[EtherCAT:EC_USE_SLAVE|EC_USE_SLAVE]]完成的。 最后一个参数“TRUE”指示ECat主站与驱动器时钟同步。
 
<syntaxhighlight lang="vb">
 
<syntaxhighlight lang="vb">
 
call EC_USE_SLAVE(drive_addr, SERVOTRONIX_VENDOR_ID_0X2E1, STX_CDHD_PRODUCT_CODE_0X0, "ECAT_AXIS_SLAVE", TRUE)
 
call EC_USE_SLAVE(drive_addr, SERVOTRONIX_VENDOR_ID_0X2E1, STX_CDHD_PRODUCT_CODE_0X0, "ECAT_AXIS_SLAVE", TRUE)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Set the Micro-Interpolation mode:
+
设置微插值模式:
 
<syntaxhighlight lang="vb">
 
<syntaxhighlight lang="vb">
 
'  Micro Interpolation
 
'  Micro Interpolation
Line 53: Line 53:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
The next step is reading PNUM / PDEN from the drive in order to calculate the [[MC-Basic:axis.POSITIONFACTOR|Position Factor]].
+
下一步是从驱动器读取PNUM / PDEN,以计算[[MC-Basic:axis.POSITIONFACTOR|Position Factor]]
 
<syntaxhighlight lang="vb">
 
<syntaxhighlight lang="vb">
 
PNUM = EC_SDO_READ(drive_addr, 0x6092, 1)
 
PNUM = EC_SDO_READ(drive_addr, 0x6092, 1)
Line 59: Line 59:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
If the motor is linear, read the pitch, and add it to the position factor calculation.
+
如果电机是线性的,读取节距,并将其添加到位置因子计算中。
 
<syntaxhighlight lang="vb">
 
<syntaxhighlight lang="vb">
 
if EC_SDO_READ(drive_addr, 0x2024, 0) = 2 then
 
if EC_SDO_READ(drive_addr, 0x2024, 0) = 2 then
Line 66: Line 66:
 
</syntaxhighlight>
 
</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/>
+
最后是创建驱动器的数字IO和系统数字IO之间的关联。STX CDHD具有11个数字输入和6个数字输出。<br/>
The association is done as follows:<br/>
+
关联方式如下:<br/>
 
Drive's digital inputs 1-11  --->  System digital inputs [drive address * 100] - [drive address * 100  +  10]<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/>
 
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/>
+
例如:STX CDHD驱动器第四个拓扑中分配驱动器地址4。<br/>
Its digital inputs are associated with System digital inputs 400 to 410.<br/>
+
其数字输入与系统数字输入400至410相关联。<br/>
Its digital outputs are associated with System digital outputs 400 to 405.<br/>
+
其数字输出与系统数字输出400至405相关联。<br/>
The drive's digital inputs are read as follows:<br/>
+
驱动器的数字输入读取如下所示:<br/>
 
?Sys.Din[400][11]<br/>
 
?Sys.Din[400][11]<br/>
The drive's digital outputs are set as follows:<br/>
+
驱动器的数字输出设置如下所示:<br/>
 
Sys.Dout[400][6] = <6 bits value><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/>
+
使用子程序[[EtherCAT:EC_ASSOCIATE_PDO_TO_SYS_DIO|EC_ASSOCIATE_PDO_TO_SYS_DIO]]完成关联:<br/>
 
<syntaxhighlight lang="vb">
 
<syntaxhighlight lang="vb">
 
' Map Drive digital IOs to system digital IOs
 
' Map Drive digital IOs to system digital IOs
Line 91: Line 91:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
For more information, refer to [[EtherCAT:DIGITAL-IOS|DIGITAL-IOS]]
+
有关详细信息,请参考[[EtherCAT:DIGITAL-IOS|DIGITAL-IOS]]
  
 
<br/>
 
<br/>

Latest revision as of 09:15, 5 May 2017

语言: English  • 中文(简体)‎

描述

通过调用子程序EC_INSTALL_STX_CDHD配置CDHD驱动器功能.
本文介绍了此子例程执行的配置步骤。

IMPORTANT.svgIMPORTANT
要配置CDHD驱动器,必须在全局加载库EC_CDHD.LIB。
IMPORTANT.svgIMPORTANT
EC_SETUP.PRG检测到STX CDHD时,该子程序将自动调用。

输入

驱动器地址 - 驱动器在物理拓扑中的位置,其中第一个驱动器分配了驱动器地址1,以此类推。
供应商ID - 有几种定制品牌的STX CDHD驱动器,因此EtherCAT设置可能会运行到多个供应商ID
运动模式 - 详细说明如下
微插值 - 驱动器的微插值模式,这个参数默认传递为2

输出

None

返回值

None

声明

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)

格式

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

例子

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

安装过程

第一步是创建PDO映射。 驱动器中的不同运动运行模式使用不同的PDO映射;因此,在启动EtherCAT setup步骤之前,必须决定系统是工作在位置同步模式还是速度同步模式。

一旦EtherCAT启动,就不可能在同步位置和同步速度之间切换。 切换模式需要停止EtherCAT通信,并通过新的PDO设置重新启动。 然而,在大多数情况下,同步位置模式是合适的。

不同运行模式下的PDO映射如下:
位置同步 - PCMD映射到0x607A,VCMD映射到0x6081
位置- PCMD 映射到0x60C1
速度同步 - VCMD映射到0x60FF

通过将参数<motion_opmode>传递给子程序EC_CDHD_SET_PDOS,使用以下常数之一设置正确的PDO映射:
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)

下一步是通知特定地址包含一个运动驱动器的EtherCAT主站。 这是通过调用子程序EC_USE_SLAVE完成的。 最后一个参数“TRUE”指示ECat主站与驱动器时钟同步。

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

设置微插值模式:

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

下一步是从驱动器读取PNUM / PDEN,以计算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 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

最后是创建驱动器的数字IO和系统数字IO之间的关联。STX CDHD具有11个数字输入和6个数字输出。
关联方式如下:
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]
例如:STX CDHD驱动器第四个拓扑中分配驱动器地址4。
其数字输入与系统数字输入400至410相关联。
其数字输出与系统数字输出400至405相关联。
驱动器的数字输入读取如下所示:
?Sys.Din[400][11]
驱动器的数字输出设置如下所示:
Sys.Dout[400][6] = <6 bits value>

使用子程序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)

有关详细信息,请参考DIGITAL-IOS


See Also