Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

modbus rtu data calculation

Status
Not open for further replies.

raman00084

Full Member level 6
Full Member level 6
Joined
Nov 29, 2010
Messages
375
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
4,076
dear friends,
i am new to modbus rtu i am getting the following data how to compute the same.

01 03 04 (86 9F 00 01) 22 95 = 99999
(86 9F 00 01) this is the data how can i compute to get 99999

01 03 04 (79 61 FF FE )72 C1 = -99999
(79 61 FF FE ) this is the data how can i compute to get -99999

01 03 04 (40 00 44 0D) 1D 36 = 7894.567
(40 00 44 0D) this is the data how can i compute to get 7894.567
i am using pic ccs c complier.
kindly help me
 

How in the world one could give any tip on this if you show no code ? Anyawy, why don't you start by doing the simple math on the code or by using some of dozens examples available on the web ?
 
You are skipping several steps in your question.
1. Do you know the MODBUS application protocol and serial line RTU framing so you are able to decode the shown messages? Respective documents are available at modbus.org.
2. Each of the messages is the response to a 0x03 Read Holding Registers request with a length of 2 registers. You have already marked the numerical data fields with brackets.
3. MODBUS standard doesn't specify other data entities than single bit and 16-Bit numbers. The shown responses are apparently using a vendor specific interpretation of 32-Bit integer and float data.

You should have no problems to decode the first and second response as 32 bit signed integer numbers with flipped high and low word. Easy to map it to C int32 format.
For the third response, I'm not sure. IEEE float value with flipped high and low word would be 565.00. If it's some unusual custom float or fixed point value, you should have respective information. Which device is sending the data?
 

Hello
since you have said you are using CCS Ccompiler i don't know PCM OR PCH type there is in example folder
two examples one for slave and the other for master in addition "modus header file " you must include this header
to your source code you can use the P.C as master or as slave read the two exmp. carefully .i am using PCM type . the protocol is RTU. if you want many replies in this forum write the frame of RTU(Communication protocol structure) of your code for master and the slave

kamal
 

You are skipping several steps in your question.
1. Do you know the MODBUS application protocol and serial line RTU framing so you are able to decode the shown messages? Respective documents are available at modbus.org.
2. Each of the messages is the response to a 0x03 Read Holding Registers request with a length of 2 registers. You have already marked the numerical data fields with brackets.
3. MODBUS standard doesn't specify other data entities than single bit and 16-Bit numbers. The shown responses are apparently using a vendor specific interpretation of 32-Bit integer and float data.

You should have no problems to decode the first and second response as 32 bit signed integer numbers with flipped high and low word. Easy to map it to C int32 format.
For the third response, I'm not sure. IEEE float value with flipped high and low word would be 565.00. If it's some unusual custom float or fixed point value, you should have respective information. Which device is sending the data?
i have decoded the first 2 response but unable to decode the third floating point response
i am using weintek hmi heare is some more response examples
Rx:000001-01 03 04 (4F 80 47 C3) 9E AE =99999.000
Rx:000003-01 03 04( 44 9C C2 6A )FF A2 = -58.567
Rx:000005-01 03 04 (33 33 41 43) 74 D9 = 12.200
Rx:000007-01 03 04 (E6 B6 46 40) 1F 0D = 12345.678
--- Updated ---

How in the world one could give any tip on this if you show no code ? Anyawy, why don't you start by doing the simple math on the code or by using some of dozens examples available on the web ?
thankyou.
 

According to my knowledge, Weintek is using IEEE 754 float format, but it doesn't fit the shown numbers.
 

Yes you are right, I did read the exponent wrongly. Swapping of high and low word is the same as with int32 numbers, shouldn't be a problem. CCS C has built-in functions to handle it.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top