Programming Serial Devices in VISA
- Updated2025-01-24
- 1 minute(s) read
Programming Serial Devices in VISA
VISA supports programming Serial devices connected to either an RS-232 or RS-485 controller.
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.
VISA provides a consistent API across a broad range of Serial port controllers on all supported platforms. As operating systems continue to evolve and other new Serial APIs inevitably emerge, VISA will insulate you against unnecessary changes to your code.