RSLogix 5000 User-Defined Function Blocks?

E

Thread Starter

ER

Hello Everyone!!

Does anyone know if RSLogix 5000 allows a user to create his/her own function blocks? I want to
create a block of code that I can re-use over and over again. In my program, I have to do
various unit conversions and it would be great if I could create a function block that allows me
to give it the necessary input(s) and obtain the result(s). Any help is greatly appreciated as
always!

THANKS A MILLION!
 
C

Currie Gardner

At this time RSLogix does not allow User Defined Function Blocks (DFBs), which is too bad as DFBs are one of the great strengths of the IEC-61131-3 Standard. When I spoke with a Rockwell software engineer at the Automation Fair in November 2001, he indicated that they were in no hurry to implement this important function any time soon.

The only way you can "sort of" simulate the DFB functinality with RSLogix5000 is to use subroutines and pass parameters.
 
If you meen RSLogix 500 then try looking in the help file for the SLC Library, this is where you can store rungs of logic and paste them wherever you want. If you select your desired ladders and click the right mouse button you get a "Copy To SLC Library" option. Also there is a paste from option.
As far as fuction blocks are concerned I can't find them!
Hope this helps
John!
 
I'm just starting my first RSLogix5000 project so I'm not sure but I don't think you can make user defined function blocks. However, I
beleive you can make a routine that uses its own local tags and you can use it over and over again. I haven't tried it yet.
 
T

Trevor Ousey

Try using JSR with the parameter pass through, and you will end up something similar to Function Blocks.
 
L

Larry Lawver

User-Defined Function Blocks (UDFB) are under development at Rockwell, but probably will not appear in the released system during calendar year 2002.

Under RSLogix5000 V10, available today, the FBD environment now includes the JSR block, allowing you to call (jump to) a subroutine (LD or FBD) with parameters passed in and out of the called routine. Thus, you can have a user-defined function until the UDFB arrives.

If you need help with that, feel free to post more about the function you want to implement, either to the list or to me personally.


Hope this helps!


Larry Lawver
Rexel / Central Florida
 
M
They are called subroutines.

ControlLogix and PLC5 can pass paramters, with the SLC you have to do a bit more work.

PLC5 can only pass words (N,B, etc)

ControlLogix allows you to pass arrays and structures also. From version 10 of RSLogix5000 you can pass BOOL datatypes. From version 8 sub routines are available in FBD (previously they were only available in ladder).

RSLogix5 and 500 are designed to assist you in reusing code and can save and import library files. Unfortunately RSLogix 5000 doesn't have this feature.

Another thing to whatch with ControlLogix is as far as I can tell you can't have controller scope routines, which means that if you want to use a function block in more than one task you have to duplicate the routine.
 
I've tried using subroutines. However, how can I define a tag to be local and therefore available only to that subroutine?

Thanks Everyone!
 
I've tried using subroutines. However, how can I define a tag to be local and therefore available only to that subroutine?

Thanks Everyone!
 
M
You can't. But although routine 'scope' variables would be useful, function block instance variables would be more so.

Even Siemens don't have instance variables yet.

However you can fake them by assigning a data table area as a control block.

With RSLogix5000 you can create a control structure with a user defined data type. You then instantiate each subroutine call with it's own control block (the best way to do this is to pass the control block into and then out of the subroutine. Create your subroutine using scratchpad (temporary) variables.

If you would like some examples I can send you one or two off list.

There are no local variables, you can still access the control block externally (which you might find useful any way), but each instance of the UFB has it's own data.
 
S

ScienceOfficer

Mark---

Another great question. No, you can't do that now. Routine-scoped tags are also on the plan for a future release; meanwhile, you'll have to keep them separated via your own diligence.

Try making them so hard to type that you would have to pick them off a pick list:

_qqq_0777_internal_tag_1_for_My_Function,
_qqq_0777_internal_tag_2_for_My_Function, etc.

Hope this helps!

Larry Lawver
Rexel / Central Florida
 
N

Nijssen.Ronald

>Even Siemens don't have instance variables yet.<

Mark, can you clarify this, the static variables, declared in a FB, and instantiated in the Data Block that goes with a call of the FB, are these
not instance variables from your perspective?

Thanks,
Ronald
 
Top