Global Variables in CPRog
As of Version V9802-10-24 all variables in CPRog are Global.
This can be demonstrated and tested quite easily by writing a little test program including a sub program. In this example a gantry moves in the following ways depending on the defined variables:
mynrvarin main.xml is set to 1 the gantry moves in x direction.
mynrvarin main.xml is set to 0 the gantry does not move in x direction.
myRetVarin sub.xml is set to 1 the gantry moves in y direction
myRetVarin sub.xml is set to 0, the gantry does not move in y direction.
- Example code for drylin_xyzGantry:
- Example code for robolink_4Axis_Small:
To try out the programs,
- download one of the links above and unzip the file to
- load the program in CPRog. The sub-program will load automatically.
- run the program in simulation (with the robot disconnected) and change the value of mynrvar and myRetVar.
- When changing any value in any cell of a program always make sure to exit the changed cell using, e.g. the "return" key prior to saving the file. Otherwise changes will not get saved.