Task: Create the control program for a hotel safe.
Initially, the safe can be opened without entering a code by clicking on the green key with the mouse. The LED on the safe changes from red (locked) to green (unlocked). If you click on the unlocked safe door, it opens.
A personal secret access code can now be entered as follows:
1. Click on the red button C
2. Enter a numeric code of 1-9 digits with the numeric keypad
3. Click on the door – the door closes
4. Click on the green key to lock the safe
5. The safe can now only be unlocked by entering the personal access code and then clicking on the green key. The safe door can then be opened.
6. A new access code can only be entered while the safe is unlocked and the door is open and after pressing the C button
The BCD (Binary Coded Decimal) codes for the pushbuttons are:
Pushbutton '1' BCD code '0001'
Pushbutton '2' BCD code '0010'
Pushbutton '3' BCD code '0011'
Pushbutton '4' BCD code '0100'
Pushbutton '5' BCD code '0101'
Pushbutton '6' BCD code '0110'
Pushbutton '7' BCD code '0111'
Pushbutton '8' BCD code '1000'
Pushbutton '9' BCD code '1001'
Pushbutton '0' BCD code '1010'
Pushbutton 'C' BCD code '1011'
'KEY' button BCD code '1100'
- 5 sensors to distinguish the pushbuttons (BCD + accompanying signal)
- 1 sensor detects lock open
- 1 sensor each for opened or closed door
- 1 actuator for opening the lock