beautypg.com

Campbell Scientific CR10X Measurement and Control System User Manual

Page 135

background image

SECTION 9. INPUT/OUTPUT INSTRUCTIONS

9-3

resistor. When the switch is closed, the
control port is at 5 V. The count is
incremented when the switch closes.

Maximum Frequency: 40 Hz
Minimum Switch Closed Time: 6 ms
Minimum Switch Open Time: 6 ms

NOTE: The Reps option cannot be used to
measure both Pulse Inputs and Control
Ports 6, 7, and 8. Use two Instruction 3’s.

NOTE: If Control Ports 6, 7, or 8 are used
for pulse measurements or interrupt
subroutines, the CR10X will not go into the
quiescent power state (1.3 mA) but will
continue to draw ~10 mA if any of Control
Ports 6, 7, or 8 is high.

CAUTION: Control Port 6 cannot be used
as a pulse input or interrupt subroutine
while using any of the following instructions:
Serial I/O (Instruction 15), SDI-12
(Instructions 105 and 106), and SDM
instructions (Instructions 100-102 or 107).
Error E33 will be displayed, at compile, if
the above instructions are used together.

PULSE MEASUREMENT DETAILS

The 2 pulse count input channels each have
eight bit counters. Input frequencies greater
than 2000 Hz (the limit of the eight bit counter,
255 counts at the reset interval of 0.125
second) can be counted by using the 64 Hz
reset option (16,000 Hz maximum) or
combining two counters on one input channel.
When this option is selected, channel 1 is used
for the pulse input. Channel 2 is not used.

Every 0.125 or 1/64 seconds, depending on the
programmed reset interval, the CR10X processor
transfers the values from the 8 (or 16) bit pulse
counters into 16 bit accumulators (maximum
count is 65,535) and the counters are hardware
reset to zero. The pulses accumulate in these 16
bit accumulators until the program table
containing the Pulse Count Instruction is
executed. At the beginning of the execution of
the Table containing the Pulse Count Instruction
(or at the beginning of each pass through a
delayed loop within the table), the total in the 16
bit accumulator is transferred to a temporary RAM
buffer. The 16 bit accumulator is then zeroed.
When the table execution reaches the Pulse

Count Instruction, the value in the RAM buffer is
multiplied by the multiplier and added to the offset
and placed into the designated input location. A
ramification of this is that the execution interval of
the table must be short enough that the 16 bit
accumulator does not overflow.

CAUTION: The RAM buffer does NOT
accumulate counts; it is zeroed each time
the table is executed regardless of whether
or not the pulse instruction is executed. If
all counts are necessary, it is imperative
that the Pulse Count Instruction be
executed (not branched around) every time
the table is executed.

If a table execution was skipped because the
processor was executing the previous table
(Section 1.1.1) or if the user resets the time, the
value in the 16 bit accumulator is the result of a
longer than normal interval. This value can
either be used or it can be discarded. If pulse
counts are being totalized, a missing count
could be significant and the value from the
erroneously long interval should NOT be
discarded. If the pulse count is being
processed in a way in which the resultant value
is dependent upon the sampling interval (e.g.,
speed, RPM), the value from the excessive
interval should be discarded. If the value is
discarded the value in the RAM buffer from the
previous measurement will be used.

There is also an option to output the count as a
frequency (i.e., counts/execution interval in
seconds = Hz) as well as discard the result from
an excessive interval. This allows the use of a
conversion factor that is independent of the
execution interval.

The options of discarding counts from long
intervals, pulse input type, and using a 16 bit
counter are selected by the code entered for the
3rd parameter (Table 9-2).

NOTE: All pulse count instructions must be
kept in the same table. If the Pulse Count
Instruction is contained within a subroutine,
that subroutine must be called from Table 2.