PIC 16F877A Keypad interfaceded with Input and LCD as Displays Output


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Red face Sorry!

    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.

  2. #2
    np123's Avatar
    np123 Guest


    Did you find this post helpful? Yes | No

    Default

    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

Similar Threads

  1. Keypad input test
    By Kalind in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th October 2008, 05:00
  2. problem with sending data using RF module
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 51
    Last Post: - 10th April 2008, 18:08
  3. problem with input and output (18F452)
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th March 2008, 00:21
  4. LED "capacitance" won't get lower
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 3rd May 2007, 21:31
  5. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 23:19

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts