UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio and TV Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > Specific Vintage Equipment > Vintage Computers

Notices

Vintage Computers Any vintage computer systems, calculators, video games etc., but with an emphasis on 1980s and earlier equipment.

Closed Thread
 
Thread Tools
Old 28th Nov 2018, 9:46 pm   #1
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default MK14 programming interface - MK2

Over the past few weeks I have been putting together a new MK14 programming system. I made one which worked perfectly well back in 2012, but it was quite physically complex and not really a suitable project to put into the public domain for other people to build.

Here is the 2018 version.

-Like the original interface, fully isolated so that the interface can be connected to / disconnected from a running MK14.

-Uses only 12 optocouplers in a less complicated layout compared to the original project's 20, greatly simplifying construction.

-Directly controlled via a Python program running on a late model (40 pin) Raspberry Pi, such as the Pi Zero used on this one.

-An (optional) thirteenth opto allows the interface to reset the MK14, so that if it is already running a user program the interface can force it back to the monitor in order to programme it.

-The python control software looks out for two bytes in the file at address FFFE/FFFF, not a real address on the MK14. If it finds them it will take those two bytes as the Hi/Lo bytes of the execution address and will run the program automatically after the code has been typed in. (For those not familiar with the MK14, the first byte of an MK14 program is not necessarily the address from which the program has to be run).

The above two features combined form a hands-off development system for the MK14, since you can can then continually modify, download and run programs on the machine without having to touch it, unless of course your program requires keypad input.

Here's the hardware. It's built on stripboard, because it is simple enough to build on stripboard. I chose to use SM components because I have easy access to them and soldered them on the track side, but it is just as easily built using conventional components.

I'll add the python control software (which is working) and a couple of example .hex files of programs from the MK14 manual to upload with it in due course.
Attached Thumbnails
Click image for larger version

Name:	PiZero_MK14_PRG_1.jpg
Views:	314
Size:	57.7 KB
ID:	173605   Click image for larger version

Name:	PiZero_MK14_PRG_2.jpg
Views:	320
Size:	146.9 KB
ID:	173606   Click image for larger version

Name:	MK14_Pizero_Interface.jpg
Views:	369
Size:	72.1 KB
ID:	173607  
SiriusHardware is online now  
Old 4th Dec 2018, 9:46 pm   #2
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
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, 165 views)

Last edited by SiriusHardware; 4th Dec 2018 at 9:51 pm.
SiriusHardware is online now  
Old 10th Dec 2018, 12:10 am   #3
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: MK14 programming interface - MK2

Sterling work Sirius. I REALLY must find that box of edge connectors I have somewhere...
Slothie is offline  
Old 10th Dec 2018, 1:03 am   #4
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

The uploader program / script which does the real work will be uploaded here soon. I did all the preliminary testing with the program written to work only with MK14s which have the new OS, then relented and decided that I would include a settable flag in the program so that it could be set to work with the old OS just by changing one line of the script. Code entry on an MK14 with the old OS requires a different (and more numerous) sequence of keypresses to achieve the same thing.

I made those changes and started to test it, only to discover that the file copy of the 'old' OS that I've had lying around for years was corrupt - it came up with the correct '---- --' reset prompt but would not allow me to enter data. I still have my original old-version PROMs somewhere but could not manage to find them anywhere, no idea where I have put them.

Martin Lukasek's site came to the rescue once more, as I found binary file coples of both OSes buried in an obscure corner there. The file for the old OS there is good, and so far the uploader seems to be working with the old OS as well as the new. I've only tested on a Pi Zero W so far - just need to find a 40 pin to 40 pin IDC header cable so I can test with a Pi 3 as well.

If you can't find your original collection of edge connectors there are various retro suppliers who sell 'ZX Spectrum' edge connectors - they are longer than needed for the MK14 edge connector but are easily sawn down to size.
SiriusHardware is online now  
Old 11th Dec 2018, 3:09 pm   #5
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: MK14 programming interface - MK2

Quote:
Originally Posted by SiriusHardware View Post
just need to find a 40 pin to 40 pin IDC header cable so I can test with a Pi 3 as well.

If you can't find your original collection of edge connectors there are various retro suppliers who sell 'ZX Spectrum' edge connectors - they are longer than needed for the MK14 edge connector but are easily sawn down to size.
Don't forget an old IDE hard drive connector is a 40 way ribbon cable with IDC connectors... If you can't find one of those I can send you one of mine, in these days of SATA they're not much use (aside from use on Raspberry Pi's I suppose!)

I know as soon as I put hacksaw to expensive Spectrum connector I will trip over the box with my edge connectors! They are lovely MIL spec McMurdo connectors too, so maybe it would be worth the sacrifice
Slothie is offline  
Old 11th Dec 2018, 11:45 pm   #6
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

Ahem, I still have more PCs with IDE drives than I do with SATA (...Grump..!)

I had considered an IDE cable but they are usually over long for this purpose... if I can find one with two connectors near one end (did that ever happen?) I may just cut that section off. They are available quite cheaply as short ready made assemblies from the likes of CPC anyway, specifically intended as GPIO breakout / extender cables for the Pi.

I think I do need to test on a Pi 3 etc because I have the relevant delays pared down to the shortest which will reliably work (therefore the fastest upload speed) on a Pi Zero W. On the new OS it uploads the 'Message' program from the manual in just over three seconds. The Old OS unfortunately requires five keypresses per data byte entry, so it takes a second or so longer to upload.

While things like the length of a keypress and the post-release debounce period are specifically timed and will not vary from one Pi to the next, the extra speed at which a 'big' Pi could whizz through the other, un-timed parts of the script may cause unforseen problems, so I just want to check that.
SiriusHardware is online now  
Old 12th Dec 2018, 12:37 am   #7
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: MK14 programming interface - MK2

It is possible to carefully dismantle and remove the IDC connectors on a ribbon cable and re-connect them closer together if you use a small vice to re-pierce the insulation. I've done it to repair a cable when I've needed to "in extremis" (i.e. at 2am when you need it working in the morning and you can't find any spares). I think I broke one of the plastic clips by being clumsy, but it was nothing a bit of hot glue couldn't fix!
Slothie is offline  
Old 13th Dec 2018, 1:39 am   #8
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

Found an IDE cable with two closely spaced drive connectors on it at one end, but then noticed that the drive connectors had a blanked off pin, to ensure connection of the headers the right way around. Found two more like that, and then finally a fourth one where the connectors were 'ordinary' 2 * 20 (40 way) IDC connectors. I'll try the interface with a Pi 3B tomorrow, time allowing.
SiriusHardware is online now  
Old 14th Dec 2018, 3:35 am   #9
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

Here it is, attached, the companion Python hex uploader script for the interface described in post #1, called 'send14'. I have also included a couple of the programs from the MK14 manual as hex files, namely 'Message' and the 'Moon Landing' game. As before, the script is a Linux / Unix format test file and is best viewed / edited on the Pi or a Linux PC. I don't claim this is beautiful code - but it does work.

It was originally written on a Pi Zero W but has also been tested on a Pi 3B. In theory it will work on any Pi with a 40-way GPIO connector. The 'alternative' SPI mode of some of the GPIO pins needs to be turned off in raspi-config otherwise they will clash with some of the pins used by this project.

Unpack the zip file into your home directory and move the 'send14' file into your home/bin directory. There, make it executable with

Code:
chmod +x send14 <enter>
On returning to your home directory you should be able to run it.

Example Usage:

Code:
send14 message.hex <enter>
If all is well you should see the MK14 display zooming rapidly through the address range as the code is typed in at superfast speed, and then, if you have uploaded either the message.hex or moonland.hex file included in the .zip file, the program will also auto-run. On an MK14 with the 'New' OS, 'Message' will upload and run in roughly three seconds. 'Moon Landing', probably the longest and most complex program in the MK14 manual, takes a little longer.

Limitations:

- Can only upload Intel Hex format files.

- No checks on whether the addresses in the hex file are legal addresses on an MK14 - it's up to you to make sure they are, by including .ORG statements in your source code.

- Can only upload code to the MK14 if it is at the 'ready' prompt, ---- -- for the old monitor and 0000 00 for the new - unless you have included the thirteenth 'Reset' opto in the interface, in which case the interface will reset the MK14 to force it back to the monitor before it starts uploading. The reset circuit is not directly available at the PCB edge connector, so connections from the reset opto to the reset circuit have to be made with spring test clips clipped onto the +ve and -ve leads of the reset capacitor close to the reset switch.

The Autorun feature is invoked by including something like the following
at the end of your source code - or in fact anywhere in the source code:-

Code:
    .ORG 0xFFFE
    .DB   0x0F
    .DB   0x12
(The exact syntax depends on which assembler you use). FFFE is a 'special' address for the uploader, not a real address on the MK14. It will use the two bytes at FFFE and FFFF in the file as the execution address from which the program should autorun after being uploaded.

The uploader expects the execution address bytes in the order high byte, low byte. If you use something like a .DW 0x0F12 statement to place a 16-bit word in memory, your assembler might actually place the bytes in reverse order - so I suggest always defining the execution address as two separate bytes, as in the example above, to make sure they are placed in the code in the right order.

The script was originally written to upload to an MK14 with the 'new' OS, but I modified it so that it could easily be made to work with an MK14 with the 'old' OS - to do that, load the script in a Linux text editor, locate the 'MK14_OS = 1' Line just a few lines into the program, edit it to say 'MK14_OS = 0' and save the modified file.

If you get it working or experience any problems, let me know.
Attached Files
File Type: zip send14.zip (4.4 KB, 155 views)
SiriusHardware is online now  
Old 31st Dec 2018, 1:47 pm   #10
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: MK14 programming interface - MK2

Ooh! Santa gave me a Pi Zero W this christmas! What should I make with that?
Slothie is offline  
Old 31st Dec 2018, 10:01 pm   #11
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

They are useful little things as far as they go - if it's the only Pi you have so far don't be too disappointed by how relatively slowly / poorly it does 'desktop' things like productivity / wordprocessing / web surfing, that isn't really the Pi Zero's forté. The high-end quad-core Pi 3B etc are a bit better at that sort of thing.

The Zero is really meant for the sort of single-purpose niche job you wouldn't want to tie up a 'big' Raspberry Pi for.

If you don't already have one, a wireless keyboard / touchpad combo which uses a single USB nano-dongle or single wired USB lead for its connection to the Pi will come in handy.
SiriusHardware is online now  
Old 1st Jan 2019, 7:41 pm   #12
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: MK14 programming interface - MK2

I've never used the Pi Zero, but I have been using the older A/B/B+ Pi's since they came out. A few years ago I worked with a friend to make a point-of-sale machine with a Pi and a touchscreen to activate SIM cards for mobile phones using a GSM modem card, so I have realistic expectations of the Pi!
I'm going to set it up "headless" and SSH into the device rather than using a keyboard etc mainly because having googled about it seems simple enough and I don't have a wireless keyboard/mouse as you described. The Pi Zero was a starter kit from Pimoroni and came with a power supply and a USB dongle + HDMI adapter so that remains an option if I get stuck.
Slothie is offline  
Old 1st Jan 2019, 11:23 pm   #13
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

Well, sounds like what you've been using them for is far more ambitiious than anything I have attempted to do so there's nothing much I can tell you about them.

I've never ever tried to use a Pi headless so I'd be interested to know whether the above utilities can actually be used that way (neither utility requires the opto interface hardware to be connected in order to run).
SiriusHardware is online now  
Old 2nd Jan 2019, 2:31 am   #14
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: MK14 programming interface - MK2

Quote:
Originally Posted by SiriusHardware View Post
I've never ever tried to use a Pi headless so I'd be interested to know whether the above utilities can actually be used that way (neither utility requires the opto interface hardware to be connected in order to run).
Anything you can run in a terminal windows will work just fine. With the right options you can get gui applications to run on the Pi with the gui on your laptop over the network but it can be a bit of a fiddle!
Slothie is offline  
Old 17th Jan 2019, 1:21 pm   #15
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

I've just been looking around for other signs of MK14 activity online and stumbled across this alternative way of getting code into an MK14. A bit slower than the method outlined here, but for sheer style, it beats mine literally hands down.

https://robdobson.com/2016/10/mk14-meets-7bot/
SiriusHardware is online now  
Old 17th Jan 2019, 9:17 pm   #16
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: MK14 programming interface - MK2

Quote:
Originally Posted by SiriusHardware View Post
I've just been looking around for other signs of MK14 activity online and stumbled across this alternative way of getting code into an MK14. A bit slower than the method outlined here, but for sheer style, it beats mine literally hands down.

https://robdobson.com/2016/10/mk14-meets-7bot/
Or one could always get one's valet to enter the code for one.
Attached Thumbnails
Click image for larger version

Name:	jeeves-8c7ee49c-b0d5-41aa-a11b-fe8176da383-resize-750.jpeg
Views:	122
Size:	11.6 KB
ID:	176591  
Slothie is offline  
Old 25th Feb 2019, 10:21 pm   #17
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

After no end of delay and a mere 7 years after the first one, a short Youtube video demonstrating the operation of the programming interface discussed in this thread. To see some actual action, skip to about 1:18.

https://www.youtube.com/watch?v=-AXgyeH0F2E
SiriusHardware is online now  
Old 25th Feb 2019, 10:46 pm   #18
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: MK14 programming interface - MK2

I look forward to the next video in 2026!
Slothie is offline  
Old 25th Feb 2019, 11:11 pm   #19
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

Well, I'm supposed to be working on a 'demo' for the MK14 VDU. I've been going to do that since 2013, and it has not advanced by one byte since then.
SiriusHardware is online now  
Old 14th Mar 2019, 2:16 am   #20
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,483
Default Re: MK14 programming interface - MK2

Something which just occurred to me: I did all my testing and tuning of the 'V2' interface and 'send14' Python script with my own MK14 which has the original 4.43Mhz crystal in it.

The values of the time delay constants 'KeyPressLength' and 'KeyReleaseLength' and 'ModeChangeSettleTime' (defined early on in the script) are pared down to almost the smallest values consistent with 100 percent reliable input, in order to obtain the highest possible upload speed.

If your replica MK14 or original MK14 happens to have a 4.00MHz crystal fitted (...original MK14s often had the crystal changed to 4.00MHz when a VDU was added) it will be running slightly more slowly and these timing values may need to be adjusted upwards slightly for 100% error free operation. Unfortunately, I can't check this by fitting a 4.00MHz crystal myself because the tracks on my (original) MK14 are quite fragile.
SiriusHardware is online now  
Closed Thread

Thread Tools



All times are GMT +1. The time now is 7:22 pm.


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright ©2002 - 2023, Paul Stenning.