Displaying a bitmap on a gLCD
Posted: Mon Jul 02, 2012 10:24 am
Hello,
I am probably going to write this up as an official article but in the mean time I thought I would release the software to see if anyone could put it to good use or find any other uses for this.
Basically we have wanted to be able to display images onto a graphical LCD for a long time now but been unable to control the data source effectively.
Now using the FAT component I have written a routine that will directly parse through a standard 24-bit bitmap file and print it to a graphical display.
To do this project you will first need a target microcontroller that can run the FAT component. eg a PIC18, AVR, ARM, PIC24 or dsPIC. I don't think there are any PIC16 devices that can support the FAT buffer required to drive the FAT component. Secondly you need the graphical display, note that the EB057/58 display requires hardware SPI so you will have to use software SPI for the FAT component to allow this display to work.
You will also need a copy of Fowcode v5 for your target microcontroller to allow you to import or open the example file. The programs are written in v5 as this allows the macros to be fairly standalone to allow you to export and import the bitmap handler macros into existing programs.
Program 1 demonstrates how to display known images by using a pre determined file name. The program then reads the image from the card and displays a list of the image properties such as height, width, compression etc, before outputting the image to the display.
Program 2 demonstrates how to dynamically browse through a folder looking for a specific file type (in this case .bmp). The end result of this program is a replication of a standard electronic photo frame where you pop your pictures on to a card (in the right dimensions and bitmap format) and the program automatically displays each picture in a loop with a few seconds delay between each image.
With a bit of work it should be possible to change the print function so it will scale and display any size bitmap to the appropriate width or height for the display whilst maintaining the aspect ratio. The downside to this is that larger bitmap files would be much slower to process and display.
The function should work as is to allow small sprites or background images to be loaded directly onto the display in any x,y location. On a larger and faster device like a dsPIC or PIC24 you could probably read the sprite image data directly into RAM and then have it readily available to print to the display on command without having to re-parse the bitmap file.
I am probably going to write this up as an official article but in the mean time I thought I would release the software to see if anyone could put it to good use or find any other uses for this.
Basically we have wanted to be able to display images onto a graphical LCD for a long time now but been unable to control the data source effectively.
Now using the FAT component I have written a routine that will directly parse through a standard 24-bit bitmap file and print it to a graphical display.
To do this project you will first need a target microcontroller that can run the FAT component. eg a PIC18, AVR, ARM, PIC24 or dsPIC. I don't think there are any PIC16 devices that can support the FAT buffer required to drive the FAT component. Secondly you need the graphical display, note that the EB057/58 display requires hardware SPI so you will have to use software SPI for the FAT component to allow this display to work.
You will also need a copy of Fowcode v5 for your target microcontroller to allow you to import or open the example file. The programs are written in v5 as this allows the macros to be fairly standalone to allow you to export and import the bitmap handler macros into existing programs.
Program 1 demonstrates how to display known images by using a pre determined file name. The program then reads the image from the card and displays a list of the image properties such as height, width, compression etc, before outputting the image to the display.
Program 2 demonstrates how to dynamically browse through a folder looking for a specific file type (in this case .bmp). The end result of this program is a replication of a standard electronic photo frame where you pop your pictures on to a card (in the right dimensions and bitmap format) and the program automatically displays each picture in a loop with a few seconds delay between each image.
With a bit of work it should be possible to change the print function so it will scale and display any size bitmap to the appropriate width or height for the display whilst maintaining the aspect ratio. The downside to this is that larger bitmap files would be much slower to process and display.
The function should work as is to allow small sprites or background images to be loaded directly onto the display in any x,y location. On a larger and faster device like a dsPIC or PIC24 you could probably read the sprite image data directly into RAM and then have it readily available to print to the display on command without having to re-parse the bitmap file.