Sub 1 Minute Output Interval Synched To Real Time; Interrupt Subroutine Used To Count Switch Closures (Rain Gage) - Campbell Measurement and Control Module CR10 Operator's Manual

Ds 70;
Hide thumbs Also See for Measurement and Control Module CR10:
Table of Contents

Advertisement

13:
P
8.4 SUB 1 MINUTE OUTPUT INTERVAL
SYNCHED TO REAL TIME
Output can be synchronized to seconds by
pressing "-" or "C" while entering the first
parameter in Instruction 92. 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 actually
compiled and started running. If the table
overran its execution interval (Section 1.1.1),
the output interval would not be the count
multiplied by the execution interval, but some
longer interval.
In this example a temperature (107
Temperature Probe) is measured every 0.5
seconds and the average output every 30
seconds.
Input Location Assignments:
*
1
01
.5
01:
P17
01:
1
02:
P14
01:
1
02:
11
03:
2
04:
2
05:
1
06:
2
07:
1
08:
0
03:
P92
01:
0--
02:
30
03:
10
04:
P71
01:
1
02:
2
05:
P
SECTION 8. PROCESSING AND PROGRAM CONTROL EXAMPLES
End Table 1
Table 1 Programs
Sec. Execution Interval
Module Temperature
Loc [:Ref_Temp ]
Thermocouple Tem (DIFF)
Rep
2.5 mV fast Range
IN Chan
Type E (Chromel-Constantan)
Ref Temp Loc Ref_Temp
Loc [:TC_Temp ]
Mult
Offset
If time is
minutes (seconds--) into a
minute or second interval
Set high Flag 0 (output)
Average
Rep
Loc TC_Temp
End Table 1
8.5 INTERRUPT SUBROUTINE USED
TO COUNT SWITCH CLOSURES
(RAIN GAGE)
Subroutines given the label of 97 or 98 will be
executed when control ports 7 or 8,
respectively, go high (5 V, see Instruction 85,
Section 12). In this example, Subroutine 98
and control port 8 are substituted for a pulse
counting channel to count switch closures on a
tipping bucket rain gage.
The subroutine adds 0.254 (mm, bucket
calibrated for 0.01 inch tip) to an input location
and uses Instruction 22 to delay 0.2 seconds.
The delay is to insure that any switch bouncing
(when closing, the contacts actually bounce off
each other, making and breaking the circuit
several times) has died out before the
subroutine is completed. (The pulse count
inputs do this automatically.) Without the delay,
the subroutine could be completed and called
again by a bounce, causing false counts. The
interrupt has no effect while the subroutine is
still being executed.
Subroutine 98 is in effect keeping a running
total in Input Storage. On the output interval,
this total is sampled to Final Storage and
zeroed by the program in Program Table 1.
An interrupt driven subroutine can interrupt a
table while the Output Flag is set. The CR10
will complete whatever instruction it is
executing, execute the subroutine, and then
resume executing the table.
If the subroutine always added the count to the
same location and a tip occurred while the total
rain was being sampled, the subroutine would
add the count to the input location before the
location was zeroed, causing the count to be
missed.
In the example, the subroutine adds the count
to an alternate location when the Output Flag is
set. Program Table 1 sets the Output Flag low
after zeroing the location where the normal total
is kept. The value in the alternate location is
then added to location 12 and then the
alternate location is zeroed.
To provide comparison, this example has the 2
pulse inputs also reading rain gages. (In a real
8-5

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ds 70

Table of Contents

Save PDF