10-19-2015 10:14 AM
Hello!
I am trying to communicate with a barcode scanner through a virtual serial COM port (CDC). If I enable the "continuous reading" I can easily read a barcode with a continuous VISA reading loop. However I do not want the scanner to be on continuous reading. I want to use the pull trigger command. I am trying to send this command to the scanner but nothing happens. When I use an example from the developers guide (https://atgsupportcentral.motorolasolutions.com/content/emb/docs/manuals/4045103a.pdf) to request a parameter, also no response.
I attached a print screen of the really simple VI created to request a parameter. 7 bytes are written, but no bytes are received(no response)
Anyone who can help?
Michtro
10-19-2015 01:30 PM
Would be much simpler if you can buy a keyboard wedge for this barcode scanner.
10-19-2015 02:16 PM
You mention that you are using a virtual COM port. Are you using a Serial to USB converter by chance?
10-19-2015 02:49 PM
First: there is no need for a sequence structure. The wires will ensure that your code executes in the desired order.
Do you always get 0 bytes at port? Rather than reading the number of bytes available at the port, try reading a fixed number of bytes (too many is fine) and wait for the timeout. You'll get any bytes that are available, plus a warning or error (that you can ignore) if it couldn't read as many as you requested. An attempt to read 0 bytes will return immediately, and probably there aren't any bytes available to by read immediately after you send the request, since it takes a small amount of time to process the request and send back the result.
Also try sending the same commands in a serial terminal program such as HyperTerminal or PuTTY. Don't forget the end-of-line character, if required.
10-19-2015 03:26 PM
You've got no delay between your write and your read. Since you use bytes at port to read, if the scanner hasn't responded yet, you'll never see anything. Add a 1s delay to start with and then bring it down to figure out how small you can make it and still reliably get a response.
Also, if you know it ends in a standard termination character, you can set that in your VISA setup and just read without caring about delays or bytes at port.
10-20-2015 01:42 AM
I am using a USB port. I have a CDC driver installed which creates a virtual COM port.
10-20-2015 01:44 AM - edited 10-20-2015 01:50 AM
I already added a 1 second delay before but that did not do anything... I also put a fixed amount bytes to read (10) and it did not do anything except show the error that the timeout had been expired (set on 10s)
10-20-2015 02:50 AM
I also tried through RealTerm and also this tool gave no response...
10-20-2015 07:21 AM
10-20-2015 07:32 AM
@Michtro wrote:
I also tried through RealTerm and also this tool gave no response...
Yes, you need to start my configuring the device correctly so that it does a read on trigger and sends the barcode as a string - we've used some motorola scanners before and it's possible to set a termination character which you can put in your VISA configuration to terminate the read. The configuration process for us was scanning a series of barcodes from the manual to set the options.
If you can't get anything from a simple serial terminal, it's probably a device configuration issue.