IC2 pic 18f452 program problems


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    MrSafe's Avatar
    MrSafe Guest


    Did you find this post helpful? Yes | No

    Default

    Heres the subroutine for get key


    '---- Subroutine to Key from keypad ----
    '
    getkey:
    ;
    key = 0
    PortC = 0 ' all outputs pins low
    TrisC = $f0 ' bottom 4 pins out, top 4 pins in
    ;
    input PORTC
    ;
    pause 250
    ;
    PORTC = %11111110 ' row 1
    ;
    if PORTC.4 = 0 then
    key = 1
    return
    endif
    ;
    if PORTC.5 = 0 then
    key = 2
    return
    endif
    ;
    if PORTC.6 = 0 then
    key = 3
    return
    endif
    ;
    if PORTC.7 = 0 then
    key = 12
    return
    endif
    ;
    PORTC = %11111101 ' row 2
    ;
    if PORTC.4 = 0 then
    key = 4
    return
    endif
    ;
    if PORTC.5 = 0 then
    key = 5
    return
    endif
    ;
    if PORTC.6 = 0 then
    key = 6
    return
    endif
    ;
    if PORTC.7 = 0 then
    key = 13
    return
    endif
    ;
    PORTC = %11111011 ' row 3
    ;
    if PORTC.4 = 0 then
    key = 7
    return
    endif
    ;
    if PORTC.5 = 0 then
    key = 8
    return
    endif
    ;
    if PORTC.6 = 0 then
    key = 9
    return
    endif
    ;
    if PORTC.7 = 0 then
    key = 14
    return
    endif
    ;
    PORTC = %11110111 ' row 4
    ;
    if PORTC.4 = 0 then
    key = 10
    return
    endif
    ;
    if PORTC.5 = 0 then
    key = 0
    return
    endif
    ;
    if PORTC.6 = 0 then
    key = 11
    return
    endif
    ;
    if PORTC.7 = 0 then
    key = 15
    return
    endif
    ;
    goto getkey
    return
    ;
    gotkey:
    key = (col * 4) + (ncd (row ^ $f))
    '
    return
    '
    end

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Comment out the goto getkey just before GotKey:

    That will keep it from waiting for a key before proceeding.
    <br>
    DT

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 10:54
  2. Replies: 288
    Last Post: - 25th August 2008, 17:53
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  4. Replies: 14
    Last Post: - 26th September 2007, 06:41
  5. Which pic has a big flash program memory?
    By amindzo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st November 2006, 20:35

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