What you need is just program the PIC to measure the timming of the first time the switch is pressed, set it as a default short time, as for example code Time=1. It doesn't need to be exactly "time", just a counter counting loops while you hold the switch pressed. The next switch pressings would represent another timmings that would be divided by this first counter as reference, and so on. For example: If the first press, make the PIC counter to 20, the second (you hold twice longer) would be 40 and the third (also twice longer) would be again 40, your pressing button relation would be: 1st: 1 (20/20) 2nd: 2 (40/20) 3rd: 2 (40/20) So your inputed code is "122". You can do it in any digits size and lengths, and also used to "program" the unit. The only tricky is that the first button press should be the shortest one, to be used as a divisor for the rest... Wagner. Ron Fial wrote: > > Why not just use morse code? Anybody could learn 2 or 3 letters, and morse co de decode with a PIC is not hard, you only have to deal with ratios, and assume the first press is a dot or a dash, because the lock 'knows' what letter to expe ct first. > > di di di di pause di dit