EtherCAT:EC ASSOCIATE PDO TO SYS DIO

From SoftMC-Wiki
Jump to: navigation, search
Language: English  • 中文(简体)‎

This subroutine associates between System digital IOs to an EtherCAT slave IOs.
This allows the user to handle the slave's digital IOs by using the following syntax:
?Sys.din[<first system digital input bit>][<Range>]
Sys.dout[<first system digital output bit>][<Range>] = <value>

IMPORTANT.svgIMPORTANT

It is up to the user to assign system IOs carefully, and make sure that the same system IO isn't mapped to more than one IO (of a motion drive or an IO module).

Behavior is UNDEFINED if this rule is broken !!!
IMPORTANT.svgIMPORTANT
This subroutine must be invoked before the EtherCAT master is started. Refer to EtherCAT General Guide and Setup EtherCAT for more information


Input

slave address, PDO index, PDO sub-index, First SYSTEM digital output.
range - number of digital IOs mapped to the relevant PDO
inherent_offset - In some slaves, like the STX CDHD, the PDO's size is 32 bits but the DIOs are mapped from 16 to 32, therefore the inherent offset is 16.

Output

None

Return Value

None

Declaration

public sub EC_ASSOCIATE_PDO_TO_SYS_DIO(byval slaveAddr as long, byval PDOindex as long, byval PDOsubindex as long, byval systemDIOnumber as long, byval range as long, byval inherent_offset as long)

Syntax

call EC_ASSOCIATE_PDO_TO_SYS_DIO(<Slave address>, <PDO index>, <PDOS sub-index>, <first SYSTEM digital output>, <range>, <inherent offset>)

Examples

call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FD, 0x0, drive_addr*100, 11, 16) ' 16 - inherent offset in 60FD to digital inputs
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FE, 0x1, drive_addr*100, 6, 16) ' 16 - inherent offset in 60FE to digital outputs
If drive_addr == 3, the last example maps the drive's first digital output to the system digital output bit number 300,
drive's second digital output to system digital output bit number 301, and so on until Drive Dout 11 and System DOut 311.

See Also