Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I generate a trigger on the PXI backplane using a PXI-6289 DAQmx?

I need to synchronize changing an Analog output Dev1/ao0 on my PXI-6289 DAQmx with an acquisition on another instrument in the PXI. Unfortunately, most of the documentation and examples I've found give more details on how to acquire rather than generate a trigger. I have been experimenting with two methods.

 

1) Just specify the AO channel in setting up the task:

 

const char *outputTerminal = "PXI_Trig5";
TaskHandle  H2LtaskHandle=0;
char        ao_chan[256] = "Dev1/ao0";     
char        do_chan[256] = "Dev1/port0/line0";  
.

.

.

error = DAQmxCreateTask("",&H2LtaskHandle);
error = DAQmxCreateAOVoltageChan (H2LtaskHandle, ao_chan, "", 0.0, 5.0, DAQmx_Val_Volts, NULL);
// error = DAQmxSetOnDemandSimultaneousAOEnable(H2LtaskHandle, 1);  // I'm a little confused on this command
error = DAQmxWriteAnalogScalarF64 (H2LtaskHandle, 1, 1.0, 2.800, 0);      
error = DAQmxExportSignal (H2LtaskHandle, DAQmx_Val_StartTrigger, outputTerminal);   
error = DAQmxStartTask (H2LtaskHandle);      
.

.

.

DAQmxStopTask(H2LtaskHandle);
DAQmxClearTask(H2LtaskHandle);

 

 

2) Add an unused DO channel to the task to generate the trigger on the backplane:

 

const char *outputTerminal = "PXI_Trig5";
TaskHandle  H2LtaskHandle=0;
char        ao_chan[256] = "Dev1/ao0";     
char        do_chan[256] = "Dev1/port0/line0";  
.

.

.

error = DAQmxCreateTask("",&H2LtaskHandle);
error = DAQmxCreateDOChan (H2LtaskHandle, "DAQ/port0/line0", "", DAQmx_Val_ChanPerLine);
error = DAQmxCfgDigEdgeStartTrig (H2LtaskHandle, outputTerminal, DAQmx_Val_Rising);
error = DAQmxCreateAOVoltageChan (H2LtaskHandle, ao_chan, "", 0.0, 5.0, DAQmx_Val_Volts, NULL);
error = DAQmxWriteAnalogScalarF64 (H2LtaskHandle, 1, 1.0, 2.800, 0);      
error = DAQmxStartTask (H2LtaskHandle);      
.

.

.

DAQmxStopTask(H2LtaskHandle);
DAQmxClearTask(H2LtaskHandle);

 

The first method runs error free, but the other instrument does not see the trigger. The second method still has some errors.

 

Any advice is appreciated!

 

Thanks in advance,

 

Sam Broyles

0 Kudos
Message 1 of 2
(3,103 Views)

Hi sam.broyles,

 

 

This KB addresses this topic in LabVIEW.

 

You can use these functions in C just the same as the VIs from that KB. Basically call DAQmxConnectTerms before you start your task and DAQmxDisconnectTerms after you clear your task.


int32 DAQmxConnectTerms (const char sourceTerminal[], const char destinationTerminal[], int32 signalModifiers);


int32 DAQmxDisconnectTerms (const char sourceTerminal[], const char destinationTerminal[]);

 

Then open Measurment & Automation Explorer and open the Device Routes.

 

21934i70B3000A7FAC9928

 

This will show you which routes can be made.  You'll have to pick an output to send a pulse to your PXI_Trig line. This will most likely be a counter, or you could use a dummy task and re-route the start trigger from that task.

 

I hope this helps out!


Regards,

Dustin D

0 Kudos
Message 2 of 2
(3,079 Views)