18
Saia-BurgessControls AG
Introduction
Symbol Names
Saia PG5® Instruction List, 2013-10-25
Group0.Test.Symbol EQU R
NOTES
In some cases it may be advisable to avoid using accented characters in symbol names. S-Asm
supports them, but they can cause problems if a program file is transferred to another PC with a
different operating system (Windows 2000/NT/XP/Vista/7 etc) or with different language support
installed. Some characters are not translated properly by the operating system, and the file will not
assemble.
The DOS-based PG3 and the 16-bit PG4 used the old "OEM character set", which may not be
compatible with the PG5 if accented characters have been used. The current version of the PG5
uses the ANSI character set for program files. Fupla programs will be converted automatically from
the OEM to the ANSI character set. IL programs can be converted using the IL Editor's "Convert
from OEM to ANSI" command.
From PG5 version 2.0.200, Fupla supports Unicode and has a selectable ANSI code page for
symbol translation.
1.4
Scope of Symbols
A symbol's "scope" defines its visibility to other blocks and files, and the lifetime of the data that the
symbol references. IL programs can have symbols with several scopes.
The Symbol Editor has a column for the scope of a symbol, and it supports Public, External and
Local (local to the file). The Symbol Editor does not support "Local to the block" or "Temporary data"
scopes, which can be used only from IL programs - see below.
Public
Public symbols are declared with PUBL or PEQU. They can be referenced from any file in the
program. Public symbols also be exported, renumbered etc. Unless explicitly declared public,
symbols have scope only within the file in which they are defined. They cannot be referenced from
other files. Public symbols can also be declared in global $include files, see "Global symbol files"
below.
Tip: Do not make symbols Public unless they really will be accessed from other files, or you need the
features which are only available to Public symbols.
NOTE
All data and block numbers R T C I O F COB XOB PB FB SB IST ST TR TEXT DB are global, even if
their symbols (if used) are not explicitly declared PUBLic.
For example, R 100 ca be accessed directly from any file or part of the program, without using a
symbol name.
This is a common source of programming errors because the user may accidentally access the same
data using different symbol names from more than one place in the program.
This can be checked by using SPM's Build Option "Warn on symbols with same type and address".
WARNING
If a block uses fixed data addresses, and the data needs to be retained between each block call (i.e.
it is not re-initialized every time), then you cannot call the block from more than one COB (more than
one task) because the data will be valid for only one task, not for both, unless the code has been
specially written to support this. This is another common source of programming errors. Blocks which
are shared by more than one task must use different static data for each task, either by using
Register Indirect addressing, by passing the addresses as FB parameters, or clever use of the Index
Register.
External
A symbol whose actual type and value is defined in another file can be declared as an external
symbol using EXTN. In Symbol Editor, use the "External" scope.EXTN declarations can be placed in
the referencing IL file, or in an include file which defined the "interface" to another IL file.
Symbols which are declared Public are know as "Global" symbols. An IL file's global symbols can be