XG5000 and Mod bus Command
Thanks so much for your invaluable input.Please find attached the image file pertaining to a read command of Process Value from a PID controller (please zoom in to see everything). Here is a link in case it is not attached:
http://files.engineering.com/getfile.aspx?folder=376da431-5e34-4b23-a89d-74411b920d8b&file=file.bmp
I converted character by character:
Start of Tx ':' -> 3A
Address if unit 1 and address of unit 2 ( I am not sure whether you combine them or you have to have an ascii for each char, please look at the char. Why do we have address if unit 1 and unit 0 ? 0:
01 -> 31 or you could say 0 1 --> 30 31
Command 1 and Command 2 : 03 -> 33 or 0 3 -> 30 33 (read)
Starting address: 10 00 -> 4130 or 1 0 0 0 -> 31 30 30 30
....
so what do you think?
As for the PID controller, yes, it does accept ASCII protocol in the settings.
Should ASCII data length be 7 or 8? I get both numbers mentioned in different articles and it is confusing a bit.
Now as for sending the message, you have a good point. I have to ask the PLC manufacturer about the s/w utilities that make it work.
Thanks again for your care to educate people. I really look forward to your response.
Boy, that protocol example you provided sure looks like Modbus ASCII to me . . .
The example shows you the characters that you would type on the keyboard when using HyperTerminal. HyperTerminal then converts what you type to ASCII for transmission via the serial port.
So the characters in the example have to be converted to ASCII (as you've done) in your routine, unless you're using a terminal tool like Hyperterminal.
Start of Tx ':' -> 3A
Ans: That's correct. Colon is the Modbus ASCII start character.
>Address if unit 1 and address of unit 2 ( I am not sure whether you combine them or you have to have an ascii for each char, please look at the char. Why do we have address if unit 1 and unit 0 ?
Ans: You're suffering from a bad manual writer or maybe a bad translation from Japanese.
There is only a single address composed of two characters.
The address should be:
high order address character, then low order address character.
In the Omron example the slave address was 01, so
high order character = 0, low order character = 1.
The Modbus format requires both characters for the address, so for an address of 01h,
Modbus ASCII would use 30 31 ASCII
Same holds true with the function command, both ASCII characters are needed.
Modbus function command 03h is the most commonly used function: 'read holding registers'.
High order character = 0, low order character = 3.
So the command read holding register, 03h, would translate to 30 33 (ASCII)
> Command 1 and Command 2 : 03 -> 33 or 0 3 -> 30 33 (read)
Ans: You are correct.
So far the message reads (the forum formatting will screw up the columns)
: 0 1 0 3
ASCII: 3A 30 31 30 33
> Starting address: 10 00 -> 4130 or 1 0 0 0 -> 31 30 30 30
Let's assume that the example is correct & works, so that the address for the PV is at 1000h.
(you might want to examine the Modbus map and confirm that the PV is really at 1000h. In fact you might want to fire up Hyperterminal, get a 'read' and see if the PV is really at 1000)
The address is 2 bytes, or 4 characters in hex, 4 characters in ASCII
The conversion to Modbus ASCII is 31 30 30 30, like you proposed.
: 0 1 0 3 1 0 0 0
ASCII: 3A 30 31 30 33 31 30 30 30
Now you have to define how many registers are to be read. If you only want the single value then one value = 0001h or 30 30 30 31 ASCII
: 0 1 0 3 1 0 0 0 0 0 0 1
ASCII: 3A 30 31 30 33 31 30 30 30 30 30 30 31
> Should ASCII data length be 7 or 8? I get both numbers mentioned in different articles and it is confusing a bit.
Ans: Modbus ASCII, by the Standard, is a 7 bit data word.
Modbus RTU is an 8 bit data word. This protocol is clearly Modbus ASCII.
http://smxplc.com/
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home