To download NI software, including the products shown below, visit ni.com/downloads.
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.
Software:
Steps to Implement or Execute Code
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
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
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!
Good stuff here, thanks for posting!
This is a great, simple summary. Perfect for troubleshooting of RS485 2-wire connections.
Great, tried NI examples with no joy. Your example worked first time! My card is working fine - all I wanted to know. Much appreciated.
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.
Have you tested the voltage of idle level in 2-wire mode? Is it high or is it 0V?