Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 30834 - Wait timed out - acquisition not complete

Hi.

I have a Visual Basic application in which I am occasionally getting "error 30834 - Wait timed out - acquisition not complete" when performing acquisitions using the "one shot" method. I have a form with a cwimaqviewer control, a combo box from which you can pick the camera number to view, and a menu from which you can choose either Live Video or View (one shot).

When the form initially opens, it is automatically in one-shot mode. You can choose from the cameras and it changes the image in the viewer accordingly. I then switch to Live Video and once again I can choose from the cameras and it correctly changes the live image in the viewer. However, when I then switch back to one-shot mode again, I have a number of problems, one of which is the "Wait timed out" error happening sometimes. Also, the images are not always clear (they contain lines) or they are from the wrong camera.

Sample code:

CODE THAT RUNS WHEN YOU CHOOSE A CAMERA:
========================================

If CWIMAQ1.AcquisitionType = cwimaqAcquisitionOneShot Then
Call AcquireImageIMAQ
Else
Call LiveVideo
End If



CODE TO SWITCH TO LIVE VIDEO:
=============================

Private Sub LiveVideo()
On Error Goto Err_LiveVideo

Dim lngreturn As Long

'Stop the acquisition if in continuous mode
If CWIMAQ1.AcquisitionInProgress Then
Me.CWIMAQ1.Reset
End If

CWIMAQ1.Images.RemoveAll
CWIMAQ1.AcquisitionType = cwimaqAcquisitionContinuous
CWIMAQ1.Images.Add (1)
Me.imaqDisplay.Attach CWIMAQ1.Images(1)
CWIMAQ1.Images(1).Channel = Me.cboCameraNumber
CWIMAQ1.Configure
lngreturn = CWIMAQ1.Start

Err_LiveVideo:
If Err.Number <> 0 Then
MsgBox "Error " & Err.Number & ": " & Err.Description, vbOKOnly + vbCritical, "Error"
Exit Sub
End If

End Sub


CODE TO SWITCH TO ONE-SHOT MODE:
================================

'Stop the acquisition if in continuous mode
If CWIMAQ1.AcquisitionInProgress Then
Me.CWIMAQ1.Reset
End If

' Acquire the image
Call AcquireImageIMAQ


FUNCTION TO ACQUIRE A "ONE-SHOT" IMAGE:
=======================================

Private Function AcquireImageIMAQ() As Boolean
On Error GoTo Err_Handler

If Me.CWIMAQ1.AcquisitionInProgress Then
Me.CWIMAQ1.Reset
End If

' clear any regions (rectangles, etc.) from the existing image
Me.imaqDisplay.Regions.RemoveAll
Me.imaqROIDisplay.Detach

Me.CWIMAQ1.AcquisitionType = cwimaqAcquisitionOneShot
' set the zoom scale and channel
SetZoomScale
CWIMAQ1.Channel = Me.cboCameraNumber
' acquire an image
CWIMAQ1.Configure
Me.CWIMAQ1.AcquireImage
imaqDisplay.Attach CWIMAQ1.Images(1)

AcquireImageIMAQ = True

Err_Handler:
If Err.Number <> 0 Then
MsgBox "Error " & Err.Number & ": " & Err.Description, vbOKOnly + vbCritical, "Error"
AcquireImageIMAQ = False
Exit Function
End If

End Function




Can anyone tell me why this might be happening?


Thanks.
0 Kudos
Message 1 of 2
(2,788 Views)
Thank you for contacting National Instruments. I have a few thoughts after glancing over the above code and looking at your description. From the error that you are receiving, that seems to indicate that you are either leaving resources open as you change between the different "modes" of your program or that you have accidentally closed out the camera resources. If the resources were closed then we would expect the acquisition to time out since there is no longer a valid session with the camera to receive the frames and timing signals.

Glancing over your code, you are calling CWIMAQ.reset as you switch between the modes. This function will "reset the currently configured session and release all hardware resources." This was taken from the Visual Basic Function
Reference manual. From the code pieces included above, it does not look like you are calling CWIMAQ1.Interface = blah.Text or CWIMAQ1.LoadInterfaceDefaults after you have reset CWIMAQ.

You might try to include these functions in each segment of the code to make sure the interface is still configured properly, or you can play around with using CWIMAQ.Stop instead of CWIMAQ.Reset.

Also, it looks like your application is very close to working and you may have already seen them, but remember that there are a number of VB examples that are included with NI-IMAQ that can be located on your PC in the ..\Prgoram Files\National Instruments\NI-IMAQ\Sample\VB\ folder.
0 Kudos
Message 2 of 2
(2,788 Views)