Facebook Pixel

AN-00013 ViSi-Genie Labels, Texts, and Strings

 

Description

This Application Note explores the possibilities provided by ViSi-Genie for the Labels objects:This Application Note explores the possibilities provided by ViSi-Genie for the Labels objects:

•   Label   

•   Static text

•   Strings

Supported Processor ,PICASO, DIABLO16
Supported Environment ViSi-Genie
Difficulty

Medium

File Downloads
Files

Description

This Application Note explores the possibilities provided by ViSi-Genie for the Labels objects:

This application note requires:

  • Workshop 4 has been installed according to the document Workshop 4 Installation;
  • The user is familiar with the Workshop 4 environment and with the fundamentals of ViSi-Genie, as described in Workshop 4 User Guide and ViSi-Genie User Guide;
  • 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 discussed in these recommended application notes.

Three ViSi-Genie projects are provided as examples to help you along this application note.

Application Overview

It is often difficult to design a graphical display without being able to see the immediate results of the application code. ViSi-Genie is the perfect software tool that allows the user to see the instant results of their desired graphical layout with this large selection of gauges and meters that can simply be dragged and dropped onto the simulated module display.

Each object can have properties edited and at the click of a button, all relevant code is produced in the user program. Each feature of ViSi-Genie will be outlined with examples below.

Setup Procedure

This application note comes with a zip file which contains three ViSi-Genie projects.

For instructions on how to launch Workshop 4, how to open a ViSi-Genie project, and how to change the target display, kindly refer to the section “Setup Procedure” of the application note:

ViSi Genie Getting Started – First Project for Picaso Displays (for Picaso)

or

ViSi Genie Getting Started – First Project for Diablo16 Displays (for Diablo16).

 

Create a New Project

Create a New Project

For instructions on how to create a new ViSi-Genie project, please refer to the section “Create a New Project” of the application note

ViSi Genie Getting Started – First Project for Picaso Displays (for Picaso)

or

ViSi Genie Getting Started – First Project for Diablo16 Displays (for Diablo16).

 

Simulation Procedure

Select the Home menu to display the objects:

 

The Labels objects are located on the Labels pane:

To add an object, first click on the desired icon, here start with the first one, the Label

…and then click on the WYSIWYG screen to place it.

 

Label Options

You can load the example…

Example:  4D-AN-00013 – Labels

…or follow the procedures described hereafter.

The options are listed on the Object Inspector:

The Label object has no event.

Font Options

Three fonts are available: small FONT1, medium FONT2 and large FONT3. Those fonts are provided by the screen module.

 

The font can be set to bold, italic, underline, inverse, opaque.

 

Colour Options

Front colour and background colour can be selected. Set Opaque to yes to display the background colour. Set Inverse to yes to switch the front and background colours.

 

Magnification Options

The font can be adjusted both vertically and horizontally. By default, magnification is 1 on both axes.

 

StaticText Options

You can load the example…

…or follow the procedures described hereafter.

 

To add a StaticText object, select the Labels pane…

…click on the StaticText icon…

…and then click on the WYSIWYG screen to place it:

Enter the text on the Caption field:

 

Use \n for line-feed.

The options are listed on the Object Inspector:

The StaticText object has no event.

Font Options

The fonts used by the StaticText object include all the fonts from Windows.

Click on the  symbol on the right…

 

…to display the Font window:

Select the font and change the size. Choosing Tahoma 12…

…to obtain the following result:

Auto-Size Option

By default, the auto-size option is set to Yes.

When auto-size is activated, the size of the static-text object is automatically adjusted for the text.

Setting AutoSize to No allows using the mouse to change the width and height of the static text object.

Click on the red dotted line and resize the object. The text is then automatically reformatted.

Word-Wrap Option

The word-wrap option automatically includes carriage returns.

 

To fit the text on the screen, either

  • Adjust the Width and the Height of the StaticText object manually if AutoSize is on,

or

  • Set AutoSize to no and use the mouse:

 

Strings Options

You can load the example…

Example:  4D-AN-00013 – String

…or follow the procedures described hereafter.

To add a String object, select the Labels pane…

 

…click on the Strings icon…

 

…and then click on the WYSIWYG screen to place it:

 

Predefined and Dynamic Strings

The area enclosed by the box can be thought of as the “container” or the “place holder” for that strings object. The text or string displayed inside this container can be classified into two – predefined strings and dynamic strings. Predefined strings are those that are created in Workshop during design time. These are actually saved into the uSD card and can later be retrieved during runtime. Dynamic strings, on the other hand, are those that are sent by a host to the display during runtime. A strings object (or container) can display a predefined string and a dynamic string, one at a time. There are separate commands for these.

Predefined strings can be further classified by how they are displayed – message style and book style. For message style, the user creates a text composed of multiple parts (usually a part is composed of a line). During runtime, the strings object or container can be made to display the desired line. For book style, the user creates a text composed of multiple pages. During runtime, the strings container can be made to display the desired page. Displaying of message and book style strings will now be illustrated. Displaying of dynamic strings will be illustrated in the section “Debugger Output”.

The options for a strings object are listed on the Object Inspector:

 

The object is empty. To enter the text, select the line…

…and click on the  : a new window opens the String Editor:

 

Message Style Option

On the Strings Editor, select the Message option:

Enter each message, one message per line.

The messages can be monitored on the right part of the String Editor by using the arrows:

 

Each message is displayed separately:

The background and foreground colours can also be changed.

Book Style Option

Create a strings object similar to Strings0 above. On the Strings Editor, select the Book option this time:

A book includes pages, each page with multiples lines:

All the lines from the same page are displayed together:

The background and foreground colours can also be changed.

Font Options

The font options offer a wide range of fonts, and include the fonts provided by the screen module and the fonts provided by Windows.

Attributes can be set, as the type ANSI or UNICODE:

 

With static text objects added as labels and the background and foreground colours changed, the final output is shown below.

 

Build and Upload the Project

For instructions on how to build and upload a ViSi-Genie project to the target display, please refer to the section “Build and Upload the Project” of the application note

 

ViSi Genie Getting Started – First Project for Picaso Displays (for Picaso)

or

ViSi Genie Getting Started – First Project for Diablo16 Displays (for Diablo16).

 

The uLCD-32PTU and/or the uLCD-35DT display modules are commonly used as examples, but the procedure is the same for other displays.

Debugger Output

The GTX tool is used to send and receive messages to and from the display. It is an essential debugging tool.

Launch the Debugger

To launch the Genie Test Executor or GTX, select the Tools menu…

 

…and then click on the GTX button.

 

A new screen appears, with the form and objects we have defined previously, here from the Strings example:

Use the Debugger

The debugger window provides all the controls for the strings object:

 

Display a Predefined String

To display the second message for Strings0 (message style) and to display the second page for Strings1, enter the value “1” into both fields as shown below and press on the “Set” buttons.

 

The appropriate line and page are now displayed.

 

The right part of the GTX window displays the command sent and the acknowledgement 06:

 

Send and Display a Dynamic String

To send a dynamic string to the strings object String0, click on its “Send” button. A new Send Text window asks for the text to be sent…

 

Type the text in…

…and press OK. The screen is updated accordingly:

 

This new message doesn’t alter the recorded messages or the predefined strings.

The right part of the GTX window displays the command sent and the acknowledgement 06:

 

Note the difference between the command for displaying a predefined string and that for displaying a dynamic string.

Referring to the ViSi-Genie Reference Manual, these two commands are highlighted below:

 

Here is an additional information on strings object from the manual (section 3.2.5.2 Strings).

The first strings are displayed initially. Normally strings are set to predefined values, e.g. a value of 0 might display the string ‘Hello There’. Using predefined values makes the most efficient use of the comms link and also minimizes the code required in your controller. In order to display a dynamically created string the user can send the Write String ASCII command message. The default maximum string length is 75, this can be changed in the Workshop options for Genie. For Unicode string objects Unicode strings can be sent, using the Write String Unicode command message. CRs and LFs can be included and the user is responsible for the ‘formatting’ of the string, the formatting of strings in Workshop does not apply to dynamic strings.

Thus, the right -, centre -, or left - alignment of a predefined string when being formatted in the strings editor in Workshop does not apply to dynamic strings. Furthermore, a dynamic string does not automatically fit into the area defined by the strings container object. It will only be printed starting at the x and y coordinates of the strings container object. Formatting of predefined strings is set during design time, while formatting of dynamic strings is up to the host.

Another important point to consider is that when the program navigates between forms, a strings object on a certain form "remembers" the last predefined line or page of text it was made to display. However, if the string object is made to display a dynamic string and form navigation occurs, the string object will not remember anything. The host or program will have to make the strings object display another line or page of predefined text. The strings object will then remember this line or page, until the next dynamic string is received.

 

Share: