Serial Port Support
The maximum number of serial ports that NI-VISA currently supports on any platform is 256. The default numbering of serial ports is system dependent, as shown in the following table.
How Serial Ports Are Numbered
Platform | Method |
---|---|
Windows Vista/XP/2000 | All COM and LPT ports are automatically detected when you call viFindRsrc(). The VISA interface number may not equal the COM port number. |
LabVIEW RT | All COM ports are automatically detected when you call viFindRsrc(). |
LabVIEW PDA | All COM ports are automatically detected when you call viFindRsrc(). |
Mac OS X | All COM ports are automatically detected when you call viFindRsrc(). |
Linux x86 | ASRL1-ASRL4 access /dev/ttyS0 – /dev/ttyS3. |
VxWorks x86 | ASRL1-ASRL2 access /tyCo/0 – /tyCo/1. |
If you need to know programmatically which ASRL INSTR resource maps to which underlying Serial port, the following code will retrieve and display that information.
Example
Note This example shows C source code. There is also an example in Visual Basic syntax. |
#include "visa.h"
/* Error Initializing VISA...exiting */ } status = viOpen (defaultRM, rsrcName, VI_NULL, VI_NULL, &instr); printf ("Could not open %s, status = 0x%08lX\n",rsrcName, status); else { status = viFindNext (flist, rsrcName); } } |