Listed below is the same program written using a ‘straight through’ approach. Only IF state-
ments:
main ()
{
if (read_uaf(input,0,1)==0)
{
write_uaf(output,0,3,on);
}
if ((read_uaf(input,0,1)==1)
{
write_uaf(output,0,3,off);
}
}
In this case, when input 1 closes, output 3 will be turned on and then continue with the rest of
the program. If input 1 opens, output 3 will be turned off. This program cannot get held up in
a WHILE loop. Please note that these examples are greatly simplified for this discussion and
are only intended to demonstrate the dangers that are possible when using WHILE loops.
C Programming examples
Example #1 Checking for alarms
The following lines of code will check to see if Alarm 9 exists.
If (read_uaf(alarm,9,0) != 0)
{
/* an alarm exists on alarm channel 9 */
}
else
{
/* no alarm on channel 9 */
}
Example #2 Checking for low-level alarms
The following lines of code will check to see if a low-level alarm exists on Alarm channel 9.
If (read_uaf(alarm,9,0) == 2)
{
/* a low-level alarm exists on alarm channel 9 */
}
else
{
/* no low-level alarm on channel 9 */
}
Example #3 Checking for high-level alarms
The following lines of code will check to see if a high-level alarm exists on Alarm channel 9.
If (read_uaf(alarm,9,0) == 3)
{
/* a high-level alarm exists on alarm channel 9 */
}
else
{
/* no high-level alarm on channel 9 */
}
16-18
SCADA 3000 User’s Manual
Содержание Sensaphone SCADA 3000
Страница 1: ...Sensaphone SCADA 3000 User s Manual Version 2 34...
Страница 6: ...vi SCADA 3000 User s Manual...
Страница 10: ...x SCADA 3000 User s Manual...
Страница 30: ...1 6 SCADA 3000 User s Manual...
Страница 48: ...4 6 SCADA 3000 User s Manual...
Страница 70: ...9 8 SCADA 3000 User s Manual...
Страница 122: ...12 8 SCADA 3000 User s Manual...
Страница 190: ...15 30 SCADA 3000 User s Manual...
Страница 211: ...lead 1 lag 0 else lead 0 lag 1 16 21 Chapter 16 Programming in C...
Страница 212: ...16 22 SCADA 3000 User s Manual...
Страница 236: ...21 8 SCADA 3000 User s Manual...
Страница 248: ...22 12 SCADA 3000 User s Manual...
Страница 258: ...23 10 SCADA 3000 User s Manual...
Страница 274: ...25 8 SCADA 3000 User s Manual...
Страница 288: ...27 8 SCADA 3000 User s Manual...
Страница 294: ...28 6 SCADA 3000 User s Manual...
Страница 296: ...A 2 SCADA 3000 User s Manual...
Страница 302: ...D 2 SCADA 3000 User s Manual...
Страница 318: ...I 2 SCADA 3000 User s Manual...
Страница 320: ...J 2 SCADA 3000 User s Manual...
Страница 322: ...K 2 SCADA 3000 User s Manual...
Страница 335: ...Test Log...
Страница 336: ......