12-11-2014 04:43 AM - edited 12-11-2014 05:00 AM
OS: Mac OSX Yosemite 10.10.1
NIDAQ: USB-6008
Driver: NI-DAQmx_Base 14.0.0
Environment: Xcode 6.1.1
I'm trying to get the frequency measurement function to work on my mac, and I'm running into endless problems:
(Note: I've developed the same code on a Windows machine where everything work as expected.)
First of all, I can get only a single example from the "Examples" directory to run, but only using it exactly as it is. If I change anything, it doesn't work. For example,
changing DAQmx_Val_Falling --> DAQmx_Val_Rising I get the error code: -200077: <err>Requested value is not a supported value for this property.
If I change:
DAQmxBaseReadCounterScalarU32 --> DAQmxBaseReadCounterU32 I get the error code: -200428: Value passed to the Task/Channels In control is invalid.
If I copy and paste the example code: (and run with and without the minor modifications shown below)
static int gRunning=0;
void main(int argc, char *argv[])
{
// Task parameters
int32 error = 0;
TaskHandle taskHandle = 0;
char errBuff[2048]={'\0'};
time_t startTime;
// Channel parameters
char chan[] = "Dev1/ctr0";
// Timing parameters
#define bufferSize 100
// Data read parameters
uInt32 data[bufferSize];
int32 samplesToRead = 100;
float64 timeout = 10.0;
int32 read;
DAQmxErrChk (DAQmxBaseCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxBaseCreateCICountEdgesChan(taskHandle,chan,"",DAQmx_Val_RisingFalling,0,DAQmx_Val_CountUp));
//DAQmxErrChk (DAQmxBaseCfgSampClkTiming(taskHandle,clockSource,sampleRate,DAQmx_Val_Falling,DAQmx_Val_ContSamps,samplesPerChan));
DAQmxErrChk (DAQmxBaseStartTask(taskHandle));
gRunning = 1;
// The loop will quit after 10 seconds
startTime = time(NULL);
while( gRunning && time(NULL)<startTime+10 ) {
DAQmxErrChk (DAQmxBaseReadCounterU32(taskHandle,samplesToRead,timeout,data,samplesToRead10,&read,NULL));
printf("Acquired %ld samples\n",read);
}
Error:
if( DAQmxFailed(error) )
DAQmxBaseGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
DAQmxBaseStopTask(taskHandle);
DAQmxBaseClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf ("DAQmxBase Error %ld: %s\n", (int long)error, errBuff);
return 0;
}
I get the error code. -200428
Summary:
DAQmx_Val_Falling doesn't work
DAQmxBaseReadCounterU32 doesn't work
Any help would be greatly appreciated.
12-12-2014 04:44 AM
Hi roi3i3ie,
you said that this is the only example which you get to run.
Did you only try the examples we provide for the counter based acquisiton?
Are the examples we provide for DI/O or analog acquisition working?
Best regards,
Andi
12-12-2014 04:54 AM - edited 12-12-2014 04:54 AM
Hi Andi,
Thanks for the reply!
No, I only tested these ones. I'm under a bit of time pressure, so I couldn't test everything. I'm also not really using these functions in my final program, as I have some nice GPIB controllable equipment.
If I get an opportunity, I can test these too and report back.
- Rob