LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect CVI with an automat by the means of RS-232?

Hello,
 
Please, I'm looking for a help!!
 
I'm beginning with LabWindows/CVI version 7.0.
For my project (in school), I need to connect with an automat to read/write data.
The serial connection is completed; but now I don't have an idea to read data in the automat's server.
I'm thinking on DataSocket, but I'm not sure!!
 
Thanks for your help.
 
najo. 
 
0 Kudos
Message 1 of 8
(4,215 Views)
We will need some more details to help you in developing yor application. I suppose that when you say "serial connection is completed" you refere to cabling ando so: have you tested it someway? How?
Second item: your automat should have some documentation to explain how to communicate with it. Are you sure it has a "server"? Or it is a device that waits for some messages over RS232 to answer or operate some way?


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(4,187 Views)

Hello Najo,

Labwindows\CVI has a RS232 library, containing all functions needed for RS232 communication (look in the Library menu). If you need some example code, you can find it under Program Files\National Instruments\CVI70\samples\rs232, or launch the NI Example Finder ('Find Examples' in the Help menu), activate the Search tab and type 'serial' in the 'Enter keywords' field.

If you're still stuck, just let us know.

Success,

Wim

0 Kudos
Message 3 of 8
(4,164 Views)

Ok,

The automat which I use is a TSX Micro (Schneider) and has a server.  For my connection, I tested it outside the automat (with a console)and it's OK. Now, the problem is that, with my program, I can't connect with the automat directly.

While the automat has a server, I want to connect to it, to read/write data. But I don't have any idea about functions to use. For the moment, I'm seeing with the DataSocket functions.

Thanks for your help!!

0 Kudos
Message 4 of 8
(4,163 Views)

Please, I'm looking for help!!!

 

0 Kudos
Message 5 of 8
(4,133 Views)

Hi najo

The functions you need to communicate via RS-232 you have to look for them in "Library" and "RS-232". There you have the functions you'll need. So the steps you have to follow to communicate are:

-Open the port and configure it with the function OpenComConfig
-To read use the function ComRd. Is good that you use the function GetInQLen before reading the port, so you can know the amount of data in the buffer, and you pass it to the ComRd function.
-To write use the function ComWrt
-When finish the connection use CloseCom to close the port

Hope it's useful for you

Juan

0 Kudos
Message 6 of 8
(4,110 Views)

thanks Juan, for information.

Just one question:

 I don't need to use Datasocket functions because it bind to Ethernet or TCP/IP protocol?? (For my application, I use the Serial Modbus Protocol for the RS232)

 

0 Kudos
Message 7 of 8
(4,104 Views)
Hi najo
 
i don't think you need the Datasocket funtions if you're communicating with the automat by RS-232, with the functions that come in the RS-232 library should be enough. Maybe the problem you have to communicate with it is that modbus uses some kind of protocol to communicate (what it be common) and you have to follow the steps of that protocol to be able to communicate, i can't help you with that because i've never worked with modbus.
 
You should read the instructions of the automat to find out how it communicates, and maybe build an application that follows the communicating protocol of modbus, that can be not very nice, but i don't know any other solution.
 
I hope it will help
Message 8 of 8
(4,098 Views)