12-16-2019 04:03 PM
Hi,
I am new to Labview and created a VI that reads data from a serial port. I am using VISA read function and my expected data stream has the following format: A,+000.00,+000.00,M,+022.21,00,3A.
After the Read VISA, I have a Scan from String function. But when I try to run my labview VI it gives me Error 85 Scan From String (arg1). I have the following format for this arg: %s,%f,%f,%s,%f,%f,%x. Could someone let me know where I have it wrong?
Thank you.
Solved! Go to Solution.
12-16-2019 04:12 PM
No.
But if you attached your VI and saved the string you received from your device as default data in either a string constant, control, or indicator, then we might be able to figure how where you went wrong.
12-16-2019 04:20 PM
"%s", a string, matches everything including commas, therefore it never stops, therefore there is nothing after it to scan.
If you change your two "%s" instances to "%1s", that tells them to scan exactly 1 character, and it should work.
12-16-2019 04:20 PM
Because the comma following the "A" is also a string, and everything else after the comma can be interpreted as a string, it scans the whole line into your first output and then scratches its head because it can't find the comma! You have to specify that it only reads one character (the "A") and then you'll be okay. Do the same for all your fixed-width strings.
Or, you can treat it as a comma-delimited string, index each element and work on them separately...
12-16-2019 04:21 PM
@Kyle97330 wrote:
"%s", a string, matches everything including commas, therefore it never stops, therefore there is nothing after it to scan.
If you change your two "%s" instances to "%1s", that tells them to scan exactly 1 character, and it should work.
You beat me to it.
12-16-2019 04:59 PM
Hi,
I tried your solution. It still does not work.