ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx conversion

Solved!
Go to solution

 Hello? I'm still working on conversion from DAQ to DAQmx.

We have a SCAN_Start function needed to be converted.

 

Old code is

 //err = SCAN_Start( 1, dbuffer, sampleCount,  0, sampleTicks,     0, GroupTicks    );

 

New code is

 int32   read=500; //sampleTicks*10;
 float64   data[8000];

 DAQmxErrChk(DAQmxCreateTask("", &SCAN_Handle));
 DAQmxErrChk(DAQmxCreateAIVoltageChan(SCAN_Handle,"Dev1/ai0:3","",DAQmx_Val_Diff,-10.0,10.0,DAQmx_Val_Volts,NULL));
 DAQmxErrChk(DAQmxGetAIGain(SCAN_Handle, "Dev1/ai0:3" /*(const char*)channel*/ , (double*)gain)); //SCAN_Setup
 DAQmxErrChk(DAQmxSetAIConvTimebaseDiv(SCAN_Handle, 500)); //sampleTicks*10
 DAQmxErrChk(DAQmxSetSampClkTimebaseDiv(SCAN_Handle, 2000)); //GroupTicks*10
 DAQmxErrChk(DAQmxCfgDigEdgeStartTrig(SCAN_Handle, "/Dev1/PFI0", DAQmx_Val_Rising ));
 DAQmxErrChk(DAQmxCfgSampClkTiming(SCAN_Handle,"",samplePerChanPerSec,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,sampleCounts)); // Analog channel timing, trigger
 DAQmxErrChk(DAQmxReadAnalogF64(SCAN_Handle,800,10.0,DAQmx_Val_GroupByChannel,data,sampleCounts,&read,NULL));
 DAQmxErrChk(DAQmxStartTask(SCAN_Handle));

 

But new code returns countless errors saying "The specific resource is reserved. The operation could not be completed as specified. The status code: -50103." 

 

1. Is this happening due to the sane handler name on different functions?

 

2. And the conversion is right?

 

3. I assume that dbuffer of DAQ is data of DAQmx. Is this right?

 

4. How old DAQ code SCAN_Start returns dbuffer value?

 

 

Thanks,

I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 1 of 2
(3,061 Views)
Solution
Accepted by topic author anarkie

Ok, I think I found the problem. The conversion code is right and working fine but somehow it was disabled by 'power off' subroutine in my code. Currently I commented it out and it works fine.

 

But I still have a quesion about how dbuffer data is returned.

 

Thanks,

I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 2 of 2
(3,053 Views)