08-13-2014 04:53 AM - edited 08-13-2014 05:13 AM
Hello
i work with this example and a ni USB 6152.
#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int main(void)
{
int error=0;
int i=0;
TaskHandle taskHandle=0;
int32 read;
uInt32 data[1000000];
char errBuff[2048]={'\0'};
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateCICountEdgesChan(taskHandle,"Dev1/ctr0","",DAQmx_Val_Rising,0,DAQmx_Val_CountUp));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/80MHzTimebase",80000000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000000));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
printf("Continuously reading. Press Ctrl+C to interrupt\n");
while( 1 ) {
/*********************************************/
// DAQmx Read Code
/*********************************************/
DAQmxErrChk (DAQmxReadCounterU32(taskHandle,1000000,10.0,data,1000000,&read,NULL));
printf("\rAcquired %d samples\n",read);
for(i=0;i<1000000; i++)
{
printf("%d\r\n", data[i]);
}
fflush(stdout);
}
Error:
puts("");
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;
}
But how can i work with the 80Mhz Timebase and set the trigger point to 0Volt?? I measure that the triggerpint is round 1,7 Volt.
I have a sinus signal who is varius between 0hz and 6khz. And need exact cointing and the default 100khz Timetabel ist not exact enouh. With my 1MHZ test signalhe doesn't count all .
How can i route the 80Mhz timetable to the counter as external clock for solving my problem..
Thanks for helping me.
08-18-2014 06:09 AM
Hi,
there is a function called vielen "DAQmxSetCICtrTimebaseSrc" which should do what you want. You can find it in the reference help on the following link:
http://zone.ni.com/reference/en-XX/help/370471W-01/mxcprop/attr0143/
Do you really have an USB-6152? I was looking after it on ni.com, but could not find the device anywhere...
Have a nice day,
Janina
08-18-2014 08:23 AM
Sorry I have a 6259.
i will try to use "DAQmxSetCICtrTimebaseSrc".
thank you.