**PLC Type KV, Name Input / Output PLC :**

**INPUT PLC :**

0000 ; Numeric 0 from KeyPad

0001 ; Numeric 1 from KeyPad

0002 ; Numeric 2 from KeyPad

0003 ; Numeric 3 from KeyPad

0004 ; Numeric 4 from KeyPad

0005 ; Numeric 5 from KeyPad

0006 ; Numeric 6 from KeyPad

0007 ; Numeric 7 from KeyPad

0008 ; Numeric 8 from KeyPad

0009 ; Numeric 9 from KeyPad

0010 ; ENTER Key from KeyPad

0011 ; Door closure Sensor

0012 ; Door Exit Button

**OUTPUT PLC :**

0500 ; Output to Relay Coil (Used for Electromagetic Lock and Green LED)

Download PDF File:

Lock Unlock Door Using Keyence PLC(.pdf)

Reading Ladder

**PLC Programming**for

**Lock Unlock Door**using Keyence PLC :

**Step 1 :**

Password Data using DM0020

Password Data using DM0020

**a.**If 2002 = ON (Always ON) Then DM0020 = 5214 (can be modified and 4 Digits Decimal)

**Step 2 :**

Numeric 0 to 9 is pressed

Using DM0000 for temporary data storage

Numeric 0 to 9 is pressed

Using DM0000 for temporary data storage

**a.**If 0000 = ON (Numeric 0) Then DIFU 1000 = ON AND DM0000 = 0

**b.**If 0001 = ON (Numeric 1) Then DIFU 1000 = ON AND DM0000 = 1

**c.**If 0002 = ON (Numeric 2) Then DIFU 1000 = ON AND DM0000 = 2

**d.**If 0003 = ON (Numeric 3) Then DIFU 1000 = ON AND DM0000 = 3

**e.**If 0004 = ON (Numeric 4) Then DIFU 1000 = ON AND DM0000 = 4

**f.**If 0005 = ON (Numeric 5) Then DIFU 1000 = ON AND DM0000 = 5

**g.**If 0006 = ON (Numeric 6) Then DIFU 1000 = ON AND DM0000 = 6

**h.**If 0007 = ON (Numeric 7) Then DIFU 1000 = ON AND DM0000 = 7

**i.**If 0008 = ON (Numeric 8) Then DIFU 1000 = ON AND DM0000 = 8

**j.**If 0009 = ON (Numeric 9) Then DIFU 1000 = ON AND DM0000 = 9

Note : DIFU = Single-scan of target relay ON at rising edge of previous state

**Step 3 :**

Count the number keypad is pressed

Using DM0030 for Count data storage

Count the number keypad is pressed

Using DM0030 for Count data storage

**a.**If 1000 = ON Then INC DM0030 (Increment target device value)

**Step 4 :**

Enter Released for Value DM0030 = 0 (Count data RESET)

Enter Released for Value DM0030 = 0 (Count data RESET)

**a.**If 0010 = ON (ENTER key is pressed) Then DIFD 1001 = ON (Single-scan of target relay ON at falling edge of previous state)

**b.**If 1001 = ON Then Value DM0030 = 0

**Step 5 :**

Password from the KeyPad

Using DM0012 for Password from the KeyPad

Password from the KeyPad

Using DM0012 for Password from the KeyPad

**a.Keypad is pressed first, multiplied by 1000**

(1000 = ON) -> (LDA DM0030) -> (CMP#0001) -> (2010) -> (LDA DM0000) -> (

**MUL #01000**) -> (STA DM0001)

**b.Keypad is pressed second, multiplied by 100**

(1000 = ON) -> (LDA DM0030) -> (CMP#0002) -> (2010) -> (LDA DM0000) -> (

**MUL #00100**) -> (STA DM0002)

**c.Keypad is pressed three, multiplied by 10**

(1000 = ON) -> (LDA DM0030) -> (CMP#0003) -> (2010) -> (LDA DM0000) -> (

**MUL #00010**) -> (STA DM0003)

**d.Keypad is pressed four, multiplied by 1**

(1000 = ON) -> (LDA DM0030) -> (CMP#0004) -> (2010) -> (LDA DM0000) -> (

**MUL #00001**) -> (STA DM0004)

**e.Sum all the data**

(1000 = ON) -> (LDA DM0001) -> (ADD DM0002) -> (STA DM0010)

(1000 = ON) -> (LDA DM0010) -> (ADD DM0003) -> (STA DM0011)

(1000 = ON) -> (LDA DM0011) -> (ADD DM0004) -> (STA

**DM0012**)

**Example :**

Keypad is pressed :

first : Numeric 5 pressed -> 5 multiplied by 1000 = 5000

second : Numeric 2 pressed -> 2 multiplied by 100 = 200

three : Numeric 1 pressed -> 1 multiplied by 10 = 10

four : Numeric 4 pressed -> 4 multiplied by 1 = 4

Sum all the data : 5000 + 200 + 10 + 4 = 5214

**So,Password from the keypad is 5214**

**Step 6 :**

Check the number of digits

Check the number of digits

**a.**If DM0030 = 4 (4 times the keypad is pressed) Then 1002 = ON

**Step 7 :**

Correct Password And UnLock Door

7.1. Correct Password

Correct Password And UnLock Door

7.1. Correct Password

**a.**If 0010 = ON (ENTER key is pressed) Then DIFU 1004 = ON (ENTER Down)

**b.**If 1004 = ON (ENTER Down) AND 1002 = ON AND Value(DM0012 = DM0020) Then SET 1003 = ON

**7.2. UnLock Door by Correct Password**

**c.**If 1003 = ON AND 1007 = OFF AND T000 = OFF Then 1006 = ON (Hold UnLock)

**7.3. UnLock Door by Door Exit Button**

**d.**If 0012 = ON (Door Exit Button) AND 1007 = OFF AND T000 = OFF Then 1006 = ON (Hold UnLock)

**7.3. UnLock Door**

**e.**If 1006 = ON Then 0500 = ON (UnLock Door)

**Step 8 :**

Lock Door by Door position

Lock Door by Door position

**a.**If 0011 = ON (Door Closure Sensor) Then DIFU 1007 = ON

**b.**If 1007 = ON Then 1006 = OFF

**c.**If 1006 = OFF Then 0500 = OFF (Lock Door)

**Step 9 :**

Lock Door by Timer

Lock Door by Timer

**a.**If 0500 = ON AND 0011 = ON (Door Closure Sensor) Then Activate the Timer T000

**b.**If T000 = ON Then 1006 = OFF

**c.**If 1006 = OFF Then 0500 = OFF (Lock Door)

**Step 10 :**

**a.**If 1000 = ON AND 1003 = ON (Correct Password) Then RES 1003 (1003 = OFF)

**b.**If 1007 = ON AND 1003 = ON (Correct Password) Then RES 1003 (1003 = OFF)

**c.**If T000 = ON AND 1003 = ON (Correct Password) Then RES 1003 (1003 = OFF)

Please Download Programming for KV Builder :

**Lock Unlock Door Using Keyence PLC**

See :

**Lock Unlock Door**