Using Trigger and Digital I/Os - Part 5

Published on June 6, 2008 by TIS Marketing.

Please Note: This blog post is part of a series of five posts altogether. The posts include: Part 1, Part 2, Part 3, Part 4 and Part 5.

Programming Examples With IC Imaging Control®

All The Imaging Source cameras are shipped with the SDK IC Imaging Control®. IC Imaging Control® removes a lot of programming effort, since it offers many ready-to-use basic procedures.

Below are brief examples in Visual Basic to give you an idea of how to use IC Imaging Control® to control the trigger and the digital I/Os. You can learn more about IC Imaging Control® and download sample source code at www.imagingcontrol. com. Additionally, our support department (support@imagingcontrol.com) has some more detailed programming examples available for you.

Using The Trigger The program begins by assigning the video Device (in this case the FireWire camera DMK 21BF04), defines a VideoFormat and sets the camera's operation mode to DeviceTrigger.

After the command LiveStart, the camera is ready to shoot: the camera now waits for a trigger pulse. MemorySnapImage instructs IC Imaging Control to put the next image (which has been captured due to the trigger pulse) into a buffer (Memory) for further processing. Take as an example MemorySaveImage, which saves the content of this buffer to Triggered.bmp.

Private Sub Form_Load() ICImagingControl1.Device = "DMK 21BF04" ICImagingControl1.VideoFormat = "Y800 (640x480)" ICImagingControl1.DeviceTrigger = True ICImagingControl1.LiveStart ICImagingControl1.MemorySnapImage ' Do something with the image - for instance: ICImagingControl1.MemorySaveImage "Triggered.bmp" End Sub Activating The Strobe Output FireWire cameras typically have a set of properties - such as "exposure time" or "gain". IC Imaging Control makes these properties available in the class VCDSimpleProperty. The program begins by defining the variable VCDProp that will later contain these properties.

Secondly, the video Device is assigned (in this case the FireWire camera DMK 21BF04) and then we define a VideoFormat. The function GetSimplePropertyContainer assings the properties of the opened camera to the variable VCDProp.

The command VCDProp.Switch(VCDID_Strobe) = True activates the strobe output. Therefore, after having started the camera with LiveStart, pin 6 (see page 1) indicates the CCDs exposure.

Private Sub Form_Load() Dim VCDProp As VCDSimpleProperty ICImagingControl1.Device = "DMK 21BF04" ICImagingControl1.VideoFormat = "Y800 (640x480)" Set VCDProp = GetSimplePropertyContainer(ICImagingControl1.VCDPropertyItems) VCDProp.Switch(VCDID_Strobe) = True ICImagingControl1.LiveStart End Sub Reading The Digital Input The first three program lines are similar to those of the preceeding example (Activating the strobe output). The main difference is to be found at the programs end: The command VCDProp.OnePush VCDElement_GPIORead reads the digital inputs state, while Debug.Print VCDProp.RangeValue(VCDElement_GPIOIn) indicates this state in terms of a debug output.

Private Sub Form_Load() Dim VCDProp As VCDSimpleProperty ICImagingControl1.Device = "DMK 21BF04" Set VCDProp = GetSimplePropertyContainer(ICImagingControl1.VCDPropertyItems) VCDProp.OnePush VCDElement_GPIORead Debug.Print VCDProp.RangeValue(VCDElement_GPIOIn) End Sub Setting The Digital Output The first three program lines are similar to those of the preceeding example (Reading the digital input). The main difference is to be found at the programs end: The command VCDProp.RangeValue sets the variable VCDElement_GPIOOut to 0, whereupon VCDProp.OnePush VCDElement_GPIOWrite copies the content of this variable (0 in our case) to the digital output.

Private Sub Form_Load() Dim VCDProp As VCDSimpleProperty ICImagingControl1.Device = "DMK 21BF04" Set VCDProp = GetSimplePropertyContainer(ICImagingControl1.VCDPropertyItems) VCDProp.RangeValue(VCDElement_GPIOOut) = 0 VCDProp.OnePush VCDElement_GPIOWrite End Sub