Shop OBEX P1 Docs P2 Docs Learn Events
Problems with Serin and the MemKey — Parallax Forums

Problems with Serin and the MemKey

ArchiverArchiver Posts: 46,084
edited 2002-07-08 07:35 in General Discussion
Hello.
I have just purchased Solutions Cubed MemKey keypad controller. It
came with a sample coding to start out with. When you run the code,
you are instructed to enter a key from the keypad. Sure enough when
a key is pressed it's value appear on the debug screen and then you
are asked again. My problem is that I need the user of my project to
press more than one key such as 1,2,3, so that the number One-
Hundred-Twenty-Three is in the MemKey's buffer. Here is a snippet of
the code that solutions cube supplied:

SEROUT 8,396,[noparse][[/noparse]$0E,$00] ' program config
byte: poll mode, typematic off
PAUSE 10 ' allow
EEPROM to write
SEROUT 8,396,[noparse][[/noparse]$0F] ' read configuration
byte
SERIN 9,396,[noparse][[/noparse]b0]
DEBUG "Config byte is: ",bin b0,cr,cr
'
SEROUT 8,396,[noparse][[/noparse]$10] ' test mode
SERIN 9,396,[noparse][[/noparse]b0]
DEBUG "Firmware version is: ",dec b0,cr,cr
'
KeyScanStart
DEBUG "Enter Length: ",cr
'
KeyScanLoop:
SEROUT 8,396,[noparse][[/noparse]$01] ' read # of keys
SERIN 9,396,[noparse][[/noparse]b0]

If b0 = 0 Then KeyScanLoop ' if no keys in
buffer keep looking
'
ReadKeys: ' keys in buffer so
read buffer

SEROUT 8,396,[noparse][[/noparse]$00]
SERIN 9,396,[noparse][[/noparse]b0] ' get key value
DEBUG "Keypress is: ",dec b0,cr,cr

serData = b0
Debug "serData = ",dec serData,cr
GOTO KeyScanStart
RETURN


I tried to modify the following line:
SERIN 9,396,[noparse][[/noparse]b0]

to read:
SERIN 9,396,[noparse][[/noparse]dec b0]

The Basic Stamp manual states that when the DEC modifier is used, it
waits for a numerical value 0 - 9. When a non numerical value is
entered SERIN is exited and the information is ready to be sent to
the Basic Stamp. However, after I modified the line by adding the
DEC modifier and ran the code the keypad no longer responds. no
charactors appear on the debug screen although the code was
tokenized successfully. The MemKey is set to polemode (automatic is
off) as the code above shows.

Can someone please shed some light on this for me.

Thank you in advance.

Rod
Sign In or Register to comment.