Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

pci 6132 retriggerable

Solved!
Go to solution

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

 

 

 

0 Kudos
Message 1 of 14
(11,530 Views)

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?

Best regards,
Rohan B
0 Kudos
Message 2 of 14
(11,495 Views)

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

 

0 Kudos
Message 3 of 14
(11,487 Views)

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.

Best regards,
Rohan B
0 Kudos
Message 4 of 14
(11,437 Views)

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

 

Message Edited by oktanto on 06-03-2010 10:25 PM
0 Kudos
Message 5 of 14
(11,409 Views)
Solution
Accepted by topic author oktanto

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

Best regards,
Rohan B
0 Kudos
Message 6 of 14
(11,386 Views)
Hi Rohan,

Thanks for your link. I have tried this example code before and applied for my applications. Actually this example code give me specified sample each start trigger occur, but there is a problem if I am using counter output pulse generator as source clock AI. Cause I must give external clock for my PCI-6132, only by external clock, VCO for signal modulation and DAQ would be synchronous.

Using counter output, I don't know how to create pulse using external clock. I have search for it, but until now I do not found it.

Regards,
Oktanto Dedi Winarko
0 Kudos
Message 7 of 14
(11,372 Views)

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.

Best regards,
Rohan B
0 Kudos
Message 8 of 14
(11,347 Views)

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

 

0 Kudos
Message 9 of 14
(10,444 Views)

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?

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 10 of 14
(10,424 Views)