Skip to Main Content
Cognex 支持中心
LogoLogo

Script - Trigger Hold Function For Unstable Trigger

Trigger hold function

2025/04/16

Details

Sometimes, a stable trigger signal from the photoeye or an external device/system may not be available. In such cases, it's essential to hold the trigger for a specified duration to ensure consistent results.

 

To achieve this, the following section of the script should be placed before the onResult function:

const HOLDOFF_TYPE = 1; // Set to 0 for Off, 1 for Time, 2 for Distance
dmccSet("TRIGGER.HOLDOFF-TYPE",HOLDOFF_TYPE);

if(HOLDOFF_TYPE == 1)
{
   dmccSet("TRIGGER.HOLDOFF-TIME",100); // 0-10000ms time trigger must be ON to be count as being on
   dmccSet("TRIGGER.END-HOLDOFF-TIME",1000); // 0-10000ms time trigger must be OFF to really end the trigger
}
else if(HOLDOFF_TYPE == 2)
{
   dmccSet("TRIGGER.HOLDOFF-DISTANCE", 55); // 0-10000mm distance trigger must be ON to be count as being on
   dmccSet("TRIGGER.END-HOLDOFF-DISTANCE",55); // 0-10000mm distance trigger must be OFF to really end the trigger
}

 

Then, we need to configure the trigger hold method (either by time or distance from the encoder) and set the trigger's on and off timing.

相关资源

Loading component...