Modules

Modules

The program is divided into program and system modules. The program can also be divided into modules .

 

 The program can be divided into modules.

Program modules

A program module can consist of different data and routines. Each module, or the whole program, can be copied to diskette, RAM disk, etc., and vice versa. One of the modules contains the entry procedure, a global procedure called main. Exe-cuting the program means, in actual fact, executing the main procedure. The program can include many modules, but only one of these will have a main procedure. A module may, for example, define the interface with external equipment or contain geometrical data that is either generated from CAD systems or created on-line by dig-itizing (teach programming).Whereas small installations are often contained in one module, larger installations may have a main module that references routines and/or data contained in one or several other modules.

System modules

System modules are used to define common, system-specific data and routines, such as tools. They are not included when a program is saved, meaning that any update made to a system module will affect all existing programs currently in, or loaded at a later stage into the program memory.

Module declarations

A module declaration specifies the name and attributes of that module. These attributes can only be added off-line, not using the teach pendant. The following are examples of the attributes of a module:

Attribute If specified, the module:

SYSMODULE is a system module, otherwise a program module

NOSTEPIN cannot be entered during stepwise execution

VIEWONLY cannot be modified

READONLY cannot be modified, but the attribute can be removed

NOVIEW cannot be viewed, only executed. Global routines can be reached from other modules and are always run as NOSTEPIN. The current values for global data can be reached from other modules or from the data window on the teach pendant. A mod-ule or a program containing a NOVIEW program module can-not be saved. Therefore, NOVIEW should primarily be used for system modules. NOVIEW can only be defined off-line from a PC.

e.g. MODULE module_name (SYSMODULE, VIEWONLY)

!data type definition

!data declarations

!routine declarations

ENDMODULE

A module may not have the same name as another module or a global routine or data.

Syntax

Module declaration

<module declaration> ::=

MODULE <module name> [ <module attribute list> ]

<type definition list>

<data declaration list>

<routine declaration list>

ENDMODULE

<module name> ::= <identifier>

<module attribute list> ::= ‘(‘ <module attribute> { ‘,’ <module attribute> } ‘)’

<module attribute> ::=

SYSMODULE

| NOVIEW

| NOSTEPIN

| VIEWONLY

| READONLY

(Note. If two or more attributes are used they must be in the above order, the

NOVIEW attribute can only be specified alone or together with the attribute

SYSMODULE.)

<type definition list> ::= { <type definition> }

<data declaration list> ::= { <data declaration> }

<routine declaration list> ::= { <routine declaration> }