Introduction

This codebase example demonstrates how an external host interacts with rocker switch objects on the display module. A display module loaded with a ViSi-Genie program follows the Genie Standard Protocol when it sends and receives messages to and from an external host. The protocol utilizes only a handful of commands and is simple and easy to implement. This codebase example focuses on demonstrating the use of some of these commands when interacting with rocker switch objects.
The display module used in this example is the uLCD-32PTU. The host used is the GTX Tool running on a PC. The GTX tool is a utility inside the Workshop 4 IDE.

Prerequisites
This codebase example assumes that the reader already knows how to create a project and how to program a display module in the ViSi-Genie environment. Beginners may refer to any of the following application notes.
- ViSi-Genie Getting Started - First Project for Picaso Display Modules.
- ViSi-Genie Getting Started - First Project for Diablo16 Display Modules.
The Project
The attached ViSi-Genie project was created by adding two rocker switch objects - Rockerswitch0 and Rockerswitch1 - to the WYSIWYG area. The colors of the rocker switch objects were modified by changing their SwitchColors properties in the object inspector. Rockerswitch0 was configured to report an event when it is touched-and-released (see the image below). Static text objects were then added as labels.
Event Handler Configuration
Rockerswitch0 : OnChanged

Rockerswitch1 : No Event Handler

When Rockerswitch0 is touched-and-released, it changes state accordingly and sends a message to the serial port. The serial port of the display module is connected to a uUSB-PA5 programming module, which, in turn, is connected to a USB port of the PC.
The GTX Tool
The Workshop 4 IDE has a utility that can be used to communicate with the display module through the programming module (a uUSB-PA5 or a 4D USB Programming cable). The GTX tool runs on the PC and displays messages coming from the display module. Conversely, the GTX tool can also send messages to the display module.

The Genie Standard Protocol
Again, a display module loaded with a ViSi-Genie program follows the Genie Standard Protocol when it sends and receives messages to and from an external host. The Genie Standard Protocol provides a simple yet effective interface between the display and the host controller and all communications are reported over this bidirectional link. The protocol utilizes only a handful of commands and is simple and easy to implement. In this codebase example, the use of the following messages of the Genie Standard Protocol is demonstrated.
Message | Description |
READ_OBJ | This message is used for reading the value(state) of an object. A READ_OBJ message is sent by the host to the display module. |
WRITE_OBJ | This message is used for changing the value(state) of an object. A WRITE_OBJ message is sent by the host to the display module. |
REPORT_OBJ | This is the response message from the display after the host issues a READ_OBJ message. |
REPORT_EVENT | When correctly configured, an object on the display can send a REPORT_EVENT message when its value(state) has been changed through touch. |
To know more about the Genie Standard Protocol, see the ViSi-Genie User Reference Manual.
Project File(s)
Location and Filename | Description |
Workshop Files\ RockerSwitch_R_1_0.zip |
This is the Workshop ViSi-Genie project zip file. |
Instructions
Follow the procedure below to run this example. The reader is also advised to watch the accompanying video.
- Extract the content/s of the ViSi-Genie Project zip file to a folder.
- Open the project in Workshop.
- Compile the project source code and download or upload the program to the target display module (a uLCD-32PTU in this codebase example). Let Workshop copy the supporting files to a uSD card mounted to the PC.
- Properly unmount the uSD card from the PC and mount it to the uLCD-32PTU.
- Open the GTX tool of the Workshop 4 IDE.
The application should now run. If not familiar with the details of the steps above, see the application notes below.
- ViSi-Genie Getting Started - First Project for Picaso Display Modules.
- ViSi-Genie Getting Started - First Project for Diablo16 Display Modules.
Property | Details |
Number | 4D-CD-00064 |
Revision | 1.00 |
Author | 4D Systems |
Difficulty | easy |
Tested on a | uLCD-32PTU |
Relevant 4D Product/s | All Picaso and Diablo16 touch displays |
Workshop 4 Environment | ViSi-Genie |
Recommended Codebase Examples | NA |
Relevant Application Notes |
ViSi-Genie Getting Started - First Project for Picaso Display Modules.
ViSi-Genie Getting Started - First Project for Diablo16 Display Modules. |
Relevant Projects | NA |
Relevant Workshop 4 IDE Examples | NA |