26
com.tom GRAPHIC 4.10 Getting Started V1.1 com.tom GRAPHIC 4.10 Getting Started Copyright © 2000-2014 Beck IPC GmbH Page 1 of 26

com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

  • Upload
    dotuyen

  • View
    227

  • Download
    0

Embed Size (px)

Citation preview

Page 1: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

com.tom GRAPHIC 4.10 Getting Started

Copyright © 2000-2014 Beck IPC GmbH Page 1 of 26

Page 2: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

TABLE OF CONTENTS

1 INTRODUCTION .................................................................................................. 3

2 SYSTEM START-UP ............................................................................................ 3

2.1 WHAT DO YOU NEED TO GET STARTED? ................................................................................. 3 2.2 STEP 1 – HARDWARE SETUP ................................................................................................ 4

2.2.1 DK61 development kit ........................................................................................................ 4

2.2.2 Connecting the com.tom GRAPHIC-4.10 .......................................................................... 4

2.3 STEP 2 – CONFIGURING THE IPC@CHIP® ............................................................................ 5

2.4 STEP 3 – WRITING, COMPILING AND RUNNING A DEMO PROGRAM ............................................ 5

2.4.1 Installing the GCLIB library ................................................................................................ 5 2.4.2 The Hello World example .................................................................................................. 5

2.5 STEP 4 – USING BITMAP GRAPHICS ............................................................................. 12

2.6 STEP 5 - USING FONTS ................................................................................................. 14

3 USING CHIPFORMS CLASS LIBRARY ............................................................. 19

4 FIRMWARE UPGRADE ..................................................................................... 25

5 WHERE TO GET FURTHER INFORMATION .................................................... 25

5.1 GETTING STARTED ............................................................................................................. 25

5.2 UPDATES, TOOLS AND EXAMPLES ........................................................................................ 25 5.3 SUPPORT ........................................................................................................................... 25

Copyright © 2000-2014 Beck IPC GmbH Page 2 of 26

Page 3: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

1 Introduction This document will help you get started with com.tom GRAPHIC and IPC@CHIP. It provides a step-by-step guide on how to put the com.tom GRAPHIC 4.10 into operation. In order to work with the DK61 along with GRAPHIC 4.10 you need:

- Experience with DK60 (SC1x3)

- Experience with IP configuration and networks

- Background knowledge of the C or C++ programming language

2 System Start-up

2.1 What do you need to get started? The following components are among others included within the com.tom Starter Kits - The com.tom GRAPHIC 4.10 Starter Kit consisting of:

o com.tom Graphic 4.10 o com.tom GRAPHIC ETH-01 (or a equivalent com.tom GRAPHIC ETH-0x) o Power supply unit o Crossover Cable

- From the Development Kit DK61:

o Development Board DK60 o Serial null-modem cable o Ethernet cable o Power supply unit o SD Card o Paradigm C++ Beck IPC Edition CD (including IPC@CHIPTOOL, DK61 start-up

documentation and drivers)

- Furthermore you need: Personal Computer o Microsoft Windows 2000/XP/Vista Operating System with Ethernet adapter

- Software from the com.tom website at com.tom GRAPHIC 4.10 Downloads http://www.com-tom.de/products.php?device=com.tom%20GRAPHIC%204.10

Be aware that the Development Kit DK61 are electrostatic sensitive components. Observe general precautions for handling.

Copyright © 2000-2014 Beck IPC GmbH Page 3 of 26

Page 4: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

2.2 Step 1 – Hardware Setup

2.2.1 DK61 development kit As previously explained, previous experience with the DK61 development kit is required in order to be able to test com.tom GRAPHIC 4.10. However, should you lack any experience and this is your first time using it, please refer to the DK60 and DK61 documentation in the firm’s website.

2.2.2 Connecting the com.tom GRAPHIC-4.10 Insert the com.tom GRAPHIC ETH-01 adaptor and look it with the screw.

After setting up our DK61 kit, connecting our com.tom GRAPHIC with the Crossover Cable to ETH1 on the DK61. Connect afterwards your com.tom GRAPHIC to the power supply. On the com.tom GRAPHIC display will appear following screen:

On the right lower corner the firmware version of your com.tom GRAPHIC is displayed. The red points at the bottom show the start-up activity. A running light is shown here. Only the first two dots are blinking alternately when the firmware is running, but no Ethernet link has been detected. After the Ethernet link is established all four dots are blinking alternately.

Copyright © 2000-2014 Beck IPC GmbH Page 4 of 26

Page 5: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

2.3 Step 2 – Configuring the IPC@CHIP® To communicate to the IPC@CHIP via network you have to configure it. Therefore the @CHIPTOOL should be used. For further information on Ethernet configuration and the usage of the @CHIPTOOL please refer to the DK61 Getting Started manual.

2.4 Step 3 – Writing, compiling and running a demo program In order to have a better look of com.tom GRAPHIC 4.10 capabilities, the graphics library (GCLIB) needs to be installed into the Paradigm IDE :

2.4.1 Installing the GCLIB library Download the GCLIB setup on the download section of com.tom GRAPHIC 4.10 on the com-tom website

To use the GCLIB in your Paradigm projects, include the header file GCLIB.H into your C files and add the file GCLIB_GC04.LIB to your project.

2.4.2 The Hello World example The DK61 development kit includes the Paradigm C++ Beck IPC Edition development environment which produces executables for the IPC@CHIP® SC1x3. For more detailed information on how to develop software for the IPC@CHIP® please refer to the DK60 Getting Started manual. Paradigm IDE is the environment used for developing applications for our products. For easier and more effective use, a special utility program is used: Postmake. Postmake is a small tool, which finishes IPC@CHIP® executables and is then invoked by the IDE each time a project has been successfully build. Postmake can then pack the executable and transfer it via FTP to the IPC@CHIP®.

Copyright © 2000-2014 Beck IPC GmbH Page 5 of 26

Page 6: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

Before you start developing HMI applications you have to install the GCLIB library software package as described in the previous chapter. Now let’s write our first graphical “Hello World“ program: 1. Start the Paradigm IDE. You’ll see the main window.

2. Select File → New → Project… from the main menu to create a new project.

3. Complete the appearing dialog as follows:

Project Path and Name: Enter the directory and name where you want to save the project. You may use the Browse button. For this example we choose the name HELLO.PDL.

Target name: Leave as set automatically Target Type: Application [.exe] Platform: Extended address mode Target Model: Large Target Connection: No debugging Math Support: None No Exceptions: Checked Controller Hardware: SC123/SC143 Library Options: Single-Threaded

4. Press the OK button to create the project

Copyright © 2000-2014 Beck IPC GmbH Page 6 of 26

Page 7: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

5. Add the GCLIB library to your project. You can do that with a right mouse click on the EXE node in the project window and choose the menu entry Add node.

6. In the open dialog enter the name GCLIB_GC04.LIB and press Open. Since the GCLIB library is installed in Paradigm’s standard library path, there is no need to specify the absolute path of the library file.

Copyright © 2000-2014 Beck IPC GmbH Page 7 of 26

Page 8: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

7. Now double-click the filename HELLO.C in the project view to open the source file. 8. For this example you’ll now implement a program which initializes the display controller and shows simple text. Therefore add the following bold lines into the file HELLO.C.

#include <clib.h> #include <gclib.h> //screen settings are defined for the needs of our program to values matching //our device, for easier configuration.Example coordinates with the exact //location of our messge are defined as well #define SCREEN_WIDTH 480 #define SCREEN_LENGTH 272 #define UPPER_LEFT_X 200 #define UPPER_LEFT_Y 116 void main(void) { GcErrorCode gcError; // this variable is defined for error control // init the display with no double buffering and specifying display size and // initialization parameters gcError = gcInit(FALSE, SCREEN_WIDTH, SCREEN_LENGTH, (GcInitParams *)& gGcInitParamsGc04DLC0430EZG_T_2); if (gcError != GC_ERROR_NO) { helper_printf("Error: Init failed! Code %d\r\n", gcError); return; } //clear the background by filling the frame buffer with blue colour gcError = gcClear(NULL, GC_BLUE);

Copyright © 2000-2014 Beck IPC GmbH Page 8 of 26

Page 9: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

if (gcError != GC_ERROR_NO) { helper_printf("Error: Clear failed! Code %d\r\n", gcError); return; } // draw "Hello World" by specifying the position and the message written gcError = gcDrawText(NULL, UPPER_LEFT_X, 140, "Hello World!"); if (gcError != GC_ERROR_NO) { helper_printf("Error: DrawText failed! Code %d\r\n", gcError); return; } // stay 10 seconds to show the drawn image RTX_Sleep_Time(10000); // deinit the display gcError = gcDeinit(); if (gcError != GC_ERROR_NO) { helper_printf("Error: Deinit failed! Code %d\r\n", gcError); return; } }

9. Now your source code should look like the figure below (last part not visible due to code’s length):

Copyright © 2000-2014 Beck IPC GmbH Page 9 of 26

Page 10: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

10. Build the project; press the button in the red circle to do so:

The compiler will do its work and then show a success message. A file called hello.exe has now been created and the two following windows will be visible in your screen:

Copyright © 2000-2014 Beck IPC GmbH Page 10 of 26

Page 11: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

11. In this window, fill in the “Remote Ip” field that is assigned to your DK60 device and ftp as username and password. Click on the “Go” button

The following progress bar should be visible on your screen:

12. Access your DK60 device (check the documentation in Beck IPC website under Support->First Steps->IPC@CHIP® starter kits->DK61 and Paradigm C/C++ >Documentation) and execute your demo program, in our case hello.exe. The following result is visible

Copyright © 2000-2014 Beck IPC GmbH Page 11 of 26

Page 12: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

2.5 Step 4 – USING BITMAP GRAPHICS The GCLIB library supports the Microsoft Windows® bitmap file format BMP, as well as *.jpg, *.png and *.gif files. So you can load and show such images on the screen using the corresponding functions (see GCLIB API documentation). In order to show these capabilities, we shall extend our demonstration code and add three more functions. The code following shows the three new functions in bold:

#include <clib.h> #include <gclib.h> //screen settings are defined for the needs of our program to values matching //our device, for easier configuration.Example coordinates with the exact //location of our messge are defined as well #define SCREEN_WIDTH 480 #define SCREEN_LENGTH 272 #define UPPER_LEFT_X 200 #define UPPER_LEFT_Y 116 void main(void) { GcErrorCode gcError; // this variable is defined for error control GcImage gcImageExample; // this variable is defined for storing the image // init the display with no double buffering and specifying display size and // initialization parameters

gcError = gcInit(FALSE, SCREEN_WIDTH, SCREEN_LENGTH, (GcInitParams *)& gGcInitParamsGc04DLC0430EZG_T_2);

if (gcError != GC_ERROR_NO) { helper_printf("Error: Init failed! Code %d\r\n", gcError); return; }

Copyright © 2000-2014 Beck IPC GmbH Page 12 of 26

Page 13: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

//version of the structure type. This field is included to keep the library //compatible with future versions.The library will check if it can handle the //present version of a structure data type.This field must be set to 1 before //passing a GcImage object to any library function gcImageExample.structVer = 1; //load image named “example.bmp” gcError = gcLoadImageFromFile(&gcImageExample, "example.bmp"); if (gcError != GC_ERROR_NO) { helper_printf("Error: LoadImage failed! Code %d\r\n", gcError); return; } //clear the background by filling the frame buffer with white colour gcError = gcClear(NULL, GC_WHITE); if (gcError != GC_ERROR_NO) { helper_printf("Error: Clear failed! Code %d\r\n", gcError); return; } //draw the image loaded to our device thus making it visible gcError = gcDrawImage(NULL, 0, 0, &gcImageExample); if (gcError != GC_ERROR_NO) { helper_printf("Error: DrawImage failed! Code%d\r\n", gcError); return; } // draw "Hello World" by specifying the position and the message written gcError = gcDrawText(NULL, UPPER_LEFT_X, UPPER_LEFT_Y, "Hello World!"); if (gcError != GC_ERROR_NO) { helper_printf("Error: DrawText failed! Code %d\r\n", gcError); return; } //use gcFlush, necessary especially in case of enabling double buffering. It //makes sure that all hardware-accelerated drawing functions have finished.If //double buffering is enabled it switches the frame buffers and thus eventually //causes everything drawn since the last gcFlush() call to be displayed gcError = gcFlush(); if (gcError != GC_ERROR_NO) { helper_printf("Error: Flush failed! Code %d\r\n", gcError); return; } // stay 10 seconds to show the drawn image RTX_Sleep_Time(10000); // deinit the display gcError = gcDeinit(); if (gcError != GC_ERROR_NO)

Copyright © 2000-2014 Beck IPC GmbH Page 13 of 26

Page 14: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

{ helper_printf("Error: Deinit failed! Code %d\r\n", gcError); return; } }

gcLoadImage is used to load the picture in our device, gcDrawImage is used in order to show the picture and gcFlush is used to make sure that all hardware-accelerated drawing functions have finished (necessary in case of double buffering). The picture that is displayed, in our case the “example.bmp” located in the directory of gcConverter utility program (used in the next section), must be uploaded and placed in the same directory as our executable, as declared in the DrawImage function. Our image is then shown as background to our “Hello World” text. In the selection of the image, the resolution of the display is to be noted.

2.6 STEP 5 - USING FONTS The GCLIB library supports to load user specific fonts. The font must be enclosed in the Beck

Graphics Font format BGF. To convert a font from your Windows PC to the BGF format you should use the IPC@CHIPP® Graphic File Converter (GcConverter) which is available on the CD or in the download section of the Beck IPC website

In this section a font installed on your Windows PC will be converted to the BGF format. After that the Hello World example from the previous chapter will be extended to use the font. Download the GcConverter setup and install it on your PC. When completed, the program can be found in the Windows® start menu.

1. Start the GcConverter. 2. Select the Convert fonts tab.

Copyright © 2000-2014 Beck IPC GmbH Page 14 of 26

Page 15: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

3. Click the browse button “...” on the right side of the window, select Arial, Bold and size 10 (in our example is the German language version of the window) and click the OK Button :

Note: Please make sure that you are allowed to convert a font and use it in your

Copyright © 2000-2014 Beck IPC GmbH Page 15 of 26

Page 16: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

IPC@CHIP® application. The Arial font used in this example is not licensed for free. So you may not use it in your IPC@CHIP application. Here it will be used for demonstration purpose only since it is installed on every Window PC! There are some other free fonts available (such as “bitstream”) which are published under free licences.

4. Press the Start button and choose the directory where the font file should be created and enter arial10 as name for the bgf file:

5. Now open the Hello World example from the previous chapter and extend the hello.c file with the following bald lines:

#include <clib.h> #include <gclib.h> //screen settings are defined for the needs of our program to values matching //our device, for easier configuration.Example coordinates with the exact //location of our messge are defined as well #define SCREEN_WIDTH 480 #define SCREEN_LENGTH 272 #define UPPER_LEFT_X 200 #define UPPER_LEFT_Y 116 void main(void) { GcErrorCode gcError; // this variable is defined for error control GcImage gcImageExample; // this variable is defined for storing the image GcFont gcFontArial; // this variable is defined for storing the font // init the display with no double buffering and specifying display size and // initialization parameters gcError = gcInit(FALSE, SCREEN_WIDTH, SCREEN_LENGTH, (GcInitParams *)& gGcInitParamsGc04DLC0430EZG_T_2); if (gcError != GC_ERROR_NO) { helper_printf("Error: Init failed! Code %d\r\n", gcError); return; }

Copyright © 2000-2014 Beck IPC GmbH Page 16 of 26

Page 17: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

//version of the structure type. This field is included to keep the library //compatible with future versions.The library will check if it can handle the //present version of a structure data type.This field must be set to 1 before //passing a GcImage object to any library function gcImageExample.structVer = 1; //load image named “example.bmp” gcError = gcLoadImageFromFile(&gcImageExample, "example.bmp"); if (gcError != GC_ERROR_NO) { helper_printf("Error: LoadImage failed! Code %d\r\n", gcError); return; } //clear the background by filling the frame buffer with white colour gcError = gcClear(NULL, GC_WHITE); if (gcError != GC_ERROR_NO) { helper_printf("Error: Clear failed! Code %d\r\n", gcError); return; } //draw the image loaded to our device thus making it visible gcError = gcDrawImage(NULL, 0, 0, &gcImageExample); if (gcError != GC_ERROR_NO) { helper_printf("Error: DrawImage failed! Code%d\r\n", gcError); return; } //version of the structure type. This field is included to keep the library //compatible with future versions.The library will check if it can handle the //present version of a structure data type.This field must be set to 1 before //passing a GcImage object to any library function gcFontArial.structVer = 1; //load font file named “arial10.bgf” gcError = gcLoadFontFromFile( &gcFontArial, "arial10.bgf" ); if (gcError != GC_ERROR_NO) { helper_printf("Error: LoadFontFromFile failed! Code %d\r\n", gcError); return; } // set loaded font as current font gcFontArial.color = GC_BLACK; // set font color to black gcError = gcSetFont(&gcFontArial); if (gcError != GC_ERROR_NO) { helper_printf("Error: SetFont failed! Code %d\r\n", gcError); return; } // draw "Hello World" by specifying the position and the message written gcError = gcDrawText(NULL, UPPER_LEFT_X, UPPER_LEFT_Y, "Hello World!"); if (gcError != GC_ERROR_NO)

Copyright © 2000-2014 Beck IPC GmbH Page 17 of 26

Page 18: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

{ helper_printf("Error: DrawText failed! Code %d\r\n", gcError); return; } //use gcFlush, necessary especially in case of enabling double buffering. It //makes sure that all hardware-accelerated drawing functions have finished.If //double buffering is enabled it switches the frame buffers and thus eventually //causes everything drawn since the last gcFlush() call to be displayed gcError = gcFlush(); if (gcError != GC_ERROR_NO) { helper_printf("Error: Flush failed! Code %\r\n", gcError); return; } // stay 10 seconds to show the drawn image RTX_Sleep_Time(10000); // deinit the display gcError = gcDeinit(); if (gcError != GC_ERROR_NO) { helper_printf("Error: Deinit failed! Code %d\r\n", gcError); return; } }

In order to execute the program, the same process as the previous two times is followed;

Build and upload (using Postmake) the project. However in our case the font file, arial10.bgf, must be uploaded in the same directory as our executable. After execution our screen will now have the following image drawn:

Copyright © 2000-2014 Beck IPC GmbH Page 18 of 26

Page 19: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

3 USING CHIPFORMS CLASS LIBRARY

For more extended applications, users have the ability to use ChipForms class library. This library provides means to draw GUI (Graphical User Interface) objects and handles the touch events for the drawn objects. This library is available as a C++ software package and can be found in the download center.

Download the latest ChipForms zip file and extract it. Should you wish to check the functions of the library, open the index.html file located in the documentation directory. A new demo application will be created in a way similar to the example provided in previous pages. Open Paradigm C++ and select File->New->Project

Copyright © 2000-2014 Beck IPC GmbH Page 19 of 26

Page 20: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

In the following window settings are same with the examples previously shown

As this is a C++ example, click on “Advanced” and select “.cpp Node” as Initial nodes and then click OK

Copyright © 2000-2014 Beck IPC GmbH Page 20 of 26

Page 21: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

Click OK, then Right Click on the demo.exe file of your project and select Add Node

Navigate to your ChipForms directory and select chipforms.lib file, as well as gclib_gc04.lib from the Gclib library.

Copyright © 2000-2014 Beck IPC GmbH Page 21 of 26

Page 22: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

The other library is to be used for Huge Model projects, differences between the models can be found in the program’s Help. Click Open and then select the demo.cpp file. Paste the following code inside

/* // demo example using ChipForms library */ //include the header files necessary for our demonstration,please also check the //index.html inside the “documentation” directory of the library #include <clib.h> #include "CForm.h" #include "CButton.h" #include "CMessageWindow.h" #include "CLabel.h" //screen settings are defined for the needs of our program to values matching //our device, for easier configuration #define WIDTH 480 #define HEIGHT 272 //an exit flag is defined that is used to terminate our program, any event //however could set the flag, such as pressing the ESC key bool gExitDemo = false; //Although there is a default implementation of this function using //predefined default display parameters, the user is expected to //override the function in his/her own application, in order to define //the proper initialization parameters GcInitParams *ChipForms_GetDisplayInitParams() { return (GcInitParams *)&gGcInitParamsGc04DLC0430EZG_T_2; }

Copyright © 2000-2014 Beck IPC GmbH Page 22 of 26

Page 23: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

//Same thing applies for the display dimensions as well void ChipForms_GetDisplayDimensions(unsigned short & width, unsigned short & height) { width = WIDTH; height = HEIGHT; return; } class CHelloForm; //create an instance of the form class CHelloForm *helloForm; //define the class for hello world Form class CHelloForm : public CForm { public: //class constructor with arguments the parent window and the text CHelloForm() : CForm(NULL, "Hello Form") { //create exit button with specific name and coordinates buttonExit = new CButton("Exit", 50, 180); // create and add an actionListener for the exit // button which calls the local method // ‘onExitButton’ from this object. buttonExit->addActionListener(CActionListener( this, (WindowHandlerPtr)&CHelloForm::onButtonExit) );

// register the exit button to the form, true is used to free memory // on destroy of the parent window automatically

registerControl(buttonExit, true); //create and register to the form an example label labelHelloWorld = new CLabel("Hello World!", 150, 80); // register the label to the form, true is used to free memory // on destroy of the parent window automatically registerControl(labelHelloWorld,true); } //method to handle what happens after pressing exit button void onButtonExit(CWindow *source) { //after clicking the exit button a message window appears with arguments //source, coordinates, text and buttons CMessageWindow mymessage(this, 300, 180, "Do you want to exit?", CMSGWNDMODE_OK | CMSGWNDMODE_CANCEL); //if the OK button is pressed flag becomes true and main function’s loop ends if (mymessage.showModal() == CMSGWNDMODE_OK) { gExitDemo = true; } } private: CButton *buttonExit; CLabel *labelHelloWorld; }; //main fuction, the main event loop. This loop should be included in every //application which utilizes the ChipForms Library, in order to correctly handle //events. The sleep time given in the RTX_Sleep_Time() function could //theoretically be set to any wished value, as long as the sleep period is short

Copyright © 2000-2014 Beck IPC GmbH Page 23 of 26

Page 24: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

//enough for the event actions to be properly visible. 5 to 30 ms would be a //suitable sleep period in practice void main() { CHIPFORM_EVENT *event; helloForm = new CHelloForm(); //Brings the form to the front helloForm->setFocus(); //while loop that ends by changing value of the flag, that is when the OK //button is clicked while(!gExitDemo) { while((event = ChipForm_GetNextEvent()) != NULL) { ChipForm_SendToWindow(event); } //go for sleep for 5 ms RTX_Sleep_Time(5); } //delete the dynamically allocated variable and return memory allocated by new //back to the heap delete helloForm; }

In this specific demo, we use the chip forms library to demonstrate the appearance of forms, labels, buttons and message windows. Therefore we include all the necessary header files in the beginning of our program. After defining a variable necessary to terminate our main function, the screen is initialised to its proper parameters. Next step is creating a form with some example arguments, then creating and registering a button and a label into the window (thus making these elements visible). The addActionListener method should be used to add an action listener to the form, which shall be called within the event handler, when the event occurs, in our case the event is pressing Exit button. The method to handle what happens after pressing the exit button is afterwards written. For our program, a message window appears having an OK and a Cancel button; clicking Cancel returns to our original screen image, while clicking OK terminates our main function and consequently our program. The following image shows what will appear on your screen:

Copyright © 2000-2014 Beck IPC GmbH Page 24 of 26

Page 25: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

After pressing the Exit Button, the message box described in our program appears on the designated coordinates; pressing Cancel returns to the original picture, while OK shuts down our program

4 Firmware Upgrade In this section we shall describe how the module’s firmware can be updated, should a newer version be uploaded. For that reason a special utility program is used, named gcprog_gc04_sc186_eth_v1.01.exe. The whole process requires the user at first to upload this program, as well as the .hex image containing the new firmware version via FTP to the DK61 device. Connect via Telnet with the device (refer to the DK61 documentation should you have questions for the process). Navigate to the directory containing the two files and execute the program followed by the .hex file, for example “gcprog_gc04_sc186_eth_v1.01.exe firmware_0.21.hex”. The whole process lasts less than a minute. After completion of the process, the new firmware version will be visible in the bottom right corner (in the following picture a beta v0.21 can be seen ) :

5 WHERE TO GET FURTHER INFORMATION

5.1 Getting Started All software referred to in this document can be downloaded from the Getting Started website at http://www.com-tom.de/download or (IPC@CHIP/DK61 related) http://www.beck-ipc.com/gettingstarted

5.2 Updates, tools and examples Regularly check out the IPC@CHIP® website at http://www.beck-ipc.com/ipc for IPC@CHIP related updates, for com.tom GRAPHIC updates please visit http://www.com-tom.de • Firmware updates • New APIs • Example programs that you may use as a base for your own applications • Useful tools for your development • Application notes

5.3 Support If you need support please…

1. Check our support website at http://www.beck-ipc.com/ipc/support. 2. Visit our forum at http://forum.beck-ipc.com. Here you will find a lot of answers to customer problems and you can also add your own ideas and questions.

3. Contact our support at mailto:[email protected]. Of course you may also contact us by phone. But please use email if possible. This not only reduces the time you spend on the phone, it also allows us to easily manage the questions and identify problem areas. Important or frequent questions and the corresponding answers are becoming part of our FAQ that is published on the Internet.

Copyright © 2000-2014 Beck IPC GmbH Page 25 of 26

Page 26: com.tom GRAPHIC 4.10 Getting Started · com.tom GRAPHIC 4.10 Getting Started V1.1 1 Introduction ... - Experience with IP configuration and networks ... 2 System Start-up 2.1 What

com.tom GRAPHIC 4.10 Getting Started V1.1

Copyright © 2000-2014 BECK IPC GmbH All rights reserved

No part of this document may be copied or reproduced in any

form or by any means without the prior written consent of

BECK IPC GmbH. The information in this document is subject

to change without notice. Devices sold by BECK IPC GmbH

are covered by warranty and patent indemnification

provisions appearing in BECK IPC GmbH Terms and

Conditions of Sale only.

BECK IPC GmbH MAKES NO WARRANTY, EXPRESS,

STATUTORY, IMPLIED OR BY DESCRIPTION,

REGARDING THE INFORMATION SET FORTH HEREIN OR

REGARDING THE FREEDOM OF THE DESCRIBED

DEVICES FROM INTELLECTUAL PROPERTY

INFRINGEMENT. BECK IPC GmbH MAKES NO

WARRANTY OF MERCHANTABILITY OR FITNESS FOR

ANY PURPOSE.

BECK IPC GmbH shall not be responsible for any errors that

may appear in this document. BECK IPC GmbH makes no

commitment to update or keep current the information

contained in this document.

Life critical applications - BECK products are not authorized

for use as critical components in life support devices or

systems unless a specific written agreement pertaining to

such intended use is executed between the customer and

BECK prior to use. Life support devices or systems are those

which are intended for surgical implantation into the body, or

which sustain life, and whose failure to perform, when

properly used in accordance with instructions for use provided

in the labeling, can be reasonably expected to result in

significant injury to the user. BECK IPC GmbH customers

using or selling these products for use in such applications do

so at their own risk and agree to fully indemnify BECK IPC

GmbH for any damages resulting from such application.

Right to make changes - Beck IPC GmbH reserves the right

to make changes without notice in the products, including

software, described or contained herein in order to improve

design and/or performance. Beck IPC GmbH assumes no

responsibility or liability for the use of any of these products.

Copyright © 2000-2014 Beck IPC GmbH Page 26 of 26