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: