PDA

View Full Version : Jace & ModbusRTU Conversion



bridgeIT
09-02-2008, 05:05 PM
I was hoping that I could find some help in converting Modbus Data.
The System has a Jace and the ModbusRTU driver. I have the AI's scaled and working properly, however the Modbus Device use High and Low Byte data for Setpoints. This data is in Decimal and needs to be converted to hex before splitting the Hi and Lo bytes. Does anyone know of a conversion from Decimal to Hex?

amigo
09-02-2008, 05:16 PM
make and model of the field device?

orion242
09-02-2008, 07:35 PM
>Does anyone know of a conversion from Decimal to Hex?

Do you know what type of point is it. 32bit integer, 32bit IEEE float or some other 32bit float? All three of these can be used in Modbus.

orion242
09-02-2008, 07:42 PM
almost forgot....

Just to keep it simple it could be 32bit signed or unsigned interger also.

bridgeIT
09-03-2008, 09:35 PM
The Modbus Device is a York Simpicity 3-25 Ton Roof Top Unit.
It uses a 16 bit Unsigned Integer.
Ex. Register returns Decimal Value: 18500
Hex Value: 4844
Hex High Byte: 48 Decimal High Byte: 72
Hex Low Byte: 44 Decimal Low Byte: 68

In this same example if I read Register as A string value: HD
String High Byte: (Ascii 72=H)
String Low Byte: (Ascii 68=D)

Thanks in advance for your help ;-)

orion242
09-03-2008, 10:31 PM
Roger I had the idea you where talking about 32bit numbers. To convert this over to this over to hex you will need to do a bit work. I’m not familiar with the Jace, but pending you can write some line code in it this should be simple enough.

You need to divide the number 16 and figure out the remainder each step along the way.

18500 / 16 = 1156 with a remainder of 4
1156 / 16 = 72 with a remainder of 4
72 / 16 = 4 with a remainder of 8
4 / 16 = 0 with a remainder of 4

Take your remainders and convert them to hex 0-F with a lookup table. In this case all the remainders are below 11, so there is no change. Reverse the order and you come up with the answer 4844h.

Using a loop-while structure keep dividing unitil you have a result that is zero, and then convert your remainders to hex. Hope this helps give you an idea on how to convert decimal to hex.

BAS_Guy
09-09-2008, 01:27 AM
Try and get your info here.

http://www.onlineconversion.com/base.htm

bridgeIT
09-09-2008, 03:00 AM
Thanks for all of your replies. A friend sent me a custom palette that took care of the conversion. :)