This example allows a user to send serial commands to frame grabbers through VBAI using a specific .dll which is included below. This is done through the clallserial.dll in the CLSerialInterface.dll. The example does not call the clallserial .dll directly from LabVIEW because the string data types don't match up between what the .dll expects and what LabVIEW sends. The work around implemented in this program changes the LabVIEW string in the .dll included so it can pass the string data to the clallserial.dll as it is expected.
What should occur in the VI is outlined below:
1.) Open a session to a frame grabber serial port based on the index. This will be 0 for a single board system.
2.) Flush the serial port on that frame grabber so nothing is currently in the serial port buffer. This ensures we have a clean start so when we check for bytes later on, we don't read old bytes that may be there.
3.) Write the serial command
4.) Wait for the expected number of bytes from the camera or a timeout (100ms timeout)
5.) Add a delay since some cameras may need extra time after their response for some serial commands. Delay defaults to 0, so no extra wait.
6.) Once again flush the serial port on the frame grabber.
7.) Close the serial port session.
The clallserial interface is what camera manufacturer's serial utilities use, and this can be used at the same time as an NI-IMAQ session without returning errors about device already in use.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.