PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Thomas Bock on April 09, 2020, 04:55:15 AM

Title: how to scan GS1 barcodes
Post by: Thomas Bock on April 09, 2020, 04:55:15 AM
Does someone know how to scan a GS1 barcode with multiple fields?
The scanner seems to insert some control bytes as field separators which are stripped by a multiline control.
Title: Re: how to scan GS1 barcodes
Post by: James Zukowski on April 09, 2020, 09:19:40 AM
We don't use multi-field codes. You may have already done this, but I would check to confirm that the codes are not being stripped by the scanner first. Then try using INPUT to test it. You may need to set the Auto Signal on All Change attribute to process each character coming in.
Title: Re: how to scan GS1 barcodes
Post by: Thomas Bock on April 09, 2020, 10:10:21 AM
We tried an INPUT A$ with a GS1 barcode consisting of three fields. The scanner always sent three inputs, no matter what we tried. In console mode the first one was assigned to A$ and the next two caused syntax errors of course. An INUT A$,B$,C$ didn't help, because the inputs did not correspond to the fields. A multilined mulit_line doesn't help either.
Title: Re: how to scan GS1 barcodes
Post by: Mike King on April 09, 2020, 10:23:28 AM
Thomas, I would try a raw read from the input to see what is being returned by the device.  Something like this:

while 1
 obtain (0,siz=1),'bi',x$,'ei'
 if x$="" x$=eom
 if x$=esc break
 print hta(x$)," ",
wend

Loops until ESCAPE is received

This should tell you exactly what is being sent. (You may need to change the ESC to something else should the reader send that character).

Once we know exactly what is being received between the fields we may be able to advise.
Title: Re: how to scan GS1 barcodes
Post by: Thomas Bock on April 14, 2020, 03:32:35 AM
Thank you Mike.
The separator byte is $1D$. So the next question is how to integrate this into a GUI? Is there a way to set a multiline to raw mode?
Title: Re: how to scan GS1 barcodes
Post by: Mike King on April 14, 2020, 02:06:09 PM
There is no easy way to allow a graphical control to handle a $1d$ character (CTRL+]).  I would suggest you see if there is a way to change the separator on the reader or reader capture software (many have this option). 

If you cannot change the character, you could in your code switch focus to window itself (SET_FOCUS 0) and capture the characters much the same way as the test program did.