assuming you know how to use (OK) and (ESC) in your program,
you are probably almost there
you probably only need to define it a bit better so each
part is clear and easy to implement. try to make it modular.
for example
- create bit that tells you that alarm is tripped (this can be B2 if you connect
inverter B5 output to one of the B2 inputs).
- if password is ok disarm system (an arm/disarm function can be simple SET/RESET block)
- turn alarm outputs if alarm is detected AND system is armed (just an AND block)
- an alarm can also be wrong password (doesn't have to be switch or sensor)
also i would probably use more than one digit password
so each digit would require separate counter. to manage this
i would start by creating some basic functions:
detect long OK press (this arms alarm)
detect long ESC press (this resets all counters and returns to first digit)
detect short ESC press (this increments counter for current digit)
detect short OK press (this initiates check for current digit and switches to next one)