Shop OBEX P1 Docs P2 Docs Learn Events
Who can optimize the code? — Parallax Forums

Who can optimize the code?

ArchiverArchiver Posts: 46,084
edited 2002-11-24 12:57 in General Discussion
Hello all,

in the last days i have written my first project for the basic stamp
(Codelock for a door). Can anybody help me to optimize the code (i
need someone bytes):

'2002 Nov.22 Codelock with "STAMP"
'2002 Nov.23, it works but memory is full!

' CODSCH44 = 4*4 Matrix

'The 8 available pins are not enough.
'Under use of a 74 HCT 138 (DS 8205), 1 from 8 Dekoder, it is
'possible to make _new_ pins.
'Function:
'On Reset a standard personal identification number is activ. In this
'case the number is 4-digit and named 1110. Is this number sequence
'pressed, pin 7 goes to (a various time) on high (Relais
'switches). Every pressed failure blocks the keyboard for 3 seconds.

'The programming of a new personal identification number or opening
'time starts with 0 0 on the keyboard followed from the current code.
'For example 0 0 1 1 1 0. Now the programming mode is active.
'A number <8 or >7 is expected.

'A number <8 fixes the new place number (1...7). Corresponding
'e.g. 5 becomes the new code now the chosen place number, for example
'1 2 3 4 5 . The programming mode is leaving automatically.
'The new personal identification number is effective.

'A digit >7 allows to change of the opening time.
'Expected is a number 1..15. The programming mode now left again
'automatically.
'The entered number * 200ms is the current opening time.

'Wrong keystrokes of every kind are rejected and block further
'Petitions for approx 3s. After this a restart is carried out.

'writing a temporary personal identification number in EEProm:

'Position 0 = place number, in the example 4-digit
'Position 1,2,3,4 (1110) personal identification
number
'Position (8) opening time

eeprom 9,(4,1,1,1,0,0,0,0,4)
'writing temporary personal
for b0 = 9 to 17 'identification number on
place 0
b1 = b0-9 'b1 = 0...8
read b0,b2
write b1,b2
next b0

dirs = %10000111 'pin 0..2 output columns, from this
'by 74 HCT 138 to 8 become
'split, there 4!
'pin 3..6 input lines
'pin 7 Relaisoutput

symbol spalte = b2
symbol test = b3
symbol l
Sign In or Register to comment.