Graphic LCD: Display Icons in RAM
This application note will review the setup of a graphic LCD and how to program small icons into the internal RAM of the display.
The graphic display used in this application note is Focus LCD’s G12864B-BW-LW63. Icons will be programmed into the display as bitmaps for non-moving images. The dynamic functions such as interactive buttons will be programmed on top of the bitmaps and will be continuously updated.
G12864C-BW-LW63 is a transmissive STN blue LCD with a white LED backlight. The embedded display driver is ST7565 which contains an internal oscillator and on chip RAM used to store display data. Features of this display are reviewed in the table below.
|Mode||STN Blue Negative||-|
|Size||89.70 x 49.8 x 6.0||mm|
|Interface||SPI, 8080/6800, Parallel||-|
This display offers multiple interfaces to select from and is chosen through the hardware connections. The interface used in this application is a parallel 8-bit 8080 type. The alternative interfaces to select from are SPI and 6800 parallel. The display is interfaced with a STM32 Nucleo board. A simple 8-bit microcontroller would be sufficient to control this display because many of the features are provided internally by the display driver.
Graphic LCD’s provide internal RAM to support the frame buffer of images projected onto the display. This display has an internal RAM capacity of 8580 bits or approximately 1kB. Additional RAM can be provided externally or with the microcontroller.
2. Hardware Connection
The connection of the display to the microcontroller is through 30 pins which include the data lines, the voltage boosting circuit and the backlight. The voltage boosting circuit will step up the input voltage 3 times. There are different configurations for selecting the voltage boosting multiple which can be found in the datasheet of the driver. The 3X boost was chosen because the input voltage at VDD is at 3.3V and VLCD requires a voltage of 8.5V.
The voltage boosting circuit is used in configuration with the voltage divider circuit to produce a voltage of 8.5V for the display. This value can be measured at the pin VOUT. The capacitors used in the circuit can be in a range of values specified in the datasheet. Below is an outline of the hardware connections of the display.
The pin connections to the microcontroller and power supply are reviewed below. This application is using the 8080 parallel interface and all the data lines will need to be used. For the SPI interface the parallel data bus pins 6 and 7 will alternatively function as the clock and data pins. Some interface and display function pins are specified by pinning them to ground or to VDD. Below is a description of each of the pins and their connection.
3. Initializing the Display
The graphic LCD needs to be initialized before sending display data. This is done through a series of commands that specify voltage settings, bias, and display area. A detailed explanation of each of these commands can be found in the controller datasheet. This application will review a minimal initialization sequence used to set up the display.
The bias of the display is set by selecting the duty cycle specified in the datasheet. The duty cycle is 1/65 which means that the voltage bias ratio can be either 1/9 or 1/7. For this display, the 1/7 voltage bias ratio is selected. Below is the command to select the voltage bias ratio of 1/7.
The segment direction is set through the command “ADC Select”. This command can reverse the column address and the segment output. This would reverse the location of pixels projected onto the display. There is also a command to select the direction of the COM output. These commands are listed sequentially below.
The display start line will need to be set to indicate where the display data begins in RAM. The display start line can be a value from 0-65 corresponding to the vertical lines of pixels on the display. This value will be set the start address of line 0 to start at the top of the display lines.
The power functions of the display driver are set through a sequence of commands. These functions indicate which internal power systems are used. For this example, all of the power supply circuits are used. This is indicated by the following commands. These commands turn on the voltage converter, regulator and follower then sets the resistor ratio for the voltage divider.
The final commands are to turn the display on, active all points and set the electronic volume of the display. This is done by the following command sequence.
4. Programming Icons into RAM
The controller in the display has a feature to program icons into different page addresses of RAM. This allows for multiple pages to be stored internally and to be accessed later. The controller offers eight pages of storage for the 128x64 pixels of visible display area. The pages are chosen through commands by setting the data bus pins D3, D2, D1 and D0 to a value from 0 to 8.
One full page consists of the data for each pixel of the display. The total RAM required for one page of data is calculated by the area of the resolution, 128x64=1024 pixels. Since the total RAM available in the controller chip is 8580 bits, the number of pages that can be stored is eight. Multiple icons can be stored in display RAM individually where each icon is less than the full area of the display.
A bitmap is created for the icons which contains the data for each pixel on the screen. Since the display has a resolution of 128x64, the icons will have to be very small. This makes the icon choices slim for graphic LCDs because there are only so many pixels to work with. This graphic LCD is monochrome and can only display pixels as on or off. Some creativity is needed when creating these icons because of these challenges.
Creating icon images can be done on Microsoft paint. The image can be a full page or individual icons that only take a portion of the resolution. You will zoom into the Paint application until the frame matches the resolution of the display (128x64). Now images can be created within these boundaries to be displayed on the screen.
Some available icons can be found when searching “vector icons”. The resolution is limited, so finding a standard set of tiny icons can be helpful when choosing what to display. Below are some examples of low-resolution icons that can be stored on the display.
A simple menu was created for this application that shows the options for setting the next display page. Each of these menu items can be selected to display the specified page in RAM where their bitmaps are stored. The menu was created on MS Paint and saved as a Monochrome .BMP file.
Once the bitmap is created it will need to be converted to an array of hexadecimal values to specify the on or off attribute of the pixels. The application that was used for this is called “LCD-imageconverter”. There are many applications that can be used for converting bitmap images into hexadecimal, binary, and c file types.
The bitmap can be uploaded onto one of the pages in RAM and accessed based on selection. Push buttons can be added to select menu options which will indicate which page is selected. The display has internal RAM of 1kB so there are eight possible page addresses to save data to. Below is the menu created from this application when read from page 0.
Using different pages of data can be done by specifying the page through the “Page Address Set” command. For example, a page for the menu item “Temperature” can be programmed into page 2 using the same “Page Address Set” command and writing the bitmap data into that page.
After the data is written to RAM, “Temperature” can be selected to read from the specified page address in RAM. The selection of the page can be done through the "Page Address Set" and read RAM functions. This can be based on external inputs such as push buttons or timing. This is the page programmed into the second page and accessed when selecting temperature from the menu.
Buyers and others who are developing systems that incorporate FocusLCDs products (collectively, “Designers”) understand and agree that Designers remain responsible for using their independent analysis, evaluation and judgment in designing their applications and that Designers have full and exclusive responsibility to assure the safety of Designers' applications and compliance of their applications (and of all FocusLCDs products used in or for Designers’ applications) with all applicable regulations, laws and other applicable requirements.
Designer represents that, with respect to their applications, Designer has all the necessary expertise to create and implement safeguards that:
(1) anticipate dangerous consequences of failures
(2) monitor failures and their consequences, and
(3) lessen the likelihood of failures that might cause harm and take appropriate actions.
Designer agrees that prior to using or distributing any applications that include FocusLCDs products, Designer will thoroughly test such applications and the functionality of such FocusLCDs products as used in such applications.