CGA Output to IBM Enhanced Color Display from Teensy 3.1
Benjamin Gould made this cool project with his CGA monitor using Teensy via paradigm lift
A while back, while hunting for an IBM PC AT Model F keyboard, I came across a Craigslist ad that said something like “IBM Model 570 computer for sale with monitor and keyboard, $50”. I realized that it was probably a typo and that they meant Model 5170, which was the IBM PC AT. To make a short boring story shorter, the keyboard with the system was a 1986 Model M instead of Model F, but by itself was worth more than $50 anyhow so I lugged the whole thing home and sold the keyboard to cover the cost. I set the PC and monitor aside for a while until I became curious if you could drive the monitor with a microcontroller, and I came across this post on hackaday.com .
The aforementioned post featured a project by a hacker who was able to get a signal from his Arduino Uno to show up on a CGA monitor. His demonstration only had horizontal lines, which is much easier than sending individual pixels. Still, his proof of concept project was very encouraging and gave me a great jumpstart on the timing calculations that I would need. Here’s some quick notes regarding the scanning:
• The pixel clock for CGA was 14.31818 MHz. Take the reciprocal of that i number (1/14318180) to find that it takes about 0.06984 microseconds (μs).
• CRT display has electron emitting beams that are rapidly moved across a phosphor screen to create an image. At the end of each line the beams are turned off as they move back to left side of the screen and down 1 pixel. After the last visible horizontal scan line they are also turned off long enough for the beams to retrace vertically.
• In between each horizontal and vertical scan, a synchronization signal is emitted as well. For CGA, there are dedicated HSYNC and VSYNC lines that carry these signals.
For the implementation of this project, I chose the following materials:
96 MHz ARM Cortex M4 for $20… what’s not to like about that? Bought mine from Adafruit because fast and awesome.
74AHCT125 – Quad Level-Shifter (3V to 5V)
The Teensy 3.1 board uses 3.3V logic, and the monitor 5V TTL. I found out the hard way that the output directly from the Teensy’s pins was not going to cut it. I needed 2 of them. Also from Adafruit.
D-Sub 9 pin connector
I got mine from RadioShack and soldered it to some perfboard to make an ugly and completely amateurish breakout board… it worked though.
The code is up on Github so I won’t go too in depth… get it here:
Adafruit has had paid day off for voting for our team for years, if you need help getting that going for your organization, let us know – we can share how and why we did this as well as the good results. Here are some resources for voting by mail, voting in person, and some NY resources for our NY based teams as well. If there are additional resources to add, please let us know – adafruit.com/vote
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.