Facebook Pixel

AN-00167 Visi-Genie Magic Spectrum

 

Description

This application note primarily shows how Magic Object can be used to write to two spectrum objects. GTX or a host controller like arduino can be used to write values to the spectrum objects. The Magic Object is under the Genie Magic pane in Workshop 4 Pro. In this application it contains a 4DGL code that receives string of bytes from GTX and sends back an acknowledgement.

Supported Processor PICASO, DIABLO16
Supported Environment ViSi-Genie
Difficulty

Medium

 

File Downloads
Files

Description

This application note primarily shows how Magic Object can be used to write to two spectrum objects. GTX or a host controller like arduino can be used to write values to the spectrum objects. The Magic Object is under the Genie Magic pane in Workshop 4 Pro. In this application it contains a 4DGL code that receives string of bytes from GTX and sends back an acknowledgement.

 

Note 1:The ViSi-Genie project for this application note is the demo “MagicSpectrum”, which is found in Workshop. Go to the File menu -> Samples ->ViSi Genie Magic (Picaso/Diablo16) ->MagicSpectrum.4DGenie.

Note 2:Workshop Pro is needed for this application.

Before getting started, the following are required:

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.

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

In the past it was not possible to easily write to a spectrum object using a host. The application shown in this document uses GTX as a host that sends string of bytes to the display. The string of bytes is received using Magic Object. The Magic Object also writes to the two spectrum objects if the received string of bytes is in accordance to the format.

 

Byte   Meaning

    1    Spectrum object number

    2    Starting Bar(0 to Columns-1)

  3-n   New values to be written to consecutive bars

 

Setup Procedure

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

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

 

Design the Project

Add Spectrum0

A spectrum object is added to Form0. This is Spectrum0.

Add Spectrum1

A another spectrum object is added to Form0. This is Spectrum1.

Spectrum0 has more columns than Spectrum1.

To know more about spectrum objects, their properties, and how they are added to a project, refer to the application note ViSi-Genie Spectrum.

Add Magic Object

A Magic Object is added to Form0. This is MagicObject0.

Magic Object Properties:

A Magic Object allows the user to write a custom handler for messages received from the serial port. In this application note, GTX was used as a master.

To know more about adding Magic Objects refer to the application note ViSi-Genie How to Add Magic Objects

 

The image above shows the content of MagicObject0. The 'action' parameter of the 'rMagicObject0' function is the command received from the host this can be READ_OBJ, WRITE_OBJ, WRITE_MAGIC_BYTES or WRITE_MAGIC_DBYTES. In this application note the program checks if the received command from the host is 'WRITE_MAGIC_BYTES'. If so, then it will store 'ptr[0]' to 'actobj' variable then store 'ptr[1]' to variable 'st'. The ptr is N/A for action of READ_OBJ and WRITE_OBJ, otherwise Pointer to array of parameters passed. Array is always a standard Picaso/Diablo integer array. For WRITE_MAGIC_BYTES each element contains a byte. After that a for loop is used to successively write to the spectrum object.

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.

 

Identify the Messages

The PC will send messages to the display module. In this format:

Use the GTX Tool to Analyse the Messages

Using the GTX or Genie Test eXecutor tool is one option to get the messages sent by the display to the host. Here the PC will be the host. The GTX tool is a part of the Workshop 4 IDE. It allows the user to receive, observe, and send messages from and to the display module. It is an essential debugging tool.

Launch the GTX Tool

Under the Tools menu click on the GTX tool button.

The Genie Test eXecutor window appears.

Spectrum Magic Object Handler

from GTX (or program), send a string of bytes. eg in GTX, click 'Send Values', check "Other" and Bytes, then enter 00, 05, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 and click OK

Byte   Meaning

    1   spectrum object number

    2   Starting Bar(0 to Columns-1)

  3-n   New values to be written to consecutive bars

 

The GTX tool sends the WRITE_MAGIC_BYTES message.

The format of this message is:

OUTPUT:

Now to write to Spectrum1:

The Spectrum Object Number is now 01:

Share: