190
Built-in Outputs Section 7-1
7-1 Built-in Outputs
7-1-1 Using Interrupts to Read Input Pulses (Length Measurement)
Specifications and Operation
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.
Instructions Used
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.
Preparation
PLC Setup Settings High-speed Counter Input and Interrupt Input Settings
High-speed Counter 1
Clears the PV. Reads the PV.
Interrupt input 1
(2960.01)
Interrupt input 3
(2960.03)
PLC Setup setting details Address Data
Use high-speed counter 1 (100 kHz).
Linear mode, Software reset, and Increment pulse input
053 2013 hex
Use built-in inputs IN1 and IN3 as interrupt inputs. 060 1010 hex
Disable origin search function for pulse output 0. 256 0000 hex
Disable origin search function for pulse output 1. 274 0000 hex