You are on page 1of 2

Top Back Contact Us

VOL. 1 Counting total number of products


Example Totaling the number of products on multiple production lines

Outline
The number of products travelling on each of 5 lines is 0000
counted simultaneously. When the total number of products
0001
on the 5 lines reaches 100 the KV outputs.
An FS Series fiberoptic sensor counts the number of 0002
products on each line. When the total number equals the
preset value, the KV outputs. 0003

0004

Line 1
Products counted 0 1 2 3 4 5 6 7, 8

Line 2

Line 3 Input 0000: Counting products on line 1


Input 0001: Counting products on line 2
Input relay 0002: Counting products on line 3
Line 4 Input relay 0003: Counting products on line 4
Input relay 0004: Counting products on line 5
Input relay 0005: Resetting

Line 5
Output relay 0500: Comparator output

Visual KV Series

FS Series Fiberoptic Sensor

■ Programming Technique
The following 2 instructions can be used for counting.
(1) Counter instruction
(2) Increment Memory instruction
The programs created using instruction (1) and (2) are as follows:

Using instruction (1) Using instruction (2)


0005 #09999 C001 DM0001 0000 DM0000
C001 LDA STA INC
0000
#09999 C002 DM0002 0001 DM0000
C002 LDA STA INC
0001
#09999 C003 DM0003 0002 DM0000
C003 LDA STA INC
0002
#09999 C004 DM0004 0003 DM0000
C004 LDA STA INC
0003
#09999 C005 DM0005 0004 DM0000
C005 LDA STA INC
0004
2002 DM0001 DM0002 DM0003 DM0004 DM0005 DM0000 0005 $0000
LDA ADD ADD ADD ADD STA DW
DM0000

For the same control as shown here, using instruction (2) simplifies programming.

Time and labor for debugging is saved.


To obtain comparator output, the CMP instruction can be used.
Top Back Contact Us

VOL. 1 Counting total number of products


Programming Example
0000 DM0000
0001 INC When Input 0000 (line 1) turns ON, DM0000 is
incremented by 1.
0001 DM0000
0002 INC When Input 0001 (line 2) turns ON, DM0000 is
incremented by 1.
0002 DM0000
0003 INC When input relay 0002 (line 3) turns ON, DM0000 is
incremented by 1.
0003 DM0000
0004 INC When input relay 0003 (line 4) turns ON, DM0000 is
incremented by 1.
0004 DM0000
0005 INC When input relay 0004 (line 5) turns ON, DM0000 is
incremented by 1.
0005 $0000
0006 DW When input relay 0005 (reset input) turns ON, DM0000 is
DM0000 reset to 0.
2002 DM0000 #00100 2009 0500
0007 LDA CMP When DM0000 equals 100 or more, output relay 500 turns
END ON.
0008 When the reset input (0005) turns ON, output 0500 turns
OFF.
ENDH
0009

Set the input time constant to 10 µs using HSP instruction when the line speed is very high.

Tips ORing Differentiation instructions


• Compare the following 2 programs.

(1) 0000 DM0000 (2) 0000 DM0000


INC INC

0001 DM0000 0001


INC

0002 DM0000 0002


INC

0003 DM0000 0003


INC

0004 DM0000 0004


INC

In program (1), counting is performed for each input even when input relays 0000 to 0004
turn ON simultaneously.
In program (2), simultaneous inputs are ignored when input relays 0000 to 0004 turn ON
simultaneously.

Referring to the above, program according to your purpose.

You might also like