11-25-2009 02:49 PM
Hi there.
I've got at problem with my driver. I receives a string with 2 characters and 8 numbers. But sometimes there's a character between the numbers which makes LabVIEW Stops. How do I work around this problem? Do I need to add something to the Scan from string.vi ? I've included a jpq picture. Thank you for a great software...
11-25-2009 03:22 PM - edited 11-25-2009 03:23 PM
Hi,
You could look for an error when scanning the second part of the string and extract the bit you want like this
Hope this helps
David
11-25-2009 06:01 PM
What do you mean "makes LabVIEW stop"? Stop as in stops the loop? Stop as in you get some error message? Stop as in it crashes in a blazing inferno?
You seem to be reading something off of an instrument, but you are passing in a specific number of bytes to read. Are you saying that the "Bytes Read" is larger than the requested number of bytes you said to read?
11-26-2009 01:50 PM
Hi smercurio_fc.
Well the whole program stops. The program is running in a while-loop, and yes it's collecting a series of numbers- starting with SL and then eight numbers: [01234567] and then it starts reading again and again. The numbers are from two ADC's from a microcontroller. And the microcontroller keeps sending the data. "Stop as in it crashes in a blazing inferno?" <--- Yeah great.. That really made my day.. 🐵
11-26-2009 02:02 PM
Do you have automatic error handling enabled? This would make an error dialog appear whenever an error occurs in a function that does not have the error output wired. The program stalls until you dismiss the dialog.
If you don't care about the error, you could just wire from the error out to the edge of the case structure, for example (once the error_out is wired, automatic error handling is suppressed).
Even better, wire it to a case structure where you can take corrective actions to handle the irregularity, e.g. parse it differently. 😉
11-26-2009 02:33 PM
Hi altenbach.
Well have a look at this picture. The two error indicators helped a lot. BUT when there's a character in the second Scan from String, there's nothing on the chart? Do I have to reset or set something up for the VI or the error thing? When will it come back so I can have a look at the chart?
<Do you have automatic error handling enabled? This would make an error dialog appear whenever an error occurs in a <function that does not have the error output wired. The program stalls until you dismiss the dialog.
-Eh what? Ok is that what I've just have done? Added the two error indicators?
<If you don't care about the error, you could just wire from the error out to the edge of the case structure, for example <(once the error_out is wired, automatic error handling is suppressed).
-Are you referring to the picture with the for- and case-loop?
<Even better, wire it to a case structure where you can take corrective actions to handle the irregularity, e.g. parse it <differently.
- Please help me. How do I do that?
Thanks 🙂
11-26-2009 04:00 PM
11-26-2009 04:32 PM
11-26-2009 04:49 PM
Slynge wrote:Well have a look at this picture. The two error indicators helped a lot. BUT when there's a character in the second Scan from String, there's nothing on the chart?
Yes, if scan form string generates an error, the output will be blank. All you need to do is define a format that successfully scans the string if the extra character is present. Wire the error to a case structure. In the no error case, use the output from the original scan operation. In the error case, scan with the other format.
Please attach a collection of possible inputs for the two cases (character present or not) and tell us what output you want. You just need to write a parser that handles both.
It will also help if you could attach your VI. It's much easier for us than looking at a picture.