Phonetics 5100 Home Security System User Manual


 
108
Sensaphone
®
ISACC Instruction Manual
The first program fragment uses a WHILE loop for the timing.
if (input(1)==0) {
output(9,1);
start_time=minutes;
while ((start_time+1)>minutes) {
}
output(9,0);
}
if (input(2)==0) {
data (0,0,1,1);
}
In this code fragment, when input 1 closes, the program will turn output 9 on, and then wait
for 60 seconds without doing anything else. Input 2 may close during this time period, and
critical data may be lost. After this time period, output 9 is turned off, and then input 2 is
checked.
The next program fragment is a 'straight-through' approach using only IF statements.
if (input(1)==0) {
output(9,1);
start_time=minutes;
}
if ((start_time+1)<=minutes) {
output(9,0);
}
if (input(2)==0) {
data(0,0,1,1);
}
In this code fragment, when input 1 closes, the program will turn output 9 on, and then
continue with the rest of the program. It will then check for the output 9 off condition (time
expired) and for the input 2 closure condition. It will not be held up in a WHILE loop.
Please note that these examples are greatly simplified for this discussion, they do not account
for the minutes variable rolling over from 59 to 0.