Sign in to follow this  
Followers 0
lotuseater

Help to Convert String (Hex Format) to Decimal

2 posts in this topic

We are doing some testing communicating serially with a linear actuator in order to get its current position using an Allen Bradley Compact Logix processor. The information comes back as a string and I am able to extract the part of the string I need using an MID instruction. This string contains a hexadecimal value. The actuator company has demonstrated to me how find the actual position using this value within Microsoft Excel, but I would like some assistance automating this in my PLC. Here is an example of how to find the position using Excel: String Value from device: 'FFFFEC14' Excel HEX2DEC() = 4294962196 Constant Base Position: 'FFFFFFFF' Excel HEX2DEC() = 4294967295 Actual Position = 4294962196 - 4294967295 - 1 = -5100 Actual Position is -51.00 mm This matches up to the actual value when looking at the front end software for the device, but I would like to complete this procedure within my PLC. Does anyone have any tips for converting the string value (HEX) to an appropriate decimal value? Thanks. Edited by lotuseater

Share this post


Link to post
Share on other sites
There seems to be more discussion going on here: http://www.plctalk.net/qanda/showthread.php?p=295793

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0