data storing
I though I had this down but it just seems no0t to be working. I am trying to store a "pass code" using either the write or data commands.
wouldn't this spit out 1111? it spat out a 1000 instead. am i missing something obvious?
write 0, 1
write 1, 1
write 2, 1
write 3, 1
FOR idx = 0 TO 3
READ idx, char
DEBUG DEC char(idx)
NEXT
wouldn't this spit out 1111? it spat out a 1000 instead. am i missing something obvious?

Comments
rxlcd PIN 3 txlcd PIN 0 int PIN 2 lcdbaud CON 84 prefix CON $FE lcdclear CON $14 lcdlighton CON $0A lcdlightoff CON $0B lcdpos CON $0C lcdhome CON $0D lcdread CON $1B lcdmode CON $1C code VAR Byte(4) counter VAR Byte idx VAR Byte char VAR Byte WRITE 0, 1 WRITE 1, 1 ' passcode is 1111 WRITE 2, 1 WRITE 3, 1 SEROUT rxlcd, lcdbaud, [noparse][[/noparse]prefix, lcdmode, 1] ' sets to eight button mode GOSUB Lcd_Clear ' clear lcd GOSUB Lcd_Home ' sets cursor to home FOR idx = 0 TO 3 READ idx, char ' just reads the written passord from EEPROM DEBUG DEC char NEXT Main: counter = 0 ' set counter to zero DEBUG "Please enter pass", CR ' entry statement 'DO ' something i was trying, ignore polling: ' polling address BRANCH int, [noparse][[/noparse]Keypad, polling] ' see if int pin is high or low, high = keep waiting, low = get one byte of data from button press PAUSE 200 Keypad: 'keypad address PAUSE 200 SEROUT rxlcd, lcdbaud, [noparse][[/noparse]prefix, lcdread] ' reads one byte from keypad buffer SERIN txlcd, lcdbaud, [noparse][[/noparse]code(counter)] ' "catches" that one byte from buffer DEBUG DEC code(counter) ' tells you what was "captured" counter = counter + 1 ' counter increments by one to help indicate button presses in buffer PAUSE 1000 'LOOP UNTIL (counter = 4) IF (counter = 4) THEN ' when 4 button presses occur, 4 bytes have been buffered GOTO compare ELSEIF (counter < 4) THEN ' if less than 4 bytes are buffered, wait for another button press (for int to go low @ polling) GOTO polling ENDIF compare: FOR idx = 0 TO 3 READ (idx), char ' reads idx value and stores it temporarily in char IF (char <> code(idx)) THEN ' if that location does not match recently buffered code, its wrong GOTO wrong ENDIF NEXT right: DEBUG CR, "come on in!", CR ' passcode valid GOTO Main wrong: DEBUG CR, "wrong pass, try again", CR ' passcode invlaid GOTO Main