Hi all,
hope you can help me.
In a scheduled process we are setting the voltage output on a specific AO channel. The first couple of times it works, but after 3,4 times the DAQ returns the error -200287.
Below is the C code, pretty straight forward. Yes this is JNI as we call the C code from a Java environment but this should be an issue.
The error description of -200287 is totally unclear to me:
Attempted to write to an invalid combination of position and offset. The
position and offset specified a sample prior to the first sample generated
(sample 0). Make sure any negative write offset specified will select a valid
sample when combined with the write position.
Can anyone explain what this error means and perhaps based on the code below identify possible mistakes?
Thanks,
The C code:
JNIEXPORT jint JNICALL Java_com_es_suite_devices_ni_PCI6221_analogGroupOutput
(JNIEnv *env, jobject obj, jint group, jdoubleArray dArray, jint noOfValues) {
double *doubleArray = malloc(noOfValues*sizeof(double));
doubleArray = (*env)->GetDoubleArrayElements(env,dArray,0);
float64 *writeArray = malloc(noOfValues*sizeof(float64));
int i;
for(i=0;i<noOfValues;i++) writeArray[i] = (float64)doubleArray[i];
error = checkDAQError(DAQmxWriteAnalogF64(outputTaskArray[group],noOfValues,TRUE,
DAQmx_Val_WaitInfinitely,DAQmx_Val_GroupByChannel ,writeArray, NULL, NULL));
free(writeArray);
return error;
}