5 Symbol Editor
6 Programming with Fupla
6.3 Editing Symbols
The Symbol Editor window contains a list of all the data used in the file. It can be viewed with the Show/Hide Symbol Editor button, or with the menu command View, Symbol Editor. The table has several columns:
Symbol Name
Each input, output, flag, register, etc. can be assigned a symbolic name. Names are easier to remember than numbers, and make it easier to understand what the data is for. Using descriptive symbol names makes program maintenance much easier.
The first character of a symbol name is always a letter, followed by other letters, numbers, or the underscore character. Avoid using accented characters (ö, è, ç etc).
Differences of case (upper or lower) are not significant: MotorOn and MOTORON are the same symbol.
Type
The data type of the symbol: input (I), output (O), register (R), counter (C), timer (T), TEXT, DB, etc.
Address/Value
Each data type has its own range of valid addresses or values, for example:
Inputs/Outputs: depends on I/O modules inserted in PCD Flags: F 0..8191
Registers: R 0..4095 (or 16383) Timers/Counters: T/C 0..1599
…
Comment
The comment is linked to its symbol and can be displayed on the Fupla page. Place the mouse pointer over the connector to display its full symbol definition in a bubble.
Scope
The Scope field defines the accessibility of the symbol. Local = the symbol is used only in the current file. Public = the symbol can be accessed from other files, where the symbol is declared as Public. External = the symbol is defined as Public in Show Hide
Symbol Editor
6.3.1 Adding a new symbol
Simple method
To add a symbol to the list, open the Symbol Editor window. A free line is always available, select and complete each field Symbol Name, Type, Address/Value, Comment and Scope, pressing the Tab or Enter key to move to the next field.
Quick method 1
The entire definition can be entered in the Symbol Name field, which is much faster.
Declare the symbol with this syntax the press Enter to automatically place the data in the correct fields:
symbol_name type address ;comment
Quick method 2
Use the same syntax when entering a symbol on the input or output connector of the Fupla page:
If only the symbol name is entered in the Fupla page connector, it is added to the symbol table with a default type, and the details can be filled in later.
Enter
Enter
6.3.2 Symbol definitions
A symbol definition does not always need both a name and an address, but it must have a name and/or an address. This gives three types of symbol definition.
Absolute address only
The data is defined with only a Type and Address (e.g. 32), and an optional comment. Absolute addresses are OK for small test programs, or during development, but a final program should always have useful symbol names for all its data.
Full definition
The Symbol Name, Type, and Address are filled in, with an optional comment.
Dynamic addressing
If an actual address is not defined, the program build will assign an unused address from an address range defined from the device's Build Options, see Project Manager.
The Type must always be defined.
Dynamic addressing can be used for flags, counters, timers, registers, texts, DBs, COBs, PBs, FBs and SBs. Inputs, outputs, XOBs and constants must always have a fixed address.
Drag mouse cursor into Fupla connector
Release mouse button
6.3.3 Using a symbol from the Symbols list in an Fupla program
When a program is edited, symbols already defined in the Symbol Editor window can be used in different ways:
Symbol entry from the keyboard
The symbol name is entered into the page connector in full, using the keyboard. This method might allow a symbol name to be entered with a typing error, causinh a new symbol to be added to the symbol table.
Symbol entry by selective searching
If only the first few characters of the symbol name are typed, the pressing the
Ctrl+Space keys at the same time displays a window showing a list of all the symbols which start with the letters which have been typed. The required symbol can then be selected either with the mouse or the keyboard arrow keys (↑, ↓) and confirmed by pressing Enter.
Symbol entry by drag-and-drop
This way of using a symbol excludes any possibility of typing errors. In the Symbol Editor window, place the mouse cursor over the button at the start of the symbol line, press the left mouse button and keep it down. Drag the mouse cursor over the empty connector and release the mouse button. The symbol name, or type/address, is copied into the connector under the mouse cursor.
You can also drag a symbol onto a free space on the Fupla page, and the connector and symbol are added automatically in a single operation.
Ctrl + Space
↑, ↓ ,Enter
Place the mouse pointer on the button at the start of the line and hold down the left-hand mouse button.
6.3.4 Local, Public and External symbols
The view with the symbols definition includes a Scope cell to define the option: Local, Public or External.
A symbol's scope defines the accessibility of the symbol:
Local symbols are accessible only within the file which contains the symbol definition.
For example, only inside Daily timer.fup.
Public symbols are accessible from all files in the device. For example, publics symbols are shared by both the files Parking lot.fup and Ventilation.src in device Daily timer, regardless of which file defines the symbol.
The Symbol Editor typically shows three views: a view with the name of the open Fupla file, two views called ALL Publics and System:
The view with the name of the open file allows the definition of all the locals and publics symbols used by the program of this file.
New symbols created in the Symbol Editor or the Fupla editor are by default either Local or Public depending on an option defined by Fupla's View, Options, Symbols, Add symbols with Public scope.
The ALL Publics view shows all publics symbols in the device. The System view shows all the system symbols. The symbols on the ALL Publics and System pages are updated when a file is saved or when a Build is done.
These pages use the results of the Build to gather all the publics and system symbols from all the files in the device's program and show them in a single view.
To place a public or system symbol into the program, select the symbol on the Public or System view and do a drag-and-drop of the symbol onto the Fupla page. The reference to the public symbol is placed into the file's symbols page with the scope External. This shows that the symbol is defined in another file.
The symbols on the ALL Publics page are not editable. Public symbol definitions can only be edited from the file which defines them. You can use the context menu's Goto Definition command to open the file which defines the symbol. The File column shows the name of the file which defines the symbol, this is the file which must be opened to modify the symbols.
Local Local Public