Global Variables in CPRog

From CPR Wiki
Jump to: navigation, search

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:

  • If mynrvar in main.xml is set to 1 the gantry moves in x direction.
  • If mynrvar in main.xml is set to 0 the gantry does not move in x direction.
  • If myRetVar in sub.xml is set to 1 the gantry moves in y direction
  • If myRetVar in sub.xml is set to 0, the gantry does not move in y direction.

Globalvar1.png Globalvar2.png

To try out the programs,

  1. download one of the links above and unzip the file to C:\CPRog\Data\Programs\.
  2. load the program in CPRog. The sub-program will load automatically.
  3. 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.