You can execute a trigger with the
This function is equivalent to writing the
Execute Trigger) GPIB command to the instrument.
trigger instructs all the addressed Listeners
to perform some instrument-specific function such as taking a measurement.
Refer to your instrument documentation to learn how to use its triggering
This example illustrates GPIB triggering using an Agilent® 33120A function generator. The output of the function generator is displayed with an oscilloscope so that you can observe the trigger.
Create an instrument
object — Create the GPIB object
with a National Instruments® GPIB controller with board index 0,
and an instrument with primary address 1.
g = gpib('ni',0,1);
Connect to the instrument —
g to the function generator.
Write and read data — Configure the function generator to produce a 5000 Hz sine wave, with 6 volts peak-to-peak.
fprintf(g,'Func:Shape Sin') fprintf(g,'Volt 3') fprintf(g,'Freq 5000')
Configure the burst of the trigger to display the sine wave for five seconds, configure the function generator to expect the trigger from the GPIB board, and enable the burst mode.
fprintf(g,'BM:NCycles 25000') fprintf(g,'Trigger:Source Bus') fprintf(g,'BM:State On')
Trigger the instrument.
Disable the burst mode.
While the function generator is triggered, the sine wave is saved to the Ref A memory location of the oscilloscope. The saved waveform is shown below.
Disconnect and clean
up — When you no longer need
you should disconnect it from the instrument, and remove it from memory
and from the MATLAB® workspace.
fclose(g) delete(g) clear g