LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make program for RS-232

Solved!
Go to solution

One of my favorite tricks is to use a terminal program (such as Hyperterminal) to talk to an instrument and observe what is being sent back. Hyperterminal will allow you to change baud rates, termination, data bit settings, and other settings. Once you can successfully talk to your instrument, you can use those settings and feed them into VISA Configure Serial Port.vi.

 

Hyperterminal should allow you to test that the cabling and settings are correct.

 

     Rob

0 Kudos
Message 11 of 37
(2,627 Views)

Okay, I'll admit that I can't leave well enough alone, so here is a small VI in LabVIEW 8.5.1 that will configure the serial port for the Instek supply.

 

I was surprised to find that its serial port is 2400 baud and that the serial port is DTE. So you NEED a cross-over cable to talk to it.

 

     Rob

Message Edited by Robert Cole on 02-06-2009 03:04 PM
Message 12 of 37
(2,625 Views)
But it won't send the CR after the L.
Message 13 of 37
(2,617 Views)

It's been a while and my test system is temporarily out of commission.

 

I set the termination character and enabled termination. Does this not send the termination character after a send? I forget if it does or not.

 

     Rob

0 Kudos
Message 14 of 37
(2,607 Views)
Nope. The enable termination and the term character is only for the read. In order to automatically send a term character with a write, you have to write to the Send End Enable and end Mode for Writes properties like is done in the Advanced Serial Write and Read.
Message 15 of 37
(2,605 Views)

Hi All,

 

Thanks for all the inputs that you guys wrote here.

I finally solved the problem!!

 

0 Kudos
Message 16 of 37
(2,514 Views)

Hi All,

Like mogusa, I'm also a begineer trying to use labview to read data off a modbus device via rs232.  After reading this tread, I'm wondering if the basic serial read and write will really do the trick.  I tried myself, but did'nt get any reading but probably because i didn't modify the termination character; i'm not sure how that works, can anyone help?

thanks

0 Kudos
Message 17 of 37
(2,402 Views)

If you're using Modbus, you should really look at the NI Modbus libraries.  http://sine.ni.com/nips/cds/view/p/lang/en/nid/201711

 

Why?  They do use the serial write and read VI's underneath.  But they also handle the formatting of commands and parsing of responses as well as the CRC-16 checksum bytes for you.

0 Kudos
Message 18 of 37
(2,395 Views)

Thanks for your response Ravens. I have looked over the vis for the MB library, but i was suggested that the pre-made "advanced serial write and read vi." should do the trick.  I tried the vi as it is with the corresponding setting for my device, but there appears an error of "timeout expires".  Does anyone know how I can get the right timeout and rather this method really works?  I only need to read the temperature off my rs232 device.

thanks, really appreciate your help.

0 Kudos
Message 19 of 37
(2,369 Views)

DevZone: Introduction to MODBUS

 

This is a great article when starting out with MODBUS. As you can see there is a specific structure to a MODBUS message that must be followed in order for your device to understand and respond. This structure includes Address, Function, Data and CRCCheck fields..

 

Hope this helps.

---

Peter Flores
Applications Engineer
0 Kudos
Message 20 of 37
(2,360 Views)