27963 Parallax Inc, 27963 Datasheet - Page 15

SOLUTIONS CUBED: MEMKEY

27963

Manufacturer Part Number
27963
Description
SOLUTIONS CUBED: MEMKEY
Manufacturer
Parallax Inc
Datasheet

Specifications of 27963

Accessory Type
Keypad Encoder
Product
Microcontroller Accessories
For Use With/related Products
BASIC Stamp®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Miniature Engineering Modules – MEMKey
NextBufferByte:
EndGetByte:
'Program Serial Key Value
RetryProgram:
INPUT "Enter the Serial Key to Program. (0 - 19) ", SerKey
PressReturn:
ExitProgram:
END
AN-302 Interfacing with a single wire
is not able to function in this mode. However, most microcontrollers are able to support this functionality. this example
shows how to interface the MEMKey to a Parallax BASIC Stamp II with only one wire.
merely reads the key presses in a continuous loop.
AN-302 Interfacing with a single wire code listing
input 15
key
'
Begin:
HIGH 15
PAUSE 1000
'
SEROUT 15,396,[$11]
GetKey:
SERIN 15,396,[key]
DEBUG "Keypress is: ",dec2 key, cr,cr
GOTO GetKey
'
END
SOLUTIONS CUBED
530-891-8045
CLOSE #1
BSII
IF MoreData$ = "Yes" THEN GOTO NextBufferByte
FOR i = 1 TO 100000: NEXT
PRINT
GOTO PressReturn
INPUT "Enter the Data Value to Send. (0 - 255) ", Value
PRINT #1, CHR$(10) + CHR$(SerKey) + CHR$(Value);
PRINT : PRINT "******** PRESS ANY KEY TO CONTINUE ********"
DO: LOOP WHILE INKEY$ = "": CLS
GOTO Determine
The diagram shows the connections necessary and the code following uses the default MEMKey settings and
IF SerKey < 0 OR SerKey > 19 THEN GOTO RetryProgram
IF Value < 0 OR Value > 255 THEN GOTO RetryProgram
+5V
GND
P15
var
IF LOC(1) = 0 THEN GOTO EndGetByte
IF LOC(1) <> 0 THEN MoreData$ = "Yes"
Valid$ = "No"
MoreData$ = "No"
A$ = INPUT$(1, #1)
Byte$ = A$
Valid$ = "Yes"
IF Valid$ = "Yes" THEN PRINT ASC(Byte$);
IF Valid$ = "No" THEN PRINT "(No Data Returned)"
byte
MEMKey
VDD
GND
TM
FM
KEY
K0
K1
K2
K3
K4
K5
K6
K7
'TO/FROM Memkey
'let noise settle
'default reset command
'read the key buffer
Keypad
Grayhill 96BB
Row0
Row1
Row2
Row3
Col0
Col1
Col2
Col3
'Get Serial Data
'Reset Flags
'Read Data From Buffer
'Provide delay for write to EEPROM
communication. However, its TM and FM pins are pseudo
open-collector. This coupled with the fact that the FM pin
and TM pin never communicate simultaneously (half-
duplex) allows the MEMKey to communicate via 1 wire if
the master processor is able to support this mode.
master processor must be able to both send and receive
on one I/O line. Because of this, a standard PC serial port
The MEMKey uses a two wire serial interface for
In order for 1 wire communication to work, the
14

Related parts for 27963