Drawing Bitmaps onto the OLED Screen ( PART II ) This is a short tutorial that goes through how to store bitmap images into the available external memories, namely the MMC card (SD-Compatible) and the Dataflash chip, and then access these bitmaps and draw it to the OLED screen.
Introduction In this tutorial, we’ll be using the image as shown below;
File Name: Play.bmp First, Create a New Project and Save it.
‘DATA1 The value 1563 is the size of the bmp file in word (16bit) meaning every 2 bytes make a word. You may obtain the size by: 3. Click on the DataFlash tab;
4. Click on Compile. If there’s no pop up, that’s a good thing. (It means there are no problems).
5. Next, click on Download. The download will take some time depending on the amount of Data there is to be downloaded to the chip. The IDE may appear to hang at this stage. Don’t worry. It’s downloading.
6. BMP files are now programmatically accessible through the use of the variable name (in this case, IMAGE) as per the example code under the OLED.Draw.BitmapDFlash Command. Note: The data file downloads directly to the external data flash chip, separate from downloading the actual program. Downloading your program does NOT download the data from the data file to the external data flash chip at the same time.
Drawing the Bitmap to Screen OLED.Draw.BitmapFromDFlash(Position,Address) You may get the address of your image by using the command AddressOf(variable name) Since Data1 is separate from the main module, it is necessary to type the data code name “DATA1” along with the variable name in order to let the compiler know where the variable “IMAGE” is declared.
Dim P1 As Point Your image should end up in the middle of the screen as seen in the image right at the top.
|




