lotuseater
Member
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 the appropriate decimal value?
Thanks.
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 the appropriate decimal value?
Thanks.