©
National Instruments Corporation
F-1
ENET-232 and ENET-485 Series User Manual
F
VISA and Serial APIs on UNIX
To access the serial ports on an ENET-Serial box under a UNIX
architecture such as Solaris or Linux, you must use the NI-VISA driver.
You can use the device I/O API on these platforms to access local serial
ports (open, write, etc.); however, you cannot use it to access the ports on
the ENET-Serial box. The API on Solaris and Linux was not designed to
access remote serial ports and thus cannot support this functionality.
Fortunately, the VISA architecture supports use of the ENET-Serial
devices, as well as local serial ports and many others. The VISA
architecture is simple to use and is both bus type independent and cross
platform compatible.
For serial users who are familiar with the UNIX serial API, the following
table shows the several common UNIX device-level function calls and the
corresponding VISA operations. As you can see, the APIs are very similar.
In many cases, the VISA operations are even easier to use than the
conventional UNIX serial API. For example, in the UNIX API you must
manipulate complex bits in the termios structure. However, to make
identical operations in VISA, you just make a simple call to
Table F-1.
UNIX Function Calls and Corresponding VISA Operations
Solaris Function
Linux Function
VISA Operation
open
open
viOpen
close
close
viClose
tcgetattr/ioctl
tcgetattr/ioctl
viGetAttribute
tcsetattr/ioctl
tcsetattr/ioctl
viSetAttribute
read
read
viRead
aioread
read
viReadAsync
write
write
viWrite
aiowrite
write
viWriteAsync
aiowait
select
viWaitOnEvent