LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to scan for Delimiter?

Hi there,
 
My Vi is reading data from a bar code scanner. I would like to stop my while loop by reading the terminal string "/s" from the bar code that been scanned.
May I know to "scan" for the terminal string?
 
Thanks & Regards,
Norman
0 Kudos
Message 1 of 9
(3,951 Views)

if you are looking for the space you can use the build in VISA termination charater (properties, look into the help)  to stop your read.

if you are looking for a (two or n character) string termination, you can read your buffer byte by byte and do a match pattern ('/s$' )

 

Message Edited by Henrik Volkers on 07-12-2006 09:43 AM

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 9
(3,944 Views)
hello again...
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 3 of 9
(3,935 Views)
Hi Chris, Thank you for your value reply. When I add your solution to my vi it don't work well. Because I'm using Global variable to pass the data. Can help me to take a look of my vi and let me know where I can improve with? To stop the while, I have try Match pattern, however it don't really work because it can't read the "/s" termial char. I also tried Scan String For Token, it works however I not very sure whether it is the correct method to use or it is not? Thank you in advance for the reply, Best Regards, Norman
Download All
0 Kudos
Message 4 of 9
(3,914 Views)

hi there

the "trim whitespace.vi" kills your "\s". see attachment.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 9
(3,912 Views)
Hi Chris, I have removed the trim white space vi however the while loop still cannot be stopped. Thanks & Regards, Norman
0 Kudos
Message 6 of 9
(3,900 Views)
when you create a breakpoint inside the " " case you'll see that you enter that case, but you only terminate the inner while loop. to stop your app you have to switch your statemachine to "end". pass the state to the inner loop and set the state to "end" inside the " " case.
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 7 of 9
(3,897 Views)
Hi Chris, Thank you for the info. After modifying it works. For curiosity, for those bar code scanning use in Supermarkets' cashiers, how do they program in such a way that they can scan for many items and total the sum by pressing the Total button? What kind of structure do they use? Thank you in advance for the info. Best Regards, Norman
0 Kudos
Message 8 of 9
(3,878 Views)
OK, I'm going to give my 2 cents on this one, even though I can't open the VIs posted.

I think scan for tokens is the best route to go.  Especially if all of the strings with spaces in them are delimiters between seperate strings.  In this case you can use "scan string for tokens" to give you an array of the individual strings without the delimeters.

Attached is an example

Hope this helps,

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 9 of 9
(3,866 Views)