EtherCAT Programming Guide High Speed Pulse Compare Function
March, 2017 27-13
27
27.10 _ECAT_Compare_Set_Channel0_Trigger _By_GPIO
Syntax
U16 PASCAL _ECAT_Compare_Set_Channel0_Trigger_By_GPIO (U16 CardNo, U16 dir, U16
interval, I32 trigger_cnt)
Purpose
Set the parameters for triggering the signal at a fixed pulse interval of channel 0, which function
is triggered via PIN10 of CN2 connector (GPIO, general-purpose input/output)
Note:
1. Before GPIO is enabled, please make sure channel 0 is enabled by API
“_ECAT_Compare_Set_Channel_Enable”.
2. About the triggering retaining time, please refer to section 27.5
“_ECAT_Compare_Set_Channel_Trigger_Time”.
3. Output signal of channel 0 is triggered via PIN11 and PIN12 of CN2 and CN9 connector on motion card
PCI-L221-B1. These two sets of points will both be triggered when pulses are matched.
Parameter
Name Data type Property Description
CardNo U16 Number Card No.
Dir U16 Numeric value
0: forward
1: backward
Interval U16 Option Pulse number of each interval
Trigger _cnt I32 Pulse number Pulse interval for carrying out the compare.
Example
U16 CardNo = 0;
U16 Dir = 1;
U16 Interval = 10;
I32 trigger_cnt = 50000;
U16 status = _ECAT_Compare_Set_Channel0_Trigger_By_GPIO (CardNo, Dir, Interval,
trigger_cnt);
/* The motion card starts comparing pulses from position 100000 and channel 0 will be triggered
once every 10 pulses with total trigger count 50000. */
/* That is, when the pulse is 100010, 100020, 100030, …, 600000, channel 0 will be triggered
once.*/
Description
The comparing method is the same as that described in Chaper 27.9
“_ECAT_Compare_Channel0_Position”. However, to enable this compare function, the GPIO
(PIN 10 of CN2) has to be set to on.