I have made a few assignments for the children of the local "young enginers" group. One assignment culminates in such a one-button code lock. The code is below. It is in JAL, my very own programming language. The compiler is available for free, so you can translate it to 16x84 assembler or hex (I'm working on SX support). see www.xs4all.nl/~wf/wouter/pic/jal When you use another chip you can use it as starting point. include 16c84_10 include jlib pin_a0_direction = output pin_a1_direction = input procedure lees_code( byte out x ) is for 8 loop var byte n = 0 while pin_a1 == high loop delay_1mS( 5 ) n = n + 1 if n == 255 then x = 0 return end if end loop delay_1ms( 200 ) x = x << 1 if pin_a1 == low then x = x + 1 end if while pin_a1 == low loop end loop end loop end procedure var byte code forever loop pin_a0 = high if pin_a1 == low then lees_code( code ) if code == 0b_0000_1111 then pin_a0 = low delay_1s( 5 ) else delay_1s( 10 ) end if end if end loop