05-27-2010 03:08 AM
Dear All,
I have a problem with my DAQ PCI-6132. I need to acquire signal with a finite sampling. DAQ acquiring signal start by digital edge of start trigger, begin collecting signal until spesified amount of sample have acquired. Its start collecting a finite sample again when another digital edge start trigger have detected.
Therefore, I set digital start trigger attribute as retrigerable. But when I called DAQmxErrChk (DAQmxSetStartTrigRetriggerable(taskHandle,true)), it said that :
DAQmx Error: Specified property is not supported by the device or is not applicable to the task.
Property: DAQmx_StartTrig_Retriggerable
Task Name: _unnamedTask<0>
Status Code: -200452
End of program, press Enter key to quit
First, I think that DAQmx_StartTrig_Retriggerable property is not supported by my DAQ (PCI-6132). But when I read NI-DAQmx C Reference Help, on supported Property by device topic, start retriggerable is one of NI PCI-6132 supported property. Why this error eccur?
My code is same as ContAcq-IntClk-DigStart-Retrig.c
int32 error=0;
TaskHandle taskHandle=0;
char errBuff[2048]={'\0'};
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",1000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,100));
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(taskHandle,"/Dev1/PFI1",DAQmx_Val_Rising));
DAQmxErrChk (DAQmxSetStartTrigRetriggerable(taskHandle,true));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,100,0,EveryNCallback,NULL));
DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
printf("Acquiring samples continuously. Press Enter to interrupt\n");
getchar();
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
Thank You
Solved! Go to Solution.
05-28-2010 03:05 PM
Hi Oktanto,
You card should definitely support retriggerable AI from a digital trigger. Have you tried to run the ContAcq-IntClk-DigStart-Retrig.c code by itself? Also, are you sure that you are running your code on the 6132? Are there any other devices in you chassis? I would also suggest to try to run code that is retriggerable based on an analog trigger. You will also have to make sure that you are not using either of your two counters if you want your AI to be retriggerable. Have you verified this to be the case?
05-28-2010 05:25 PM
Thanks for your reply Rohan,
I have tried to run ContAcq-IntClk-DigStart-Retrig.c
code by my self and even without any modifications, it still give me the same error. The only one devices that installed on my chasis is pci-6132 as dev1. I have tried another example of analog input voltage without a problem, except retrigger command.
I'm using windows 7 pro 32bit, intel core 2 duo 2.4 GHz with memory 3 GB and installed DAQmx 9.0.2. I suggest that error may caused by DAQmx library, therefore I might to try another version of library.
Do you have solution of my problem?
regards,
Oktanto D
06-01-2010 02:44 PM
Hi Oktanto,
I looked at your code in depth, and the only difference that I found, apart from the sampling time and the number of samples, is two lines:
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(taskHandle,"/Dev1/PFI0",DAQmx_Val_Rising));
I think that you are referencing PFI1 in your code, which is the AI Ref Trig. PFI0, which you will want to use, is the AI Start Trig, so you will want to use this one instead of the reference trigger.
DAQmxErrChk (DAQmxSetStartTrigRetriggerable(taskHandle,1));
I believe that you have set it to "true" instead of "1". Although it seems reasonable that using "true" would be equivalent, I suggest you try with "1" just to make sure that everything is in line.
06-03-2010 10:24 PM - edited 06-03-2010 10:25 PM
Thanks Rohan,
I have tried to changed my code from
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(taskHandle,"/Dev1/PFI1",DAQmx_Val_Rising));
DAQmxErrChk (DAQmxSetStartTrigRetriggerable(taskHandle,1));
into
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(CounterHandle,"/Dev1/PFI0",DAQmx_Val_Rising));
DAQmxErrChk (DAQmxSetTrigAttribute (CounterHandle, DAQmx_StartTrig_Retriggerable, TRUE));
as your suggest, but its still give me the same error as before.
DAQmx Error: Specified property is not supported by the device or is not applicable to the task.
Property: DAQmx_StartTrig_Retriggerable
Task Name: _unnamedTask<0>
Status Code: -200452
End of program, press Enter key to quit
I don't know why this error is happen, cause I thing that I was doing in line. This is standart example code (ContAcq-IntClk-DigStart-Retrig.c) that I have compiled but still give me the same error :
#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData);
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData);
int main(void)
{
int32 error=0;
TaskHandle taskHandle=0;
char errBuff[2048]={'\0'};
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000));
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(taskHandle,"/Dev1/PFI0",DAQmx_Val_Rising));
DAQmxErrChk (DAQmxSetStartTrigRetriggerable(taskHandle,1));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,1000,0,EveryNCallback,NULL));
DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
printf("Acquiring samples continuously. Press Enter to interrupt\n");
getchar();
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
printf("End of program, press Enter key to quit\n");
getchar();
return 0;
}
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
{
int32 error=0;
char errBuff[2048]={'\0'};
static int totalRead=0;
int32 read=0;
float64 data[1000];
/*********************************************/
// DAQmx Read Code
/*********************************************/
DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByScanNumber,data,1000,&read,NULL));
if( read>0 ) {
printf("Acquired %d samples. Total %d\r",read,totalRead+=read);
fflush(stdout);
}
Error:
if( DAQmxFailed(error) ) {
DAQmxGetExtendedErrorInfo(errBuff,2048);
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
printf("DAQmx Error: %s\n",errBuff);
}
return 0;
}
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData)
{
int32 error=0;
char errBuff[2048]={'\0'};
// Check to see if an error stopped the task.
DAQmxErrChk (status);
Error:
if( DAQmxFailed(error) ) {
DAQmxGetExtendedErrorInfo(errBuff,2048);
DAQmxClearTask(taskHandle);
printf("DAQmx Error: %s\n",errBuff);
}
return 0;
}
Thanks
Regards,
Oktanto
06-04-2010 05:06 PM
Hi oktanto,
I simulated the device, but I was not able to run a retriggerable analog input VI. It seems like this property is not supported by the 6132. There may be a workaround that is possible: you may be interested in the following example code. Although it is a little bit older, it should probably still work for you
06-05-2010 03:18 AM
06-07-2010 04:56 PM
Hi Oktanto,
If you wanted to use an external clock to create a counter output for synchronization purposes, you can import the clock source on a PFI line and use the DAQmx Connect Terminals.VI to route the imported clock to the 20MHz timebase. Now the counter output you generate will be based on the imported clock source.
01-06-2011 03:46 AM
I also have the same issue with a PCI-6110 card that should also support this property
The file links on the suggested alternative code are broken
01-07-2011 10:08 AM
Hi IChodera,
The link seems to still be working on my side, it is a link to a DevZone with a few examples that may be useful to you. I will repost the full link here: http://sine.ni.com/devzone/cda/epd/p/id/2345. Does this work for you, or are you talking about links internal to the document?