Virus scan in progress. Please wait to download attachments.
This example demonstrates reading data from one serial port and forwarding this data to be written out of another port. This is useful when there are multiple serial ports and you are interested in sniffing or monitoring the serial communication between two points.
Read the data in from one port with VISA Read and write it to another port with VISA Write. Both ports need to be configured. This example also displays a log of the data read in so that it can be viewed on the front panel.
LabVIEW 8.6 (or compatible)
Steps to Implement or Execute Code
Configure the two serial ports (baud rate, data bits, parity, stop bits, and flow control)
Use a property node to extract the number of bytes available at the serial port being read.
Use VISA Read to read in the data. Use the value returned by the property node for the byte count input of VISA Read.
Use VISA Write to write the data to the second port.
Display the read data by formatting the string for the log.
Close VISA sessions to both ports to free them up for other applications.
Additional Information or References
**This document has been updated to meet the current required format for the NI Code Exchange.**
Peter Flores Applications Engineer
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.