You can synchronize National Instruments® devices using the Real-Time System Integration (RTSI) bus. The RTSI bus connects data acquisition boards directly, with no external wiring, allowing you to accurately synchronize the subsystems of a device. It can also synchronize multiple subsystems on multiple devices using a cable. You can eliminate latency in synchronous acquisitions by coordinating the devices using the RTSI bus.
You can configure the system so that the start of the acquisition will trigger the start of the generation of data in the hardware. For example, you can configure the analog input object as the system controlling the start of the analog output object.
this allows the analog input object to start when the
is executed. Set the
to signal on the RTSI bus, which triggers the analog output object.
ai = analoginput('nidaq', 'Dev1'); addchannel(ai, 0); ai.ExternalTriggerDriveLine = 'RTSI0'; ao = analogoutput('nidaq', 'Dev1'); addchannel(ao, 0);
Next, you should set the analog output object to receive a trigger
from the same RTSI line you specified for the analog input object's
ExternalTriggerDriveLine. You should also
To make sure that both the analog input object and the analog output
object start simultaneously, you should also set the analog output
ao.TriggerType = 'HwDigital'; ao.HwDigitalTriggerSource = 'RTSI0'; ao.TriggerCondition = 'PositiveEdge';
You should start your analog output object first, and then the analog input object. The analog output object starts, but will not send data until the analog input object starts.
putdata(ao, zeros(1000,1)); start(ao); start(ai);
When the analog input object is started, it will send a pulse on the RTSI bus. The analog output object detects this pulse and starts almost simultaneously.