LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Which library functions to use in CVI for rs485 operations?

I reconfigured my computer so that the serial port is now rs485. CVI 5.0.1 only has library defined for the rs232 functions. Does it have any functions in the library relating to rs485?
0 Kudos
Message 1 of 4
(4,364 Views)
I am not sure about RS485 but I guess as long as you don't need to use
multi-drop capabilities, regular RS232 library calls should work with RS485.
A while back I had used standard CVI RS232 library with RS422 card.


vishi

"elersebn" wrote in message
news:506500000008000000707B0000-1042324653000@exchange.ni.com...
> I reconfigured my computer so that the serial port is now rs485. CVI
> 5.0.1 only has library defined for the rs232 functions. Does it have
> any functions in the library relating to rs485?
0 Kudos
Message 2 of 4
(4,364 Views)
There's really no difference in the functions used to communicate via RS485. I understood that the main differences between RS232 and RS485 were distance (30' vs 4000') and addressing. That is, RS485 allows you to communicate with multiple instruments using the same port whereas RS232 was primarily designed for single instrument communication.

I used RS485 extensively for an application I recently wrote. Since you are still using the same physical port, you still use the RS232 library functions such as OpenComConfig(), ComRd() and ComWrt(). It's all about how the device on the other end expects the command or query to be formatted. So you use the Fmt() and Scan() functions quite a bit to create and read your communication messages. The RS232 example a
pplication that comes with your CVI package should work fine for RS485 as long as you're able to create the proper formatted string command. If the format has escape characters in it, as many do, then you will need to modify things a bit to make them work.

Find a simple query that your device can respond to such as a model number or firmware version number. Modify your rs232 sample program by hard coding the correct string in right before the ComWrt() function. Connect to your device, click the Send button on the front panel to send the hard-coded string query, then check the in queue button to see if the device sent anything back.

What is the make and model of the instrument you're trying to communicate with? Perhaps I can look up the manual online and give you suggestions on what you need to do.

Craig
Message 3 of 4
(4,364 Views)
Thanks Craig for your very profound explanation. It is really helpful.
0 Kudos
Message 4 of 4
(4,364 Views)