You are on page 1of 3

Using a High-speed Counter

The M90 OPLC offers high-speed counter functions of the following types:

Shaft encoder, at resolutions x2 and x4.


High-speed counter.
High-speed counter + reset,
Frequency measurement, at 100, 500, and 1000 msec.
High-speed counter functions are built into the M90 hardware. This is why you do not build a high-speed counter
within your Ladder program. Instead, you define it as part of the M90 OPLCs hardware configuration by first
selecting the counter type as shown in Figure 1 below, and then linking it to an MI that contains the counter value.
Note that the counter value is an integer with a range of -32768 to +32767. After the counter reaches the maximum
value of +3,2767 it will continue to count in the negative range.
The last input of an M90 unit is the actual counter, and is capable of counting 5,000 pulses per second. Note that
the M90 high-speed input is a pnp-type input, requiring a nominal voltage of 24V, a minimum of 15V.
The next-to-last input also serves a purpose in certain high-speed counter functions:

Shaft encoder function: the next-to-last input serves to indicate the direction of the encoder.
High-speed counter + reset function: the next-to-last input serves to reset the counter.
When the next-to-last input is used in a high-speed counter function, it is normally OFF. It remains off until it
receives a signal; the input then turns ON, stopping and resetting the high-speed counter. The high-speed counter
begins counting pulses only after the counter reset turns OFF. Note that SB 10 High Speed Counter Reset Enable
must be ON; it is ON by default.

To use a high-speed counter


1. Select Hardware Configuration from the Controller menu. The M90 OPLC Hardware Configuration window
opens.
2. Click on the icon representing your M90 OPLC model. The appropriate hardware model window opens.
3. Select a high-speed counter type by clicking the drop-down arrow shown below to display the options, then
clicking one.
Figure 1.

4. A Select Operand Address box opens as shown below. Select an MI to contain the counter value, and then
click OK.

Figure 2.

This MI contains the counter value which is current at the last program scan. Use this MI in your program like any
other MI. You can reset the counter by placing a 0 value into this MI via the Store function. Note that in order to
reset the counter, SB 10 High Speed Counter Reset Enable must be turned ON; SB 10 is ON by default.
Compare Functions and Counter Values
It is probable that the value will not be read at the exact moment that a Compare function in your program is being
carried out. This can cause an Equal (=) function to miss the desired counter value; if the counter does not reach
the value required by the Equal function at the moment the function is carried out, the Equal function cannot
register that the value has been reached. To avoid this problem, use functions Greater Than Or Equal To () and
Lesser Than Or Equal To ().

Shaft Encoder
Selecting the shaft encoder function enables the counter to count both up (-3, -2, -1, 0, 1, 2, 3, ) and down (3, 2,
1, 0, -1, -2,-3 ). Note that the input requires you to use pnp-type shaft encoders.

High-speed Counter
If you select the high-speed counter function which does not include Reset, note that you must reset it within your
Ladder program. This type of counter only counts up.
If you select the high-speed counter function with reset, the counter is capable of counting up within the positive
range, 0-32767. This function uses the next-to-last input as a counter reset. Since the reset is done via the
hardware, the reset is immediate and independent of the program scan.

Frequency Measurement
This counts the number of pulses over the selected period of time (sample rate): 100 msec, 500 msec, or 1000 msec
(1 second), expressing the result in Hertz. For example, 155 pulses counted over 100 msec is equal to 1550Hz; 155
pulses counted over 500 msec is equal to 310Hz.
Some of the sample programs installed together with U90 Ladder include high-speed counters of different types.

You might also like