Skip to content

ViSi-Genie: Arduino ITOA Demo for Strings

Introduction

The strings object in ViSi-Genie can display a predefined text or dynamic text or string. The application note below discusses the difference between predefined and dynamic strings.

ViSi-Genie: Labels, Texts, and Strings

Quote

"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."

Refer to the application note specified above for more information.

The application note below shows how to write to a Strings Object to make it display predefined tetxt or dynamic text.

ViSi-Genie: Writing to Genie Objects Using an Arduino Host

The application note further says.

Quote

"...the second argument for genie.WriteStr() is a pointer to a null-terminated character array. Section 2.1.3.3 Write String (ASCII) Message of the ViSi-Genie Reference Manual emphasizes this."

Certain applications may require the printing of integer values as a dynamic text on a string object on the display. There is therefore a need to convert the integer into a null-terminated character array. Hence, the itoa(...) function in C. Other applications may also require the insertion of dynamic integer values into text. To illustrate,

The display will turn off in n second(s).

Where n is a decrementing value. In this case, correct handling of character arrays is required.

Prerequisites

This codebase example assumes the reader can program the 4D Systems display module using Workshop4 IDE ViSi-Genie environment. Beginners are advised to read the following aplication notes.

Instructions

This code presents a working example of the above. Below are the steps involved in creating this code example.

  1. Create an Arduino sketch for a program that sends dynamic strings to the display.

  2. In Workshop4 create a new ViSi-Genie project and add two strings objects.

    1. Strings0 - to be used for printing the changing value of a variable.
    2. Strings1 - to be used for printing the changing value of a variable inserted into a text.
  3. Compile the project and upload it to any 4D Systems displays with PICASO, DIABLO-16, PIXXI-28 and PIXXI-44 graphics processors in this codebase example we are using uLCD-32PTU. Copy the supporting files to a uSD mounted to the PC. Properly unmount the uSD card from the PC and mount it to the target display.

  4. Properly connect the Arduino Uno to the traget display. See the application notes - ViSi-Genie: Connecting a 4D Display to an Arduino for this.

Attachment

Project File