Hi
I have a problem measuring a frequency of 2.5 Mhz with counter 1 en 2 with counter 0 as a gate signal of 100 Khz
With the code snippet I get an error gpctrDataLossError (on the Watch function)
This code snippet worked fine, but now I have this error, and I have not changed anything.
checkInstErr(GPCTR_Control(iDevice, ND_COUNTER_0, ND_RESET),NI6602);
checkInstErr(GPCTR_Set_Application(iDevice, ND_COUNTER_0,ND_PULSE_TRAIN_GNR),NI6602);
checkInstErr(GPCTR_Change_Parameter(iDevice, ND_COUNTER_0, ND_SOURCE,ND_INTERNAL_100_KHZ),NI6602);
checkInstErr(GPCTR_Change_Parameter(iDevice, ND_COUNTER_0, ND_COUNT_1,ulLOWcount),NI6602);
checkInstErr(GPCTR_Change_Parameter(iDevice, ND_COUNTER_0, ND_COUNT_2,ulHIGHcount),NI6602);
checkInstErr(Select_Signal(iDevice, ND_GPCTR0_OUTPUT, ND_GPCTR0_OUTPUT,ND_LOW_TO_HIGH),NI6602);
checkInstErr(GPCTR_Control(iDevice, ND_COUNTER_0, ND_PROGRAM),NI6602);
printf(" Frequency squarewave generation started...\n");
checkInstErr(GPCTR_Control(iDevice, ND_COUNTER_1, ND_RESET),NI6602);
checkInstErr(GPCTR_Set_Application (iDevice, ND_COUNTER_1, ND_BUFFERED_EVENT_CNT),NI6602);
checkInstErr(GPCTR_Config_Buffer(iDevice,ND_COUNTER_1,0,1000,Buffer),NI6602);
checkInstErr(GPCTR_Change_Parameter(iDevice, ND_COUNTER_1, ND_SOURCE,ND_PFI_35),NI6602);
checkInstErr(GPCTR_Change_Parameter(iDevice, ND_COUNTER_1, ND_GATE,ND_OTHER_GPCTR_OUTPUT),NI6602);
checkInstErr(GPCTR_Change_Parameter(iDevice, ND_COUNTER_1, ND_INITIAL_COUNT, 0),NI6602);
checkInstErr(GPCTR_Change_Parameter(iDevice, ND_COUNTER_1, ND_BUFFER_MODE, ND_SINGLE),NI6602);
checkInstErr(GPCTR_Control(iDevice, ND_COUNTER_1, ND_PROGRAM),NI6602);
do {
checkInstErr(GPCTR_Watch(iDevice, ND_COUNTER_1, ND_ARMED,&ulArmed),NI6602);
//iRetVal = NIDAQYield(iYieldON);
} while (ulArmed == ND_YES);
// After the counter is unarmed, read the buffer from the beginning.
checkInstErr(GPCTR_Read_Buffer(iDevice, ND_COUNTER_1, ND_BUFFER_START,ulReadOffset, ulNumPtsToRead, ulTimeOut, &ulNumPtsRead, Buffer),NI6602);
for (count=1;count
printf("Punt %i is %i Frequentie is %lf\n",count,Buffer[count],(1/(10E-3/(Buffer[count]-Buffer[count-1]))));
}
checkInstErr(GPCTR_Control(iDevice, ND_COUNTER_0, ND_RESET),NI6602);
checkInstErr(GPCTR_Control(iDevice, ND_COUNTER_1, ND_RESET),NI6602);
An idea what the problem is ?
What does an gpctrDataLossError mean ?