I am transferring data ASCII Modbus though an Allen Bradley Point I/O Rs232 module.
I can query the data and load my data tables with the information.This work well but I am sure there is an easier way. But this is the route I have to follow
The problem is converting the data into floating points. I understand the process but I think there has to be an easier way. Here is what I have.
I am using PLC 5
I receive the data into the integer files. For example sake, let say I get them in order…
Reading it in ASCII
N7:0 – 4A
N7:1 – D0
N7:2 – 5E
N7:3 – 08
Reading in Decimal right from the tables
N7:0 – 13377
N7:1 – 17456
N7:2 – 13637
N7:3 – 12344
My first problem is 4A = 74 not 13377. So I am assuming there is some data somehow truncated on the ASCII – Hex data? Not sure why or what to do with it.
The number I am trying to get is 6827780
If I take this number (Float point) and copy it to an integer file, I will get two integers.
19152 and 24072. This is easily understood.
I know that if you take the following and copy them in to a floating point you will get the proper number back 6827780. Again easy, peasie…
4AD0 = 19152
and
5E08 = 24072
But looking at the data I am getting, it is stored in 2 byte data chunks 4A and D0 and 5E and 08.
How can I put these back together to attain the correct floating point value?
If the data in the tables actually where 4A, I could bit shift it and add the second but for some reason this will not work.
I am thinking I missing the point and over seeing something obvious. Anyone have a minute, I would appreciate some feedback.
This is a Sigma Water Meter. Communicates ASCII Modbus via wireless to a 1734-RS232 Point I/O Module then DeviceNet into my PLC.
I tried to get the system to transfer 4 byte chucks of info which would be nice but it is not happening.
Thanks for anything anyone has to offer!
Here is a great Website for some detail for anyone.
http://www.markworld.com/showfloat.html
Scorpio
I can query the data and load my data tables with the information.This work well but I am sure there is an easier way. But this is the route I have to follow
The problem is converting the data into floating points. I understand the process but I think there has to be an easier way. Here is what I have.
I am using PLC 5
I receive the data into the integer files. For example sake, let say I get them in order…
Reading it in ASCII
N7:0 – 4A
N7:1 – D0
N7:2 – 5E
N7:3 – 08
Reading in Decimal right from the tables
N7:0 – 13377
N7:1 – 17456
N7:2 – 13637
N7:3 – 12344
My first problem is 4A = 74 not 13377. So I am assuming there is some data somehow truncated on the ASCII – Hex data? Not sure why or what to do with it.
The number I am trying to get is 6827780
If I take this number (Float point) and copy it to an integer file, I will get two integers.
19152 and 24072. This is easily understood.
I know that if you take the following and copy them in to a floating point you will get the proper number back 6827780. Again easy, peasie…
4AD0 = 19152
and
5E08 = 24072
But looking at the data I am getting, it is stored in 2 byte data chunks 4A and D0 and 5E and 08.
How can I put these back together to attain the correct floating point value?
If the data in the tables actually where 4A, I could bit shift it and add the second but for some reason this will not work.
I am thinking I missing the point and over seeing something obvious. Anyone have a minute, I would appreciate some feedback.
This is a Sigma Water Meter. Communicates ASCII Modbus via wireless to a 1734-RS232 Point I/O Module then DeviceNet into my PLC.
I tried to get the system to transfer 4 byte chucks of info which would be nice but it is not happening.
Thanks for anything anyone has to offer!
Here is the old fashion way
4AD05E08 (hex)
01001010 11010000 01011110 00001000 (binary)
The Sign of the mantissa (and therefore the number) is 0 which represents a positive value.
The Exponent is 10010101 (binary) or 149 decimal.
The exponent field is represented in excess 127 so the exponent value is 22
The Mantissa is 10100000101111000001000 binary
with the implied leading 1, the mantissa is (1).A0BC10 (hex)
The floating point representation is therefore +1.62786961 times 2 to the 22
Here is a great Website for some detail for anyone.
http://www.markworld.com/showfloat.html
Scorpio
Last edited: