Incrementing Alpha Numeric Serial

CraigTRD

Member
Join Date
Aug 2008
Location
London, On
Posts
24
Hello World,
I am having difficulty incrementing a serial number that needs to start at 0, and go through Z. (After 9, comes A).
The serial number is a String. Is that right? If not, what should it be, please?
What is the command to move the letter "A" into a Serial_1.DATA[8]?

RSLogix 5000

Thanks in advance!
 
Set up a SOURCE_STRING with "0123..ABC..XYZ" in it. Set up an "index" DINT.

Start the index at 0 and increment it up to 35.

For each increment do
MOV SOURCE_STRING.DATA[index] Serial_1.DATA[8]

You decide what to do after reaching 35 on the index, restart at 0?
 
Since character '9' (dec 57) and character 'A' (dec 65) are not sequential in the ASCII table you'll need to cobble together some logic to accommodate that quirk. As far as moving to the string, MOV N7:0 ST9:0.DATA[0] works in the pre-CLX processors.
 
I was working on this, as you guys were replying. This is what I have come up with. Not sure if it will work, as I am not online with the PLC....but I think it will. It makes sense, with what GaryS said. It also explains why I was getting a colon, instead of an "A". I'll try it out ASAP. Thanks to everyone for the ideas! I'm always looking for better/slicker ways to do code.
PLC.PNG
 
Just in case it wasn't obvious my statement

Set up a SOURCE_STRING with "0123..ABC..XYZ" in it. Set up an "index" DINT.

Means create SOURCE_STRING with the contents "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

No need to test anything at the 9-A transition point.
 
Last edited:
Just in case it wasn't obvious my statement



Means create SOURCE_STRING with the contents "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

No need to test anything at the 9-A transition point.

That's what I thought you meant, and when I tried it, it doesn't seem to work. It won't let me adjust the value circled in blue:
PLC1.PNG
 
Don't try to change the individual characters.

Just click the area after Source_String (which now shows '1') - Not Source_String.DATA[0] - just Source_String above the .LEN entry.

You'll get a grey button with an ellipsis (triple period). Click that button to get a 'String Browser' window. Just type in the 36 character string and click OK.

Edit - I see now that you get the ellipsis button even if you click in a character area. It shows the string with the cursor just before the specific character. I've never done it that way. Interesting.
 
Last edited:

Similar Topics

So, I get sent a heartbeat, an int that goes from 0-9 every second and then restarts, I need to detect if it stops after 3 secs. Any simple way...
Replies
11
Views
3,076
I'm sure this is an easy one for the experienced guys, how can I use an incrementing dint value to trigger a counter to count? It seems like it...
Replies
4
Views
3,164
Hi guys, Im about to add a new flowmeter which pulse every 0.1 cubic meter to my Micrologix 1400. I would like to increment of 0.1 everytime i...
Replies
13
Views
1,989
Good Morning, I have a sort of easy problem that is driving me nuts. I have an application where I'd like to take a set point, lets say it...
Replies
4
Views
2,264
Hey everyone, I am hoping that i can get an answer on this matter... I have a micrologix 1100 hooked up to a signal conditioner (Omrga DMD-466-DC)...
Replies
4
Views
1,577
Back
Top Bottom