python-3.xnidaqmx

Using nidaqmx to trigger signal in line with behavioural task


I am using the python nidaqmx API to instruct a USB-6009 DAQ to output an analog signal when a tone plays. I am trying to use the API guidelines and also the previous stackoverflow question (Triggering an output task with NIDAQmx) but still need help.

The timing of the tone is set using Psychopy, a python-based behavioural task package.

The general format of this would be:

if tone = on:

trigger_digital_output

I just cannot figure out the code from the nidaqmx documentation to trigger the analog output. Additionally, will I need to specify a digital input (USB-6009 will be connected by USb to my computer).

Thankyou


Solution

  • According to its specifications, the USB-6009 does not have any hardware triggers for analog output, and only a digital edge trigger for analog input.

    So for your analog output task, you would use the same approach as the topic you referenced: use stop() and start() to begin the output each time you want to generate it.

    The Digital I/O on the USB-6009 is only software-timed: the input or output happens on-demand, each time you call the read_one_sample_one_line() or write_one_sample_one_line() functions.

    To get started with the full DAQ commands, there are a few Python examples on GitHub