Introduction to Programming Serial Devices in VISA

NI-VISA

Introduction to Programming Serial Devices in VISA

Serial users have traditionally faced difficulties when porting code from one platform to another. Each operating system has its own Serial API; each application development environment has its own Serial API; and all of these usually differ. The VISA Serial API is consistent across all supported platforms and all supported ADEs.

The first thing to point out is how to open a given Serial port. The format of the resource string that you pass to viOpen() is "ASRL<port>::INSTR". The actual binding of a given resource string to a physical port is platform dependent. Refer to the documentation and example in NI-VISA Platform-Specific and Portability Issues. However, ASRL1::INSTR and ASRL2::INSTR are typically reserved for the native Serial ports (COM1 and COM2) on the local PC, if they exist.