08-07-2013 02:23 PM
I'm writing a program which will utilize the internal memeory of the Agilent 34410A DMM for making fast measurements (10K/s). In order to do this, I need to setup a test, have the data stored to the internal memory, then read and delete it, while other measurements are still happening. The best command for the read/delete function is the R? command, but it returns the data in a strange format which breaks the ViScanf format string.
an example of the R? reading in below:
R? 2
#231+2.87536000E-04,+3.18131400E-03
Is there a way to setup the ViScanf format string to handle this?
Thanks
Ryan
08-08-2013 01:24 AM
Just a guess without trying it myself, did you consider the format string
%*[^\n]
to discard the first line?
08-09-2013 08:54 AM
So you mean this? If so, I no longer get the error, but all my data is 0.00.
viScanf (vi, "%*[^\n]", fbuf);
08-12-2013 10:46 AM
What NI software are you using? CVI?
Seems like this forum post here talks about a similar issue.
08-12-2013 11:15 AM
Yes, I am using CVI
If it was just returning one value I would use a simple viScanf function like this:
viScanf (vi, "%f", fbuf);
If you do a READ from in the instrument, it returns an array of floats so you need to adjust you viScan fuction parse the string into an array of floats like this (array of 500 for this example):
viScanf(vi, "%,500f", fbuf);
The problem is the data response to the R? command starts with the array size and is then followed by the data (#231+2.87536000E-04,+3.18131400E-03). In the previous example, I need to delete the #, and parse the 231 into an array size variable and then fill an array (fbuf in this case) with the data.
08-12-2013 11:31 AM
While my earlier comment was meant as suggestion of how to discard the first line
R? 2
I'll try again with a suggestion that includes your second line:
%*[^#]%d%,500f
The %*[^#] is supposed to discard everyting until the '#' character, with %d you read the integer value, and then follows your array of floats