Overview
This examples tests any serial COM port installed on the machine.
Description
This LabVIEW VI verifies the operation of your serial port hardware. You will need LabVIEW, standard 9-pin serial cable, and some wire or a paperclip. Connect the serial cable to your serial port and then short the transmit and receive pins of the cable with the wire. For an RS-232 cable you must short pin 2 to pin 3. For an RS-485 cable you must short pin 4 to pin 8 and pin 5 to pin 9.
Once everything is connected and your cable is shorted, run the Loopback.VI. This sends out a string and if your hardware is working correctly then you should receive that same message back.
Requirements
Hardware: PC/Laptop with Serial COM port (RS-232 or RS-422/485), Serial cable (RS-232 or RS-422/485) Software: LabVIEW Full Development System 2012 or compatible, NI-VISA
Steps to Implement or Execute Code
- Connect the serial cable to COM port
- Short circuit the transmit (Tx) and receive (Rx) pins of the serial cable. For an RS-232 port, wire pin 2 to pin 3. For an RS-485 port, wire pin 4 to pin 8 and pin 5 to pin 9
- Check the COM number from NI MAX under Devices and Interfaces.
- Enter the Port Number in the control
- Enter the String to Write text
- Run the VI
Additional Information or References
VI Code Screenshot*
*The NIVerified version of this code simply flattens the sequence structure for readability. Rewriting this to use the newer VISA Serial API is still recommended.
**The code for this example has been edited to meet the new Community Example Style Guidelines.**