LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Correct timing/parsing

Solved!
Go to solution
Solution
Accepted by Cory_K

OK.  If you have about 10 digits per data line the total time to transmit all 21 lines would be around 0.3-0.4 seconds, provided the instrument does not pause between lines.  Then you have more than half a second with nothing coming in.  Here is how I would handle something like this:

 

1. Put empty string into shift register. Set timeout counter to zero (also in a shift register).

2. Read all available bytes with a timeout of 0.1 s.  Append bytes read to string.

3. Did Read timeout? 

   If timeout then increment counter, else go to 2.

4. If counter >=3, then exit loop, else go to 2. 

 

Then put string into Spreadsheet String to Array to get 21 element array.  If the data contains non-numeric characters, set the datatype of the array to string.

 

This would work even if the strings are almost twice as long as what I estimated above.  The timeout and count can be adjusted to meet the specifics of your system.

 

Lynn 

Message 11 of 14
(913 Views)
Just a quick question, if the VISA read times out, it will throw an error, correct?
If so, will that error stop the VI, or can I force it to continue?
Cory K
0 Kudos
Message 12 of 14
(910 Views)

You should get a timeout error.  I do not know what the error code is, but you can find out by test easily enough.

 

To handle the error, wire the error out to logic to handle that error.  This will override the automatic error handling for that VI.

 

Lynn 

0 Kudos
Message 13 of 14
(907 Views)
Great, thanks for all your help
Cory K
0 Kudos
Message 14 of 14
(892 Views)