316
4
4 Instructions4.12.2 Bit Switch Access
DSW: Digital switch
◆
Overview
The DSW instruction reads digital switch setting.
DSW S D1 D2 n
Digital switch
Applicable model:
H3U
S
Input port head
address
Start number of X ports used for key scan input
If n = 1,
four consecutive X ports are occupied; if n = 2, eight
consecutive X ports are occupied.
16-bit instruction
(9 steps)
DSW:
Continuous
execution
D1
Gating bit
element head
address
Start number of Y ports used for key scan output. Four
consecutive Y ports are occupied.
D2
Data storage
unit
Unit that stores key inputs, in the range D0 to 9999.
n Data count Number of digital switch sets; optional values: 1 and 2.
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
D1 X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
D2 X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
n X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
Note: The elements in gray background are supported.
◆
Function
The statuses of matrix-type switches are read and stored in a designated unit. Each set of switches
consists of four BCD switches. A maximum of two sets can be read. Example:
X20
〔DSW X0 Y0 D0 K2 〕
S D1
D2 n
First set of switches
X0
X2
COM
X1 X3
Y0
Y2
COM1
Y1 Y3
X4
X6X5 X7
Second set of switches
Ones
place
Tens
place
Hundreds
place
Thousands
place
Ones
place
Tens
place
Hundreds
place
Thousands
place
BCD digital
switch
0.1 A/50 V diode
with short circuit
protection
When X20 = ON, the system scans
and reads the digital switch setting.
1. The values of the first set of
digital switches are converted to
BIN values, which are stored in D0.
2. The values of the second set of
digital switches are converted to
BIN values, which are stored in D1.
3. M8029 is set by one scan cycle
after a reading loop.
Usage: Digital switches can be detected only by PLCs of the transistor output type. It takes multiple scan
cycles to complete a digital switch read operation. If a read operation is initiated in key press mode, the
following statement is recommended to ensure reading cycle completeness: