Execution Time of NI-VISA Write Same for Both Synchronous and Asynchronous Mode

Updated Apr 19, 2024

Reported In

Driver

  • NI-VISA

Issue Details

I'm using the NI-VISA driver to conduct some data transfers, and have benchmarked the time it takes for my VISA Write function to execute using a method similar to the below image. I noticed that the VISA Write takes the same amount of time to execute regardless of if I have the Synchronous I/O Mode set to Synchronous or Asynchronous. Asynchronous mode is supposed to unlock the thread handling the VISA Write function faster than Synchronous mode - why doesn't this produce a faster execution time for the VISA Write function?
 

Solution

The overall execution time of the NI-VISA Write function is determined by your specified baud rate and the size of your written data. Since this does not change when you change the Synchronous I/O Mode, and this total execution time is what benchmarking code is tracking, the time it takes for the NI-VISA Write function to execute remains the same regardless of what you have the Synchronous I/O Mode set to.

Additional Information

The Synchronous I/O Mode of the VISA Write function does not influence the function's execution time because, while the modes free the thread processing the communication at different points, the thread being freed does not necessarily mean that the actions of the VISA Write are done executing. Changing these modes control the method LabVIEW uses to transfer data to the port it is being written off of and change the time it takes until LabVIEW can process other actions, but the time it takes to write the data you are trying to send off of your designated port stays the same. The Synchronous I/O Mode does change when threads managing VISA functions in LabVIEW are released, however, so you can speed the execution of other operations in your LabVIEW code by choosing a mode which makes the most sense for the architecture of your code.