LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

communicate with RS485

Hello,
 
I want to communicate with two device (up to twelve). The problem is that the documentation of my device is very badly written (DSP9000 from Riber if you want to know). It says that for a network communicating I should write for an commands : EOD GID GID UID UID STX MN1 MN2 <command> ETX BCC    (for example "r off" is a command). When I write on one device only I use the attached file (ex.vi).
 
Someone can Help me ?
 
Lab 8.0
 
If some information miss please leave me a message
Thanks,
 
0 Kudos
Message 1 of 5
(5,241 Views)
You'll need some more information from Riber, but the data looks very similar in structure to what I have used in talking to a Control Techniques motor controller.
Here is how I interpret it
 
EOD  ??  Could this be EOT which is the End of Transmission control character of CTRL D or ASCII 4 decimal?
GID GID are two bytes representing a group ID #  (this may be a single digit value that gets written twice)
UID UID are two bytes represening a user ID # (this may be a single digit value that gets written twice)
STX is the start transmission control character of CTRL B or ASCII 2 decimal
MN1 MN2  menu ??? (two digit menu value?)
<command>
STX is the end transmission control character of CTRL C or ASCII 3 decimal
BCC is a block checksum code which is a calculation based on all the characters before it. 
 
So you would have to concatenate all of these string characters together.  In dealing with the control codes, it is a good idea to set your constants to hex code display.
 
Here is a snapshot of how this looked in my code. 

Message Edited by Ravens Fan on 06-11-2007 05:28 PM

0 Kudos
Message 2 of 5
(5,242 Views)
Hi,
 
There is my VI. It still doesn't work. I wonder if you can see an error easily. The documentation of the device is in attached file and my vi as well.
 
Thanks for any help,
Download All
0 Kudos
Message 3 of 5
(5,203 Views)
The first reason your code won't work is that the string you are sending is "@ABCDEF" which means nothing to the controller.  You have to send the string of characters that are formatted on page 18 of the manual you attached.  I am not sure if you looked at my example code at all.
 
Your string control is labelled as "String (HEX formatted ASCII" but is actually just normal display with hexadecimal digits and spaces.  As a result you are doing a lot of manipulation of the characters to convert them to hex codes.  All you need is a string control that has its properties on the right click menu set to Hex display.  Then you can type in the hexadecimal string and use the string as is.
 
I am reattaching your VI with this control set to the example string shown on page 19 of the manual.  Try this to start.
 
Then the question will be are there just a few commands you will execute which you can predefine the string to send along with its checksum character, or will the VI need to be more flexible to send any kind of command.  If the latter, you will need to code how the block checksum character is calculated.  You would also have to concatenate the special control characters together like I did in the example I attached earlier.
 
I would also recommend that you attached a serial read function so you can see what response you get back from the controller.  If you are still having problems, double check your serial port settings of baud rate, parity, data bits, stop bits. 
 
Also check your wiring.  Your subject says you are using RS-485.  Is it 2-wire or 4-wire?  The manual is a little cryptic in that it starts talking about RS-422 on page 21.  But on page 22, lists the RS-485 2-wire and 4-wire setups.  But it never truly shows the full wiring of an RS-422 setup.
0 Kudos
Message 4 of 5
(5,188 Views)

Many thanks Ravens fan

Finally, wires were badly wired.

Bye

0 Kudos
Message 5 of 5
(5,165 Views)