background image

 

 

 

                                                             ©New Eagle 2017         

www.neweagle.net

       PH: 734.929.4557 

 

 

 

 

 

  

 
 
 

C O N T R O L  S Y S T E M  S O L U T I O N S

 

 

 

 
 
 

 
 
 

 
 
 

 
 
 
 
 

 

 

Getting Started with a

 

Raptor™ Touchscreen Display

 

Building an Inter active Application

 

 

Last Updated: 

3/8/2017 

 

 
 
 

 

 

 
 

 
 
 

 

 

 

 

 

 

 

 

Summary of Contents for Raptor VeeCAN 800

Page 1: ... New Eagle 2017 www neweagle net PH 734 929 4557 CONTROL SYSTEM SOLUTIONS Getting Started with a Raptor Touchscreen Display Building an Interactive Application Last Updated 3 8 2017 ...

Page 2: ...ogramming the Display 9 3 Creating a Display 11 3 1 Screens 11 Screen Outputs 11 Switching Between Screens 12 3 2 Drawing 12 Drawing Order 13 Standard Drawing Blocks 13 Drawing Images 15 Clearing Screen Area 15 Drawing Text Example 16 3 3 Working with the Touchscreen 19 Touchscreen Calibration 19 Touchscreen Status 19 Touchscreen Buttons 20 4 Data Logging 22 4 1 Under the Hood 22 4 2 USB Blocks an...

Page 3: ...revious and Next Ports 13 Figure 3 2 2 a Standard Drawing Blocks 14 Figure 3 2 3 a Display Image Blocks 15 Figure 3 2 4 a Block to Clear Screen Area 15 Figure 3 2 5 a Raptor String and Printf blocks 16 Figure 3 2 5 b Basic Example to Draw Text 17 Figure 3 2 5 c Drawing text in an Element Block Triggered Subsystem 17 Figure 3 2 5 d Comparing Techniques Drawing Text Without an Element Block vs With ...

Page 4: ...ne Interfaces that may either directly control the host system or coordinate with other devices 1 1 Motivation Figure 1 a The Raptor Display Library The purpose of this paper is to introduce the reader to the Raptor Touchscreen Display A user with no knowledge of the device should be able to put together a simple but useful application It is assumed that the reader has a basic understanding of Mat...

Page 5: ...C Operating Voltage 10 32 VDC Available I O 14 Analog Inputs 4 Digital Inputs 8 Outputs 2 CAN Channels Ethernet 2 USB Ports PC 1 gigahertz GHz or faster 32 bit x86 processor 1 gigabyte GB RAM 32 bit 16 GB available hard disk space DirectX 9 graphics device with WDDM 1 0 or higher driver One USB port and flash drive with 128MB or higher free space Datalink Adapter optional Though optional a CAN ada...

Page 6: ... of the display devices Raptor 2015b and newer no longer support 32 bit MATLAB instillations Figure 1 2 2 a Raptor Compatibility Matrix Development Environment Windows 7 or Windows 10 Matlab 2014a or newer CodeSourcery Sourcery G Lite for ARM GNU Linux Visual Studio 2010 Visual C 2010 SP1 Full Visual Studio 2010 SP1 Update NetFX4 5 Raptor 2016b ...

Page 7: ... a Model Update ctrl d The user may validate a model without executing a full build by performing a Model Update This will validate parameters connections data types and block specific constraints to let the user know if a build will fail and what can be done to prevent it Building a Raptor Touchscreen Display Model In Simulink a build can be triggered with ctrl b This will begin the task of trans...

Page 8: ...Configuration Settings in the Target Definition Block Compiler There are actually two parameters to choose for Compiler Device and Simulator If a compiler is selected not set to none for device then a device binary to program a physical VeeCAN 800 will be generated If a compiler for Simulator is selected then the same code will be compiled and loaded into a simulator executable Figure 2 1 3 b Comp...

Page 9: ...mulator In addition to simulating the on screen graphics users can use a virtual CAN channel to test the functionality of the display Open Raptor CAN and select the simulate tab notice that the screen will be blank at first Next choose the DBC file you want to simulate by selecting Add DBC The messages from the DBC file will appear they can be expanded using the icon give the user access to indivi...

Page 10: ...2 1 3 Programming from a USB drive Programming the display requires a USB flash drive To begin reprogramming unzip the contents of the device binary into top level of the flash drive ie so the file system on the flash drive mirrors what is inside of the zip file With the display turned on insert the flash drive into either USB port After a few seconds the device should detect a new program on the ...

Page 11: ...tion available From the hardware manufacturer Make sure the power is off then insert the USB Stick into the USB Port Turn on the power while simultaneously holding down the small red button right next to the USB port on the back of the unit The screen will turn blue and after a few seconds the update process will begin There will be on screen information during the update process Please remove the...

Page 12: ...the Init or IsCurrentScreen subsystems using ports as necessary to pipe relevant data back and forth Init Actions that are executed when a screen is initialized go into the Init function This subsystem is called each time the screen is brought up as the current screen That is for two hypothetical screens MyScreen1 and MyScreen2 if the application begins on MyScreen1 switches to MyScreen2 and then ...

Page 13: ...led subsystem allowing everything inside it to run continuously free of the display loop This is where logic I O and communications relevant to a particular screen should go Switching Between Screens Figure 3 1 2 a Raptor Goto Screen Block Called by a Falling Edge Trigger Switching between screens can be done with the Goto Screen block When executed this block will switch from the current screen t...

Page 14: ...gure 3 2 1 a to draw one element on top of another simply put the next port of the element that goes on bottom into the previous port of the element that goes on top Standard Drawing Blocks There are ten standard drawing blocks that cover everything from drawing and filling in differently shaped regions to writing text to the screen As an aid all of these blocks show a sample of their selected col...

Page 15: ... drawing text see section 3 2 5 Draw Circle Draws a circle of specified color and thickness around a coordinate location with a specific radius Figure 3 2 2 a Standard Drawing Blocks Fill Circle Fills in a circle area of specified color around a coordinate location with a specific radius Draw Rectangle Draws a rectangle of specified color and thickness between two coordinate locations Fill Rectang...

Page 16: ...ified directly or through a port with an Image Ref block The Image Ref can be useful for using application logic to draw either one image or another Clearing Screen Area Sometimes it is helpful to be able to clear an area There are a few blocks in Raptor to help to help with clearing screen area Clear Rect Figure 3 2 4 a Block to Clear Screen Area The Clear Rect block works just like the Fill Rect...

Page 17: ... object Raptor provides a few blocks to make working with String text easier 3 2 5 a Raptor String and Printf blocks The first block Raptor provides is the String block The String block allocates a block of program memory of a particular character length and if defined initializes it with a null terminated String value The benefit to this is that a String of text can now be passed around without n...

Page 18: ...m zero once a second to give us some sample data to change live at runtime Figure 3 2 5 b Basic Example to Draw Text The above example will draw text on the screen updating the text value every second The problem with this approach is that Raptor will not clear the previous string before drawing the next one The result will be a strange overlapped string drawn on the screen To updated strings from...

Page 19: ...18 New Eagle 2017 www neweagle net PH 734 929 4557 Figure 3 2 5 d Comparing Techniques Drawing Text without an Element Block vs With One ...

Page 20: ...ramming The application designer can and should provide some extra gesture to recalibrate the display if need be This can be a long press a button or a simple pattern If the touchscreen needs to be recalibrated this can be done with the Recalibrate Screen block triggered with a Function call generator If possible in the application the gesture to initiate recalibration should not be dependent on n...

Page 21: ...to show whether or not the screen is currently being touched and if so in what coordinate location Figure 3 3 2 a Display Touchscreen Status block Possible uses include Detecting when a particular area has been pressed Determining how long the screen has been pressed Transforming user input Drawing a cursor momentarily when the user presses the screen to indicate where the program interprets the l...

Page 22: ...software This block should be placed in the Create_Backgound subsystem of a Screen_Definition This ensures that the button will only be active when the current scree on which the button is drawn is active The Button Status block may be placed anywhere in the model and acts just like a digital input outputting a high value when the button is pressed and low when released Note When using a touchscre...

Page 23: ...display application These blocks come prewritten when the user opens a new raptor display model using the raptor_create_touch_display ProjectName function in MATLAB 4 1 Under the Hood When the user delves into the Simulink code behind the data logger example_project Foreground Display CAN Logging Log CAN1 they will eventually see the image below Figure 4 1 a Create_Display Code for CAN Logging 22 ...

Page 24: ...e Printf block Here the string is formatted in order to give a path to where the file will be written disk_sda1 is referencing the USB This allows the file to be written onto the USB bdroot is the project title _v 03 0F_ 06 0F_ formats the path to include the number of the Log created with leading zeros and no decimals as well as the build number used with leading zeros and no decimals E g if the ...

Page 25: ...created when the user creates a new model the example can be easily replicated Figure 4 2 a Simple USB Read Application Within the Open a File triggered subsystem the File Open block takes in a string with the path of the file the user wishes to open keeping in mind to include disk_sda1 as it allows access to the USB Within the Read a File enabled subsystem there is a File Read block that then rea...

Page 26: ... can be put into a triggered subsystem that is triggered whenever the user would like to disconnect the USB from the display This Raptor block ensures that the USB drive is safely removed upon the user s approval Figure 4 2 2 a USB Eject Block 5 Conclusion The Raptor Touchscreen Display is a powerful tool for creating interactive controls applications By now the reader should feel confident to beg...

Reviews: