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.