March 28th, 2008
Multitrack audio synthesizer, 2-d and 3-d video controller, all packed into 8K or ROM and 1K of RAM @ 20MHz. I do a bunch of PIC and ATMega projects, but this blows away everything I've done in every way, shape, and form.
- reddit comments
Apart from the sync signals mentioned above, a VGA signal contains three analog voltage lines — red, green and blue — that vary between ground and 0.7 V during the visible parts of the video frame. As you can see in the schematic below, I perform a two-bit digital-to-analog conversion for each of these signals, using R-2R resistor ladders. That way, the software can change the current colour in a single clock cycle using the out PORTC,register instruction.
In addition to this, I've hooked up a couple of diodes and a PNP transistor in such a way, that when the MOSI pin is low while the OC2B pin is high, the three color signals will be pulled to a high voltage, corresponding to white. This is used to generate high resolution scroll text: The MOSI pin is connected to a shift register internally in the AVR (it is typically used for serial data transmission), and this shift register can be programmed to emit a sequence of 8 bits with a single instruction, thus offloading the CPU. Smooth scrolling is then implemented by inserting variable delays before and after each display line, [...]