15
98
15 - Graphical programming
Operators are icons that you add to the workspace between the inputs and the outputs to increase
the range of things the program can do. The operators are classied by the number of inputs they
have and by the type of signals they use. All operators have one output, to the right. They can have
one, two or three inputs. Things are relatively straightforward if there is just one input, but if there is
more than one, it is important to keep track of which is which. If there are two inputs, the one on top
is called a and the one on the bottom is called b. If there is a third in the middle, it is called c.
Although there is really only one type of signal in the graphical program and in the script language,
signals are used and interpreted in two dierent ways. Normal analog signals can take any value –
theoretically from minus innity to plus innity. Digital signals have two values – true and false. If a
signal is 0, it is interpreted as logical false by operators using digital signals. Anything other than 0 is
interpreted as true. If the signal from a digital output is 0 or negative, the output is interpreted as o,
and any positive value means it is interpreted as on. If you send 42 to a digital output, it will change
to on – in other words true. The output signal from a digital operator is either 1 or 0 and nothing
else.
Operators using digital signals for the input as well as the output are shown with black border. These
include NOT, AND, OR and XOR.
Operators using analog signals with a digital output signal have a blue border. The comparison
operators = , >, <, >=, <= and <> all fall into this category. For some operators, for example >, it
matters how the comparison is structured. Usually, the a is placed in front of the operator and the b
after. This will work as follows:
If a > b the output is 1, otherwise the output is 0.
To make the program more readable and to tell the signals apart, connections from a digital output
are drawn in a shade of blue-green, whereas analog signals are yellow-green. Lines connected to an
input have the same colour as the input. These colours are green for channels, blue for parameters,
red for alarms, cyan for calendar functions and black for constants.
All operators using analog signals have a solid background. The background for simple mathemati-
cal relationships is yellow-green. The plus, minus, times and divide symbols are shown using round
icons. The others with just one input are shown as squares. Turn to the end of this section for a full
list of all the operators and what they can do.
Other, more complex, operators have a pink icon. The most important of these is probably the
SWITCH operator. It has three inputs – the a input is a control input. You can think of the operator as
a relay. If the control input is 0, the b input (the one on the bottom) is connected to the output. If the
control input is true (not 0), the relay is activated and the c input (in the middle) is connected to the
output.