Monochrome Graphic Display Source Code Driver Project
Section 01. Driver Overview

01. Driver Overview

a) Graphic Screens Overview

A typical monochrome graphic screen, which may use LCD, E Ink, LED, OLED, Vacuum Fluorescent or some other screen technology, consists of a large array of pixels that are triggered using a X and Y axis matrix of connections. The actual drive of each pixel is provided by a display controller IC. This may already be built into your screen, may need to be provided by you externally or may be built into the particular microcontroller or processor you are using. This display controller IC will constantly scan the matrix of pixels, turning on or off each pixel based on the data held in the IC’s memory. In its basic form the IC will have a data buffer to which you write data to tell the controller IC which pixels you want on and which you want off. This driver is designed to be used with any screen which can be controlled in this way, allowing its use with the simplest and also more sophisticated controllers.

The problem with displaying graphics and text on a monochrome screen is that you typically need to transfer pixel data as bytes which means that either the X or the Y axis of your screen is being addressed in 8 bit multiples. For example:-

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

In the above example the layout of a 32 x 24 pixel screen is shown. The controller IC has a data memory buffer that is laid out say as follows:-

Address, Pixels
0 Column 0, Rows 0:7
1 Column 0, Rows 8:15
2 Column 0, Rows 16:23
3 Column 1, Rows 0:7
||
95 Column 31, Rows 16:23

If you want to turn on the top left pixel you would write 0×01 to address 2 – easy enough. If you want to display a bitmap that you have in processor memory that is 8 bits high by 10 bits wide to be displayed with its bottom left corner 8 rows up and 5 columns in then no problem, your working with the screen and its layout. However, this is of course very limiting and as soon as you want to be able to display a bitmap that isn’t sized in 8 bit multiples in the byte based axis, or want to be able to display bitmaps at any position on the screen then things get a whole lot more complex. Even worse, what if you need to use the screen rotated by 90º? As you can see, having to work with a graphic screen and this byte addressing can severely limit what you are able to do with the screen. This driver solves this problem and allows you to display bitmap graphics and text of any size anywhere on the screen.

b) Driver Introduction

Graphic screens look impressive and allow you to display images that a simple character based screen can’t provide. However this improvement comes at the cost of a great deal of complexity. Once configured for your screen, this driver removes that complexity for you and allows you to simply display bitmaps of any size and ASCII text strings using user adjustable fonts anywhere on a screen. Monospace or proportional width text with left, centre or right alignment and scrolling functions provides the complete toolbox of text display capabilities. Once you have these capabilities using a graphic screen is easy and it’s a simple matter to add any special user interface features you require for your application, such as menus, animated graphics, graphs and more. One of the great advantages of this driver is that it provides you with very simple but very powerful control over everything you display on the screen, allowing you to implement your display, and any user interface, exactly as you want it down to the individual pixel.

This driver provides complete bitmap and string display capabilities on any standard mono graphic display with a built in or external 8 bit display controller IC. It may also be used with virtually any mono pixel display system, such as LCD, E Ink, LED, OLED, Vacuum Fluorescent, or others. Once configured, the driver removes you from all of the problems of byte updating of displays. The driver can optionally use the display controller IC memory buffer for the display data rather than processor memory, resulting in a very small RAM memory requirement for the driver for screens which provide read as well as write access.

The included bitmap converter PC application will read all of your source monochrome .bmp bitmap files, created in a standard graphics application, and convert them into the selected format ready for use in your application. It will also convert special font bitmap files to be used to display ASCII text strings. Options allow you to rotate your bitmap images and fonts before converting, allowing you to use a screen in any of the 4 possible orientations.

As well as displaying ASCII text strings in standard ‘monospace’ fixed pitch mode (each character takes the same horizontal space regardless of its actual width), this driver also allows you to display text in proportional mode. This makes lines of text much more attractive and natural to read and typically allows you to fit additional characters across a screen as each character only uses as much width as is required to display it. Left, centre and right text alignment options remove you from the pain of having to manually calculate text offsets to make your text appear where you want it on the screen. Scrolling text lets you create impressive effects or display more information on a small display than would fit as a static line.

This driver can’t quite remove all of the complexity for you as you will need to configure the basic screen access functions to suit the particular screen / display controller IC you’re using. This has been made as simple as possible, and some sample screen models are included for you to copy and modify as required.

The driver code has been designed using ANSI compliant C compliers. Using the driver with other ANSI compliant C compliers and with other processors / microcontrollers should not present significant problems, but you should ensure that you have sufficient programming expertise to carry out any modifications that may be required to the source code. Embedded-code.com source code is written to be very easy to understand by programmers of all levels. The code is very highly commented with no lazy programming techniques. All function, variable and constant names are fully descriptive to help you modify and expand the code with ease.

The driver and associated files are provided under a licence agreement. Please see www.embedded-code.com/licence.php for full details.

The remainder of this manual provides a wealth of technical information about the driver as well as useful guides to get you going. We welcome any feedback on this manual and the driver.

c) Features

Display bitmaps of any size anywhere on the screen without having to worry about 8 bit size multiples or 8 bit boundaries.

Use your display in any of the 4 possible orientations.

Display monospace or proportional width text anywhere on the screen.

Left, centre or right text alignment and scrolling options.

Use the included PC Bitmap Converter Application to convert your source bitmap (.bmp) files ready for use with the driver. Create your bitmaps using a standard graphics application.

Create your own fonts simply by creating a line of characters in a single bitmap file.

Output your bitmap source files as a C compliant header file or as a binary file using the Bitmap Converter Application. Use the header file option to include all of your bitmaps as part of the program memory of your microcontroller / processor – convert the files and they are immediately ready to use in your project. Use the binary file option to store your bitmaps as a single data block in external flash memory and provide the driver with a function to read the binary data byte by byte. Use both methods if desired to split storage between on chip and external.

No requirements to use your display in pre-defined ways – use your display exactly as you want with your user interface implemented exactly as you want it, down to the individual pixel.

Use display memory instead of microcontroller / processor memory to buffer the display data, resulting in a very low ram requirement. Use a local ram buffer for displays with no read capability or to improve speed.

Small program memory requirement.