Serial Port Init VI

LabVIEW 2011 Mobile Module Help

Edition Date: June 2011

Part Number: 372508C-01

»View Product Info
Download Help (Windows Only)

Owning Palette: Serial Compatibility VIs

Requires: Embedded Module for ARM Microcontrollers, Mobile Module, or Touch Panel Module

Initializes the selected serial port to the settings you specify.

Note  This VI clears the buffer of any existing data. Use this VI only if you want to reset the serial port completely.

flow control etc. enables you to set options for the serial port.
input XON/XOFF is a software handshaking protocol you can use to avoid overflowing the serial port buffers. The default is FALSE.
input HW Handshake corresponds to Request To Send (RTS) handshaking. The default is FALSE.
input alt HW HShk corresponds to Data Terminal Ready (DTR) handshaking. The default is FALSE.
output XON/XOFF is a software handshaking protocol you can use to avoid overflowing the serial port buffers. The default is FALSE.
output HW Handshake corresponds to Clear to Send (CTS) handshaking. The default is FALSE.
output alt HW HShk corresponds to Data Set Ready (DSR) handshaking. The default is FALSE.
XOFF byte is the byte used for XOFF (^S). The default is 0x13.
XON byte is the byte used for XON (^Q). The default is 0x11.
parity error byte determines the behavior when a parity error occurs. If the high byte is nonzero, the low byte is the character that replaces any parity errors found when you enable parity. The default is 0.
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 is 0, which instructs the system to keep the same buffer size as before.

(Windows and Pocket PC) LabVIEW limits buffer size to 65534 bytes (or 64 – 2 KB). The value must be even on Windows.
port number is the serial port. The following table shows the available port number and the corresponding device name on different operating systems.
port number Windows, Pocket PC, Windows Mobile VxWorks eCos UNIX
0 COM1 /tyCo/0 /dev/ser0 /dev/ttyS0
1 COM2 /tyCo/1 /dev/ser1 /dev/ttyS1
2 COM3 /tyCo/2 /dev/ser2 /dev/ttyS2
3 COM4 /tyCo/3 /dev/ser3 /dev/ttyS3
4 COM5 /tyCo/4 /dev/ser4 /dev/ttyS4
5 COM6 /tyCo/5 /dev/ser5 /dev/ttyS5
6 COM7 /tyCo/6 /dev/ser6 /dev/ttyS6
7 COM8 /tyCo/7 /dev/ser7 /dev/ttyS7
8 COM9 /tyCo/8 /dev/ser8 /dev/ttyS8
baud rate is the rate of transmission. The default is 9600.
data bits is the number of bits in the incoming data and can be between 5 and 8. The default is 8.
stop bits specifies the number of stop bits used to indicate the end of a frame.

101 stop bit
151.5 stop bits
202 stop bits
parity specifies the parity used to transmit or receive every frame.

0no parity (default)
1odd parity
2even parity
3mark parity
4space parity
error code is the error or warning code. error code is –1 if baud rate, data bits, stop bits, parity, or port number are out of range or if the VI could not initialize the serial port. 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.

WAS THIS ARTICLE HELPFUL?

Not Helpful