mdia

HexaDecimal to String Conversion in Studio 5000 Logix Designer

1 post in this topic

I am working on  calculating a checksum value for a command that is to be sent from an Allen-Bradley CompactLogix PLC to a Mass flow controller. An example of a command is the following: "@@@022SX!20.00;CHECKSUM". 
1. The checksum is the sum of every characters' ASCII code value (starting from character 3). 
2.Then this sum (which would be in decimal format) has to be converted to HexaDecimal
3. Finally, the last two characters of the result have to be extracted and that would be the value of the checksum. 

(For Ex: the value of every individual characters' ASCII code (starting from point 3) of the above command is 715. in HexaDecimal, 715 = 2CB. So , the value of the checksum for this command would be 2CB)

I got to the point where i found the sum of ASCII code. Any idea on how to convert that to  a HexaDecimal and then convert that HexaDecimal to a string so that I could concatenate it to the command string?? 
 

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