Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Output not staying at programmed level SetAOIdleOutputBehavior vs. Buffer size

Hello,

hav

I'm writing a function for a PXI-6259, which programms an output voltage on the analog output, but the problem I am having is that I have to write the value twice to the buffer for the output to stay at the programmed voltage, otherwise it is just a pulse value.

 

I am not sure if it is an issue with the buffer size, or the idle output behavior, although I expect the buffer size.

 

The write command currently looks like this.  Keep in mind the function is written in python:

 

def write(self, value):
samples_written = int32(0)
data = np.asarray([value, value], dtype = np.float64)
callc('WriteAnalogF64', self, int32(2), bool32(True), float64(-1), DAQmx_Val_GroupByChannel, data.ctypes.data, ctypes.byref(samples_written), None)

 

with the finite clocking looking like:

def configureSampleClockTiming(self):
callc('CfgSampClkTiming', self, 'OnboardClock', float64(10000), DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, uInt64(2))

 

I have already tried setting the buffer size in  configureSampleClockTiming to 1, and the same for the buffer in the write funciton, but that just causes an error.

 

I have also tried SetAOIdleOutputBehavior with DAQmx_Val_MaintainExistingValue, but this also creates an error:

 

DAQmxErrorAttributeNotSupportedInTaskContext                               (-200452)

any hints?
0 Kudos
Message 1 of 3
(3,033 Views)

Can you built in a short delay?

Maybe it's a timing problem.

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

You shouldn't need to configure timing at all if you just want to update the value of the output to a constant voltage from software.  Pseudocode using the ANSI C function names:

 

//Initialization Routine (once at the start)

DAQmxCreateTask
DAQmxCreateAOVoltageChan

DAQmxStartTask

 

//Make this call whenever you need to update the voltage

DAQmxWriteAnalogF64

 

//Cleanup Routine (once at the end)

DAQmxStopTask
DAQmxClearTask

 

 

The minimum buffer size is 2 if you configure timing (I can't really give a great explanation of why, something to do with the read/write pointers not being identical).  Anyway, for simplicity I would just remove the timing configuration altogether (although you should be able to write the entire buffer with new data with just a single call... not sure why that's not working exactly--you might want to provide the entire sequence of DAQmx calls being made in order that results in the situation you are experiencing.).

 


Best Regards,

John Passiak
0 Kudos
Message 3 of 3
(2,956 Views)