In this section we are going to create a combination lock. This is the kind of thing you could put onto a door and it will fire a bolt to let someone in only when they have entered the correct ID number. We are going to make our lock more interesting in that we are going to use two additional features of the PIC microcontroller, non-volatile memory and the sleep instruction.

This means that our lock effectively switches itself off when it is not in use, and that the combination in use can be retained even when there is no power at all.