Sign in to follow this  
Followers 0
justacoder

ASCII Conversion

3 posts in this topic

I am reading in a 12 digit ASCII string from a barcode scanner to CH0 of a Controllogix. I need to convert every pair of digits in this 12 character string to HEX and then add them together. The string consists of letters and numbers (which rules out the STOD instruction). Is there a quick way to convert the ASCII data in to HEX, add the HEX values, and send the orginial ASCII string with 4 appended HEX values (the result of the addition, could be letters and/or numbers) back out CH0?

Share this post


Link to post
Share on other sites
Just thought I would supply an example. The string I am reading in looks like this: 0184191A001C In the real world, this is a HEX code It is ASCII (String) once in the ControlLogix. I need to break the string into this: 01 84 19 1A 00 1C I need to convert each 2 digits to HEX and add them together, appending the sum to the end of the orginial string, and send it all back out again. Remember, although the string is coming into the PLC as ASCII, they represent HEX numbers.

Share this post


Link to post
Share on other sites

Did you ever find a solution to this issue?

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