RaspiElf Keypad
Intro
The Elf Membership Card has 8 data switches, 3 mode switches, and a IN push button on its front panel. The data is displayed on 8 LEDs (binary). It is a error prone but educational task to "switch in" (load) the program.

I have got an old external keypad because my old notebook did not have any numeric keypad. The keys looks similar to those old Elf hex keypads, why not use this spare keypad for the Elf Membership Card? It is a Cherry keyboard and I have an other Cherry keyboard with the same type of key caps and it was easy to replace the two upper rows with the A to F caps.

See also the RaspiElfDisplay (TIL311 like LED display).

Hardware

Pics

gal 2000 G84-4700 2 persp.jpg
Cherry Keypad G84-4700, original key caps
hex-keypad.jpg
Hex Keypad
keypad-display.jpg
Keypad and display

elfdisplay (COSMICOS II) Function Keys

Short Mode Key Keycode Notes
IN Input I, [CR] 96 Increment address, in LOAD mode causes the data byte shown to be written to the address shown
LD Load L, + 78 Goes to the LOAD mode. In the LOAD mode goes to the address entry mode
R/S Run/Wait R, . 83 Toggles between Run and Wait. R/S is a reminiscence of HP pocket calculators
MP Memory Protect M, - 74 Shows data byte from the address shown
SW Switch/Keypad S, [BS] 14 Toggles between front panel switches and keypad

The modes are shown in the display by the decimal points.

Some Other COSMAC Keypads

RCA COSMAC Microterminal

RCA COSMAC Microterminal

R
Reset: resets the logic of the Microterminal and microprocessor system. Puts the CDP1802 in Reset state.
RU
Run Utility: starts execution of the Utility Program (UT5), which is at location 8000.
RP
Run Program: starts program execution at location 0000 with R0 as program counter.
CONT/STEP
Slide switch to enable continous or single-step operation of the microprocessor system.
Arrow leftArrow right
Entry Mode Control: this key toggles between the address entry and data entry modes.
INC
Increment Address: each depression increments the address shown in the display. In the data entry mode, it also causes the data byte shown to be written to the address shown before incrementing the address.
$P
Start Addressed Program: starts program execution at the location shown in the address display.
CA
Clear Address: clears (resets) the address display to 0000.

QUEST Super Elf

I
Input
L
Load mode
R
Reset
G
Go (run mode)
W
Wait (processor clock could be stopped)
M
enable Monitor ROM
S
Single step
P
Protect memory

Elf 2000

R
RESET
G
RUN
L
LOAD
M
MP Memory Protect
I
INPUT

Software for the Raspberry Pi

No special software needed. Keyboard drivers are already built in Raspbian.

Here some ideas if you want to customize your own keypad.

pi@cosmac:~/elf/RaspiElf/tools $ $ test-key /dev/input/by-id/usb-046a_0014-event-kbd
Code: 82 0x52, value 1 key 0 pressed
Code: 82 0x52, value 0 key 0 released 
Code: 79 0x4f, value 1 key 1 pressed
Code: 79 0x4f, value 0 key 1 released
Code: 80 0x50, value 1 key 2 pressed
Code: 80 0x50, value 0 key 2 released
Code: 81 0x51, value 1 key 3 pressed
Code: 81 0x51, value 0 key 3 released
Code: 75 0x4b, value 1 key 4 pressed
Code: 75 0x4b, value 0 key 4 released
Code: 76 0x4c, value 1 key 5 pressed
Code: 76 0x4c, value 0 key 5 released
^C

pi@cosmac:~/elf/RaspiElf/tools $ udevadm info /dev/input/by-path/*-usb-*-kbd
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:046A:0014.0002/input/input1/event0
N: input/event0
S: input/by-id/usb-046a_0014-event-kbd
S: input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-kbd
E: BACKSPACE=guess
E: DEVLINKS=/dev/input/by-id/usb-046a_0014-event-kbd /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-kbd
E: DEVNAME=/dev/input/event0
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:046A:0014.0002/input/input1/event0
E: ID_BUS=usb
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_MODEL=0014
E: ID_MODEL_ENC=0014
E: ID_MODEL_ID=0014
E: ID_PATH=platform-3f980000.usb-usb-0:1.2:1.0
E: ID_PATH_TAG=platform-3f980000_usb-usb-0_1_2_1_0
E: ID_REVISION=0100
E: ID_SERIAL=046a_0014
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030101:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=046a
E: ID_VENDOR_ENC=046a
E: ID_VENDOR_ID=046a
E: MAJOR=13
E: MINOR=64
E: SUBSYSTEM=input
E: USEC_INITIALIZED=69042133468
E: XKBLAYOUT=gb
E: XKBMODEL=pc105

Mapping scancodes to keycodes is universal and not specific to Linux console or Xorg, which means that changes to this mapping will be effective in both.

showkey --scancodes

evdev:input:bvpe-

File /etc/udev/hwdb.d/10-hexkeypad.hwdb

evdev:input:b*v046ap0014* # ML4700
 KEYBOARD_KEY_45=a  # bind numlock to A
 KEYBOARD_KEY_62=b  # bind /       to B
 KEYBOARD_KEY_37=c  # bind *       to C
 KEYBOARD_KEY_01=d  # bind ESC     to D
 KEYBOARD_KEY_1d=e  # bind Ctrl    to E
 KEYBOARD_KEY_38=f  # bind Alt     to F

pi@cosmac:~ $ ls -l /dev/input/by-id/
total 0
lrwxrwxrwx 1 root root 9 May 14 20:23 usb-046a_0014-event-kbd -> ../event0
pi@cosmac:~ $ ls -l /dev/input/by-path/
total 0
lrwxrwxrwx 1 root root 9 May 14 20:23 platform-3f980000.usb-usb-0:1.4:1.0-event-kbd -> ../event0
pi@cosmac:~ $ ls -l /dev/input/event0
crw-rw---- 1 root input 13, 64 May 14 20:23 /dev/input/event0

pi@cosmac:~ $ cat /dev/input/event0 | hexdump -C

ESC
00008010  cb d9 f9 5a cc fd 04 00  04 00 04 00 29 00 07 00  |...Z........)...|
00008020  cb d9 f9 5a cc fd 04 00  01 00 01 00 01 00 00 00  |...Z............|
00008030  cb d9 f9 5a cc fd 04 00  00 00 00 00 00 00 00 00  |...Z............|
00008040  cb d9 f9 5a b8 7a 05 00  04 00 04 00 29 00 07 00  |...Z.z......)...|
00008050  cb d9 f9 5a b8 7a 05 00  01 00 01 00 00 00 00 00  |...Z.z..........|
00008060  cb d9 f9 5a b8 7a 05 00  00 00 00 00 00 00 00 00  |...Z.z..........|

Ctrl
00008070  cf d9 f9 5a 66 55 06 00  04 00 04 00 e0 00 07 00  |...ZfU..........|
00008080  cf d9 f9 5a 66 55 06 00  01 00 1d 00 01 00 00 00  |...ZfU..........|
00008090  cf d9 f9 5a 66 55 06 00  00 00 00 00 00 00 00 00  |...ZfU..........|
000080a0  cf d9 f9 5a 94 f1 06 00  04 00 04 00 e0 00 07 00  |...Z............|
000080b0  cf d9 f9 5a 94 f1 06 00  01 00 1d 00 00 00 00 00  |...Z............|
000080c0  cf d9 f9 5a 94 f1 06 00  00 00 00 00 00 00 00 00  |...Z............|

How to get and build the RaspiElf Keypad/Display Software

The elfdisplay is part of the RaspiElf tools package. See RaspiElf#How_to_get_and_build_the_RaspiEl

Sample session

TBC (video)

-- Peter Schmid - 2018-05-03

Comments

Topic attachments
I Attachment History Action Size Date Who Comment
JPEGjpg gal_2000_G84-4700_2_persp.jpg r1 manage 88.8 K 2018-05-09 - 21:36 PeterSchmid  
JPEGjpg hex-keypad-s.jpg r1 manage 42.7 K 2018-05-20 - 18:42 PeterSchmid  
JPEGjpg hex-keypad.jpg r1 manage 457.2 K 2018-05-16 - 20:00 PeterSchmid  
Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r12 - 2018-12-16 - PeterSchmid
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback