Facebook Pixel

AN-00116 ViSi-Genie Blocked User Buttons

 

Description In ViSi-Genie User Buttons, the use of ordinary or non-blocked user buttons was discussed. This application note, on the other hand, introduces the concept of "blocking" or of blocked user buttons. Blocking allows for user buttons to have multiple sets, anyone of which can be activated by the host during runtime.
Supported Processor PICASO, DIABLO16
Supported Environment ViSi-Genie
Difficulty

Medium

 

File Downloads
Files

Description

This application note provides a first hands-on example with ViSi-Genie and describes all the steps related to a project.

 

Before getting started, the following are required:

 

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

Application Overview

In ViSi-Genie User Buttons, the use of ordinary or non-blocked user buttons was discussed. This application note, on the other hand, introduces the concept of "blocking" or of blocked user buttons. Blocking allows for user buttons to have multiple sets, anyone of which can be activated by the host during runtime. An ordinary or non-blocked momentary user button, for instance, has two states - "Up" and "Up Pressed".

A blocked momentary user button, on the other hand, can have multiple blocks, wherein each block has two states. Shown below is an example of a momentary user button with four blocks.

 

As shown above, the blocks are indexed from 0 to 3. Anyone of these blocks can be activated by the host using the appropriate commands. The images for the states of different blocks may not need to be similar even. To illustrate,

 

A host with a temperature sensor and a GUI for controlling the speed of rotation of a fan can display block 0 if the temperature is too high, block 1 if the temperature is too low, and block 2 if the temperature is within range.

For non-momentary user buttons, blocking is applied as shown below.

The section “Identify the Messages” discusses the format of the messages coming from and going to a user button using the GTX Tool in Workshop. This section also discusses the format of the message for changing the block of a blocked user button. An understanding of this section is essential for users who intend to interface the display to an external host.

 

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

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 of the Project

Adding User Buttons

For an in-depth discussion about user buttons please refer to the application note ViSi-Genie User Buttons. It is discussed here how a user button can be configured to behave as a momentary button, a toggle button, or one among a group of buttons. Each of these configurations has its own application. The application note also discusses the format of the messages coming from and going to a non-blocked user button using the GTX Tool in Workshop.

To add a user button, go to the Buttons pane then click on the user button icon.

 

Click on the WYSIWYG (What-You-See-Is-What-You-Get) screen to put the object in place. The WYSIWYG screen simulates the actual appearance of the display module screen.

   

The object can be dragged to any desired location and resized to the desired dimensions. The Object Inspector on the right part of the screen displays all the properties of the newly created user button object named Userbutton0. In this application, there are a total of five user buttons, namely Userbutton0, Userbutton1, Userbutton2, Userbutton3, and Userbutton4. The first three user buttons are part of a button matrix, Userbutton3 is a non-momentary user button, and Userbutton4 is a momentary (both) button.

Create a User Button Matrix

Add three user button objects to Form0. These are Userbutton0, Userbutton1, and Userbutton2. Add images to each of the buttons by using the ‘Image List editor’.  Click on the button   located at the right of the ‘Images’ property.

 

Click on ‘Add’ to open the file explorer.

 

 

In the file browser, select all of the images inside the folder ‘BlockedUserButtons.ImgData’.

 

The number of images required is 16 to create 4 Blocks. This is due to the number of states of a non-momentary button.

Arrange the files according to the image below. The   buttons can be used to change the arrangement of the files added. This is necessary for the proper groupings of the image. Each colour represents a block.

 

After adding all of the needed images, the three user buttons will now look like the image below. Block 0 represents white coloured buttons.

 

Configure the properties of the three user buttons according to the images below. To group these buttons into a matrix, edit the Matrix property in the object inspector. It is important that all buttons grouped share the same matrix number, otherwise pressing on one button will not release the other buttons of the group.

 

Userbutton0 is set to momentary ‘On’ so that its initial state is the fourth state or the ‘Down Pressed’ image.

Properties for UserButton1:

 

Properties for Userbutton2:

After changing the properties the output should now look like the image shown below.

 

Create a Non-Momentary User Button

Add another user button object to Form0. This is Userbutton3. Add images in the ‘Image List editor’ by clicking on   located at the right of the ‘Images’ property. Add the same images added to each of the matrix user buttons.

 

Set the ‘Momentary’ property of Userbutton3 to ‘No’.

 

After changing the properties the output should now look like the image shown below.

 

Create a Momentary button

Add another user button object to Form0. This is Userbutton4. Add images in the ‘Image List editor’ by clicking on  located at the right of ‘Images’ property.

 

Click on ‘Add’ to open browser/file explorer.

 

In the browser, inside the folder ‘BlockedUserButtons.ImgData’, select all of the images that contains ‘up’.

 

This time the number of images required is 8 to create 4 Blocks. This is due to the number of states of a Momentary Button.

Arrange the files according to the image below. The   buttons can be used to change the arrangement of the files added.

 

Set the ‘Momentary’ property of Userbutton4 to ‘Both’.

 

Note: Momentary ‘Both’ and ‘Yes’ are different in terms of how report messages occur. A momentary ‘Both’ reports a value of 1 if pressed, and if released it reports a value of ‘0’. A momentary ‘Yes’ reports a value of 1 if pressed and reports nothing if released.

The final output of the Genie program is shown below.

 

Configure the OnChanged Event of the User Buttons

A user button can be configured to report a message to an external host controller when its status has changed. Go to its object inspector and configure the onChanged event as shown below. Do this for all of the user buttons.

 

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 receive and send messages from and 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 the first option to get the messages sent by the screen 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.

 

The Blocked Momentary User Button

Momentary user buttons have two states. Image 0 or ‘Up’ is the ‘released’ state and image 1 or ‘Up Pressed’ is the ‘pressed’ or ‘touched’ state. A momentary user button initially starts at image 0 and goes to image 1 if pressed. If it is released it will go back again to image 0. To create N Blocks, it is needed to have N*2 images.

 

Change the Block of a Momentary User Button

To be able to change the block, it is needed to set the block by writing to the user button. For example, to change the block of a momentary user button to block 3:

 

When writing to a user button to change blocks, the MSB (most significant byte) has a constant value of 0x80 always. To change the block of a momentary user button to block ‘n’, the LSB (least significant byte) value is equal to the block index ‘n’ itself.

 

The Non-momentary Blocked User Button

Non-momentary user buttons have four states. Image 0 or ‘Up’ and image 2 or ‘Down’ are the ‘released’ states. Image 1 or ‘Up Pressed’ and image 3 or ‘Down pressed’ are the ‘pressed’ or ‘touched’ states. A non-momentary user button initially starts at image 0 and if pressed it will go to image 1. If it is released it will go to Image 2 and to image 3 if pressed again. The cycle repeats itself. To create N Blocks, it is needed to have N*4 images.

 

Change the Block of a Non-momentary User Button

To change the block of a non-momentary user button to block 3, the correct message is:

  

To change the block of a non-momentary user button to block ‘n’, the LSB (least significant byte) value is equal to the block index ‘n’ multiplied by 2.

 

The LSB Value: - Momentary vs. Non-momentary Blocked User Buttons

Again, when writing to a user button to change blocks, the MSB (most significant byte) has a constant value of 0x80 always. To change the block of a non-momentary user button to block ‘n’, the LSB (least significant byte) value is equal to the block index ‘n’ multiplied by 2. For momentary user buttons, the LSB value is equal to the block index ‘n’ itself. To further illustrate,

For non-momentary user buttons:

 

For momentary user buttons:

 

Where ‘n’ is the index of the desired block of destination.

 

Set the Blocks

Change the Block of the User Buttons to Block 0

Set all of the LSB values to 0 and click all of the ‘Set Block’ buttons.

 

The image below shows the reported messages after changing the block.

 

Block 0 represents white coloured buttons.

Change the Block of the User Buttons to Block 1

Set all of the LSB values to 2 for the non-momentary buttons and 1 for the momentary button then click ‘Set Block’.

 

The image below shows the reported messages after changing the block.

 

Block 1 represents orange coloured buttons.

Change the Block of the User Buttons to Block 2

Set all of the LSB values to 4 for the non-momentary buttons and 2 for the momentary button then click ‘Set Block’.

 

The image below shows the reported messages after changing the block.

 

Block 2 represents yellow coloured buttons.

 

Change the Block of the User Buttons to Block 3

Set all of the LSB values to 6 for the non-momentary buttons and 3 for the momentary button then click ‘Set Block’.

 

The image below shows the reported messages after changing the block.

 

Block 3 represents green coloured buttons.

Share: