Yep, it sure does look like a loop, Steve. You posted the correct link--the one I wanted to send. Oops! Thanks for catching that, Steve.
Yep, it sure does look like a loop, Steve. You posted the correct link--the one I wanted to send. Oops! Thanks for catching that, Steve.
Russ
N0EVC, xWB6ONT, xWN6ONT
"Easy to use" is easy to say.
Could some1 explain me the algorithm of whats happening int he keypad.bas?
I ve been trying to figure out and it doesnt make a whole lot of sense to me
So my Kb_row_bit =0 and kb_col_bit=4 (initially)
how does the algorithm take care of the scanning from here?
I think I understood a few iterations but I am not toosure I
totally understand
Below are teh subroutines from that file that I think are managing the scanning process
Scan the Keypad
' ===============
repeat
key=0 ' no key is press
row=0 ' begin scan @ ROW0
col=0 ' COL0
kb_row_PORT=kb_row_PORT | InitialState ' set all ROW bits to 1
repeat
ROWBIT=ROW+KB_ROW_BIT ' point to a ROW bit
kb_row_PORT.0[RowBit]=0 ' clear actual ROW bit
Gosub readcol ' Read column
if KeyTemp != KeyMask then ' Any column to 0?
REPEAT ' YES
IF KeyTemp.0=0 THEN ' IF the actual column=0
key=row*KB_COL ' Calculate
key=key+col ' the
key=key+1 ' Value
row=KB_ROW ' Set maximum ROW to getout of here
@ ifndef KEYPAD_AUTOREPEAT ' If AutoRepeat is not DEFINE
repeat
Gosub readcol ' Wait until
until KeyTemp=keymask ' Key is released
@ endif
PAUSE DebounceDelay ' Debounce delay
ENDIF
keytemp=keytemp>>1 ' shift to next column bit
Col=col+1 ' go to next column
UNTIL COL=KB_COL ' COL scan Finished?
endif
kb_row_PORT.0[Rowbit]=1 ' set actual ROW bit
row=row+1 ' point to next row
until row>(KB_ROW-1)
until key!=0 ' Row scan finished?
RETURN ' any key pressed?
ReadCol:
KeyTemp=kb_col_PORT>>kb_col_Bit ' Read Column state
KeyTemp=KeyTemp & kEYMASK ' Keep only wanted bits
return
Bookmarks