Shop OBEX P1 Docs P2 Docs Learn Events
using SERIN to read keypad on LK204-25 — Parallax Forums

using SERIN to read keypad on LK204-25

rhuggrhugg Posts: 14
edited 2008-04-15 20:49 in BASIC Stamp
Having a curious problem reading data from an LK204-25 LCD display/keypad interface from Matrix Orbital. I can read the version number and type of display, buy not when trying to read the keypad:

SEROUT ioA8Tx,LCDBaud,[noparse][[/noparse]254]
SEROUT ioA8Tx,LCDBaud,[noparse][[/noparse]79]··· 'AUTO keypress off
SEROUT ioA8Tx,LCDBaud,[noparse][[/noparse]254]· 'poll for a character
SEROUT ioA8Tx,LCDBaud,[noparse][[/noparse]38]
SERIN ioA9rx, LCDBAUD, [noparse][[/noparse]value] 'tried several·variants of this, including timeouts etc
DEBUG HEX value," was read"
but the above lines hang when trying to read the keypad. from what i can tell, SERIN needs to be terminated by a non-numeric character, is this a possibility. i have it in my mind that it the BSP40 that i am using is reading the byte, then waiting for a termination character that never arrives.

Any insightss? - thanks

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-04-14 00:58
    Read the help file on serin. you can set a timeout and also tell serin what to expect from the other device.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-04-15 20:49
    Rhugg,

    I would consolidate your SEROUT statements…By using SEROUT so many times you will waste valuable program memory.

    SEROUT ioA8Tx, LCDBaud, [noparse][[/noparse]254, 79] 'AUTO keypress off
    SEROUT ioA8Tx, LCDBaud, [noparse][[/noparse]254, 38] 'poll for a character

    Of course, on the second line I would recommend doing this different…You set the mode at the beginning of your program. You poll when ready for the key press. Waiting for a non-numeric value has nothing to do with your code. You’re not using a formatter that requires that. The I/O lines you’re using on the BS2p40, are they on the MAIN or AUX ports?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.