Application Note: 4D-AN-P4010 ViSi-Genie Connection to a Host with Red- Green-Blue LED Control

Similar documents
APPLICATION NOTE. Application Note: 4D-AN-P4009. ViSi-Genie Inputs. Document Date: November 19 th, Document Revision: 1.0

APPLICATION NOTE. Application Note: 4D-AN-P4004. ViSi-Genie Advanced Buttons. Document Date: November 15 th, Document Revision: 1.

Workshop 4 Installation INSTALL GUIDE. Document Date: February 4 th, Document Revision: 1.1

APPLICATION NOTE. Application Note: 4D-AN-P4007. ViSi-Genie Play Video. Document Date: November 15 th, Document Revision: 1.

USER GUIDE. Workshop 4 User Guide. Document Date: 17 th December 2012 Document Revision: 1.1

DATASHEET 4D SYSTEMS. 4D Arduino Adaptor Shield TURNING TECHNOLOGY INTO ART. 4Display-Adaptor-Shield

DATASHEET 4D SYSTEMS. 4Display Shield with 2.2 Display TURNING TECHNOLOGY INTO ART. 4Display-Shield-22

4D Systems. Application Note: 4D-AN-G3001. in ViSi Environment. Document Date: 15 th December Document Revision: 1.0

DATASHEET 4D SYSTEMS. 4D Raspberry Pi Serial Adaptor TURNING TECHNOLOGY INTO ART. 4D-Serial-Pi-Adaptor

DATASHEET 4D SYSTEMS. 4D Raspberry Pi Serial Adaptor TURNING TECHNOLOGY INTO ART. 4D-Serial-Pi-Adaptor

DATASHEET 4D SYSTEMS. 4D Raspberry Pi Serial Adaptor TURNING TECHNOLOGY INTO ART. 4D-Serial-Pi-Adaptor

DATASHEET 4D SYSTEMS TURNING TECHNOLOGY INTO ART. USB to Serial UART Bridge Converter. Document Date: 5 th September 2012 Document Revision: 1.

4D SYSTEMS TURNING TECHNOLOGY INTO ART. Application Note: 4D-AN-G5002

4D SYSTEMS APPLICATION NOTE. Application Note: 4D-AN-P3001 TURNING TECHNOLOGY INTO ART. ViSi - Displaying Third-Party Fonts

DATASHEET. 3.2 Display Bezel. 4D-Bezel-32 For the ulcd-32ptu Display Module. Document Date: 16 th September 2013 Document Revision: 1.

4D SYSTEMS APPLICATION NOTE. Application Note: 4D-AN-G5001 TURNING TECHNOLOGY INTO ART. Serial - Displaying Third-Party Fonts

DATASHEET. gen4 Programming Adaptor For all gen4 sizes (Picaso and Diablo16) gen4-pa. Document Date: 29 th January 2016 Document Revision: 1.

DATASHEET 4D SYSTEMS TURNING TECHNOLOGY INTO ART. microusb Programming Adaptor. USB to UART Serial Bridge

4D Systems. Application Note: 4D-AN-P2002. Playing Video on PICASO based modules using RAW option. Document Date: 15 th December 2012

DATASHEET 4D SYSTEMS. uusb-pa5 uusb-pa5-ii. microusb Programming Adaptor TURNING TECHNOLOGY INTO ART. USB to UART Serial Bridge

DATASHEET 4D SYSTEMS TURNING TECHNOLOGY INTO ART. Carrier Board for μoled-160-g1/g2 CB-160-G1

DATASHEET. 4D 4.3 LCD CAPE Beagle Bone Black 4.3 LCD CAPE. Document Date: 3 rd February 2014 Document Revision: 1.9

2.8 microlcd Intelligent PICASO Display Module

DATASHEET. 4.3 Embedded SPI Display. 4DLCD-FT843 Powered by the FTDI FT800 Video Engine. Document Date: 25 th September 2013 Document Revision: 0.

USER MANUAL. Workshop4 IDE USER GUIDE. Document Revision: 2.1 Document Date: 29 th July 2017

Introduction. Rev.1.2

Font Tool User Guide. Abstract. Document Date: 1 July 2009 Document Revision: 01

udrive-usd-g1 Embedded DOS micro-drive Module Data Sheet

DATASHEET 4D SYSTEMS TURNING TECHNOLOGY INTO ART. Embedded DOS micro-drive Module. μdrive-μsd-g1

DATASHEET. 4.3 Embedded SPI Display. 4DLCD-FT843 Powered by the FTDI FT800 Video Engine. Document Date: 8 th January 2014 Document Revision: 1.

DATASHEET. 4D 7.0 LCD CAPE Beagle Bone Black 7.0 LCD CAPE. Document Date: 3 rd February 2014 Document Revision: 1.2

DATASHEET 4D SYSTEMS. Embedded Audio-Sound Module TURNING TECHNOLOGY INTO ART SOMO-14D. Document Date: 5 th February 2013 Document Revision: 1.

USER GUIDE. Workshop 4 - ViSi-Genie User Guide. Document Date: 2 nd February 2015 Document Revision: 1.4

Serial JPEG Camera Module Data Sheet

DATASHEET. 4D 4.3 LCD CAPE Beagle Bone Black 4.3 LCD CAPE. Document Date: 15 th October 2013 Document Revision: 1.7 DISTRIBUTED BY TEXIM EUROPE

DATASHEET 4D SYSTEMS. Serial JPG Camera Module TURNING TECHNOLOGY INTO ART. Document Date: 5 th September 2012 Document Revision: 1.

REFERENCE 4D SYSTEMS TURNING TECHNOLOGY INTO ART. μdrive. (μdrive-μsd-g1) COMMAND SET. Document Date: 23 rd October 2012 Document Revision: 4.

Serial JPEG Camera Module Data Sheet

DATASHEET 4D SYSTEMS. Arduino Display Module Pack TURNING TECHNOLOGY INTO ART. ulcd-43-pt-ar. Featuring 4.3 Serial Display Module

DATASHEET 4D SYSTEMS. Raspberry Pi Display Module Pack TURNING TECHNOLOGY INTO ART. Featuring a 2.8 Display Module ulcd-28-ptu-pi

USER GUIDE. Workshop4 PRO SMART WIDGETS EDITOR. Document Revision: 1.1 Document Date: 29 th July 2017

TO OUR VALUED CUSTOMERS

DATASHEET. Embedded Audio-Sound Module SOMO-II. Document Date: 8 th January 2014 Document Revision: 0.1

DATASHEET. Embedded Audio-Sound Module SOMO-II. Document Date: 21 st March 2014 Document Revision: 1.1

QT3 Xplained Pro. Preface. Atmel QTouch USER GUIDE

Copyright mikroelektronika, All rights reserved.

USER GUIDE. Atmel Segment LCD1 Xplained Pro. Preface

mikroprog Suite for PIC programming software

USER GUIDE. Atmel QT6 Xplained Pro. Preface

USER GUIDE. Atmel QT1 Xplained Pro. Preface

DATASHEET. Serial Camera Module. ucam-ii. Document Date: 6 th March 2014 Document Revision: 1.1

CEC1702 clicker. a great idea is just a click away

Copyright mikroelektronika, January All rights reserved.

AVR42789: Writing to Flash on the New tinyavr Platform Using Assembly

EDBG. Description. Programmers and Debuggers USER GUIDE

ATtiny104 Xplained Nano. Preface. AVR 8-bit Microcontrollers USER GUIDE

ATAES132A Firmware Development Library. Introduction. Features. Atmel CryptoAuthentication USER GUIDE

DATASHEET. Serial Camera Module. ucam-ii. Document Date: 24 th July 2014 Document Revision: 1.3

QT2 Xplained Pro. Preface. Atmel QTouch USER GUIDE

Ethernet1 Xplained Pro

AVRflash. Program. User manual

USER GUIDE. ATWINC1500 Xplained Pro. Preface

RE866 Interface User Guide

TO OUR VALUED CUSTOMERS

AT09381: SAM D - Debugging Watchdog Timer Reset. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Installing Your Microsoft Access Database (Manual Installation Instructions)

AN LPC82x Touch Solution Quick Start Guide. Document information. Keywords

GS2K External Flash based Host Firmware Update Application Note NT11608A Rev

GUI design made easy. Creating the First Project with. additional software

DATASHEET. 4DPi-24-HAT. 2.4 Primary Display for the Raspberry Pi. In partnership with. Compatible with A+, B+ and Pi2

LV Programmer. User manual

AT03975: Getting Started with SAM L21. Descripton. Features. SMART ARM-Based Microcontroller APPLICATION NOTE

USER GUIDE. Atmel OLED1 Xplained Pro. Preface

DSS Bit Exact Output. Application Report. 1 Display Subsystem (DSS) Overview. Prasad Konnur, Sivaraj R, Brijesh Jadav

Development system. mikrommb for PIC32. User manual

AT06467: Getting started with SAM D09/D10/D11. Features. Description. SMART ARM-based Microcontrollers APPLICATION NOTE

MySonicWall Secure Upgrade Plus

SOMO-14D Embedded Audio-Sound Module

CC13x0 Low Data Rate Operation

AT11512: SAM L Brown Out Detector (BOD) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

QPP Proprietary Profile Guide

APPLICATION NOTE. Atmel QT4 Xplained Pro User Guide ATAN0114. Preface

mikrommb for PIC18FJ TABLE OF CONTENTS strana

Terminal I/O Profile Client Implementation Guide

ESS Utility Android App User Guide

ATECC108/ATSHA204 USER GUIDE. Atmel Firmware Library. Features. Introduction

USER GUIDE EDBG. Description

NOVPEK NetLeap User Guide

STAND-ALONE PROGRAMMER

user's guide to Expand development system capabilities by adding 8K EEPROM memory accessory board EEPROM

mikrobasic PRO for FT90x Creating the first project in

AN S1401 Using BlueMod+S as Beacon

USERS MANUAL. 4D Systems. (4DGL Platform Only) Revision 1.0

USB MODULE USER MANUAL

GS2K OV SDK User Guide. 1VV Rev

AVR42772: Data Logger Demo Application on XMEGA A1U Xplained Pro. Introduction. Features. AVR XMEGA Microcontrollers APPLICATION NOTE

NeoLoch. Inquisitor 4116 DRAM Blade Manual. Overview. Preliminary Release

Apollo2 EVB Quick Start Guide

End User License Agreement

Arduino: RGB LEDs Diagrams & Code Brown County Library

Transcription:

APPLICATION NOTE Application Note: ViSi-Genie Connection to a Host with Red- Green-Blue LED Control Document Date: January 3 rd, 2013 Document Revision: 1.1

The RGB LED is a classic 5 mm with four pins: Description This Application Note explores the possibilities provided by ViSi-Genie to work with a host. In this example, the host is an AVR ATmega328 micro-controller-based Arduino Uno board with a red-green-blue LED. This application note requires: 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; The user has completed a first project like the project described in 4D-AN-P4001 Getting Started First Project with ViSi-Genie. The ViSi-Genie project and the Arduino sketch are provided as examples to help you along this application note. 2012 4D Systems Page 2 of 36 www.4dsystems.com.au

Content Description... 2 Content... 3 Application Overview... 4 Setup Procedure... 5 Launch ViSi-Genie... 5 Load the Example... 6 Create a New Project... 8 Step 1: Design the Screen... 12 Add the Sliders... 12 Add the Button... 15 Define the Actions... 16 Step 2: Identify the Messages... 18 Build and Upload the Project... 18 Debug the Project... 19 Launch the Debugger... 20 Message from a Slider... 21 Message from the Button... 22 Message from Query Values... 22 Query for Sliders 22 Query for Button 23 Send Commands to the Screen... 23 Use the Terminal... 24 Step 3: Write the Host Application... 26 Table of Messages and Commands... 26 Screen Connection Setup... 26 Read Messages... 26 Send Messages... 27 Step 4: Integrate the Screen and the Host... 28 Connect the Screen to the Host... 28 Run the Project on the Screen... 29 Appendix: Example of Code for Arduino... 30 Proprietary Information... 36 Disclaimer of Warranties & Limitation of Liability... 36 2012 4D Systems Page 3 of 36 www.4dsystems.com.au

Application Overview The application allows controlling a red-green-blue LED, which allows virtually any possible colour of the spectrum. The colour is adjusted by moving each of the three sliders, one per component, red, green or blue. A Reset button sets the default mid-range white colour. The screen sends commands to the host micro-controller, when a slider is moved and when the Reset button is pushed. HOST MCU When a slider is moved or the Reset button pushed, the screen sends commands to the host microcontroller. Then the host micro-controller translates the commands and drives the RGB LED. HOST MCU RGB LED The screen is connected to a host, in this example an AVR ATmega328 micro-controller-based Arduino Uno board. The host microcontroller translates the commands received and manages the red-green-blue LED. 2012 4D Systems Page 4 of 36 www.4dsystems.com.au

In the specific cases of the initialisation and reset procedures, the host sends commands to the screen to place the sliders at mid-course. HOST MCU Setup Procedure Launch ViSi-Genie There is an alias for 4D Workshop on the desktop: For initialisation and reset, the host microcontroller sends commands to the screen. Developing such an application is done in just four steps: Design the Screen Identify the Messages Write the Host Application Integrate the Screen and the Host Launch 4D Workshop by double-clicking on the icon: 2012 4D Systems Page 5 of 36 www.4dsystems.com.au

Load the Example You can load the ViSi-Genie project example Example: AN11 ViSi-Genie RGB or follow the procedures described in the next section. Workshop 4 opens and displays the Recent page: To load the existing project, click on the left-most icon Open a standard Open window asks for a ViSi-Genie project 2012 4D Systems Page 6 of 36 www.4dsystems.com.au

select ViSi-Genie RGB and click on it. to load to display the Change Display window: Now, check the type of the screen module: select the Project menu the type and orientation of the screen are displayed: If the screen module you use is different, click on the button Select the screen on the drop-down list and define the orientation. and confirm by. 2012 4D Systems Page 7 of 36 www.4dsystems.com.au

Create a New Project 4D Workshop opens and displays the Recent page: Click on the icon close to Create a New Project on top or, if the settings have been already defined, click on the icon close to Create a New Project on bottom: To create a new program, there are multiple options: Click on the top left-most icon New 2012 4D Systems Page 8 of 36 www.4dsystems.com.au

All those options update the main window with the selection of the screen: The selected screen is displayed: Select the screen, here the LCD-32PT: Orientation is portrait by default. 2012 4D Systems Page 9 of 36 www.4dsystems.com.au

To set it to landscape, just click on the image of the screen to rotate it: The main window now asks for the kind of project: Press Next to proceed: 2012 4D Systems Page 10 of 36 www.4dsystems.com.au

To select ViSi-Genie, just click on the blue arrow: The development environment is now displayed: You are ready to start. 2012 4D Systems Page 11 of 36 www.4dsystems.com.au

Step 1: Design the Screen You can load the example Example: AN11 ViSi-Genie RGB or follow the procedures described hereafter. The Slider object is located on the Inputs pane: The first step is to design the screen with Workshop 4. The control panel includes three sliders, one per component, red, green or blue, with value included between 0 to 255, and one button Reset. Click first on the Slider icon and click on the WYSIWYG screen to place it. Add the Sliders Select the Home menu to display the objects: 2012 4D Systems Page 12 of 36 www.4dsystems.com.au

The Slider0 is added. To move the slider, click and drag it to the desired position: To resize the slider, click on the dotted green rectangle and move it to the desired size: This is the slider for the red component. Change the Palette with High to Red and Low to Maroon: 2012 4D Systems Page 13 of 36 www.4dsystems.com.au

The WISYWYG screen shows the final result: Proceed the same way for the green and blue components: For the green component, change the Palette with High to Lime and Low to Green: For the blue component, change the Palette with High to Aqua and Low to Blue: For both, enter 255 for MaxValue and 0 to MinValue: Now, the maximum and the minimum values of the slider should be set to 255 and 0 respectively. Enter the value to MaxValue and MinValue: The Slider1 and Slider2 are added. The slider for the red component is ready now. 2012 4D Systems Page 14 of 36 www.4dsystems.com.au

Final result looks like: Add the Button The Button object is located on the Buttons pane: Click first on the Button icon and click on the WYSIWYG screen to place it. For more information on the Slider object, please refer to the application note 4D-AN-P4009 ViSi-Genie - Inputs. 2012 4D Systems Page 15 of 36 www.4dsystems.com.au

The WinButton0 is added. Set the Caption to Reset and choose the appearance and the colour as you wish, here Colour set to black, Font to white and size to 16: The control panel is ready now: For more information on the Button object, please refer to the application note 4D-AN-P4004 ViSi-Genie Advanced Buttons. Define the Actions The interface is ready now but WinButton0, Slider0, Slider1 and Slider2 have no actions defined. When pressed or changed, the objects raise events. All the events are going to be defined as Message. 2012 4D Systems Page 16 of 36 www.4dsystems.com.au

The message goes though the serial connection to the host and includes the object identification and the value. When pressed, the WinButton0 button When released after being moved, the Slider0 for the red component raises the event OnChanged and sends a Message: raises the even OnChanged and sends a Message: When released after being moved, the Slider1 for the green component raises the event OnChanged and sends a Message: 2012 4D Systems Page 17 of 36 www.4dsystems.com.au

When released after being moved, the Slider2 for the blue component raises the event OnChanged and sends a Message: Step 2: Identify the Messages The screen is going to generate and send messages to the host. But what are those messages? We need first to build and upload the project, then use either the debugger Codeless Executive Test Instrument or the terminal. Build and Upload the Project To build and upload the project, first select the Comms menu and check that: The communication port light is blue. The micro-sd card is plugged on a USB port or the micro-sd card to SD card converter inserted into the SD-card slot and the drive mounted. 2012 4D Systems Page 18 of 36 www.4dsystems.com.au

Then select the Project menu Once this is done, the screen displays the form: and click on Flash as destination: Finally, select the Home menu Debug the Project and click on the Build button: Using the debugger is the first option to get the messages sent by the screen to the host. It's time now to eject the micro-sd card from the PC and plug it in the micro-sd card slot of the screen. Setting the handler to Message sends the values to the debugger, Genie Test Executor or GTX. 2012 4D Systems Page 19 of 36 www.4dsystems.com.au

Launch the Debugger To debug the project, launch the Genie Test Executor or GTX. Select the Tools menu A new screen appears, with the form and objects we have defined previously: and then click on the GTX button. 2012 4D Systems Page 20 of 36 www.4dsystems.com.au

Just try to move one of the sliders and press Reset. Messages are sent to the debugger: All values are in hexadecimal. The messages are formatted according to the following pattern: Command Object Type Object Index Value MSB Value LSB Checksum 07 04 00 00 38 3B REPORT_EVENT Slider Number 1 0x0038 Message from a Slider The messages from Slider objects are formatted according to the following pattern: Command Object Type Object Index Value MSB Value LSB Checksum The white area on the right displays in green the messages sent to the screen and in red the messages received from the screen: 07 04 00 00 38 3B REPORT_EVENT Slider Number 1 0x0038 Each slider has its specific number: The red slider is number 00, so the message from the red slider starts with 070400 The green slider is number 01, so the message from the red slider starts with 070401 The blue slider is number 02, so the message from the red slider starts with 070402 2012 4D Systems Page 21 of 36 www.4dsystems.com.au

The values allowed for the slider are between 0 and 255. So: minimum value sent on a message is 0 = 0000 Query for Sliders Pressing Query on top of the leftmost slider maximum value sent on a message is 255 = 00FF The messages are sent when the slider is being moved, because Message has been defined for the event OnChanging, which is raised as many times and as long the slider is being moved. Message from the Button The message is formatted according to the following pattern: Command Object Type Object Index Value MSB Value LSB Checksum 07 06 00 00 38 01 adds two lines to the message area on the right: REPORT_EVENT Button Number 1 0x0038 Each button has its specific number: the Reset button is number 00, so the message from the Reset button starts with 070600 Value is always 0000 and sent when the button is pressed. Message from Query Values The Codeless Executive Test Instrument debugger features four Query buttons, one per object: The first line in green is a command sent by the debugger to the screen, asking the values for the first slider: Command Object Type Object Index Checksum 00 04 00 04 READ_OBJ Slider Number 1 2012 4D Systems Page 22 of 36 www.4dsystems.com.au

The second line in red is the message sent back by the screen, with 0400 for Slider0 or slider number 0 for the red component: Command Object Type Object Index Value MSB Value LSB Checksum 05 04 00 00 3A 3B WRITE_ CONTRAST Slider Number 1 58 Query for Button Pressing Query on top of the button The second line in red is the message sent back by the screen: Command Object Type Object Index Value MSB Value LSB Checksum 05 06 00 00 00 03 WRITE_ CONTRAST If the button is pressed Button Number 1 Button released the value is adds two lines to the message area on the right: Command Object Type Object Index Value MSB Value LSB Checksum 05 06 00 00 01 03 The first line in green is a command sent by the debugger to the screen, asking the values for the button: WRITE_ CONTRAST Button Number 1 Button pressed Command Object Type Object Index Checksum 00 06 00 06 READ_OBJ Button Number 1 Send Commands to the Screen The screen sends messages to the host but the host can also send commands to the screen. A first example is the Query Values seen before. Another example is sending a value for a specific slider, for example for Slider0, the slider for the red component. 2012 4D Systems Page 23 of 36 www.4dsystems.com.au

First set the value on the debugger, here close to the maximum The handler for the command is 0400, or the object Slider0, with 04 for slider and 00 for the first slider number 1, and the value is FF. In case the value is greater than 0xFF, for example 0x0102, the value is coded on the MSB and LSB: Command Object Type Object Index Value MSB Value LSB Checksum 01 04 00 01 02 06 WRITE_OBJ Slider Number 1 257 press Set below When a command is sent to the screen, the screen always answers by an acknowledgement: 06 for success, 15 for failure. and two lines are added to the message area on the right: The first line in green is a command: Use the Terminal As an alternative to GTX, the terminal is the second option to get the messages sent by the screen to the host. To launch the Terminal, select the Tools menu Command Object Type Object Index Value MSB Value LSB Checksum 01 04 00 00 FE FB WRITE_OBJ Slider Number 1 254 2012 4D Systems Page 24 of 36 www.4dsystems.com.au

and Click Terminal connect 9600 to open the currently selected com port at 9600 baud in the Terminal program. or Click Terminal connect 115200 to open the currently selected com port at 115200 baud in the Terminal program. A new screen appears: Enter the hexadecimal code in the Terminal window, including the final checksum: Here, the command Set Slider0 to value 0xFE is sent to the screen module, or 01 04 00 00 FE FB displayed in green on the terminal window. To send the commands on hexadecimal format, press The commands sent by the host and the messages sent by the screen are the same as with the Codeless Executive Test Instrument debugger. And the screen answers with the 06 for successful acknowledgement, displayed on red on the terminal window. 2012 4D Systems Page 25 of 36 www.4dsystems.com.au

Step 3: Write the Host Application The application for the host is going to do exactly what has been done with the Genie Test Executor debugger or the terminal. The application for the host has four specific parts related to ViSi-Genie: A table of message and commands, The setup of the connection with the screen, A function to read messages sent by the screen, A function to send messages to the screen. Table of Messages and Commands Based on the messages and commands identified with the debugger, the following list of constants is set: #define READ_OBJ 0x00 #define WRITE_OBJ 0x01 #define REPORT_OBJ 0x05 #define REPORT_EVENT 0x07 const uint16_t buttonreset = 0x0600; const uint16_t sliderred = 0x0400; const uint16_t slidergreen = 0x0401; const uint16_t sliderblue = 0x0402; Using constants with plain English names both #define and const instead of hexadecimal codes eases the readability and the maintenance of the code. Screen Connection Setup The screen could take up to 3 seconds to boot-up, so the setup function integrates a delay delay(3000); and sets the serial connection myserial.begin(9600); with myserial being the serial port. Read Messages The screen is attached to the micro-controller host through the myserial serial port. The readmessage function Reads the bytes coming from the screen, bool readmessage(uint8_t &command0, uint16_t &object0, uint16_t &value0) { bool flag0 = false; uint8_t buffer[6]; uint8_t checksum = 0x00; uint8_t i=0; if (myserial.available()>0) { buffer[i] = myserial.read(); command0 = buffer[0]; checksum = command0; Identifies the command, in this case REPORT_EVENT, if (command0==report_event) { 2012 4D Systems Page 26 of 36 www.4dsystems.com.au

Reads the object, with type and identification, Gets the value, if (myserial.available()>3) { buffer[i] = myserial.read(); checksum ^= buffer[i]; buffer[i] = myserial.read(); checksum ^= buffer[i]; object0 = buffer[1]<<8 buffer[2]; buffer[i] = myserial.read(); checksum ^= buffer[i]; object0 = buffer[1]<<8 buffer[2]; buffer[i] = myserial.read(); checksum ^= buffer[i]; value0 = buffer[3]<<8 buffer[4]; And finally performs and checks the checksum. Send Messages flag0 = (checksum==myserial.read()); return flag0; The screen is attached to the micro-controller host through the myserial serial port. a = sendmessage(write_obj, sliderred, red); The sendmessage function Sends the bytes to the screen, bool sendmessage(uint8_t command0, uint16_t object0, uint16_t value0) { bool flag0 = false; uint8_t buffer[6]; uint8_t checksum = 0x00; uint8_t i=0; Sends the command, in this case WRITE_OBJ passed through command0, buffer[i] = command0; checksum = command0; Sends the object, with type and identification, in this case sliderred passed through object0, buffer[i] = object0 >>8; checksum ^= buffer[i]; buffer[i] = object0 & 0xff; checksum ^= buffer[i]; Sends the value, in this case red = 0x7f;passed through value0, buffer[i] = value0 >>8; checksum ^= buffer[i]; buffer[i] = value0 & 0xff; checksum ^= buffer[i]; 2012 4D Systems Page 27 of 36 www.4dsystems.com.au

Calculates and sends the checksum. buffer[i] = checksum; myserial.write(buffer, i); And finally reads the acknowledgement return (nacack()==0x06); When a command is sent to the screen, the screen always answers: 0x06 for success, 0x15 for failure. uint8_t nacack() { delay(10); while (!myserial.available()); return myserial.read(); // 0x06 or 0xd5 Step 4: Integrate the Screen and the Host Connect the Screen to the Host The screen requires four connections: Regulated +5V, in red, TX of the screen connected to the RX of the host, in yellow, RX of the screen connected to the TX of the host, in white, Ground, in black. It is very important to read this acknowledge of receipt, otherwise it may be considered as the beginning of a new message. 2012 4D Systems Page 28 of 36 www.4dsystems.com.au

Run the Project on the Screen The project starts and the interface runs on the screen. Congratulations, you have completed your first ViSi-Genie project connected to a host! 2012 4D Systems Page 29 of 36 www.4dsystems.com.au

Appendix: Example of Code for Arduino /// /// @mainpage RGB_Genie /// @details Set colour from panel with red-green-blue sliders /// @n /// @n @a Developed with [embedxcode](http://embedxcode.weebly.com) /// /// @author Rei Vilo /// @date Nov 14, 2012 /// @version 207 /// // Core library #include "Arduino.h" // for Arduino 1.0 // Include application, user and local libraries #include "SoftwareSerial.h" // Define variables and constants SoftwareSerial myserial(2, 3); #define RED_PIN 9 #define GREEN_PIN 10 #define BLUE_PIN 11 #define READ_OBJ 0x00 #define WRITE_OBJ 0x01 #define REPORT_OBJ 0x05 #define REPORT_EVENT 0x07 const uint16_t buttonreset = 0x0600; const uint16_t sliderred = 0x0400; const uint16_t slidergreen = 0x0401; const uint16_t sliderblue = 0x0402; 2012 4D Systems Page 30 of 36 www.4dsystems.com.au

uint8_t red, green, blue; uint8_t command; uint16_t object, value; boolean flag; uint8_t nacack() { delay(10); while (!myserial.available()); return myserial.read(); // 0xc6 or 0xd5 bool readmessage(uint8_t &command0, uint16_t &object0, uint16_t &value0) { bool flag0 = false; uint8_t buffer[6]; uint8_t checksum = 0x00; uint8_t i=0; if (myserial.available()>0) { buffer[i] = myserial.read(); command0 = buffer[0]; checksum = command0; if (command0==report_event) { if (myserial.available()>3) { buffer[i] = myserial.read(); checksum ^= buffer[i]; buffer[i] = myserial.read(); checksum ^= buffer[i]; object0 = buffer[1]<<8 buffer[2]; buffer[i] = myserial.read(); checksum ^= buffer[i]; 2012 4D Systems Page 31 of 36 www.4dsystems.com.au

object0 = buffer[1]<<8 buffer[2]; buffer[i] = myserial.read(); checksum ^= buffer[i]; value0 = buffer[3]<<8 buffer[4]; flag0 = (checksum==myserial.read()); return flag0; bool sendmessage(uint8_t command0, uint16_t object0, uint16_t value0) { bool flag0 = false; uint8_t buffer[6]; uint8_t checksum = 0x00; uint8_t i=0; buffer[i] = command0; checksum = command0; buffer[i] = object0 >>8; checksum ^= buffer[i]; buffer[i] = object0 & 0xff; checksum ^= buffer[i]; buffer[i] = value0 >>8; checksum ^= buffer[i]; 2012 4D Systems Page 32 of 36 www.4dsystems.com.au

buffer[i] = value0 & 0xff; checksum ^= buffer[i]; buffer[i] = checksum; myserial.write(buffer, i); return (nacack()==0x06); void update() { analogwrite(red_pin, red); analogwrite(green_pin, green); analogwrite(blue_pin, blue); // value for red channel // value for blue channel // value for green channel void reset() { uint8_t a; red = 0x7f; green = 0x7f; blue = 0x7f; myserial.flush(); a = sendmessage(write_obj, sliderred, red); a = sendmessage(write_obj, slidergreen, green); a = sendmessage(write_obj, sliderblue, blue); update(); 2012 4D Systems Page 33 of 36 www.4dsystems.com.au

// Add setup code void setup() { delay(3000); myserial.begin(9600); pinmode(red_pin, OUTPUT); pinmode(green_pin, OUTPUT); pinmode(blue_pin, OUTPUT); reset(); update(); // Add loop code void loop() { if (readmessage(command, object, value)) { if (command==0x07) { switch (object) { case buttonreset: reset(); break; case sliderred: red = value & 0xff; update(); break; case slidergreen: green = value & 0xff; update(); break; case sliderblue: blue = value & 0xff; update(); break; 2012 4D Systems Page 34 of 36 www.4dsystems.com.au

default: break; delay(100); 2012 4D Systems Page 35 of 36 www.4dsystems.com.au

Proprietary Information The information contained in this document is the property of 4D Systems Pty. Ltd. and may be the subject of patents pending or granted, and must not be copied or disclosed without prior written permission. 4D Systems endeavours to ensure that the information in this document is correct and fairly stated but does not accept liability for any error or omission. The development of 4D Systems products and services is continuous and published information may not be up to date. It is important to check the current position with 4D Systems. All trademarks belong to their respective owners and are recognised and acknowledged. Disclaimer of Warranties & Limitation of Liability 4D Systems makes no warranty, either expresses or implied with respect to any product, and specifically disclaims all other warranties, including, without limitation, warranties for merchantability, non-infringement and fitness for any particular purpose. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. In no event shall 4D Systems be liable to the buyer or to any third party for any indirect, incidental, special, consequential, punitive or exemplary damages (including without limitation lost profits, lost savings, or loss of business opportunity) arising out of or relating to any product or service provided or to be provided by 4D Systems, or the use or inability to use the same, even if 4D Systems has been advised of the possibility of such damages. 4D Systems products are not fault tolerant nor designed, manufactured or intended for use or resale as on line control equipment in hazardous environments requiring fail safe performance, such as in the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, direct life support machines or weapons systems in which the failure of the product could lead directly to death, personal injury or severe physical or environmental damage ( High Risk Activities ). 4D Systems and its suppliers specifically disclaim any expressed or implied warranty of fitness for High Risk Activities. Use of 4D Systems products and devices in 'High Risk Activities' and in any other application is entirely at the buyer s risk, and the buyer agrees to defend, indemnify and hold harmless 4D Systems from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any 4D Systems intellectual property rights. 2012 4D Systems Page 36 of 36 www.4dsystems.com.au