![]() | AssertTrigger |
Asserts a software or hardware trigger.
virtual HRESULT AssertTrigger(VisaTriggerProtocol eProtocol) abstract;
[in] Trigger protocol to use during the assertion.
Returns S_OK if successful, otherwise a failure HRESULT.
The AssertTrigger function will source a software or hardware trigger dependent on the interface type.
For a GPIB device, the device is addressed to listen, and then the GPIB GET command is sent.
For a VXI device, if the attribute VI_ATTR_TRIG_ID is set to VI_TRIG_SW, then the device is sent the Word Serial Trigger command; for any other values of the attribute, a hardware trigger is sent on the line corresponding to the value of that attribute.
For a serial device or TCP/IP socket, if VI_ATTR_IO_PROT is VI_PROT_4882_STRS (see the SetProtocol function, the device is sent the string "*TRG\n"; otherwise, this operation is not valid.
For a USB device, this function sends the TRIGGER message ID on the Bulk-OUT pipe.
For GPIB, ASRL, USB, and VXI software triggers, VisaTriggerProtocolDefault is the only valid protocol. For VXI hardware triggers, VisaTriggerProtocolDefault is equivalent to VisaTriggerProtocolSync.
For a PXI resource, AssertTrigger will reserve a trigger line for assertion, or release such a reservation. Drivers should use AssertTrigger to ensure that they have ownership of a trigger line before performing any operation that could drive a signal onto that trigger line. The protocol parameter can be either VisaTriggerProtocolOn or VisaTriggerProtocolOff, which reserve a trigger line and release the reservation, respectively.
The following example demonstrates use of the AssertTrigger function.
// CoAcme4321.cpp STDMETHODIMP Acme4321::IAcme4321_Configure() { HRESULT hr = S_OK; hr = io.LowLevel.AssertTrigger(VisaTriggerProtocolSync); return hr; }