LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop and array, with index enabled, gpib read values all zero

Hi, I am using a while loop to read both time stamp and Gpib port reading.
I used the enabled indexing. I also attached a screenshot of my diagram.
However, in the result array, only the timestamp column has non-zero values. The reading from gpib are all zero. I used the probe, it is not zero until it reached the loop boundary.
I tried to search on our forum, but some shift register example is using 6.0, mine is 6.1, can not really see them.
Also, why the indexing method works for timestamp but not gpib?
 
Thank you very much.
0 Kudos
Message 1 of 8
(3,899 Views)
There must be something wrong, but it is impossible to tell from the picture. Would you mind attaching the actual VI? 🙂
 
What are your typical data values? (For example if it is less than 0.01, formatting as %9.2f would turn it into zero).
0 Kudos
Message 2 of 8
(3,889 Views)
en, the number is pretty small, like 0.0005e-9
I attached the vi files here. 
Thanks a lot.
 
Download All
0 Kudos
Message 3 of 8
(3,886 Views)


@hotrock wrote:
en, the number is pretty small, like 0.0005e-9

Then a format of %9.2f will only display 0.00 Apparently you deleted the format specifier now, so the default of %.3f will be used, which is not much better, you'll get 0.000.

Wire a format of e.g. %e or %g to "write to spreadsheet file" and see if things improve. 🙂

For more details on formatting codes, check the online help.

0 Kudos
Message 4 of 8
(3,881 Views)
Hi, altenbach, 
thanks for the reply.
I tried the new format parameter. But the problem seems reside in the path between the output of "String to number" and "build array". I set up a probe on the path, it always shows a zero.
 
While the other leg with same set up for the timestamp works well?  
0 Kudos
Message 5 of 8
(3,824 Views)
What you need to do is create an indicator on the output of the GPIB Read. Run the VI once so that there is some data in this indicator. On the front panel, go to Operate>Make Current Values Default. Save the VI and repost it. That way, someone can actually look at the VI and determine what the string is without having the instrument. Your String Subset may be incorrect or there could be something else wrong but it's impossible to determine what with the information you have provided. We don't even know the make and model of the instrument you are using.
 
By the way, 'path' is an incorrect term when talking about LabVIEW connections. The connections you make are called 'wires'. A path is where you are saving the file (i.e. C:\folder\example.txt).
0 Kudos
Message 6 of 8
(3,814 Views)
Hi, Dennis, I attached the files with some default value.
The GPIB port got a value of 1.7E-12. the numeric indicator should then show the number but it always gave "0.00".
Thank you.
Download All
0 Kudos
Message 7 of 8
(3,811 Views)
You just have to change the format. Right click on the numeric indicator and select Format & Precision. You've got it as floating point with only 2 digits of precision. Change it to scientific. Then it would match what you are writing to file. Also, you don't need the indicator to be an Ext. Dbl is just fine.
Message 8 of 8
(3,803 Views)