Grz
The block (POU) allows the use of a 4x4 matrix keyboard (Ladder Logic).
*******
1 2 3 A
*******
4 5 6 B
*******
7 8 9 C
*******
* 0 # D
 
Keyboard pins R1/R2/R3/R4 are connected to inputs %IX1.0 to %IX1.3.

The inputs of the card (here Mega) are connected in PULL-DOWN using 4 5K resistors to GND.
 
The keyboard pins C1/C2/C3/C4 are connected to outputs %QX0.0 to %QX0.3.
 
You can only enter a key on the keyboard once.
You can choose the length of the code.
The %QX0.4 output (led) gives a light indication when a key is pressed. If the code is wrong it stays on.
 
The %QX0.5 output (led...) indicates whether the code is good.
 
After time, code good or not, everything is reset.

Code check
The INPUT code is the sum of the keyboard keys, knowing that:
1 is 1
2 is 2
3 is 3
4 is 4
5 is 5
6 is 6
7 is 7
8 is 8
9 is 9
A is 10
B is 11
C is 12
D is 13
# is 14
0 is 15
* is 16
 
Example code 439B# is 41.
You can choose another coding.
 
 
Capture695847.jpg
Reply 2 0
Grz
Thank you to those who enjoyed the exercise
ladder logic coding....
 
Best regard.
Pierre
Reply 0 0
thiagoralves
Thank you Pierre for another great contribution 
Reply 0 0
Reply