PulseCount/PulseCountReset (Pulse Count)

The PulseCount instruction is used to make measurement on a pulse channel.

Syntax

PulseCount ( Dest, Reps, PChan, PConfig, POption, Mult, Offset )

PulseCountReset( ) optional

Remarks

NOTE: A PulseCount measurement and a SDI12Recorder measurement cannot be made on the same universal or control port pair.

With the PulseCount instruction, a control port or universal terminal pair can be configured as high frequency input (up to 1 MHz), low level AC input, or switch closure (maximum frequency 150 Hz). See the datalogger user manual for more information.

The PulseCount instruction must be executed once before the pulse port is ready for input. This may be of particular concern for programs with long scan intervals. For example, the PulseCount instruction will not yield a valid output until the turn of the second hour if the PulseCount instruction is used within a program with a scan interval of 1 hour.

Each control port and universal channel pair has an independent 24-bit counter. Maximum counts per scan are 224 or 16,777,216. Each scan of the datalogger causes the counter to output the number of pulses accumulated since the last scan. If the scans stop, as in a program with more than one scan loop in the Main Program, or in a program that calls an external subroutine, the counter continues to accumulate counts until the Scan with the PulseCount instruction is reentered. PulseCountReset is used to reset both the pulse counter and the running average values in the pulse count instruction, though in most instances there is no need to manually reset the counter. The only use would be if two separate scans were using the same channel for a PulseCount, then the counter would need to be reset before entering each scan.

For cases involving Scans that have subroutine calls that include a Scan/NextScan sequence, the PulseCountReset must be placed in a conditional statement prior to the PulseCount instruction, and the Subroutine call must be placed after the PulseCount instruction. If possible, calls to DataTables that store the results from the PulseCount instruction should be placed prior to the Subroutine call.

NOTE: This instruction should NOT be placed inside a conditional statement, subroutine, subscan, or SlowSequence scan. To ensure all pulses are detected, it must be executed each time the main program is executed.

Parameters

Dest (Destination)

The Variable in which to store the results of the instruction. Right-click the parameter to display a list of defined variables.

If this instruction has a Repetitions parameter and it is greater than 1, the results are stored in an array with the variable name. The array must be dimensioned large enough to hold all of the values returned from all of the Reps.

Type: Variable or Array

Reps (Repetitions)

The number of repetitions for the measurement or instruction.

Type: Constant integer (or expression that evaluates as a constant).

Measurements are made on consecutive channels. If the Reps parameter is greater than 1, the Dest parameter must be a variable array.

PChan (Pulse Channel)

The number of the pulse channel for the measurement. When Reps are used, subsequent measurements will be automatically made on the following channels. Right-click to display a list.

Terminal assignments for this instruction must fall within the guidelines for universal terminal pairs (see Universal Terminal and Control Port Pairs for more information).

Code Description
C1 Control terminal 1 (not valid for low-level AC)
C2 Control terminal 2 (not valid for low-level AC)
C3 Control terminal 3 (not valid for low-level AC)
C4 Control terminal 4 (not valid for low-level AC)
U1 Universal terminal 1 (not valid for low-level AC)
U2 Universal terminal 2
U3 Universal terminal 3 (not valid for low-level AC)
U4 Universal terminal 4
U5 Universal terminal 5 (not valid for low-level AC)
U6 Universal terminal 6
U7 Universal terminal 7 (not valid for low-level AC)
U8 Universal terminal 8
U9 Universal terminal 9 (not valid for low-level AC)
U10 Universal terminal 10
U11 Universal terminal 11 (not valid for low-level AC)
U12 Universal terminal 12

Type: Constant

PConfig (Pulse Channel Configuration)

A code specifying how the pulse channel should be configured. Right-click the parameter to display a list.

NOTE: Code 0 may be used to disable the measurement during cleaning or calibration, if the PConfig parameter is a variable.

Code Description
0 Disabled
1 Switch Closure with pull up
2 Switch Closure with pull down
3 High frequency with pull up
4 High frequency with pull down
5 Low Level AC (channels U2, U4, U6, U8, U10, and U12)only)

Type: Constant (or Variable that evaluates to 0, 1, 2, 3, 4, or 5)

POption (Pulse Option)

A code that determines if the raw result (multiplier =1, offset = 0) is returned in counts or frequency. Right-click to display a list.

Code Description
0 Counts
1 Frequency in Hz; counts/scan interval in seconds
>1 Running average of frequency (Hz).The value entered is the time period of the running average in milliseconds and must be a multiple of the scan interval

Type: Constant

If an overrange occurs and running averaging is in use, the overrange value is an element of the average until it has fallen off the end of the list. If a running average were set for 1000 milliseconds then an overrange will be the value from the PulseCount instruction until 1 second has passed. Use the PulseCountReset instruction to avoid this.

Mult, Offset (Multiplier and Offset)

Factors by which to scale the raw results of the measurement. Typically used to convert the raw measurement to engineering units or to units other than which is output. For example, the TCDiff instruction measures a thermocouple and outputs temperature in degrees C. A multiplier of 1.8 and an offset of 32 will convert the temperature to degrees F.

For temperature measurements, a multiplier (mult) of 1 and an offset of 0, would output in degrees Celsius. For analog measurements, a multiplier (mult) of 1 and an offset of 0, would output the measured voltage in millivolts divided by the excitation voltage in volts.

If Repetitions of greater than 1 are used for this instruction, Repetitions can also be used for the Multiplier and Offset. See Multipliers, Offsets, and Disable Variables with Repetitions for more information.

Type: Constant, Variable, Array, or Expression