6. Trigger 76
are connected to ports 1 and 2. Since the tape speed is not constant, to prevent warping of the acquired
image, the line exposure start must be synchronized to the encoder. Moreover, the application requests
acquiring a line every 4/3 step.
Example Code 6.5 | Encoder synchronization
// Setup acquisition trigger:
// Set debounce time to 100 us
UnitInfo units = device.PIOPorts[0].DebounceTimeUnitInfo;
device.PIOPorts[0].DebounceTime = (ushort)(100e-6 / units.Factor);
// Set port 0 direction
device.PIOPorts[0].Direction = IODirection.Input;
// Enable acquisition start trigger
device.AcquisitionStartTrigger.Enabled = true;
// Set trigger source
device.AcquisitionStartTrigger.Source = TriggerSource.External;
device.AcquisitionStartTrigger.ExternalInput = 0;
// Detect falling edge
device.AcquisitionStartTrigger.InvertExternalInput = true;
device.AcquisitionStartTrigger.DetectExternalInputEdge = true;
// Set the number of frames to be acquired
device.AcquisitionBurstLength = 4;
// Setup frame trigger:
// Port 1 and 2 are input only, therefore there is no need to set port directions.
// Set debounce time to 1 us
device.PIOPorts[1].DebounceTime = (ushort)(1e-6 / units.Factor);
device.PIOPorts[2].DebounceTime = (ushort)(1e-6 / units.Factor);
// Set the encoder quadrature inputs
device.Encoder.InputA = 1;
device.Encoder.InputB = 2;
// Detect only forward movements
device.Encoder.IgnoreDirection = false;
// Enable frame trigger
device.FrameStartTrigger.Enabled = true;
// Set trigger source
device.FrameStartTrigger.Source = TriggerSource.Encoder;
// Acquire a frame every 1000 steps
device.FrameStartTrigger.EncoderInterval = 1000;
// Start acquisition
device.Acquire = true;