Facebook Pixel

AN-00172 ViSi-Genie Magic Slide to Unlock with a Host

 

Description

This application note shows how to modify the project in ViSi-Genie Magic Slide to Unlock, such that when the knob of the slider is moved to the extreme right (the program is unlocked), a message is sent to the serial port. Also, when the winbutton on the second form is pressed (the program is locked), another message is sent to the serial port.

Supported Processor PICASO, DIABLO16
Supported Environment ViSi-Genie
Difficulty

Medium

 

File Downloads
Files

 

Description

This application note shows how the function SendReport(…) is used with ViSi-Genie Magic objects. The function SendReport(…) is one of the callable functions in the new ViSi-Genie Communications protocol. This function causes the program to send a REPORT_EVENT or a REPORT_OBJ message to the serial port. This function can be inserted into the code of a Genie Magic object.

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

Note 2: Worskhop Pro is needed for this application.

This application note shows how the function SendReport(…) is used with ViSi-Genie Magic objects. The function SendReport(…) is one of the callable functions in the new ViSi-Genie Communications protocol. This function causes the program to send a REPORT_EVENT or a REPORT_OBJ message to the serial port. This function can be inserted into the code of a Genie Magic object.

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

Note 2: Worskhop 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.

  • 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

To understand this application note more quickly, the reader is advised to read and understand first the application note ViSi-Genie Magic Slide to Unlock. ViSi-Genie Magic Slide to Unlock shows how a stand-alone ViSi-Genie program with a slide-to-unlock feature is created. The slide-to-unlock project has two forms. The first form has a slider whose knob, when dragged to the right-most part, triggers the program to navigate to the second form. A winbutton on the second form, when pressed, causes the program to navigate back to the first form.

This application note shows how to modify the project in ViSi-Genie Magic Slide to Unlock, such that when the knob of the slider is moved to the extreme right (the program is unlocked), a message is sent to the serial port. Also, when the winbutton on the second form is pressed (the program is locked), another message is sent to the serial port.

 

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

 

Design the Project

There are two ways of making the slide-to-unlock program report a message when navigating between the two forms (unlock and lock). One way is to use the OnChanged property event of a form. Another way is to use the function SendReport(…) with the Magic Event object.

Add a SendReport(…) Fucntion to MagicEvent0

Insert the SendReport(…) function to MagicEvent0 as shown below.

 

This will cause the program to send a REPORT_EVENT message to the serial port just after Form1 is activated. For more information about this function, see section 5.1 Genie Magic callable Functions of the ViSi-Genie Reference Manual.

Configure the OnActivate Event Property of Form0

Set the OnActivate Event property value of Form0 as indicated below.

This will cause the program to send a REPORT_EVENT message to the serial port every time that Form0 is activated.

 

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 display module is going to send messages to an external host. This section explains to the user how to interpret these messages. An understanding of this section is necessary for users who intend to interface the display to a host. The ViSi Genie Reference Manual is recommended for advanced users.

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.

Unlock the Program

On the display module, drag the knob of the slider to the right-most part and release. The program should now navigate to Form1 and a REPORT_EVENT message should be received from the display.

The format of the message is shown below.

Upon receiving the above message, the host would know that the display has been “unlocked” and that Form1 or the second has been activated.

Lock the Program

Press the lock button on Form1. The program should now navigate to Form0 and a REPORT_EVENT message should be received from the display.

The format of the message is shown below. 

Upon receiving the above message, the host would know that the display has been “locked” and that Form0 or the first form has been activated.

 

 

Share: