ASCII Character Values

Richard250891

Member
Join Date
Dec 2013
Location
Rugby
Posts
5
Hi,
How would I write a program to get the PLC to calculate a value for a set of characters in a string?

I'm using RSLogix 500 and a SLC 5/05 CPU.

For example, if I have a string that reads "ABCD", I know that the ASCII value of the characters combined would be 65+66+67+68=266, but is there a way to set this up so the PLC can do this automatically, without me having to manually enter the character values into, say, a CPT instruction?

Thanks
 
Hi there!

Attached, you will find my method of ASCII Lookup.

It will iterate through whatever string you enter for ST9:250 and return the decimal ASCII value for each alphanumeric character.

I added a bit where it adds all the values together, but with the premise you are using, "ABC", "BAC", "CAB", and "AAD" all have the same value. Don't know if that was your intent or not...

ST9:252 is the Master String (I capitalized it because this is very important ;) ). This must be set to:
Code:
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

Lookup table functionality without the lookup tables.

Hope this helps!
 

Similar Topics

Hi All, have a quick one new enough to this type of programming, I am using a Allen Bradley point IO with 1734-232ASC card to send out data, I...
Replies
5
Views
2,627
I'm trying to read in ASCII strings from an RS232 card reader to an AB 5/03. I get some strange characters in my string. As you can see in the...
Replies
8
Views
7,841
Hello, I am reading several BYTES from a PLC which each represent one ASCII character. How do I convert this so that WinCC will display the...
Replies
3
Views
5,157
Unregistered
U
Hi all, My requirement is to send out escape character ( and also enter , line feed characters)from MicroLogix serial port configured in ASCII...
Replies
3
Views
7,543
Hi, We couldn’t find anything specific, so am starting a new thread. I’m trying to migrate a config from a ML1400 to a micro820 & am experiencing...
Replies
1
Views
116
Back
Top Bottom