Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

RS-485 Loopback (Port to Port) Test 2 Wire AUTO MODE ONLY

Overview
This example will perform a RS-485 two wire loopback in AUTO mode.

 

Description

In order to perform a RS-485 two wire loopback in AUTO mode, you need to have two separate ports to communicate between.  In this example, the two wire AUTO mode is programmatically set on both ports.  The important part is the connection made between the two ports.  Make sure to tie pins 4 and 8 (RXD+ and TXD+) together then wire this connection to pins 5 and 9 (RXD- and TXD-), which should also be tied together.  This is refelected in the next two images.

RS485 2 Wire AUTO connection.jpg

 

Software:

  1. LabVIEW 2012 (or compatible)
  2. NI-DAQmx


Steps to Implement or Execute Code

  1. Specify VISA setting
  2. Run the application.

 

Additional Information or References

Select the serial resource and the operations (Read, Write, or both) to be performed.  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.

VI Snippet

RS-485 Loopback (Port to Port) Test 2 Wire Auto Mode 2012 NIVerified.png

  

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Comments
Member mr-vizsla
Member

I know there is another RS-485 auto mode VI on this community, but I was unable to get it to work without using two separate ports, which that examples does not include.  I have tested this, and it worked for me.

Cheers!

Active Participant Todd S.
Active Participant

Good stuff here, thanks for posting!

Todd S.
LabVIEW Community Manager
National Instruments
Member kinnikinnick
Member

This is a great, simple summary.  Perfect for troubleshooting of RS485 2-wire connections.

--
Marvin P, CLAD
Member RWG111
Member

Great, tried NI examples with no joy. Your example worked first time! My card is working fine - all I wanted to know. Much appreciated.

Member Median9
Member

Sorry if it sounds silly but can anyone please confirm if this example runs on a plain pair of RS-232 COM ports on a commercial PC? Or do we need to have hardware with RS-485 ports? Because i am getting an error when i run this vi using a pair of RS-232 COM ports on my PC.