Introduction

When Program Units are allowed in programming your application (Modicon M580 and M340), variables are determined by the scope to which they belong to:

Global variables:

They refer to the application wide - or global - scope of data in a project which are:

  • Unlocated variable

  • Located variable (mapped at %M flat address)

Program Unit variables:

They refer to the Program Unit data scope and have one of the following attributes:

  • Private: can only be R/W in the scope of this Program Unit.

  • Public: can be R/W out of the scope of this Program Unit.

  • Parameter (Inputs , Outputs , and Inputs/Outputs ): linked to Public variables (from other Program Units) or Global variables.

  • External: Global variables used in this Program Unit.

NOTE: The management of topological variable is only supported in the data editor, refer to parameter assignment to map a variable of a Program Unit to a topological variable.

Data Scope in Project Browser

1 Global variables, managed via the Data Editor

2 Variables under Program0 scope, managed via the Program Unit Data Editor of the Program0.

3 Variables under Program1 scope, managed via the Program Unit Data Editor of the Program1.

Variables Accessibility

The variable accessibility is dependent to the scope (Global, Program Unit):

NOTE: System behavior of the PLC is accessible using the system bits and system words into the Program Unit.