Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

analog input waveform with 6236

Hey NI Experts,

I've tried to solve this on my own, now it's time to turn to the experts.  All I am trying to do is send two different analog out signals at the same time on an NI 6731 PCI board.  The timing doesn't have to be different or anything like that, I just need to send constant output voltages for a certain amount of time.  I'm new to programing in c, so I'm sure my problem is a simple one, but I cannot find a direct answer.

I understand that I need to make my channel Dev1/ao0:1 and I define my sample array as because previous threads have said I need one column for each channel.

    // Data write parameters
    float64     data[2][bufferSize];

    for(;i<bufferSize;i++) {
      data[0][i] = xvolt;
      data[1][i] = yvolt;
    }

Where bufferSize is 512 and xvolt and yvolt are different constants.  But when I put it into

    DAQmxErrChk (DAQmxBaseCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxBaseCreateAOVoltageChan(taskHandle,chan,"",min,max,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxBaseCfgSampClkTiming(taskHandle,"",sampleRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,samplesPerChan));
    DAQmxErrChk (DAQmxBaseWriteAnalogF64(taskHandle,samplesPerChan,0,timeout,DAQmx_Val_GroupByChannel,data,&pointsWritten,NULL));

I get the error: "warning: passing argument 6 of ‘DAQmxBaseWriteAnalogF64’ from incompatible pointer type"

And when the code is executed, the DAQ card gives the yvolt value to both ao channels and ignores the xvolt data.  Can you help me clear this up?

Thanks,
Mark
0 Kudos
Message 11 of 12
(1,014 Views)
Hi Mark

 

Thank you for using our discussion forums.

 

In the future can you please post a new question in new thread and reference any other forums that may be on interest.

 

The DAQmx write VI in LV works differently than the DAQmxBaseWriteAnalogF64 c function with respect to the data that you pass to it. 

 

Have a look at the following link.  The 4th post describes how you should use this function.

 

Is there any reason you are using the DAQmx base driver rather than DAQmx.  If you are using windows then I would suggest using the full DAQmx driver as it is much more robust.

 

Chris_K

 
0 Kudos
Message 12 of 12
(969 Views)