Shop OBEX P1 Docs P2 Docs Learn Events
Keypad chip EDE1144 — Parallax Forums

Keypad chip EDE1144

ArchiverArchiver Posts: 46,084
edited 2000-03-31 06:04 in General Discussion
I need help!

I just connected a 4x4 keypad to an EDE1144 serial keypad decoder.
According to the data sheet, the 1144 will return ASCII $30, dec 48, ("0")
for key 0 thru ASCII $39, dec 57, ("9") for key 9. Then it returns ASCII
$41,dec 65, ("A") for key 10 thru ASCII $46, dec 70, ("F") for key 15.

I want to convert these to numbers 1 thru 16 in a BS1 program. The
following code is what I thought would work, but it doesn't, unless I have a
hardware problem:

'KEY IS A BYTE
'AT SEVERAL PLACES WE READ THE INPUT WITH
SERIN 7,N2400,KEY
GOSUB FIXKEY
...
...
FIXKEY:
IF KEY>57 THEN BIGNUM
KEY=KEY-47
GOTO ALLDUN
BIGNUM:
KEY=KEY-54
ALLDUN: RETURN

Can someone see a problem with this code?

Thanks in advance,
Ray McArthur

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-03-30 08:57
    At 12:39 AM 3/30/00 -0500, rjmca promulgated:
    >I need help!
    Ray -

    Rather than get into the guts of your problem, let me offer this:

    Todd Peterson (Prez. of E-Lab) recently offed a free applications CD for
    their products, just recently. I HOPE it can be read by ALL Windows
    systems; Win3.x
    INCLUSIVE <ahem>.

    [noparse][[/noparse]M-Soft flame on]
    There seems to be a MASS migration by lotsa folks, AWAY from Win3.x; the
    LAST stable opsys that Micro-Snort ever wrote ! YMMV on that subjectivity !
    Thanks $Billy$Boy$ <grrrrrr>.
    [noparse][[/noparse]M-Soft flame off; no cross-flames invited]

    So, you might want to grab that if you have a day or so to spare. Otherwise,
    I'm sure they have a BS-1 example they can ship you by e-mail tomorrow.

    Better to go to the source on this one, since the data sheet doesn't show
    a BS-1 example, and I/we would be interpreting the data sheet as much as you
    have <shrug>.

    Regards,

    Bruce

    >
    >I just connected a 4x4 keypad to an EDE1144 serial keypad decoder.
    >According to the data sheet, the 1144 will return ASCII $30, dec 48, ("0")
    >for key 0 thru ASCII $39, dec 57, ("9") for key 9. Then it returns ASCII
    >$41,dec 65, ("A") for key 10 thru ASCII $46, dec 70, ("F") for key 15.
    >
    >I want to convert these to numbers 1 thru 16 in a BS1 program. The
    >following code is what I thought would work, but it doesn't, unless I have a
    >hardware problem:
    >
    >'KEY IS A BYTE
    >'AT SEVERAL PLACES WE READ THE INPUT WITH
    >SERIN 7,N2400,KEY
    >GOSUB FIXKEY
    >...
    >...
    >FIXKEY:
    >IF KEY>57 THEN BIGNUM
    >KEY=KEY-47
    >GOTO ALLDUN
    >BIGNUM:
    >KEY=KEY-54
    >ALLDUN: RETURN
    >
    >Can someone see a problem with this code?
    >
    >Thanks in advance,
    >Ray McArthur
    >
    >
    >
    >-- Check out your group's private Chat room
    >-- http://www.egroups.com/ChatPage?listName=basicstamps&m=1
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-30 15:51
    Ray-

    I don't see a logic problem with the code. You may want to try the
    following to help figure out what's going on.


    'KEY IS A BYTE
    'AT SEVERAL PLACES WE READ THE INPUT WITH
    SERIN 7,N2400,KEY
    DEBUG CR,@KEY," ",$KEY ' see what we got
    GOSUB FIXKEY
    ...
    ...
    FIXKEY:

    ' IF KEY>57 THEN BIGNUM
    IF KEY>"9" THEN BIGNUM
    ' KEY=KEY-47
    KEY=KEY-"0"
    GOTO ALLDUN
    BIGNUM:
    KEY=KEY-"A"+10
    ' ALLDUN: RETURN
    ALLDUN:
    DEBUG " ",#KEY," ",$KEY ' see what we converted it to
    KEY = KEY + 1 ' convert 0 - 15 to 1 - 16
    DEBUG " ",#KEY," ",$KEY ' see what we converted it to
    RETURN


    I can't find where the '1144 datasheet comes right out and says it,
    but my reading of it implies the serial data is transmitted with
    "true" logic levels vice "inverted", so you may also want to try
    your SERIN statement this way if the '1144 serial output goes
    directly to your BS1:

    SERIN 7,T2400,KEY

    I assume you've got the '1144 strapped to 2400 baud and are
    executing the SERIN only upon active "data valid" output.


    Steve



    On 30 Mar 00 at 0:39, rjmca wrote:

    > ...I just connected a 4x4 keypad to an EDE1144 serial keypad
    > decoder. According to the data sheet, the 1144 will return ASCII
    > $30, dec 48, ("0") for key 0 thru ASCII $39, dec 57, ("9") for key
    > 9. Then it returns ASCII $41,dec 65, ("A") for key 10 thru ASCII
    > $46, dec 70, ("F") for key 15...I want to convert these to numbers
    > 1 thru 16 in a BS1 program.
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-30 18:54
    Steve:
    Thanks for your effort and the suggestions/questions. Yes, the baud pin is
    grounded. The data sheet that came with the IC (page 6) states N-8-1. It
    also states that serial usage "involves the use of Data Valid signal.." ,
    but I am ignoring that pin, just waiting for input with serin. It is
    possible that there is garbage being outputted before data valid comes
    alive? Maybe it's time to call elab?

    I guess the next step is to read the keypad in a stand alone program, trying
    my code and your suggestions without the confusion of the larger program.
    Originally, the program used Rentron's Ser-Key, but it needed more than 12
    keys for full functionality.

    Thanks,
    Ray McArthur

    Original Message
    From: S Parkis <parkiss@e...>
    To: rjmca <rjmca@w...>; <basicstamps@egroups.com>
    Sent: Thursday, March 30, 2000 9:51 AM
    Subject: [noparse][[/noparse]basicstamps] Re: Keypad chip EDE1144


    > Ray-
    >
    > I don't see a logic problem with the code. You may want to try the
    > following to help figure out what's going on.
    >
    >
    > 'KEY IS A BYTE
    > 'AT SEVERAL PLACES WE READ THE INPUT WITH
    > SERIN 7,N2400,KEY
    > DEBUG CR,@KEY," ",$KEY ' see what we got
    > GOSUB FIXKEY
    > ...
    > ...
    > FIXKEY:
    >
    > ' IF KEY>57 THEN BIGNUM
    > IF KEY>"9" THEN BIGNUM
    > ' KEY=KEY-47
    > KEY=KEY-"0"
    > GOTO ALLDUN
    > BIGNUM:
    > KEY=KEY-"A"+10
    > ' ALLDUN: RETURN
    > ALLDUN:
    > DEBUG " ",#KEY," ",$KEY ' see what we converted it to
    > KEY = KEY + 1 ' convert 0 - 15 to 1 - 16
    > DEBUG " ",#KEY," ",$KEY ' see what we converted it to
    > RETURN
    >
    >
    > I can't find where the '1144 datasheet comes right out and says it,
    > but my reading of it implies the serial data is transmitted with
    > "true" logic levels vice "inverted", so you may also want to try
    > your SERIN statement this way if the '1144 serial output goes
    > directly to your BS1:
    >
    > SERIN 7,T2400,KEY
    >
    > I assume you've got the '1144 strapped to 2400 baud and are
    > executing the SERIN only upon active "data valid" output.
    >
    >
    > Steve
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-30 23:23
    > The data sheet that came with the IC (page 6) states N-8-1. It
    > also states that serial usage "involves the use of Data Valid signal.." ,
    > but I am ignoring that pin, just waiting for input with serin. It is
    > possible that there is garbage being outputted before data valid comes
    > alive? Maybe it's time to call elab?

    I believe I spoke recently with the original author of this thread, but if
    not let me clarify a couple of points that have come up: (1) yes, the
    serial output format is non-inverted N-8-1, and (2) the Data Valid signal
    doesn't have to be used; if it is not used then your Stamp will need to sit
    in the serial receive loop until the start bit is detected. If, later on,
    you decide that you need the Stamp to be doing other things besides waiting
    for a keypress, then just periodically poll the Data Valid pin. Once it
    changes state you'll have time to get to the serial inout instruction prior
    to the EDE1144 beginning the data transmission (a delay was built in for
    this exact purpose).

    Also, someone replying on this thread mentioned our datasheet and asked if
    it was Win3.1 compatible. It is; in fact, there are two directories, one
    for Win3.1, and another for 95/98. Anyone that would like a copy of this
    CD-ROM containing datasheets for each of our IC's just send me your e-mail
    address off-list at toddp@e...

    Todd Peterson
    E-Lab Digital Engineering, Inc.

    (816) 257-9954 FAX: (816) 257-9945
    http://www.elabinc.com
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-31 02:52
    On 30 Mar 00 at 12:54, rjmca wrote:

    > Steve:
    > Thanks for your effort and the suggestions/questions. Yes, the baud
    > pin is grounded. The data sheet that came with the IC (page 6)
    > states N-8-1.

    Just to be sure we're communicating...the N-8-1 means the bytes are
    transmitted with (N)no parity bits, (8)eight data bits, and (1)one
    stop bit. This has nothing to do with whether the logic level is
    inverted or true ("non-inverted", the term Todd used, is synonymous
    with "true" as used in the BS1 manual). So you definitely want
    T2400, not N2400.

    > It also states that serial usage "involves the use of Data Valid
    > signal.." , but I am ignoring that pin, just waiting for input with
    > serin. It is possible that there is garbage being outputted before
    > data valid comes alive?

    I'd use the Data Valid indication at this point in the development,
    then perhaps yank it later when the communication gremlins are
    worked out. At least it would tell you when the '1144 is about to
    send serial data, which would let you know when the Stamp should be
    responding to it. If you have a pin to spare, I'd do something like:

    dataValid LABEL PIN6

    WAIT_FOR_KEY:
    IF dataValid = 0 THEN WAIT_FOR_KEY ' assumes DV active high (?)
    SERIN 7,T2400,KEY
    DEBUG CR,@KEY," ",$KEY ' see what we got
    GOSUB FIXKEY
    ...
    ...
    RETURN

    FIXKEY:
    IF KEY>"9" THEN BIGNUM
    KEY=KEY-"0"
    GOTO ALLDUN
    BIGNUM:
    KEY=KEY-"A"+10
    ALLDUN:
    DEBUG " ",#KEY," ",$KEY ' see what we converted it to
    KEY = KEY + 1 ' convert 0 - 15 to 1 - 16
    DEBUG " ",#KEY," ",$KEY ' see what we converted it to
    RETURN


    Steve
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-31 06:04
    Steve:
    *** PROBLEM SOLVED, IT WAS ME! ***

    Had I read Todd's message more carefully, or tried your suggestion, I would
    have saved much time. I ran the output to a standalone program with a BS1,
    got weird characters. Then hauled it to the cellar and viewed output with a
    scope....it was non-inverted "true" as you and Todd said. Changed to serin
    T2400, problem fixed. The chip works great!

    Thanks,
    Ray McArthur

    Original Message
    From: S Parkis <parkiss@e...>
    To: rjmca <rjmca@w...>; <basicstamps@egroups.com>
    Sent: Thursday, March 30, 2000 9:51 AM
    Subject: [noparse][[/noparse]basicstamps] Re: Keypad chip EDE1144


    > Ray-
    >
    > I don't see a logic problem with the code. You may want to try the
    > following to help figure out what's going on.
    >
    >
    > 'KEY IS A BYTE
    > 'AT SEVERAL PLACES WE READ THE INPUT WITH
    > SERIN 7,N2400,KEY
    > DEBUG CR,@KEY," ",$KEY ' see what we got
    > GOSUB FIXKEY
    > ...
    > ...
    > FIXKEY:
    >
    > ' IF KEY>57 THEN BIGNUM
    > IF KEY>"9" THEN BIGNUM
    > ' KEY=KEY-47
    > KEY=KEY-"0"
    > GOTO ALLDUN
    > BIGNUM:
    > KEY=KEY-"A"+10
    > ' ALLDUN: RETURN
    > ALLDUN:
    > DEBUG " ",#KEY," ",$KEY ' see what we converted it to
    > KEY = KEY + 1 ' convert 0 - 15 to 1 - 16
    > DEBUG " ",#KEY," ",$KEY ' see what we converted it to
    > RETURN
    >
    >
    > I can't find where the '1144 datasheet comes right out and says it,
    > but my reading of it implies the serial data is transmitted with
    > "true" logic levels vice "inverted", so you may also want to try
    > your SERIN statement this way if the '1144 serial output goes
    > directly to your BS1:
    >
    > SERIN 7,T2400,KEY
    >
    > I assume you've got the '1144 strapped to 2400 baud and are
    > executing the SERIN only upon active "data valid" output.
    >
    >
    > Steve
    >
    >
    >
    > On 30 Mar 00 at 0:39, rjmca wrote:
    >
    > > ...I just connected a 4x4 keypad to an EDE1144 serial keypad
    > > decoder. According to the data sheet, the 1144 will return ASCII
    > > $30, dec 48, ("0") for key 0 thru ASCII $39, dec 57, ("9") for key
    > > 9. Then it returns ASCII $41,dec 65, ("A") for key 10 thru ASCII
    > > $46, dec 70, ("F") for key 15...I want to convert these to numbers
    > > 1 thru 16 in a BS1 program.
    >
    >
    >
    > -- Easily schedule meetings and events using the group calendar!
    > -- http://www.egroups.com/cal?listname=basicstamps&m=1
    >
    >
Sign In or Register to comment.