Bitmap2LCD : Working with Custom Color Palettes

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems and a programmable graphic and text processing tool.

Working with Custom Color Palettes

From V3.8e , the above functions have been moved to the COLOR PALETTE tab , Main Menu

In the Output + Settings / Main menu, for the color mode range going from 256 to 262k Colors you can load a Custom Color Palette by loading a graphic file (BMP/JPG/PNG) that contains the exact number of reference colors, for example 256 Colors for the Custom 256 colors Palette.

The “Custom Color Palette” will override the “Default Color Palette” in a particular project other than Default.LCD (see below about projects)

To load a custom color palette, just create/switch to a project different than Default.LCD and switch to the correct color mode (for example 256 colors), then click on the “Load a custom Color Palette” item in the Output + Settings main menu (blue arrow). The Color Palette of the Reference Graphic will then be loaded.

Bitmap2LCD custom color palette

The next line in the main menu, below the blue arrow will show you if the Default or the Custom Color Palette has been loaded.

To delete a Custom Color Palette, delete the project name, for example, MyProject.LCD

About Projects in Bitmap2LCD

In the File Explorer  >>

List the projects (red arrow)

Name of the current active project (blue arrow) >> NewProject.LCD

Below the List of Projects ( each project is a set of many possible settings )

A Red Star indicates the active project name

Use Right Mouse Click or local menu to act on projects.

Export RGB Color Palettes to Text File or to a Look up Table [LUT]

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems and a programmable graphic and text processing tool.

Export RGB Color Palettes to Text File or to a Look up Table [LUT]

From V3.8e , the above function has been moved to the COLOR PALETTE tab , Main Menu

 

( From V3.2e Build 4 to V3.8d )

In the Output + Settings main menu, in the 256, 4096, 65536 and 262k Colors mode you can export the default or custom Color Palette to a text file. ( RGB 24bit Color Hex codes )

The exported file will be saved in the project output files folder

bitmap2lcd-export-rgb-palette

The prefix of the RGB 24bit Color Hex codes can be defined in the settings ( data Syntax Tab )

Bitmap2LCD Export Color Palette 2

About the Sitronix ST7528 grayscale GLCD

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems.

Bitmap2LCD V2.1b and upwards supports the Sitronix ST7528 grayscale GLCD

The Sitronix ST7528 is a 16-Grey Scale Dot Matrix LCD Controller/Driver

< Quote >

The ST7528 LCD controller does not address rows directly, but rather groups of 8 rows in pages. The LCD memory on the controller is organized into 13 8-bit pages and 160 four-bit column addresses.

There are commands to set the starting page address and column address for a write operation, but no commands to select a row address – you must determine what page the row you want to write is in and set the page address that includes that row. This also implies that if you want to write pixels on adjacent pages, you must address the first page and column(s), write the data, then increment the page address to write the pixels in the adjacent page.

The controller also happens to use what seems like a very bizarre way to load pixel data. Logically, once the address is set, you would write the 4-bit pixel data (or maybe write 2 pixels at a time with a single byte). However, since the addressing scheme addresses pages and not rows, this approach is not used.

Instead, one bit of data for the entire addressed column of pixels (8 vertical pixels) in the current page is written with each byte sent to the LCD. Since each pixel requires 4 bits of data to define the grayscale level, 4 bytes of data must be sent per column to fully define the bits. While this data is being clocked in, the “main” column address does not change. Only after the fourth bit is written to a column is the main column address pointer automatically incremented inside the LCD controller so the next 4 bytes of data sent to the LCD will write the bit data for the next column.

To be complete, we must comment that the “column address” that you send to the LCD controller is actually bits 9:2 of a larger column address inside the controller. The bottom two bits 1:0 are “internal column” address bits. When the 4 bytes of data are written to the LCD controller by the MCU, the internal column address bits increment after each byte write. After the fourth byte is sent, the internal bits will roll from b’11’ to b’00’ and subsequently increase bit 2 of the column address. As you can probably guess, if you do not write LCD data to the controller in groups of 4 bytes, than you will not have complete data for the pixels and the internal LCD addressing will be corrupt.

The implication of all this is that you cannot ever write a single pixel on this LCD. The smallest number of pixels that can be refreshed is a 1 column x 8 row line and it will always take a minimum of four bytes sent to the LCD controller from the MCU to properly set those pixels. If you really do only want to update one pixel in the 1×8 column, you must be sure to write the same data that is already present for the other 7 pixels so their information does not change. This is where keeping a local copy of all pixel data in the LCD RAM becomes essential as individual pixels can be changed in the local RAM as the application requires it, and pixel data for unchanged pixels will still be present for the LCD refresh…

< End of Quote >

Quote from this well written Application Note :  ST7528 Appnote

From Bitmap2LCD Version 3.0H

  • Enable the Special Mode (blue arrow) for ST7528 in the Output+Settings main menu
  • To check it out, just draw 8 pixels in height in the work canvas, in one of the gray colors to be found inside the color picker ( in this example the chosen color is 7 )  ( red arrow )
  • Export Work Canvas to data array 
  • Find your 8 pixels inside the data array, 4 x 0x77 , corresponding to the these 8 gray pixels ( green arrow )

When converting a picture into hex data for a graphic LCD of 160 x 100 pixels , you will get 8320 Bytes, in vertical slices of 8 pixels in height.  ( Normal Gray 4bpp Mode outputs slices of 2 pixels in height = 8000 bytes of data )

——-

Before Bitmap2LCD Version 3.0H

Here’s the needed configuration of Bitmap2LCD for a data output for the ST7528 :

  • Enable the Special Mode (red Arrow) for ST7528 in the Output main menu
  • Select the correct data direction (blue arrow)
  • Enable the Special Mode ON/OFF Switch (green arrow)
  • Select 4bpp Grayscale Mode in the Mode main menu

When converting a picture into hex data for a graphic LCD of 160 x 100 pixels , you will get 8320 Bytes, in vertical slices of 8 pixels in height.  ( Normal 4bpp Mode outputs slices of 2 pixels in height = 8000 bytes of data )

Other special Modes for the following Sitronix LCD controllers are planed in future upgrades :

4-Gray Graphic : ST7541 , St7571

32-gray Graphic : ST7529 , ST7586

Work Canvas Export to Data Settings

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems and a programmable graphic and text processing tool.

Work Canvas Export to Data Settings

Update >V3.9a

From Version V3.9a the Configuration Settings have been moved to a single panel accessible from the main menu. (red Arrow)

The Monochrome / Grayscale / Color Setting can be found in the same Window

 

Versions V3.8a – V3.8z

From V3.8a, the parameters (blue arrow) located inside the right panel of the Work Canvas ( hide/ show > red arrow ) are editable.

The Export To Data Settings are the same as those located on the Configuration Settings Windows. (purple arrow)

Note : Some of these settings are also valid for the Fonts Generator !

You can change the export settings from there (blue) . Their value will be copied to the Configuration Settings Windows (purple)

If changes are made in the Configuration Settings Windows, the values might be refreshed (Refresh Values from Settings > green) on the Work Canvas Panel

bitmap2lcd-wk-settings

Data Export Settings Examples

  • Hex Data Bytes without Prefix (a) nor Suffix, (b)  Without spaces nor separator between them

bitmap2lcd-wk-settings_2

  • Intel Hex Data Output Format (File.hex)

bitmap2lcd-wk-settings_3

  • Binary File Format (File.bin)

bitmap2lcd-wk-settings_4

  • Format  = 0X Hex data / separator = , / End of Line = ;  / 4 bytes per line

bitmap2lcd-wk-settings_5

  • Format  = Prefix (a) + Hex data + Suffix (b) / separator = , / End of Line = ;  / 6 bytes per line / Data lines Prefix = DATA

bitmap2lcd-wk-settings_6

 

Getting Started > Basic Settings

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems and a programmable text processing tool.

Update V4.7b >

Presentation of Bitmap2LCD (Youtube)

 Getting Started > Basic Settings

  • Define the project name and the filenames for Graphic, data output and touch panel data output
  • Configuration Settings window (red frame)
  • Current basic Settings (red frame)
  • Work Canvas size (green arrow)

Configuration Settings : Monochrome, Color and Grayscale, Data formats etc…

The Data Format Settings are also located in the right panel of the Work Canvas. (blue arrow and frames)

  • Edit the Output File Header syntax  (green arrow)

Output File Header

  • The Output File Header is optionally copied to the top of the Text Editor when an export to data as text is performed .

Note : the variables with the [&xxxxx]  syntax are optional script components, replaced by their value on export. (details at the end of this article)

Bitmap2LCD : Touch Panel / Touch Screen Features Update

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems and a programmable text processing tool.

update V3.7f

Bitmap2LCD : Touch Panel / Touch Screen Features Update

bitmap2lcd-touch-menu

Touch panel settings  settings_touch

bitmap2lcd Touch Panel Settings

  • The current Work Canvas image can be defined as Background  (Green Arrow)

bitmap2lcd-touch-menu_3

bitmap2lcd-touch-background-image

  • Enter Touch Panel / Touch panel Screen Mode

bitmap2lcd-touch-menu_2

bitmap2lcd-touch-make-region

To trace Touch panel regions inside the work canvas, after entering in the touch panel script or by opening the TSC file  ( Work canvas outline becomes light blue ) use the mouse inside the work canvas in a similar way to the area selection tool.

Trace the region and when ok, click on the convert to region button (green Arrow)

Theses regions can be moved or resized afterwards.

bitmap2lcd-touch-menu_4

  • Export the GLCD Touch Regions according to the defined settings

bitmap2lcd-touch-regions-data

  • Quit Touch Panel Mode  exiz

Bitmap2LCD … why not LCD2Bitmap ?

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems.

Bitmap2LCD … why not LCD2Bitmap ?

Reverse engineering : Convert an existing Data Array (or Hex File) to a Bitmap

Update V3.7e , monochrome only

Want to convert 8 bit GLCD data array from an old project to a 16 bit GLCD data array in a new project ?

Want to recover the image from of an old GLCD data array source ?

 

bitmap2lcd-glcd-array-to-bitmap

  • Load a source into Text editor ( Red arrow )  or click on source file inside Text editor
  • Data array inside Text Editor ( Green arrow )
  • Import Data to Graphic  ( Blue Arrow )

For monochrome GLCD data arrays of 8, 16 and 32 bit – bytes/words – , it is possible with bitmap2LCD !

Set your work Canvas Height and Width to a compatible size with the number of data in the array loaded in the text editor, set the byte word  Width to 8 16 or 32bits (in the output main menu) , select the data direction (horizontal or vertical) and click one of the import Data Array buttons. If it matches with the data count, the Work Canvas will show the graphic.

For example in a file an array of 2560 bytes ( 0x00 – 0xFF )

( Width * Height ) Pixels per byte =  (160 * 128) / 8 = 2560 bytes

Import the array into the work canvas and save the work canvas as bitmap.

bitmap2lcd-import-data-to-graphic

Settings :

Define the Hex byte prefix to be found inside the source file

bitmap2lcd-glcd-array-to-bitmap-settings

Editable Custom Font From Scratch

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems.

Editable Custom Font From Scratch scratchxxx

[ Editable Fonts : up to 256 colors ]

Standard Edition V3.9>

  • In the GLCD Font Menu, click Editable from Scratch scratchxxx (red arrow)

  • Define the size of the font (orange arrow)
  • Draw pixels on the Char view (green arrow)

Then use the drop down menu at the left or the buttons (purple arrow) to manage the editable font creation.

You can export and import the selected char to/from the Work Canvas.

Import System Chars into the Font Editor

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems.

Import System Chars into the Font Editor

Update V3.7e – V3.8z  Standard Edition

From Version V3.9 watch this video

[ Editable Fonts : up to 256 colors ]

bitmap2lcd-glcd-font-menu

Let’s see how we can export selected characters out of a Windows System font into the Font Editor of Bitmap2LCD :

  • Create a GLCD Font Script by clicking the Main menu item or the Font Panel Button (blue arrow)
  • Choose a Font Name and define its size

bitmap2lcd-editable-font_1

  • In the “Ascii Grid“, select the chars you want to export, here for example A, B and C  (red arrow)
  • In the menu, click on item ” Start editable font Export > Editable (Translate LCD Font Script to an Editable Font (green arrow)

bitmap2lcd-editable-font_2

The “editable font” has been created. It is an Editable Font File (EFF) and an associated GIF file, which is the catalogue of char bitmaps. Both files are located in the Fonts folder.

  • Quit Font Script Creator mode and Open editable (orange Arrow)

bitmap2lcd-editable-font_3

In this example, the selected font name and font size were Aria Unicode MS and 20, in this case the filename of the file will be Arial Unicode MS_20Editable_Font.EFF

bitmap2lcd-editable-font_4

The patterns of theses 3 chars (green Arrow) can now be freely edited.

Example 2

In the first example above, the height of the chars is 25 pixels.

This time, we want to limit the Size of chars in Height and in Width and export a Fixed Size Font.

  • Change the first 3 Parameters (purple arrow) and you will see a red frame in the char View (green arrow)
  • Export To editable (blue arrow)

bitmap2lcd-editable-font_5

  • You get these editable chars

bitmap2lcd-editable-font_6