Section 9. Input/Output Instructions
9-21
PARAM.
DATA
NUMBER
TYPE
DESCRIPTION
01:
4
Mask (0-255)
02:
4
Input location to store result
Input locations altered: 1
Instruction 26: Timer
This instruction resets a timer or stores the elapsed time registered by the timer in
seconds in an Input Storage location. Instruction 26 can be used with Program
Control Instructions to measure the elapsed time between specific input condi-
tions. There is only one timer and it is common to all tables (e.g. if the timer is
reset in Table 1 and later in Table 2, a subsequent instruction in Table 1 to read
the timer will store the elapsed time since the timer was reset in Table 2).
Elapsed time is tracked in 0.125 second increments. The maximum interval that
can be timed is 8191.875 seconds.
When program tables are changed and compiled with the *0 Mode, the timer is
reset automatically.
Entering ‘
*6
’ after changing the program compiles the programs, but does not
reset the timer.
PARAM.
DATA
NUMBER
TYPE
DESCRIPTION
01:
4
Input location no. of elapsed time in seconds (or enter 0 to
reset)
Input locations altered:
1 (0 if timer is being reset)
Instruction 27: Period Measurement
Instruction 27 measures the period (in microseconds) of a signal on a single-ended
input channel. As an option, the frequency of the signal in kHz may be output
instead of the period.
The number of cycles to measure should be chosen so that at least one millisecond
transpires while counting those cycles (e.g. if the maximum input frequency is
10kHz, count more than 10 cycles). If the time for the number of cycles is less
than one millisecond, an over range value (displayed as -99999.) will be stored for
the measurement.
The specified number of cycles is timed with a resolution of 35 nanoseconds (the
theoretical maximum), making the resolution of the period 35 nanoseconds
divided by the number of cycles measured. The resolution is reduced by noise and
signals with a slow transition through the zero voltage threshold. The ‘Time Out’
parameter specifies the maximum length of time the instruction waits during each
repetition for the specified number of cycles. If the cycles have not been counted
within this time, -99999 is loaded into the input location.
For operational reasons the period multiplied by the number of cycles must be
greater than 1ms; for example, for a signal of 150kHz, a minimum of 150 cycles
must be timed.