B&B Electronics VFG3000 - Manual User Manual
Page 163

C
ONFIGURING
P
ROGRAMS
P
ROGRAMMING
T
IPS
R
EVISION
1
P
AGE
147
P
ROGRAMMING
T
IPS
The sections below provide an overview of the programming constructions supported by
Fieldbus Gateway Manager. The basic syntax used is that of the C programming language.
Note that the aim is not to try and teach you to become a programmer, or to master the
subtleties of the C language. Such topics are beyond the scope of this manual. Rather, the aim
is to provide a quick overview of the facilities available, so that the interested user might
experiment further.
M
ULTIPLE
A
CTIONS
The simplest type of program comprises a list of actions, with each action taking up a single
line, and being followed by a semicolon. All of the various actions defined in the Writing
Actions section are available for use. Simple programs like this are typically used where
combining the actions in a single action definition would otherwise prove unreadable.
The sample shown below sets several variables, and then changes the display page…
Motor1 := 0;
Motor2 := 1;
Motor3 := 0;
GotoPage(Page1);
The actions will be executed in order, and the program will then return to the caller.
I
F
S
TATEMENTS
This type of statement is used within a program to make a decision. The construct consists of
an
if
statement with a condition in parentheses, followed by an action (or actions) to be
executed if the condition is true. If more than one action is specified, each should be placed
on a separate line, and curly-brackets should be used to group the statements together. An
optional
else
clause can be used to provide for code to be run if the condition is false.
The architecture of the
if
statement is as follow…
if( condition ){
action1;
}
else{
action2;
}
The example below shows an
if
statement with a single action…
if( TankFull )
StartPump := 1;