LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Keyence serial port barcode scanner to talk to LabView

Solved!
Go to solution

Hello,

I'm looking for any input on proper configuration of a Keyence SR-710 scanner connecting via serial port (Keyence SR-UR1) into LabView.

I can use NI Max and the Visa Test Panel to try to talk to the scanner, but it appears that the Test Panel is sending over more command data than what I am putting into the test command box under Input/Output. If I open up the NI I/O Trace program, I see the text that I am sending (LON[CR]), but it has some extra 4,4 or other characters around it. The scanner doesn't react at all to any commands I send.

I can connect to the scanner via PuTTy and send commands just fine, so I know I have good communication.

 

I'm brand new at LabView and have had this problem dropped in my lap at work. Any input on if this is even possible would be greatly appreciated.

0 Kudos
Message 1 of 6
(226 Views)

To figure out a protocol, it's best to start with the manual. (Here I think)

 

Any code you can share?

 

Data from IO Trace (both form NI Max and LabVIEW) could be helpful.

0 Kudos
Message 2 of 6
(167 Views)

The command to send to the scanner to trigger and scan a barcode is LON.

It works great using PuTTy. Nothing happens with IO Test. Here's a shot of what IO Test spits out when I put LON in the command box and hit the query button. 

 

ItsThatTimGuy_0-1725880086178.png

I'll poke around the manual and see if anything pops out.

0 Kudos
Message 3 of 6
(154 Views)

Looks like you are missing a end of command character. Normally that would be a \n (New line) or a \r (Carriage Return). What does the manual say ? 

 

You could also look into your putty setting, what does it send when you hit the Enter key.

0 Kudos
Message 4 of 6
(149 Views)

In LabVIEW you can configure serial end character termination.

 

I think you still need to send it (\n or \r\n), but it makes reading back a lot easier.

 

Simply read more bytes (even 200 or 1000) than you expect, and the read will stop reading when it encounters the end termination character. No 'bytes at port' (PLEASE) or polling!

 

If you need a LabVIEW serial quick start:

VIWeek 2020/Proper way to communicate over serial - LabVIEW Wiki

0 Kudos
Message 5 of 6
(136 Views)
Solution
Accepted by wiebe@CARYA

I have communication success!

For those who stumble across this thread in the future looking for insight on a Keyence SR series camera talking to LabView via serial USB using a Keyence SR-UR1, I used the following:

On the Keyence side,

SR-UR1 set to Dsub 9pin config set to 2:SD, 3:RD, and USB setting set to USB-COM. Everything else default.

SR camera set to communicate at 115200 baud, 8, E, 1.

 

On the NI Max side in Visa testing, 

Communications set to 115200, 8, E, 1, Xon/Xoff

Commands to trigger camera: LON\r to scan barcode\image and BUSYSTAT\r to determine if camera is ready to scan. (We use this at the start of our LabView project to confirm it's actually going to work when we want it to.)

 

Now I just have to figure out how to remove the Motorola scanner settings and replace them with Keyence in the project. Time to watch some training videos.

Message 6 of 6
(123 Views)