A weblog focused on interesting circuits, ideas, schematics and other information about microelectronics and microcontrollers.
Nokia Color LCD - using 4096 colors in 8bit mode
How to manage Nokia 6100 LCD to use 4096 colors without any limitations? It's easy... You can use my library for free.
As I promise in, here is my improved LCD C library for using with the Nokia 6100 Series LCD.
Main feature in this library is method to use full 4096 colors in the 8bits (256col) mode. It is enabled by simple hack, based on the color lookup table and the LRU cache.
The palette registers are filled in the initialization time by the 3-3-2 standard values. These values are stored in color lookup table (20 bytes) - 8 bytes for red, 8 for green and 4 for blue component of color.
You can use any color from the 4096 palette (12bits resolution) this way:
where red, green and blue are 4bits values (0-15) - one for each component.
The big miracle is hidden in LCD_color function. This function takes three arguments (R, G and B) and returns 8bits index to the internal palette, which desired color actually has.
LCD_color simply looks into the color lookup table for R, G or B values. If desired value is found, the function creates the 8-bits index value and returns them. If one (or more) of desired values is missing, the function replaces one of values in the table by new one, and then sends whole new lookup table into the LCD.
Values for replacing are selected by the LRU algorithm - LRU means Least Recently Used, so this way the often used values (i.e. 0 or 15) remains in the lookup table.
You can use the old good routines for 8bits modes (maybe you have your own favorite graphics library) with this method, so you can easy upgrade your 256-colors apps into the 4096 colors manner. The only thing you have to do is to replace all of direct color values by calling of the LCD_color(r,g,b).
Mentioned library is also available from Google Code -
svn checkout https://nokia6100lcd.googlecode.com/svn/trunk/ nokia6100lcd