View Single Post
Old 4th Dec 2018, 9:46 pm   #2
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,485
Default Re: MK14 programming interface - MK2

Attached is a little Python utility called 'key14'. This will only run on a Raspberry Pi due to the fact that it makes use of Python's specific interface to the GPIO pins on that machine. It is made to work with the interface in post #1 and is the easiest way to test it. The file inside the .zip is a Linux/Unix format text file, which means it doesn't have carriage returns at the ends of the lines and it may look rather messy if loaded into a DOS / Windows text editor. Therefore, best viewed on the Pi itself, in 'nano' or your preferred editor / viewer. It is assumed that Python 3 is already installed, as it is in the Pi's standard Raspbian distro.

As configured, 'key14' is made for Pis with 40-pin GPIO headers and the SPI interfaces must be configured OFF in raspi-config otherwise they will clash with some of the pins used by this project. It would not be difficult to edit the script to use only pins from the 26-pin subset of GPIO pins on earlier Pi models, but then the GPIO connections on the right hand side of the diagram, third image in post #1, would have to be redrawn accordingly and more GPIO pin secondary functions would have to be turned off to free up some pins.

What this utility does is send keys pressed on the Raspberry Pi's keyboard to the MK14. There is a near one-to-one correlation, so the keys 0-9, A-F on the Pi's keyboard press those keys on the MK14.

Keyboard keys G, M, and T press the MK14's Go, Mem, and Term keys.

For 'Abort' I've had to use 'Q', since 'A' is already taken. If you have included the thirteenth (Reset) opto in the interface, 'R' resets the MK14. 'Esc' gets you out of the program and back to the command line, as does CTRL-C.

All other keyboard keys are also echoed to the screen, but nothing is sent to the MK14.

The hex file uploader program (to be added eventually) works at very high speed, which would make it very difficult to debug any problem on the interface hardware. This utility was primarily made to enable single key testing of the interface but it is also perfectly possible to use it to hand-enter a hex listing into the MK14 using the Raspberry Pi's 'proper' keyboard: An unusually luxurious experience.

Limitations:

All key presses sent to the MK14 are momentary, and the Pi's keyboard auto-repeat buffer is not disabled. If you hold down a key on the Pi's keyboard it will send a single character shortly followed by a flurry of repeated characters.

This can only be run from a command line prompt due to the fact that it uses 'curses' for keyboard character input. It will fail if you try to run it from, e.g, the Idle IDE because Idle and Thonny do not play well with 'curses'.

To 'install' this, if you already have a 'bin' directory in your home directory put the file in there. If you don't already have a 'bin' directory in your home directory create one and then reboot the machine: The new 'bin' directory will then automatically be added to the command search path.

In either case, go into the 'bin' directory and if necessary make the 'key14' file executable with

Code:
chmod +x key14
Return to your home directory and it should now be possible to run the program with

Code:
key14<enter>.
Attached Files
File Type: zip key14.zip (1.0 KB, 166 views)

Last edited by SiriusHardware; 4th Dec 2018 at 9:51 pm.
SiriusHardware is online now