AN-00089 Serial Displaying Third Party Fonts FAT16

 

Description This application note explains how custom fonts can be used on a Picaso or a Diablo16 display module in the Serial environment.
Supported Processor PICASO, DIABLO16
Supported Environment Serial
Difficulty

Medium

 

File Downloads
Files

Description

This application note explains how custom fonts can be used on a Picaso or a Diablo16 display module in the Serial environment. Here is a list of items required to replicate this application:

and other superseded modules which support the ViSi Genie environment

 

Visit www.4dsystems.com.au/products to see the latest display module products that use the Diablo16 processor.

 

  • 4D Programming Cable or µUSB-PA5
  • micro-SD (µSD) memory card
  • Workshop 4 IDE (installed according to the installation document)
  • When downloading an application note, a list of recommended application notes is shown. It is assumed that the user has read or has a working knowledge of the topics presented in these recommended application notes.

Application Overview

There are three built in fonts in the Picaso processor:

  • 0 or FONT1 = System font
  • 1 or FONT2
  • 2 or FONT3 = Default font

Users might need more stylish and larger size fonts which is a need addressed in this application. User can import ANSII or UNICODE fonts. The text could be displayed using Put Character or Put String command.

 

For the Diablo16 processor, the available system font IDs are:

  • 1 for FONT_1 = System 5x7
  • 2 for FONT_2 = System 8x8
  • 3 for FONT_3 = System 8x12 (Default)
  • 4 for FONT_4 = System 12x16
  • 5 for FONT_5 = MS San Serif 8x12
  • 6 for FONT_6 = Deja Vu Sans Condensed 9pt
  • 7 for FONT_7 = Deja Vu Sans 9pt
  • 8 for FONT_8 = Deja Vu Sans Bold 9pt
  • 9 for FONT_9 = System 3x6
  • 10 – Not currently available for SPE Serial, N/A
  • 11 for FONT_11 = EGA 8x12 font

 

NOTE: The List Filenames command is the only other command that writes the list of directory directly to the screen. This command is also affected by the Fonts change.

This application note uses a Picaso display module as the sample model, but the procedures are also applicable to Diablo16 display modules. The main difference between a Picaso display and a Diablo16 display with respect to the Serial environment is the bytes used for the serial commands. The serial command bytes for clearing the screen and sending a string, for instance, are different for each graphics processor.

 
A user with a Diablo16 display module must have to consider this fact when using this application note as a reference. 

 

Setup Procedure

This application note, although written for Serial, requires the use of the ViSi environment to generate the necessary files which will be copied to the uSD card. The display module is then configured as a slave device by loading it with the SPE application. With the uSD card mounted onto the display, the host, which is the Serial Commander in this application note, will then be able to control the display and access the contents of the uSD card.

This application note starts with the creation of a basic ViSi project. Users who want to learn more about the ViSi environment may consult the application note

ViSi Getting Started - First Project for Picaso and Diablo16

Topics discussed include instructions on how to launch Workshop 4, how to open a ViSi project, how to change the target display, how to create a new ViSi project, how to save a ViSi project, how to connect the target display to the PC, and how to compile and download a program.

 

Adding Fonts

Customizing Fonts using the ViSi environment

Open the Workshop 4 (WS4) IDE and click "Create a new project".

Choose the Display module you want to use. A uLCD-32WPTU will be used for this application.

Note: Orientation of the Display is irrelevant here.

Select the ViSi evironment

 

This will open the ViSi development environment window within the WS4 IDE as shown below.

The new project starts as ‘noname’ project. Save the project as, say AddFont.

Go to Widgets, select Strings object under the Labels tab.

Click on to the WYSIWYG screen to drop the string object. A string object has now been created. This is Strings1.

Click on the ellipsis dots of the Strings property of the Object Inspector.

 

The Strings Editor window appears. Select the font and adjust other properties as required.

 

For this application, we have only adjusted the following properties,

Set Fonts to ‘Forte’

Font size is set to 20

Press OK.

 

Create another string object. This object will be Strings2.

Set the properties in the Strings Editor window. For Strings2, the properties are:

 

Now, there should be two strings in the object inspector.

Completing the ViSi project

  • Now, insert the uSD card in the uSD card reader on the PC/Notebook.
  • Make sure the uSD card is FAT (aka FAT16) formatted.
  • On the ViSi window Home ribbon in WS4 click Compile.

After clicking on Compile, you will be prompted to select and confirm the drive to where the font files will be saved. Click OK to confirm and start copying.

Press OK to start writing the Font files to the uSD card. Once the writing is completed, remove the uSD card from the PC/Notebook and insert it in to the display module.

 

Simulation

The display must be configured as a slave device first before it can be controlled by a host. For instructions on how to launch Workshop 4, how to connect the display module to the PC, and how to configure the display as a slave device, kindly refer to the section “Setup Procedure” of any of the application notes below. Choose according to your display module’s processor.

Serial Picaso Getting Started - the SPE Application

Serial Diablo16 Getting Started - the SPE Application

These application notes also introduce the user to the Serial Protocol thru the use of the Serial Commander

Clear the Screen

 

The bytes sent and received are:

The screen should now be cleared.

 

Mount the uSD Card

Mount the uSD card on to the display module. Go to the File tab and select file_Mount.

 
The bytes sent and received are: 

 

Load the Font Files

In the File tab, select file_LoadImageControl then enter the font file names and mode.

 

The bytes sent and received are:

 

Take note of the reply from the display – “5144” in decimal or “0x1418” in hexadecimal. This is the 16-bit file handle. It could be different in your case.

 

Set the Font ID

Go to the Txt tab and select txt_FontID. Enter the file handle into the FontNumber box.

 

The bytes sent and received are:

Send a String

Go the Other tab and select putstr. Input “Hello 4D Systems.” to the InString box.

 

The bytes sent and received are:

The string “Hello 4D Systems.” should now be shown on the screen.

 

The New Line Character

The ASCII code for the new line character is 0x0A in hexadecimal or 10 in decimal. In the tab Other, select putCH. Input the value “10” to the WordChar box and click on the send button.

 

The bytes sent and received are:

Choose another Font

Choose a new font by loading the correct files.

 

The bytes sent and received are:

Again, take note of the returned value, which is the 16-bit file handle. This value may be different in your case. Use this value when setting the new font ID.

 

When successful, the new string should now be in a new line and using the new font.

 

Print the Contents of the uSD Card

Send another new line character to the display.

 

Go to the File tab and select file_Dir. Input the wildcard character “*.*” to the Filename box.

 

The bytes sent and received are:

 

The file names should now be printed on the display.

 

Unmount the uSD Card

To properly unmount the uSD card, go to the File tab and select file_Unmount. Then click on the send button.

 

The bytes sent and received are:

Share: