Serial Communication for LabVIEW 6.1
The following examples demonstrate basic and advanced serial communication features such as reading from and writing to serial ports, setting and detecting breaks in the data line, performing diagnostic tests on your ports, and setting transceiver control modes when using a National Instruments RS-485 product.
Basic Serial Read and Write.vi - This example performs a Serial Port Read, a Serial Port Write, or a combination of these actions. The user selects the actions (read or write) on the front panel. If both are selected, the VI will write the data first, read data, and then close the VISA session that is opened to the port. This VI will wait until the specified number of bytes is received at the port. Only the number of bytes specified will be read.
Basic Serial Write and Read (2 Port).vi - This example opens two VISA resources and configures one COM port to perform a write operation and the other COM port to perform a read operation. Like the Basic Serial Write and Read VI, this VI allows you perform diagnostic tests on your ports. You can connect two of the ports using a null modem cable, which effectively connects one port's RX lines to the other port's TX lines.
Advanced Serial Read and Write.vi - This example performs a Serial Port Read, a Serial Port Write, or a combination of these actions while setting some advanced serial features like buffer size, termination characters, and XON/XOFF flow control.
Set Break.vi - This example illustrates how to introduce a break in the data line during serial communication. The VISA Serial Break VI is used to introduce a break in the data line. This VI can be run alongside the "Detect Break Event.vi" to monitor the breaks.
Detect Break Event.vi - This example illustrates how to detect a break in the data line during serial communication. This VI can be run alongside the "Set Break.vi" to introduce the breaks.
Troubleshooting Serial Line Monitor.vi - This example allows the user to monitor the states of the serial lines and to control the states of the DTR and RTS lines. This example is intended for troubleshooting purposes.
NI RS-485 Transceiver Control.vi - This example sets the RS-485 transceiver control modes for the specified port and performs a Serial Port Read, a Serial Port Write, or a combination of these actions. Note: This example will work only with National Instruments RS-485 interfaces.
Back to Top