How gray-scaling works, Color support – Cirrus Logic AN179 User Manual
Page 2

2
Copyright 2001 Cirrus Logic (All Rights Reserved)
AN179REV2
EP72xx and EP73xx
address, the frame buffer data corresponds exactly with the gray-scale levels. This is the usual approach. It is called
Direct Bit Mapping.
When the value programmed into any of the nibbles does not match its nibble address, then interesting patterns
can be generated on the display. For example, if it is desirable to toggle the display’s image between normal and
reverse video, this can easily be achieved by simply inverting the values in the nibbles of the palette registers. This
is much quicker and easier than having to invert all of the data in the frame buffer.
The LCD Controller also contains a nine-word deep FIFO. It is used as an intermediate storage buffer for the frame
data. An integrated DMA controller is used to fetch display data from the frame buffer memory, and refill the
FIFO. Thus, once the LCD Controller is configured and the frame buffer data is stored, the EP72xx can continue
executing other tasks without having to service the LCD Controller.
Note:
This DMA controller is dedicated to servicing the LCD Controller. It cannot be used for any other purpose.
How Gray-Scaling Works
When a product has a LCD module that is providing different gray-scale levels, it isn’t actually using a display that
can be programmed to drive each pixel with a different level of intensity. The displays actually only have the
ability to either fully turn “on” each pixel or turn it “off”. One of the poor characteristics of LCDs in general is their
response time. The response time can be defined as the amount of time it takes for a pixel to change from being
turned “on” to “off”, and vice versa. Typical response times are in the hundreds of milliseconds. The technique
used for gray scaling takes advantage of this weakness. A modulating technique is used to drive each pixel. This
technique drives each pixel a percentage of the time over a fixed time period.
Within the LCD Controller is a sixteen-cycle counter. It is used to create a sixteen-cycle period. When the LCD
Controller needs to drive a pixel, it reads the value of the palette nibble pointed to by the frame buffer data. The
value is used to determine how often within a sixteen-cycle period, the pixel needs to be turned “on”. For example,
if the value is 4, then the pixel would be turned “on” once every four clock cycles. This equates to 4/16 of the
available sixteen-cycle period. By doing this, the naked eye thinks the pixel was actually being driven at ¼ the
maximum brightness level.
In actuality, the nibble value does not correlate one-to-one with the number of times in the period that the pixel is
turned “on”. This is due to non-linear characteristics of the Response time. The EP72xx data sheets include a table
that contains the actual gray-scale value mappings. The table is called the “Gray-scale Value to Color Mapping”. It
can be found in the Palette Register section.
Color Support
When used with a so-called monochrome LCD module, it provides support for up to 15 different gray-scale levels.
Note:
Fifteen is the correct number, not 16. This is due to the fact that the middle two gray-scale levels are identical in contrast, and thus
only provide one level instead of two.
Color displays have three sub-pixels per pixel. Each pixel is made-up of three sub-color pixels (Red, Green, and
Blue). The same technique described above for gray-scaling is applied to color displays. Hence, each sub-color
pixel can be modulated to provide the perceived affect of supporting 15 different shades of its color. Therefore, one
pixel can be driven with one of fifteen possible shades of red, green, and blue.
The LCD Controller can support up to 15 x 15 x 15 = 3,375 different colors. This is based upon the assumption that
the LCD Controller has been programmed to provide 4 bpp. Now each nibble in the frame buffer represents one of
the sub-pixels in the display. When programmed to provide 2 bpp, 2
2
x 2
2
x 2
2
= 64 different colors can be
supported. When programmed to provide 1 bpp, 2
1
x 2
1
x 2
1
= 8 different colors can be supported.o support a ¼
VGA color display, the actual number of pixels triples due to the three sub-pixels. This equates to 320 (x3) x 240 =
230,400 pixels. If programmed to 4 bpp to support the maximum number of colors, the frame buffer size becomes
230,400 x 4 = 921,600 bits, or 115,200 bytes in size. This falls within the maximum size constraints of the frame
buffer (i.e., 128 kbytes) mentioned above.