LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keyence BL-1300 barcode scanner problem

Hi.
 
I want to poll the data from a Keyence Barcode reader to a basic serial write and read LabVIEW program.
What happens is when i run the VI, and i move the scanner, it will read and feedback the data but once I
stopped moving or just focus on one barcode, it will feeback to Zero value. I tried the Keyence utility
software (autonavigator) and windows hyperterminal and the result is good. It will show and maintain the
last read data when it is not moving.
 
Please find the attached for reference;
- Autonavigator image - shows barcode sensor data both when it is scanning or just at fixed position. It will NOT display zero.
- Hyperterminal image - shows barcode sensor data. It will just display present data but NOT zero.
- basic serial write and read seq 2 - shows a zero value when the barcode is at steady position or just pointing to one barcode.
   
I do not know why i have different result between my program and hyperterminal and autonavigator. I expect the same because
i will just read the data from the sensor. The settings of the barcode sensor was made thru auto navigator software.
 
Can anyone help me or give me idea/s? I want LabVIEW to remember the last data it read when it stopped on moving. It should
not result to zero.
Is there any parameter i have to change in the basic serial write and read?
 
Thanks for any help.
Regards
Bon, 
0 Kudos
Message 1 of 6
(4,732 Views)

Hi jtc,

 

two points:

1) Using BytesAtPort is silly when your barcode reader outputs values using a TermChar like CR as shown in your pics.

2) Some pseudocode, probably used by "Autonavigator" too:

IF new value read (aka "no timeout" aka "BytesAtPort>0")
THEN
  write value to display
ELSE
  don't change display
ENDIF

 

Thinks about that:

What do you expect to read from the serial port when you order VISARead to read a string of zero length?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(4,717 Views)

Hi GerdW,

 

I appreciate for your reply. I attached two more screen shots read data from the sensor. But after this read, the next iteration it is zero.

 

If its zero lenght or zero bytes then i should not read anything. But i think i look so focus on the windows hyperteminal that it

should demonstrate the same with labview.

 

will i be able to do this for this application?

IF new value read (aka "no timeout" aka "BytesAtPort>0")
THEN
  write value to display
ELSE
  don't change display
ENDIF

 

Thanks a lot.

Regards,

jtc

Download All
0 Kudos
Message 3 of 6
(4,712 Views)

Hi jtc,

 

I recommend to use the "Advanced Serial Read/Write" example, not the "Basic..." one. It includes the While loop missing in your simple VI: it's not necessary to Init/Close the serial port for each Write/Read operation! Using "Run continuously" is only recommended for very basic debugging, not for just letting a VI run several times...

 

Then for your question: Yes, you will be able to do that! Simply use a case structure and test for the given condition...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(4,709 Views)

Hi Mr GerdW

 

Thank you for the enlightenment.

Finally i can read the barcode data. Also, I can now display the last

read data even when the barcode reader is not moving. The bardoce

data will update once the barcode reader starts to read another code.

 

One last question: On the block diagram, to avoid the pop-up error

message of timeout Err -1073807339, is it okay to ignore this error?

Is it okay that I just put "no dialog" on the Simple Error Handler?

 

Thanks a lot.

jtc

 

0 Kudos
Message 5 of 6
(4,679 Views)

Hi jtc,

 

that error is indicating "TimeOut" when you don't receive any data from your scanner. Usually you handle the error inside the loop, most often you would filter/clear that special error...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(4,671 Views)