CC278: Serial Displays Save Resources (BMP Files)

In Circuit Cellar’s September issue, columnist Jeff Bachiochi provides his final installment in a three-part series titled “Serial Displays Save Resources.” The third article focuses on bitmap (BMP) files, which store images.

Photo1

A BMP file has image data storage beginning with the image’s last row. a—Displaying this data as stored will result in an upside-down image. b—Using the upsidedown=1 command will rotate the display 180°. c—The mirror=1 command flips the image horizontally. d—Finally, an origin change is necessary to shift the image to the desired location. These commands are all issued prior to transferring the pixels, to correct for the way the image data is stored.

LCDs are inexpensive and simple to use, so they are essential to many interesting projects, Jeff says. The handheld video game industry helped popularize the use of LCDs among DIYers.

Huge production runs in the industry “made graphic displays commonplace, helping to quickly reduce their costs,” Jeff says. “We can finally take advantage of lower-cost graphic displays, with one caveat: While built-in hardware controllers and drivers take charge of the pixels, you are now responsible for more than just sending a character to be printed to the screen. This makes the controllers and drivers not work well with the microcontroller project. That brings us to impetus for this article series.

“In Part 1 (‘Routines, Registers and Commands,’ Circuit Cellar 276, 2013), I began by discussing how to use a graphic display to print text, which, of course, includes character generation. In essence, I showed how to insert some intelligence between a project and the display. This intermediary would interpret some simple commands that enable you to easily make use of the display’s flexibility by altering position, screen orientation, color, magnification, and so forth.

“Part 2 (‘Button Commands,’ Circuit Cellar 277) revealed how touch-sensitive overlays are constructed and used to provide user input. The graphic display/touch overlay combination is a powerful combination that integrates I/O into a single module. Adding more commands to the interface makes it easier to create dynamic buttons on the graphic screen and reports back whenever a button is touched.

The prototype PCB I used for this project mounts to the reverse side of the thin-film transistor (TFT) LCD. The black connector holds the serial and power connections to your project. The populated header is for the Microchip Technology MPLAB ICD 3 debugger/programmer.

“Since I am using a graphic screen, it makes sense to investigate graphic files. This article (Part 3, ‘BMP Files,’ Circuit Cellar 277) examines the BMP file makeup and how this relates to the graphic screen.”

To learn more about the BMP graphical file format and Jeff’s approach to working with a graphic icon’s data, check out the September issue.