[ControlLogix] Converting STRING to a TAG

ahussnain

Member
Join Date
Dec 2005
Location
LHR
Posts
4
Hi there

In ladder logic (RSLogix5000) program, I've a string "FIC000" and I want to use this string as a TAG in some instruction say Add(FIC000, 1, FIC000)... Sine I don't have TAG but only STRING that hold the tag's name, I'll have to somehow convert String to Tag. Is there any possible way? I know its easy in VB type languages but how about Ladder?

Any comments or way around

Regards

Asim Hussnain
IPA
 
Greetings ahussnain,

and welcome to the forum ...

have you looked at the following "conversion" instructions? ...

STOD (String to DINT)
STOR (String to REAL)
DTOS (DINT to String)
RTOS (DINT to String)

I'd give those a try ... if these don't help, then post again and give us some more detail - with specific example values - and we'll see if we can come up with something that will work ...
 
Last edited:
Arrays - they don't let define Alias, DTOS etc won't help

My problem is in fact that I'm already using Arrays of PID. And I don't want to define and use a new Tag (with some IO Alias) in my logic every time I resize my array of PIDs.... Getting it? Write my logic once for all and loop on PID array... First solution came to my mind was to define array for PVs as well. But I can't use array elements as Alias i.e PV[3] can't be alias to any IO channel. So other option I have is to define my PV tags with certain naming convention e.g. PV0, PV1, PV3; and then take benefit of this name convention on my logic rungs.
 

-----|LBL|--- (inc index)------

-----(CONCAT {"PV" & index} in TagName)

-----(READ Value for TagName in TagX)

-----(MOV TagX in PID[index].PV)

-----(PID[index]

JMP
------------(LBL)--



Hope the very raw pseudo helps..

Regards

Asim Hussnain
IPA
 
Last edited:
Array Elements as Aliases to IO Channels: Possible with some limitations

We all know that ladder (RSLogix5000) doesn't allow to use any Array elements as Aliases to IO channel or any other tag.

I've a solution for that which is possible but somewhat limiting. Cosider that you've 4 Integer channels on a Card. RSLogix will generate 4 tags say Local:0:I.Ch0Data to Local:0:I.Ch03Data against the channels. Now you want an Array of 4 elements each to hold value of respective channel. You can write a routine that would run with every scan start. In this routine you can use COP command.

Lets say first of 4 channel is : Local:0:I.Ch0Data
Lets say my array name is : INTEGS[4]

you write in Ladder : COP Local:0:I.Ch0Data, INTEG[0], 4

Result: All four channel values are copied in INTEGS[0]....[3] in order.

This is possibl because COP copied byte by byte. This make INTEGS able to pretend as alias to Local:0:I I/O Channels. Now its upto you to find any practical value of this trick.

But my question still stands unanswered. How to read a tag's value when we only have tag name say "FI000".

Regards

Asim Hussnain
IPA
 
ahussnain said:
But my question still stands unanswered. How to read a tag's value when we only have tag name say "FI000".

As I said, there's no easy way to do this. You could maybe write a whole bunch of conditional logic that looks at the content of the string tag, but that wouldn't be much better than what you're already doing.

You may need to retink your approach to this problem. You seem to be getting trapped because you're used to programming a PC. The instruction sets in the PLC world are a lot more limited. Since I don't see your program and don't know anything about your system, I can't tell you the best way to make the task easier.

AK
 
Tag is nothing but a pointer to a memory location inside PLC.
There is no way to create tag name to address the memory location.

You may ask this at the Rockwell forums - Ron Bliss or Fabio will respond.
 
To resurrect a long dead thread...

I'm going to refute the other responses saying that this isn't possible. It is indeed possible... but REALLY not recommended.

You can dynamically configure the MSG instruction MESSAGE data type instance to read / write to your dynamically addressed variable (NOTE: the variable MUST be controller scoped, and allow Read / Write as required).

https://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm012_-en-p.pdf

But really... don't do this.

If you really want to dynamically reference things like this (for an HMI display or similar), then create a UDT which holds the STRING display for what you want to call the datatype (and the data type for the operation you want to perform, i.e. PIDE / etc), and create an array of your new magic UDT.

Then loop through it to find the index that matches your input string to the name string of your object. Then you can call logic that uses the index to perform the action.

NOTE: many operations (i.e. PID / PIDE etc) very much want to be called every scan (or at least regularly). So only calling the operation based on your index usage would be a really bad idea.
 
When you post "do not do this even though it is technically possible", you guarantee that somebody will make it their standard design and the basis of all of their programs.
 
If I don't put such a disclaimer then they may well think that it's a great idea, and recommended by someone.
So by adding the disclaiming I'm warning them about the badness... but still being honest about the technical possibility.
 

Similar Topics

Hello :) I've already come up with a solution to the problem described below, so this is mainly a curiosity had the situation been different...
Replies
6
Views
3,703
I have a GE Faunc 90-30 PLC's running some process in my plant and want to convert them over to Allen Bradley controllogix does any know of any...
Replies
2
Views
3,357
I am facing some difficult questions that I am unable to answer on my own. This is why I need your expert opinion. How easily can you convert...
Replies
5
Views
3,372
My project is migration hardware also logic of GML to new controllogix. as information, this GML connected to ULTRA 3000 servo driver and have 2...
Replies
4
Views
4,266
Why does the controllogix redundancy modules use a single mode fiber vs multimode fiber?
Replies
1
Views
53
Back
Top Bottom