Version 2 of Arduino Code for an 1802 Membership Card #MembershipCard #Arduino
An improved version of the hardware and code for supporting an 1802 Membership Card with Arduino based hardware is available as the MCard1802ArduinoV2 project on GitHub. The second version uses a 16x2 LCD character display for status information and a Teensy 3.2 and OLED display for Pixie Video. The hardware and code design is a bit cleaner with the logic divided into a Front Panel Card and a Daughter Card.
The Front Panel card drives the 1802 Control lines, provides serial communication, and communicates with the 1802 Membership card's data in and data out lines using only 3 logic chips, not counting the voltage regulator.
A minimum implementation could be done with a 1802 Membership Card and the Front Panel Card logic alone. The voltage regulator provides 5V power (VDD) to the 1802 Membership Card and logic chps. The same voltage (9V) that powers the Arduino, powers the voltage regulator.
The Daughter Card, provides the video and address line read logic and support for the MCSMP20J ROM. The Daughter Card plugs into the U2 ROM socket on the 1802 Membership Card. The Arduino 5V pin drives the Teensy 3.2 separately from VDD, and the Teensy's 3.3V pin drives the OLED display for the Pixie Video. This is so that the Teensy and OLED don't drain the super capacitor when power is removed.
The redesign decouples the Arduino from the 1802 control lines, so that communication to the Membership card is only over the I2C lines and Serial lines. The Arduino handles the buttons, Hex keypad and LCD display and sends I2C commands to set the control lines and data bus, and to read the data bus and address lines. This makes it easy to replace the Arduino with some other microprocessor like an ESP8266, Raspberry Pi, etc.
I made the two support cards on proto-boards, and re-used the same painted cardboard box from the first version to mount the hardware. It's not fancy and I'm still playing with the design, but I'm pretty happy with this one.
The code contains a program loader with byte code for several programs, to make it easy to load and run them. It also has a Serial Terminal to communicate to the 1802 Membership Card running the MCSMP20J ROM. The Serial Terminal works with the Arduino IDE. It's been tested with the Super Monitor, IDIOT monitor and Basic 3 programs. It also works well with RealTerm so one can run Adventureland with ANSI graphics.
The code, schematics, pictures and documentation are all available on the GitHub project. Here are some photos of the Front Panel Card and the Daughter Card.
And one picture showing the spaceship program running. I added an LED for the Q bit because I missed it. :-)
More pictures are available on the GitHub site.
Have a great day,
Gaston (aka fourstix)
I thought the I2C interface could connect to other devices, so I installed a I2C connector on my PCB.
Yes, for example in Version 2 the Arduino (the Sparkfun Redboard)
is communicating with the Hex Keypad, the LCD dislay, an MCP23008
8-bit GPIO chip for the control lines, an MCP23017 16-bit GPIO
chip for the Data in and Data Out lines, and a second MCP23017
16-bit GPI chip for reading the Address lines. That's 5 items.
But the Teensy 3.2 is only communicating with one I2C device, the
OLED display. It might be able to do more, but it could mess up
the Pixie Video timing. The DMA needs to read the video data
byte in one 1802 Instruction cycle. If one goes past this, you
start to miss bytes in the Video display. The Teensy 3.2 was
almost, but not quite fast, enough to reliable do it without
latching the data in last two clock cycles of the instruction
cycle after TPB goes high. Latching the data lines lets it take
almost as long as the next TPB pulse.
But the Tom Pittman's Pixie Video DMA Test program, which repeats a fixed set of DMA requests each followed by a precise number of 1802 instruction cycles (six) after each request, over and over, would glitch about every 5-10 video updates. But with a latch on the data lines. running with a 2 MHz clock, it would run rock solid. So with a latch there may be capacity for communication with other I2C devices. Or one could monitor the state of the Pixie Video and only communicate to other I2C devices when timing isn't critical. There are faster microprocessors as well.
I picked the Teensy 3.2 because it can be programmed by the
Arduino IDE, it's 5V compliant and it's relatively cheap. Also I
could re-use code I'd written for the Arduino Pro-Mini which had
too much interrupt latency time to keep up with the 1802 DMA
requests. I was happy with the performance of the Teensy, and
haven't considered any expansion of I2C with the Teensy. But as
you noticed, that's a possible area for improvement.
There's another are for improvement in I2C. There's a nice
standard for 3.3V I2C called Qwiic. It was developed by Sparkfun,
but it's open source and can be used by anyone. It standardizes
the connectors, cables and so on, so that one Qwiic device can
plug into another.
My design was done to be a simple extension of Lee Hart's 1802
Membership Card so it mixes 5V I2C for the 1802 Membership Card
and LCD and 3.3V I2C for the OLED and Qwiic Hex Keypad. 5V I2C is
the easiest way to talk to the 1802 Membership Card and build on
Lee's design, but having two types I2C voltage levels is a design
One improvement might be to design out the 5V I2C and go all
Qwiic. There are 3.3v LCD displays but they are more expensive
than 5V, so for this version of the design, I went with Cheaper
and Easier, rather than Better. There are ways to boost 3.3V I2C
to 5V, but they add complexity. I tried to keep things simple.
Right now I'm happy with the design, but I'll be the first to admit the design could be better. I do hope that parts of it is of use to others. Right now it's mounted in a cardboard box on proto-board, so if I want to change something, I can take a knife or soldering iron and change it easily.
Have a great day,
On 8/3/2020 6:27 PM, Kazuhiro Ouchi wrote:
Thanks for the detailed explanation.
Due to Pixie's sensitive video timing, it can be difficult to connect the I2C device to Teensy 3.2.
I'm hoping to be able to temporarily stop Pixie video and then use the I2C device for other purposes.
I'll also try version 2, which I've introduced here.
I like the cardboard box too. I used to put a digital clock I built in a cardboard box.
Cardboard boxes are easy to use and perfect for prototyping because you can modify them any way you want.
I created this PCB to exhibit at Maker Faire Tokyo 2020, which will be held in Tokyo in October.
As you may know, there are COVID-19 issues and we don't yet know if Maker Faire Tokyo 2020 will be able to take place.
Unfortunately, legacy CPUs such as the 8080, 6800 and Z80 are popular in Japan. COSMAC CPUs are not as well known in Japan.
Last year at Maker Faire Tokyo 2019, I brought a COSMAC ELF with me, and visitors had fun creating programs with toggle switches.
When Maker Faire Tokyo 2020 is successfully held, I will report back to you on how it went.