Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

VBAI: Fire a pulse every N msec based on inspection status

Solved!
Go to solution

The VBAI Delay function seems to have the functionality I am looking for, but it is too coarse in that the time lapse is 1 second minimum.

 

I have a Smart Camera (1772). I am doing an OCR inspection that could take a somewhat varying amount of time. I would like to fire a rejector if the inspection fails. The rejector must fire at a fixed amount of time after the camera is triggered. If I cannot reliably do that, then I need another controller in the system which I should not need because the Smart Camera shoulkd be more than adequate. I know it can be done in RT, but I would like to keep things in VBAI for ease of Customer training.

 

Sequence of operations:

 

1. Parts travel under 1772 on a conveyor

2. Sensor triggers 1772 when a part is present

3. Image is acquired and processed. OCR inspection performed

4. If OCR inspection fails, fire output pulse exactly 100 (for example) milliseconds after the trigger from step 2

5. Repeat from step 2 

 

Any idea how to achieve that in VBAI?

 

Thanks,

Dan

0 Kudos
Message 1 of 3
(4,147 Views)
Solution
Accepted by Photon_Dan

You could have a Generate Pulse step before your acquisition where the pulse is configured to generate a pulse based on a trigger (so configure a continuous pulse and wire you acquisition trigger to an ISO Input line as well that will trigger the output). Now this is the important part...you need to make sure your processing is done before the 100ms or whatever delay you specify or the pulse will begin. If you determine that you don't need to pulse based on your processing, transition to a state where you stop pulse generation on that line to stop it before it happens. In either case, transition to the End state and then the inspection can start again with the state that has the Generate Pulse/Acquire/Process and so the pulse will be reconfigured again for the next part.

 

If this doesn't work for you, then you could try a SW timed approach. You could have a Run LabVIEW step that gets an accurate timer value when the acquisition step completes, and another VI call that will wait for a user specified amount of time (millisecond resolution) before it continues.

 

I would recommend the first option since it will be hardware timed (but requires some extra wiring), and if that doesn't work, I can help you with a VI that will do the SW timed behavior you want.

 

Hope that help,

Brad

0 Kudos
Message 2 of 3
(4,141 Views)

I also discovered the Wait can support millisecond times if you use a previous value instead of a constant (the constant doesn't allow you to type in fractional seconds, so I will see if we can fix this in future versions). A previous value of 0.1 would wait 100ms in the Fixed Time Lapse mode. You could just use a variable that is initialized to this value. The down side to the Wait is that the first time it will always wait the full period since it dopesn't know what the previous timestamp is. Also, if your camera timeout because it didn't get a trigger in time, there's no way to reset the Delay step's timer. If the HW approach doesn't work for you, let me know and I can show you how to use a Run LabVIEW VI with a reset option to get the SW timing functionality you want.

 

Hope this helps,

Brad

0 Kudos
Message 3 of 3
(4,136 Views)