I have been in the industry for several years now and have worked with ABB IRC5 off and on over the course of this time. I work mostly in automotive plants, and for the most part all software and offline programs are already loaded into the robots with robtargets already created. And since they are already created they are already declared as VAR, CONST, or PERS. As I am trying to better myself as a programmer I wanted to know the difference between the three (3), VAR, PERS, and CONST. I know they represent Variable, Constant, and Persistent but I want a better understanding of what the exact difference is between all of them and when is it appropriate to use each. Any input would be greatly appreciated.
Better Understanding Of ABB IRC5
-
millerm213049 -
March 7, 2016 at 1:51 PM -
Thread is marked as Resolved.
-
-
CONST should be used just as a replacement for literal data, like when you have a fixed number or string that you will use a lot in the program but you don't want to type everything again all over the place. So you are just giving a new name to some data.
VAR should be used with data that have to be reset to the default value when the operator restart the program from the beginning, like a temporary data.
PERS should be used when with data that should remain saved even after the operator restart the program from the beginning, like for example a production count.
-
Some data types (eg. Work objects, tooldata) won't work if they are defined as the wrong type. I'd have to look up which is what, but some will only work if defined as CONST or PERS.
-
Iowan your statement it's correct, but the definition is not. All data can be declared with any storage type (VAR, PERS or CONST).
Some instructions request data to be of a specific storage type, for example, most of the movement instructions like MoveL and MoveJ, request that the tool and wobj must be of persistent type.
You can still create a tool or wobj as a VAR or CONST (for storing temporary data and calculations for example), but it can not be used in such instructions like MoveL. -
Thanks for the information. It makes much more sense now that I know that.
-
Worth noting is the behavior of the different classifications during restarts etc.
CONS(tants) is as the name implies, constant.
The idea is to use these for data that will never (or rarely) change.VAR(iables) can be modified but are reset to their initial value upon restart of the program (e.g. PP to main) and/or controller.
If no default value is assigned, e.g. "VAR num myNum;" then the initial value is "0", but if you assign a value, e.g. "VAR num myNum:=10;" then the initial value is what it was assigned to be, 10 in this case.PERS(istants) is a hybrid between CONS and [size=4pt]
NUM[/size] VAR in the way that they will remember the current value in the event of a restart, power loss, etc. and that you have to clear that value manually/through code if you need/want to. -
And what about the proper use NUM?
I know these may seem like simple questions, but they are ones I have never asked or had any reason to. I am now about to start on a massive ABB project and I am trying to make sure I am prepared for what ever may be thrown at me.
-
Typo... should have been "VAR" and not NUM... NUM is a datatype for NUMerical data.
Don't worry, there's no stupid or simple questions only dumb answers
-
Very true. Thanks again, everyone, for the info.