Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing AO and Digital/Counter to a single Counter clock (NI PCIe-6321, X Series DAQ (16 AI, 24 DIO, 2 AO) card) using Daqmx functions

 

Hello,

 

here's the synopsis of what I would like to achieve: 

 

CounterIO.png

 

Can anyone guide me with the channel configuration/creation and sequence of task execution?

 

warmest regards,

 

Ravi

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

I configured my code the following way and things seem to be in order. The biggest realization was that, on interleaving the samples to be written to different channels, and setting up the trigger, all channels are written to at the same rising/falling counter pulse. So my previous schematic was incorrect. Also, using the counter clock to trigger another, and adjusting the initial delay of that counter wrt the clock, I was able to achieve my goals. 

 

#Constants for Counter
LOW_TIME_D = 0.05
HIGH_TIME_D = 0.02
DELAY_D = 0.02

LOW_TIME_C = 0.03
HIGH_TIME_C = 0.04

# DAQmx Configure Code (Counter Clock) DAQmxCreateTask("",byref(taskHandleC)) DAQmxCreateCOPulseChanTime(taskHandleC,"DAQ/ctr2","",DAQmx_Val_Seconds, DAQmx_Val_Low,0.00,LOW_TIME_C,HIGH_TIME_C) DAQmxCfgImplicitTiming(taskHandleC,DAQmx_Val_FiniteSamps,TotalSamps+1) # DAQmx Configure Code (Counter Laser Trigger) DAQmxCreateTask("",byref(taskHandleD)) DAQmxCreateCOPulseChanTime(taskHandleD,"DAQ/ctr0","",DAQmx_Val_Seconds, DAQmx_Val_Low,DELAY_D,LOW_TIME_D,HIGH_TIME_D) DAQmxCfgImplicitTiming(taskHandleD,DAQmx_Val_FiniteSamps,TotalSamps) DAQmxCfgDigEdgeStartTrig(taskHandleD, "PFI14", DAQmx_Val_Falling) # DAQmx Configure Code (Analog Outputs) DAQmxCreateTask("",byref(taskHandleAO)) DAQmxCreateAOVoltageChan(taskHandleAO,"DAQ/ao0:1","",-9.0,9.0,DAQmx_Val_Volts,None) DAQmxCfgSampClkTiming(taskHandleAO,"PFI14",1000,DAQmx_Val_Falling, DAQmx_Val_FiniteSamps,TotalSamps) # DAQmx Write Voltage Values DAQmxWriteAnalogF64(taskHandleAO,TotalSamps,0,2.0, DAQmx_Val_GroupByScanNumber,VoltageXY,None,None) # DAQmx Start Code DAQmxStartTask(taskHandleAO) DAQmxStartTask(taskHandleD) #Start Counter DAQmxStartTask(taskHandleC) DAQmxWaitUntilTaskDone(taskHandleC, TotalSamps*2*TOT_TIME)

Sample Data from oscilloscope: (I think the noise is from the data acquisition process). X -Axis (time: seconds). Y- Volts. 

 

OscilloscopeReadouts.png

 

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