Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Signal I/O with NI-IMAQ in VB

4 ratings | 3.50 out of 5
Print

General

You can configure triggers and pulses for signal I/O in Microsoft Visual Basic either programmatically or by using the property pages. The property pages are fairly straight forward. However, programmatically configuring signal I/O requires more understanding about pulses and signals and configuring them in Visual Basic.

NI-IMAQ includes three Visual Basic functions you can use to configure signal lines. CWIMAQ.AcquireImage and CWIMAQ.Start start the image acquisition. You call CWIMAQ.Configure to configure the signal lines immediately. If you need to drive lines or generate pulses before or after image acquisition, you must use CWIMAQ.Configure. If your application requires signal I/O only during the image acquisition, use CWIMAQ.AcquireImage or CWIMAQ.Start to configure signals.

Triggers


You can use trigger lines to capture events or to drive signal lines. You can use triggers on the external lines or the RTSI lines for the following National Instruments devices:
  • PXI/PCI-1409
  • PXI/PCI-1422
  • PXI/PCI-1424
  • PXI/PCI-1428

You can trigger the start of an acquisition, the start of each image, and the start of each line. You can route internal signals such as the HSYNC, VSYNC, frame start, and frame done to external devices using the trigger functions. To configure trigger lines, you use the Signal I/O tab of the Visual Basic property pages for the CWIMAQ control.



This illustration shows how to configure a signal line on external line 0 to trigger the start of the acquisition.



This illustration shows how to configure the device to route the HSYNC signal over to RTSI line 0.

You can use the following code to configure signals programmatically:

CWIMAQ1.Signals(1).Initialize cwimaqExternal, cwimaqCaptureStart, cwimaqActiveHigh, 0

CWIMAQ1.Signals(1).Initialize cwimaqRTSI, cwimaqDriveHsync, cwimaqActiveHigh, 0

Examples:
Factors to Consider when Triggering

Triggered Starting and/or Stopping of an Acquisition

Pulse Generation


The following devices can generate pulses:
  • PXI/PCI-1409
  • PXI/PCI-1422
  • PXI/PCI-1424
  • PXI/PCI-1428
Generating pulses is very similar to driving triggers except that each trigger line must have a signal line associated with it.



This illustration demonstrates generating a continuous pulse train on external line 0 with a pulse delay and width of 1.0s.

You can use the following code to programmatically generate a continuous pulse train:

CWIMAQ1.Signals.Add
CWIMAQ1.Signals(1).Initialize cwimaqExternal, cwimaqGeneratePulse, cwimaqActiveHigh, 0

CWIMAQ1.Pulses.Add
CWIMAQ1.Pulses(1).Initialize 1.0, 1.0, cwimaqTrain, cwimaqActiveHigh, cwimaqImmediate

Set CWIMAQ1.Signals(1).Pulse = CWIMAQ1.Pulses(1)

The signal source property of a pulse train determines which signal triggers the start of the pulse train. You can use a variety of signals to trigger the start of the pulse.

Signal Occurrences


You can use signal occurrences to trigger a software event with a variety of signals, which is useful if you need only to view certain images or perform image processing on specific frames. To enable the signal occurrence, use the EnableSignalOccurrence method on the CWIMAQ control. You can use both internal signals, such as frame start and buffer complete, and external signals from external trigger lines or RTSI to trigger the signal occurrence.

Signal Occurrences in Microsoft Visual Basic

Integration


Integration is a key component to many systems. Using hardware signal lines is the best way to integrate several processes. Typically, motion, vision, and data acquisition systems share common ground in many applications. Two examples are using a DAQ board to trigger the acquisition of a frame at a certain reading or using a Motion board to log the position of the image acquisition. The success of these applications is dependent on the ability to share signals such as motion breakpoints), data acquisition scan clocks, and vision sync signals.

Examples:
Synchronizing Motion, Vision, and Data Acquisition

LL Triggered Ring (with DAQ)

Synchronize DAQ with IMAQ in Visual Basic

4 ratings | 3.50 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).