The tds30xx_Read/Fetch/FetchRawWaveform functions return allways 0 for the initialX ouput parameter.
This is caused by the following piece of code in tkds30xx.c/tkds30xx_FetchRawWaveform() :
viCheckErr( viQueryf (io, ":WFMPRE:%s:YZE?;YMULT?;XINCR?;PT_OFF?;XUNIT?;YUNIT?",
"%le;%le;%le;%ld;\"%[^\"]\";\"%[^\"]\"", dataSource,
yOffset, yMultiplier, xIncrement, &triggerPosition,
xUnits, yUnits));
/* if (strcmp (xUnits, "s") !=0)
viCheckErrElab( IVI_ERROR_INVALID_CONFIGURATION,
"Unable to scale waveform - X Units unknown");
if (strcmp (yUnits, "V") !=0)
viCheckErrElab( IVI_ERROR_INVALID_CONFIGURATION,
"Unable to scale waveform - Y Units unknown.");*/
*initialX = -triggerPosition * (*xIncrement);
The PT_OFF? command is used to get trigger position here. But the TKDS3000 series programmers manual says that PT_OFF? returns allways 0 . You can use the XZERO? command instead, which returns the ininialX value directly. So the following changed code fixes the problem :
/* Get Waveform Attributes */
viCheckErr( viQueryf (io, ":WFMPRE:%s:YZE?;YMULT?;XINCR?;XZERO?;XUNIT?;YUNIT?",
"%le;%le;%le;%le;\"%[^\"]\";\"%[^\"]\"", dataSource,
yOffset, yMultiplier, xIncrement,initialX ,
xUnits, yUnits));
/* if (strcmp (xUnits, "s") !=0)
viCheckErrElab( IVI_ERROR_INVALID_CONFIGURATION,
"Unable to scale waveform - X Units unknown");
if (strcmp (yUnits, "V") !=0)
viCheckErrElab( IVI_ERROR_INVALID_CONFIGURATION,
"Unable to scale waveform - Y Units unknown.");*/
/**initialX = -triggerPosition * (*xIncrement);*/
Can someone of NI please check that fix and include it in the next version of that driver ?
PS: The same problem seems also to exist in tkds30xx_FetchRawMinMaxWaveform()