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 .
Research
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.
Implementation
For the implementation of this project, I chose the following materials:
Teensy 3.1
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 publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards
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.
Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!
Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: Open Hardware is In, New CircuitPython and Pi 5 16GB, and much more! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi
EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey