LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to define timeout for the process of a function

Here's what I recommend, based on some of the new information about your Camera, its capabilities, and the (still-not-quite-specified) task.

  1. Generate an Image that includes a QR code.  Save the Image somehow so you can work with it without worrying about the Camera -- you only want a stable Image with QR Code.
  2. Create an ROI for the code.  Note that I've been assuming that you are creating the ROI "manually", that is, by drawing a box around it, but this might be completely incorrect (you haven't told us anything about the ROI).

Once you have the Image and the ROI, use a "three-frame-Timing Sequence", with a Tick Count in the first and last frame, subtracted to get Delta T, and the IMAQ Read QR function in the middle.  This will tell you precisely how long the QR takes, independent of the Camera, the ROI, etc.  If it really is > 1 second, then I don't understand the wisdom of having the camera run at 15 fps.

 

If you want more assistance on this problem, I recommend you "fill in some of the blanks" by including all of the code that you are using, including acquiring the Image, specifying the ROI, and reading the QR.

 

Bob Schor

0 Kudos
Message 11 of 20
(1,881 Views)

Dear sir :

 Thanks for guidance. I will provide you with the mentioned request. The frame per second setting is 15. But in reality it is triggered physically. So we can consider it as 15 triggers per second. But it is not that way. It would be triggered twice in one second every lets say 10 seconds. 

 

0 Kudos
Message 12 of 20
(1,870 Views)

Hi @Lotfee

The Read QR Code VI does not function like industrial scanners that you are mentioning. It instantly evaluates the image at that same instant that the image is received. It automatically gives a pass/fail result as soon as it is called and it does not necessarily wait for a specific amount of time. In that sense, a timeout is not needed to use the that function. Regarding your problem that it seems to hang up on that function for 1-2 seconds before proceeding to the next ROI, I suspect it is a bug from other part of the code which was not shown. If you can try to create a simple flat sequence to isolate the Read QR Code VI, then that will be a good point to start debugging the problem to verify that it is indeed hanging up on that point.

0 Kudos
Message 13 of 20
(1,854 Views)

Thanks a lot for the directions. 

I will try them certainly.

But aren't any methods to make a function skip its process after a specific time ?

0 Kudos
Message 14 of 20
(1,836 Views)

Some functions, like Enqueue and Dequeue, have a TimeOut as an intrinsic part of the function, but most do not.

 

Bob Schor

0 Kudos
Message 15 of 20
(1,826 Views)

It does not have a timeout function by nature. What you can do however is continuously call that VI for a certain amount of time (say like 300ms) or until a barcode has been read.

0 Kudos
Message 16 of 20
(1,822 Views)

Could you please explain more sir about how ?

0 Kudos
Message 17 of 20
(1,809 Views)

How can that be done for a certain amount of time ?

0 Kudos
Message 18 of 20
(1,791 Views)

There are some of us that would be willing to help, to test your routine, and to explain, but you have to help, as well.  We need you to attach an Image that includes a QR code that you want to read (I recommend attaching it as a PNG), and also a Screen Shot of your IMAQ Image (showing the QR) that includes the ROI (or multiple ROIs) that you are using.

 

I'm sure I won't be the only one willing to test out the QR Read functions and try to replicate (or not!) the problem you are having.  We like experimenting with LabVIEW, testing things, finding what Works and what Doesn't Work, but so far, you haven't provided much help to allow us to help you.  Give us some data (you've been asked this several times, before)!

 

Bob Schor

0 Kudos
Message 19 of 20
(1,784 Views)

In regards to keeping track of time to decide to timeout, I recommend the Elapsed Time express VI. Reset it at the start of the process and compare the elapsed time to your predefined timeout time. If elapsed surpasses timeout, it is up to you to exit the loop/function/subvi gracefully.

0 Kudos
Message 20 of 20
(1,779 Views)