LabWindows/CVI

cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

ViScanf invalid format string due to #sample size data1, data2,... response

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

 

0 Kudos
Mensagem 1 de 6
5.130Exibições

Just a guess without trying it myself, did you consider the format string

 

%*[^\n]

 

to discard the first line?

0 Kudos
Mensagem 2 de 6
5.120Exibições

So you mean this?  If so, I no longer get the error, but all my data is 0.00.

 

viScanf (vi, "%*[^\n]", fbuf);

0 Kudos
Mensagem 3 de 6
5.107Exibições

What NI software are you using? CVI? 

Seems like this forum post here talks about a similar issue.

National Instruments
Applications Engineer
0 Kudos
Mensagem 4 de 6
5.083Exibições

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.

0 Kudos
Mensagem 5 de 6
5.073Exibições

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

 

0 Kudos
Mensagem 6 de 6
5.069Exibições