CR10X User Guide
8-8
divisor. The value output would then not equal 0. Setting the Output Flag when
the seconds counter is less than the execution interval avoids this problem.
Using Instruction 18 keeps the output interval synchronised with real time. If a
counter incremented within the program was used to determine when to set the
Output Flag, output would depend on the number of times the table was executed.
The actual time of output would depend on when the program was compiled and
started running. If the table overran its execution interval, the output interval
would not be the count multiplied by the execution interval, but some longer
interval.
In this example a temperature is measured every 0.5 seconds and the average is
output every 30 seconds.
Instruction 89 is used to determine when the result of Instruction 18 is less than
the execution interval (0.5s in this case). This is done in preference to comparing
the result of Instruction 18 to zero because in a more complex program, Instruc-
tion 18 could be executed more than 0.125s after table execution began. In such a
case, the result of the modulo divide would not be zero but would still be less than
the table execution interval.
Input Location Labels:
1:TEMP DEG C
10:30 SEC 0
*
1
Table 1 Programs
01:
.5
Sec. Execution Interval
01:
P18
Time
01:
0
Seconds into current minute
02:
30
Mod/by
03:
10
Loc [:30 SEC 0 ]
02:
P17
Module Temperature
01:
1
Loc [:REF TEMP ]
03:
P14
Thermocouple Temp (DIFF)
01:
1
Rep
02:
11
2.5mV fast Range
03:
2
IN Chan
04:
2
Type E (Chromel-Constantan)
05:
1
Ref Temp Loc REF TEMP
06:
2
Loc [:TC TEMP ]
07:
1
Mult
08:
0
Offset
04:
P89
If X<=>F
01:
10
X Loc 30 SEC 0
02:
4
<
03:
.5
F
04:
10
Set high Flag 0 (output)
05:
P71
Average
01:
1
Rep
02:
2
Loc TC TEMP
06:
P
End Table 1