Exporting a DAQmx Signal in Python

Updated Mar 12, 2025

Environment

Driver

  • NI-DAQmx

Programming Language

  • Python

I have set up a data acquisition task using the python DAQmx API for python. How can I export a trigger signal from my device, e.g. a start-trigger signal?

In order to export a clock- or trigger signal from a DAQmx-task, the method "export_signal(signal_id, output_terminal)"
has to be used.


It is documented in the DAQmx python API documentation .

 

As a result, a clock- or trigger signal will be exported to a PXI- or RTSI-trigger line, depending on the device being used. See the example code in the Example section.

In this example code snippet, a start trigger of an analog input task is exported to PXI-Trigger 0:

import pprint
import nidaqmx

pp = pprint.PrettyPrinter(indent=4)


with nidaqmx.Task() as task:
    task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
    task.export_signals.export_signal(signal_id=nidaqmx.constants.Signal.START_TRIGGER,
    output_terminal="Dev1//PXI_Trig0")


    print('1 Channel 1 Sample Read: ')
    data = task.read()
    pp.pprint(data)

    data = task.read(number_of_samples_per_channel=1)
    pp.pprint(data)

    print('1 Channel N Samples Read: ')
    data = task.read(number_of_samples_per_channel=8)
    pp.pprint(data)