Then when I am designing a VB6 form and I need to communicate with the camera, I use the following functions contained in the module SerialCameraFunctions.bas. In the following examples, S is a variable of the String type:
S = ResetCamera(Mscomm1)
S = SetCameraBaud (Mscomm1, BaudRate as String) ' Example: "38400"
S = SetCameraImageSize (Mscomm1, ImageSize as String) 'Example: "320x240"
S = SetCameraCompression(Mscomm1, CompRate as String) 'Examples: "1"to"255"
S = SaveCameraJPG (Mscomm1, FileName as String) 'Example: "F:\Camera\Pic1.jpg"
S = CameraHexOutputString(Mscomm1)
All the functions include a comm argument to point to the port you are using.
All other arguments are of String type.
All the functions return a String indicating what the camera just did or else an error description.
The ResetCamera function does change the baud rate back to the default but, I fixed the SetImageSize function such that it takes effect immediately and the baud rate stays unchanged.
The SaveCameraJPG function takes as little as 1.55 seconds to complete (160x120, 115200, 210 comp) or as long as 51 seconds (640x480, 9600, 54 comp).
I didn’t need the camera’s Save Power command so I did not write a corresponding function.
No comments:
Post a Comment