National Instruments ENET-232 Series User Manual page 89

Serial, for windows 2000/nt 4.0 and linux x86/solaris 2.x
Hide thumbs Also See for ENET-232 Series:
Table of Contents

Advertisement

Appendix F
VISA and Serial APIs on UNIX
int main(void)
{
char instrDescriptor[VI_FIND_BUFLEN];
char buf[1024];
ViSession defaultRM, instr;
ViStatus status;
ViUInt32 numAvailBytes, retCount;
ViEventType eventType;
ViEvent eventContext;
int i;
/* First we will need to open the default resource manager. */
status = viOpenDefaultRM (&defaultRM);
if (status < VI_SUCCESS)
{
printf("Could not open a session to the VISA Resource Manager!\n");
return -1;
}
/* Set descriptor to a serial port at port 2 of the serial device server
at IP address 130.164.41.41 */
strcpy(instrDescriptor, "ASRL::130.164.41.41::2::INSTR");
printf("Opening %s \n",instrDescriptor);
ENET-232 and ENET-485 Series User Manual
. VISA attributes are robust and cover many types of
viSetAttribute
information and configuration functions, including port settings and
modem lines.
VISA is extensible to other hardware interfaces and is supported on various
platforms. Therefore, if you are programming multiple devices that
communicate over more than one bus type, it may be easier to use VISA for
your entire system.
The default settings for a serial VISA session are 9600 baud, 8 data bits,
1 stop bit, no parity, and no flow control. A port is set to these settings
following a successful call to
is opened, you can change these settings on a per session basis using
. To have a different set of default values following a
viSetAttribute
successful
operation, use the
viOpen
the default settings in use when a port is opened. (You must use the
parameter in
VI_LOAD_CONFIG
User Manual for more details.
The following example shows how to use some of the VISA operations.
. However, once a session to the port
viOpen
visaconf
for this option.) See the NI-VISA
viOpen
F-2
utility to change
ni.com

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enet-485 series

Table of Contents