Global Defines

Global Defines are user-generated constants used in a program.

Global Defines are used to write code and add an ifdef statement to call the Define only if it is used for a particular machine.

They are created and edited in the Project Explorer toolbox under PLC.

Global Definitions

Figure 1: Global Defines

Double-click the Defines item to open the global definitions file (named: appli.eqv) in a text editor as:

Edit the Global Definitions

Figure 2: Edit the Global Definitions

Each definition must be entered on one line of text using this syntax:

#define   Identifier   Equivalence   (* comments *)

Definition Inside Another Definition

A definition within the contents of another definition is allowed.

The definition used in the second must be declared first.

Example:

#define PI      3.14
#define TWOPI (PI * 2.0)

Local Definitions

Local definitions are user-created defines used within the corresponding program through an ifdef statement.


  • Using definitions disturbs the program monitoring and makes error reports more complex.
    It is recommended to restrict the use of definitions to simple expressions.
    This helps avoid misunderstandings when reading or debugging a program.