Keypads HELP! hehe, Need advice and possible code.


Results 1 to 14 of 14

Threaded View

  1. #8
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Keypads HELP! hehe, Need advice and possible code.

    EDIT: I got it working, it was the TRISB line, I didnt update it for the inputs past 0. So I added TRISB = %11111111 and now its reading the data, its funny though i must have some wires in wrong place because only one row reads corrects numbers all the others are way off, will have to check pinouts of keypad. but its working now

    BEFORE EDIT:
    Ok it was a bit confusing to make sure the INT was firing so I moved the code down to the INT, it places a 0 on LCD when a key is pressed so the interupt is working, but its not reading data on portB

    heres a code update

    Code:
    include "LCD_D.bas"
    INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts
    TRISD = 0                               ' PORTD is Display
    TRISB = 1                               ' PORTB is Input
    asm
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   INT0_INT,  _KEYPRESS,   PBP,  yes
    	endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   INT0_INT     ; enable external (INT) interrupts
    
    X VAR BYTE : X = 0
    
    LCDOUT $FE, 2
    Pause 1000
    Main:
    PAUSE 500
    GOTO Main
    End
    '---[INT - interrupt handler]---------------------------------------------------
    KEYPRESS:
    X = PORTB 
    X = X >> 4
    LCDOUT $FE, 2
    LCDOUT $FE, $80
    LCDOUT DEC X
    @ INT_RETURN
    Last edited by wdmagic; - 24th April 2013 at 00:17.
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

Similar Threads

  1. Membrane Keypads
    By jonathan in forum Adverts
    Replies: 0
    Last Post: - 15th April 2009, 22:18
  2. Low key count membrane keypads
    By AndrewC in forum General
    Replies: 6
    Last Post: - 7th April 2009, 21:12
  3. Need advice on A/D
    By james in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 24th August 2007, 20:30
  4. Custom membrane keypads UK
    By Calco in forum Off Topic
    Replies: 2
    Last Post: - 14th May 2004, 10:02

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