Difference between revisions of "EtherCAT:EC ASSOCIATE PDO TO SYS DIO"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "{{Template:EtherCAT-Function |DESCRIPTION= This subroutine associates between System digital IOs to a EtherCAT slave IOs This allows the user to handle the slave's digital IO...")
 
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
{{Languages|EtherCAT:EC_ASSOCIATE_PDO_TO_SYS_DIO}}
 
{{Template:EtherCAT-Function
 
{{Template:EtherCAT-Function
  
 
|DESCRIPTION=
 
|DESCRIPTION=
This subroutine associates between System digital IOs to a EtherCAT slave IOs
+
This subroutine associates between System digital IOs to an EtherCAT slave IOs.<br/>
This allows the user to handle the slave's digital IOs by using the following syntax:
+
This allows the user to handle the slave's digital IOs by using the following syntax:<br/>
?Sys.din[<first system digital input bit>][<Range>]
+
?Sys.din[<first system digital input bit>][<Range>]<br/>
 
Sys.dout[<first system digital output bit>][<Range>] = <value>
 
Sys.dout[<first system digital output bit>][<Range>] = <value>
 
<br/><br/>
 
<br/><br/>
Line 12: Line 13:
  
 
Behavior is UNDEFINED if this rule is broken !!!}}
 
Behavior is UNDEFINED if this rule is broken !!!}}
 +
 +
{{Note/Important|This subroutine must be invoked before the EtherCAT master is started. Refer to [[:Category:EtherCAT:ECAT_GENERAL_GUIDE|EtherCAT General Guide]] and [[:Category:EtherCAT:EC SETUP|Setup EtherCAT]] for more information}}
 
<br/>
 
<br/>
 
|INPUT=
 
|INPUT=
slave address, PDO index, PDO sub-indexfirst, First SYSTEM digital output.
+
slave address, PDO index, PDO sub-index, First SYSTEM digital output.<br/>
range - number of digital IOs mapped to the relevant PDO
+
range - number of digital IOs mapped to the relevant PDO<br/>
 
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.
 
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.
  
Line 31: Line 34:
 
|EXAMPLE=
 
|EXAMPLE=
 
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FD, 0x0, drive_addr*100, 11, 16)  '  16 - inherent offset in 60FD to digital inputs<br/>
 
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FD, 0x0, drive_addr*100, 11, 16)  '  16 - inherent offset in 60FD to digital inputs<br/>
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FE, 0x1, drive_addr*100, 6, 16)  '  16 - inherent offset in 60FD to digital inputs<br/>
+
call EC_ASSOCIATE_PDO_TO_SYS_DIO(drive_addr, 0x60FE, 0x1, drive_addr*100, 6, 16)  '  16 - inherent offset in 60FE to digital outputs<br/>
 
If drive_addr == 3, the last example maps the drive's first digital output to the system digital output bit number 300,<br/>
 
If drive_addr == 3, the last example maps the drive's first digital output to the system digital output bit number 300,<br/>
 
drive's second digital output to system digital output bit number 301, and so on until Drive Dout 11 and System DOut 311.<br/>
 
drive's second digital output to system digital output bit number 301, and so on until Drive Dout 11 and System DOut 311.<br/>
  
 
|SEE ALSO=
 
|SEE ALSO=
 +
* [[:Category:EtherCAT:ECAT_GENERAL_GUIDE|ECAT_GENERAL_GUIDE]]
 
* [[EtherCAT:EC_INSTALL_STX_CDHD|EC_INSTALL_STX_CDHD]]
 
* [[EtherCAT:EC_INSTALL_STX_CDHD|EC_INSTALL_STX_CDHD]]
 +
* [[EtherCAT:DIGITAL-IOS|DIGITAL-IOS]]
  
  
 
}}
 
}}

Latest revision as of 09:26, 5 May 2017

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