keypad


Closed Thread
Results 1 to 2 of 2

Thread: keypad

  1. #1
    Join Date
    Feb 2006
    Location
    france
    Posts
    47

    Default keypad

    Hello I have a small problem with this program, the data to send to the PC Are illegible, and for my beginning it is not obvious. If you can help me, I thank you.
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2006
    Location
    france
    Posts
    47


    Did you find this post helpful? Yes | No

    Default keypad

    '************************************************* *****************************
    Include "modedefs.bas"

    DEFINE OSC 20 ' Oscillator speed in MHz:


    '************************************************* ******************************
    OPTION_REG.7 = 0 ' Enable pullups on PortB
    TRISA=%00000000 ' make all port outputs initially
    PORTA=%00000000

    TRISB=%00000000
    PORTB=%00000000

    CMCON = %00000111
    VRCON = %00000000

    T1CON = %00110001



    '************************************************* ********************************

    'VARIABLES

    datac VAR BYTE
    Key VAR BYTE
    '************************************************* *********************************
    Start_loop:

    '------------------------------PORTB 0 -----------------------------------------
    TRISB=%1110
    PORTB=%0000
    IF PORTB = %0010 THEN'----------------------------CHIFFRE 1-----------------
    Key = "1" : GOTO Exit_loop
    ELSE

    IF PORTB = %1000 THEN'------------------------CHIFFRE 2-----------------
    Key= "2" : GOTO Exit_loop
    ELSE

    IF PORTB = %0100 THEN'--------------------CHIFFRE 3-----------------
    Key = "3" : GOTO Exit_loop
    ENDIF
    ENDIF
    ENDIF
    '------------------------------PORTB 1------------------------------------------
    TRISB=%1101
    PORTB=%0000
    IF PORTB = %0001 THEN'----------------------------CHIFFRE 4----------------
    Key= "4" : GOTO Exit_loop
    ELSE
    IF PORTB = %1001 THEN'-------------------------CHIFFRE 5----------------
    Key= "5" : GOTO Exit_loop
    ELSE
    IF PORTB=%0101 THEN'-----------------------CHIFFRE 6----------------
    Key = "6" : GOTO Exit_loop
    ENDIF
    ENDIF
    ENDIF
    '------------------------------PORTB 2------------------------------------------
    TRISB=%1011
    PORTB=%0000
    IF PORTB=%0011 THEN'------------------------------CHIFFRE 7----------------
    Key= "7" : GOTO Exit_loop
    ELSE
    IF PORTB=%1001 THEN'-------------------------CHIFFRE 8-----------------
    Key= "8" : GOTO Exit_loop
    ELSE
    IF PORTB=%0001 THEN'-----------------------CHIFFRE 9----------------
    Key = "9" : GOTO Exit_loop
    ENDIF
    ENDIF
    ENDIF
    '--------------------------------PORTB 3----------------------------------------
    TRISB=%0111
    PORTB=%0000
    IF PORTB=%0011 THEN'------------------------------ " * "-------------------
    Key= "*" : GOTO Exit_loop
    ELSE
    IF PORTB=%0001 THEN'---------------------------CHIFFRE 0----------------
    Key= "0" : GOTO Exit_loop
    ELSE
    IF PORTB=%0101 THEN'----------------------- " # " -----------------
    Key = "#" : GOTO Exit_loop
    ENDIF
    ENDIF
    ENDIF
    '-------------------------------------------------------------------------------

    goto Start_loop ' didn't find nothin

    Exit_loop:
    datac = KEY
    SEROUT2 PORTA.3,84,[KEY]
    LOOKUP2 datac,[17,33,65,18,34,66,19,35,67,20,36,68],KEY

    GOTO Start_loop
    ' LookDown combined,[87,110,94,62,109,93,61,107,91,59,103,55,127],Keyindex ' 0,1,2,3...
    ' LookUp Keyindex,["0","1","2","3","4","5","6","7","8","9","*","# "," "],Key ' ascii

Similar Threads

  1. Matrix Keypad routine
    By mister_e in forum Code Examples
    Replies: 134
    Last Post: - 18th September 2022, 20:30
  2. 4x4 keypad Help
    By aaliyah1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 5th October 2010, 16:34
  3. Keypad input test
    By Kalind in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th October 2008, 04:00
  4. Need help in matrix keypad coding
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th May 2008, 13:16
  5. Keypad unlock (as in garage door possibly)
    By Fred in forum Code Examples
    Replies: 5
    Last Post: - 2nd April 2006, 04:26

Members who have read this thread : 1

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