Initializes the selected serial port to the specified settings.
![]() |
flow control etc. contains the following parameters.
| ||||||||||||||||||||||||||||||||
![]() |
buffer size indicates the size of the input and output buffers the VI allocates for communication through the specified port.
You might need to use larger buffers for large data transfers. The buffer size is in bytes.
The default value is 0. |
||||||||||||||||||||||||||||||||
![]() |
port number varies by platform. The parameters for serial port numbers depend on the whether you use Macintosh, Windows, or Unix.
On the Macintosh, port 0 is the modem, using the drivers .ain and .aout. Port 1 is the printer, using the drivers .bin and .bout. You must install other boards, with the accompanying drivers, to get more ports on a Macintosh. Additional serial port numbers are assigned dynamically. When you use the serial port VIs under Windows, port number can have the values in the following table.
Because other vendor's serial port boards can have arbitrary device names, LabVIEW has developed an easy interface to keep the numbering of ports simple. A configuration option exists to tell LabVIEW how to address the serial ports. LabVIEW supports any board that uses standard UNIX devices. Some manufacturers suggest using cua rather than tty device nodes with their boards. LabVIEW can address both types of nodes. The file .labviewrc contains the LabVIEW configuration options. Set the configuration option, labview.serialDevices, to the list of devices you intend to use to set the devices the serial port VIs use. For example, the default is: labview.serialDevices:/dev/ttya:/dev/ttyb:/dev/ttyc:...:/dev/ttyz.
|
||||||||||||||||||||||||||||||||
![]() |
baud rate is the rate of transmission. The default value is 9600. | ||||||||||||||||||||||||||||||||
![]() |
data bits is the number of bits in the incoming data. The value of data bits is between five and eight. The default is 8. | ||||||||||||||||||||||||||||||||
![]() |
stop bits is 0 for one stop bit, 1 for one-and-a-half stop bits, or 2 for two stop bits. The default is 1 bit. | ||||||||||||||||||||||||||||||||
![]() |
parity is 0 for no parity, 1 for odd parity, 2 for even parity, 3 for mark parity, or 4 for space parity. The default value is 0. | ||||||||||||||||||||||||||||||||
![]() |
error code is -1 if baud rate, data bits, stop bits, parity, or port number are out of range, or if the serial port could not be initialized.
Check the values of baud rate, data bits, stop bits, parity, and port number. If these values are valid, verify that the serial port has been initialized.
You can connect error code to one of the error handler VIs, which describe the error and give you options on how to proceed when an error occurs. Some error codes returned by the serial port VIs are platform-specific. Please refer to your system documentation for a list of error codes. |