LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI freezes while using USB Barcode scanner

Screenshot 2021-12-14 093950.png

Hi,

I have used a simple USB Barcode scanner to scan a barcode and show it in my front panel, I have created this and it correctly scans too, but the problem is I have placed other string controls in the front panel too to enter data and when I run the vi the String controls freezes and I am not able to type anything in it after sometime whatever I type on that string controls get stored in the barcode scanner indicator. Can someone help me with this??

0 Kudos
Message 1 of 8
(3,448 Views)

Hi rk,

 


@rk0001 wrote:

Can someone help me with this??


How should we help when all we get is an image of parts of your code?

Remember: we cannot debug/run/edit images with LabVIEW!

 

When there is a problem within your code (aka VI) then you should attach that code (aka VI)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,409 Views)

Event structures, in general, should not be put in case structures. If you manage an event and this event occurs in a stage where the event structure cannot be executed, the program freezes.

The Key Down event, in any case, is too general. You really want to manage Key Down in the "Barcode (Serial no.)" string control. There is a specific event for this that you should choose, of course you need to change the Barcode indicator to a control instead.

As said before, however, you should avoid to generate the event when the program is not running "inside" the True case. A simple modification is to disable the Barcode (property Enabled set to 1-Disable or 2-Disable and grayed out) at the beginning of the code, then enable it inside the True case. Disable again once the case finishes.

There may be also better ways to manage the Enter key. For example, you may set the control to "Update Value while Typing" and manage the Value Change event instead of the Key Down.

Posting the whole vi may help us to make better suggestions.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 8
(3,397 Views)

hi, I want to share the whole VI but I am not allowed to unfortunately. Can you try and and help me with this image  

0 Kudos
Message 4 of 8
(3,376 Views)

 Can you at least share a Snippet of this part of code?

0 Kudos
Message 5 of 8
(3,369 Views)

@rk0001  ha scritto:

hi, I want to share the whole VI but I am not allowed to unfortunately. Can you try and and help me with this image  


Funny. I thought I already helped you. Did you read my previous post?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 8
(3,363 Views)

Thank You, was helpful :))

0 Kudos
Message 7 of 8
(3,285 Views)

I loaded the driver for scanner as a COM-port. One loop have a "read port" that write the scanned code to a string control. Another while Loop have a event structure that react on this string control and saves the code. 

The event structure deals also with other controls...one good rule is to have only one event structure.

This structure does not affect other inputs or controls.

 

The big thing was to load the driver as a COM-port. That made the life more easy.

 

 

 

 

0 Kudos
Message 8 of 8
(3,281 Views)