Trigger Service

NI-VISA

Trigger Service

Most instruments can be instructed to wait until they receive a trigger before they start performing operations such as generating a waveform, reading a voltage, and so on. Under GPIB, this trigger is a software command sent to the device. Under VXI, this could either be a software trigger or a hardware trigger on one of the multiple TTL/ECL trigger lines on the VXIbus backplane.

VISA uses the same operation—viAssertTrigger()—to perform these actions. Which trigger method (software or hardware) you use is dependent on a combination of an attribute (VI_ATTR_TRIG_ID) and a parameter to the operation. For example, to send a software trigger by default under either interface, you use the following code.

status = viSetAttribute(instr, VI_ATTR_TRIG_ID, VI_TRIG_SW);
status = viAssertTrigger(instr, VI_TRIG_PROT_DEFAULT);

Of course, you need to set the attribute only once at the beginning of the program, not every time you assert the trigger. If you want to assert a VXI hardware trigger, such as a SYNC pulse, you can use the following code.

status = viSetAttribute(instr, VI_ATTR_TRIG_ID, VI_TRIG_TTL3);
status = viAssertTrigger(instr, VI_TRIG_PROT_SYNC);

Keep in mind that VISA currently uses device triggering. That is, each call to viAssertTrigger() is associated with a specific device through the session used in the call. However, the VXI hardware triggers by definition have interface-level triggering. In other words, you cannot prevent two devices from receiving a SYNC pulse of TTL3 if both devices are listening to the line. Therefore, if you need to trigger multiple devices off a single VXI trigger line, you can do this by sending the trigger to any one of the devices on the line.