Need help in matrix keypad coding


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Rano, don't worry about Skimask. This is his own way to tell you...
    Good one...
    What I was getting at was the fact that the O/P said he 'found the code on the internet' and didn't know how to make it do what he needed it to do...suggesting that maybe the O/P dove in head first, maybe without so much as first creating a 'blinky' and working up from there. 'cause quite frankly, that fix up there a couple of posts back is a very basic fix (change should be the operative word here).
    In other words, I think a fish has been given...and more fish might soon be handed out...
    Last edited by skimask; - 29th March 2008 at 07:30.

  2. #2
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    In other words, I think a fish has been given...and more fish might soon be handed out...
    Don't you go stealing my fish, I'm not very good at sharing

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    Don't you go stealing my fish, I'm not very good at sharing
    You got fish? Sounds like a slogan for something...

    Got Fish?

  4. #4
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Got Fish?
    After studying applied reasoning I can't help but wonder if maybe I do.

  5. #5
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Smile

    It's ok skimask, I understand what you're trying to say. I'm just new in the world of PIC and know nothing about it.Now I need to deal with PIC to finish my project. So, I just do reverse Engineering..study the codes given and learn how it function.

  6. #6
    Join Date
    May 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Ok, now WHY does it work

    All right I've seen this code a bit now and I have to admit I don't know WHY it works. I do know that may or may not work if you change the port (that's informative I know) which might be related to some weak pull up issue (?) or some other circuit design point I missed.

    Here's the question - This code sets all values of the portD to zero

    ' Wait for keypress
    For col = 0 to 3 ' 4 columns in keypad
    PORTD = 0 ' All output pins low
    TRISD = (dcd col) ^ $ff ' Set one column pin to output
    row = PORTD >> 4 ' Read row
    If row != $f Then gotkey ' If any keydown, exit


    then changes the direction of one pin/column at a time to output instead of input. Great. The question is: why by simply changing the pin to output does the value of that pin go from low (portd=0) to high?

  7. #7
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    The output state of the pin is stored, even when it is an input. When you make it an input, it automatically goes wherever the input is pulling it. As soon as you make it an output, the old output value is restored.

    The way to ensure it goes to the desired state is to set the value prior to TRISing it to an output.

Similar Threads

  1. Matrix Keypad routine
    By mister_e in forum Code Examples
    Replies: 134
    Last Post: - 18th September 2022, 20:30
  2. calculator-like code entry with matrix keypad and display
    By Dennis in forum mel PIC BASIC Pro
    Replies: 35
    Last Post: - 16th December 2009, 22:58
  3. 3x4 matrix keypad
    By tazntex in forum Serial
    Replies: 3
    Last Post: - 14th October 2008, 20:13
  4. Inconsistent output on a 4x4 matrix keypad
    By markcadcam in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 24th November 2006, 03:54
  5. very basic matrix keypad question
    By kitcat in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th July 2006, 21:33

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