Built-in Outputs
6-1
Built-in Outputs
6-1-1
Using Interrupts to Read Input Pulses (Length Measurement)
Specifications and Operation
Instructions Used
Preparation and PLC Setup Settings
High-speed Counter Input
and Interrupt Input
Settings in the PLC Setup
136
This example program reads the number of encoder pulses input with high-
speed counter 1 and also reads sensor inputs 1 and 2 as interrupt inputs at
terminals IN1 (2960.01) and IN3 (2960.03). The workpiece length is mea-
sured by the number of pulses counted between the ON input at sensor input
1 and the ON input at sensor input 2.
The interrupt task triggered by built-in input 1 (IN1) clears the PV of high-
speed counter 1. The interrupt task triggered by built-in input 3 (IN3) reads the
PV of high-speed counter 1 and stores the result in D00010.
High-speed Counter 1
Interrupt input 1
(2960.01)
Interrupt input 3
(2960.03)
MSKS(690)
Enables the I/O interrupts.
INI(880)
Changes the high-speed counter PV. (Clears it to 0.)
PRV(881)
Reads the high-speed counter PV.
PLC Setup setting details
Use high-speed counter 1 (100 kHz).
Linear mode, Software reset, and Increment pulse input
Use built-in inputs IN1 and IN3 as interrupt inputs.
Disable origin search function for pulse output 0.
Disable origin search function for pulse output 1.
Clears the PV.
Section 6-1
Reads the PV.
Address
Data
053
2013 hex
060
1010 hex
256
0000 hex
274
0000 hex