ts-7000
[Top] [All Lists]

[ts-7000] Re: Keypad ts-7260

To:
Subject: [ts-7000] Re: Keypad ts-7260
From: "dokapra" <>
Date: Thu, 11 Sep 2008 22:37:18 -0000
--- In  "Fabio Vaz" <> wrote:
>
> Hi all,
> 
> I downloaded the keypad.c sample from TS ftp and it works fine on 
> ts7200 but it doesn't on ts7260. When I press "2" it shows "2" followed 
> by a "5" for example. It's very strange. Has anyone corrected this 
> problem ?
> 
> Regards,
> Fabio.
>
I had same problem. Parasitic capacitance makes that you read back
wrong data.
This is original code:
unsigned int get_keys(void) {

        unsigned int pos, on = 0;



        for(pos = 0; pos < 4; pos++) {

                *dat = ~(1 << pos);

                on |= (~(*dat >> 4) & 0xf) << (4 * pos);

        }

        return on;

}

This modification works for me:
unsigned int get_keys(void) {

        unsigned int pos, on = 0;



        for(pos = 0; pos < 4; pos++) {

            *dir = 0; // all pins set as inputs
            *dir = (1 << pos); // exactly one pin is set as output
            *dat = 0xffffffff;
            *dat = ~(1 << pos); // only one pin is set to 0
            on |= (~(*dat >> 4) & 0xf) << (4 * pos);
        }

        return on;

}

In this way, when sweeping through colons, one always have one "off"
state (provided by *dat = 0xffffffff statement) which solves the problem


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU