8 Bits Per Pixel

brought to you by:

The HULK Project

All content, diagrams, equations, html and css by Benj Carson. Hulk Logo by Jeff Mrochuk. Please send any questions, suggestions or other feedback to Benj Carson.

Description

VGA monitors accept three analog colour signals in the range of 0 to 0.7V. While the UP1 boards have a built in VGA connection, the Nios boards do not. The authors are using Nios board for their project and are required to build their own VGA output hardware. This has it's advantages, since we are no longer limited to ugly "digital" VGA. Using a few more pins and a couple of resistors beautiful 8bpp (256 color) VGA output can be produced.

Design

Typical 8bpp systems use a 3-3-2 bit distribution: 3 bits for red, 3 for green and 2 for blue. Other breakdowns are possible. This design is based on a 3.3V VDD which is available from the expansion headers on the Nios board. The schematic is shown below:

Each of the outputs, RED0-2, GREEN0-2 and BLUE0-1 originate from the chip and must pass through a 3.3V buffer before reaching this circuit.

For a single 3 bit colour the required digital to analog conversion should be:

Binary ValueAnalog Value
0000.0V
0010.1V
0100.2V
0110.3V
1000.4V
1010.5V
1100.6V
1110.7V

The 100Ω resistor was chosen somewhat arbitrarily. It is half of the voltage divider formed by the other three resistors. If it is too small currents may exceed maximum ratings, and if it is too large the current may become disturbed by noise. Using the three cases when only one pin is active, the value of each resistor is determined using the following equations:

For the most significant bit:

Where Von is the analog voltage desired for the given binary value. For the next bit:

And for the last bit:

For 2 bit colour (i.e. blue), the desired conversion is:

Binary ValueAnalog Value
000.0V
010.233V
100.466V
110.7V

The following two equations were used. For the MSB:

And for the last bit:

This method can be adapted to a 5V output expansion slot as well.

References

VGA Signal Generation with the XS Board