Example of Locking
Occasionally you may need to prevent other applications from using the same resource that you are using. VISA has a service called locking that you can use to gain exclusive access to a resource. VISA also has another locking option in which you can have multiple sessions share a lock. Because lock sharing is an advanced topic that may involve inter-process communication, see Lock Sharing for more information. The following example uses the simpler form, the exclusive lock, to prevent other VISA applications from modifying the state of the specified serial port.
Example
Note The following example uses bold text to distinguish lines of code that are different from the other introductory programming examples. |
#include "visa.h"
/* Error Initializing VISA...exiting */ } } |