DIFFeReNCeS BeTWeeN STANDARD C AND SCADA 3000 C
For those of you who are familiar with C programming, note that there are some differences
between standard C and SCADA 3000’s C compiler. The following items will be helpful to be
aware of:
1) In SCADA 3000, every IF, ELSE, FOR, DO, and WHILE
must
have a set of brackets {}
after it.
2) Condition clauses must be grouped together into pairs.
Standard C will allow:
IF ((condition 1) && (condition2) && (condition3))
SCADA 3000 requires:
IF (((condition1) && (condition2)) && (condition3))
3) There are no shortcut statements such as :
i++;
red+=5; or
bits&=5;
However, statements such as the following are allowed if placed inside parentheses:
IF ((x=read_uaf(input,0,5))==0)
4) Bitwise operators are not implemented. There are no:
bitmask = bitmask &4;
5) Variables declared before the main statement retain their values after the program has been
executed. This provides the programmer with nonvolatile memory between runs of the pro-
gram. This is useful for accumulating, timing, and most SCADA 3000 applications.
6) There are no user defined functions or procedures.
7) Suggested programming philosophy:
Avoid the use of WHILE loops. This will lengthen the execution and response
time of your C program and serves no advantage. Write your programs such that
they run ‘straight through’ and exit. If your program is checking for a certain
condition to occur, using a WHILE loop will cause your program to concentrate
on that one condition unnecessarily. Since the program will execute at regular
time intervals, you can use an IF statement and achieve the same or even better
results.
For example, we need a program to set output 3 on whenever input 1 closes. Listed below is
an example of how this would be done using a WHILE loop:
main ()
{
if (read_uaf(input,0,1)==0)
{
write_uaf(output,0,3,on);
while (read_uaf(input,0,1)==0);
{
}
write_uaf(output,0,3,off);
}
}
In this program, when input 1 closes, output 3 will be turned on. The program will hold out-
put 3 on as long as input 1 is closed. Unfortunately, this program will get stuck in the WHILE
loop, waiting for input 1 to open. Critical actions may be missed because the program was
forced to wait.
16-17
Chapter 16: Programming in C
Summary of Contents for Sensaphone SCADA 3000
Page 1: ...Sensaphone SCADA 3000 User s Manual Version 2 34...
Page 6: ...vi SCADA 3000 User s Manual...
Page 10: ...x SCADA 3000 User s Manual...
Page 30: ...1 6 SCADA 3000 User s Manual...
Page 48: ...4 6 SCADA 3000 User s Manual...
Page 70: ...9 8 SCADA 3000 User s Manual...
Page 122: ...12 8 SCADA 3000 User s Manual...
Page 190: ...15 30 SCADA 3000 User s Manual...
Page 211: ...lead 1 lag 0 else lead 0 lag 1 16 21 Chapter 16 Programming in C...
Page 212: ...16 22 SCADA 3000 User s Manual...
Page 236: ...21 8 SCADA 3000 User s Manual...
Page 248: ...22 12 SCADA 3000 User s Manual...
Page 258: ...23 10 SCADA 3000 User s Manual...
Page 274: ...25 8 SCADA 3000 User s Manual...
Page 288: ...27 8 SCADA 3000 User s Manual...
Page 294: ...28 6 SCADA 3000 User s Manual...
Page 296: ...A 2 SCADA 3000 User s Manual...
Page 302: ...D 2 SCADA 3000 User s Manual...
Page 318: ...I 2 SCADA 3000 User s Manual...
Page 320: ...J 2 SCADA 3000 User s Manual...
Page 322: ...K 2 SCADA 3000 User s Manual...
Page 335: ...Test Log...
Page 336: ......