Getting Started with itron SMART TFTs - Program Basics

If you received a development kit with USB cable and SD card inserted into the module, just plug in the USB cable between a PC and the display module.
The boot code and operational software will load and then run the file TUxxxA.mnu from the SD card where xxx is the X number of pixels of the TU module.
This will be TU320A.mnu, TU480A.mnu, TU640A.mnu or TU800A.mnu.
Production modules are not supplied with demonstration screens.
After experimenting with the demonstration, review the basic applications below.
Do not hesitate to send us an email for further explanation.

Key issues to understand..

1. The system uses text commands rather than difficult to remember hex codes.

2. All objects and functions are given a name for easy future referencing.
    Interfaces are given pre-defined names like RS2 for RS232 and RS4 for RS485.

3. Commonly used parameters are stored in 'styles' like in HTML web pages.
    This reduces the number of commands from 250 in a conventional TFT module to just 25 in itron SMART TFTs with equal or better functionality.

A typical TUxxx.mnu menu file's commands will be constructed and ordered as follows (detail removed for clarity):
					LIB...			//load in images and fonts from memory into library
					LIB...			
					INC..			//include another menu file which may have global styles and setup.
					
					STYLE...		//define styles for pages, text, images used in this file
					STYLE...
					
					SETUP..			//setup system and external interfaces like RS232
					SETUP...
					
					VAR...			//create variables used for calculation, temporary storage and pointing
					VAR...

					PAGE(MAIN,styleMain)			//create a main page with text, images and associated keys
					{								
						POSN... TEXT				//place text at a specified position on screen
						POSN... IMG					//place icon/image at a specified position on screen
						POSN... KEY					//place a touch key area on screen and define function to call
					}
					
					PAGE(SUB,stylePage1)			//create other pages
					{							 	
						POSN... TEXT				//place text at a specified position on screen
						POSN... IMG					//place icon/image at a specified position on screen
						.......
						LOOP(CntLoop,FOREVER) 
						{ 
							IF(CNTMINS=0,FncZero);	// function calls associated with page
						}	
					}
					
					FUNC(FncZero){ LOAD(RS2,"Hour Count = ",CNTHRS,"\\0A\\0D");		//send message to host via RS232
					FUNC(MyFunc){ ...................}								//other functions associated with key press or interfaces
					
					INT...			// Initialise interrupts for slave timers and inputs...not host interface - use setup with v39 software
					
					SHOW(MAIN);		// After pre-loading all style parameters, pages and functions, start the application with first page.
					
					
					//After this point, functionality follows page key presses and functions or incoming command data from host or interfaces.
					
When creating an entity for the first time, include the style parameter. To update the entity omit the style parameter.
If you specify the style again, you will create a copy. 

Entities are layered on the screen from back to front in the order they are listed in the menu with the screen background defined in the page style. If you want a button image to change colour, include one colour button in your background and the other colour button as a separate image over the top. To change colour, just HIDE and SHOW the top button. This technique is used in the air conditioner project.
 
The examples below can be cut and pasted from their box into a text editor (NotePad).
Save the file as TU480A.mnu and copy onto the SD card.
Plug it into the itron SMART TFT module, apply power and view the result.
Hello World from Internal Menu
					// Menu file TU480A.MNU for Demo using TU480X272C
					// Simple demo to display text
					STYLE(BlackPg, Page) { Back=black;} //black background
					STYLE( Txt32White, Text )
					{
						font=Ascii32;
						col=white;
						maxLen=32;
						maxRows=1;
						curRel=CC; //white system text 32 pixels high
					}

					PAGE( MainPg, BlackPg )
					{
						POSN( 240, 136 ); // Set writing position to centre of display
						TEXT( Text1, "Hello World", Txt32White ); // Draw text
					}

					SHOW( MainPg );
					//end
					
Hello World via RS232 IN with touch key to send RS232 OUT
					// Menu file TU480A.MNU for Demo using TU480X272C
					// 07-Oct-2010
					// This example is identical to example 1 except RS232 is defined
					// using setup for command mode at19200 baud, no parity
					
					STYLE(BlackPg, Page)			//define page style
					{
						Back=black;					//background is black
					}
					
					STYLE( Txt32White, Text )	//define text style
					{
						font=Ascii32;			//use built in font
						col=white;				//text colour is white
						maxLen=32;
						maxRows=1;
						curRel=CC;				//centre position
					}
					
					VAR(mytxtVar,"Hello People",TXT);	 							//create a text variable to hold up to 32 characters
					
					PAGE( MainPg, BlackPg )
					{
						POSN( 240, 136 );					 							// Set writing position to centre of display
						TEXT( Txt1, mytxtVar, Txt32White );  							// Create text area at the writing position
						KEY(Key1,[LOAD(RS2,mytxtVar,"\\0D\\0A");],470,270,TOUCH); 		//Touch screen to sends content of mytxtVar plus CRLF out of RS232 port
					}
					
					SETUP( RS2 )
					{
						set = "192NC"; 		// 19200 bps, no parity, command mode
					}
					
					SHOW( MainPg );		
					
					// Send text command to the display via RS232 : LOAD( mytxtVar, "Hello World" );;\\0D					
					// Note :-
					// Sending 2 semicolons is equivalent to SHOW (currentpage);
// All command lines must be followed by CR (\\0D)
//If your system can send binary \\0D can be sent as 0DH

Images loaded, flashed and moved
					// Menu file TU480A.MNU for Demo using TU480X272C 
					// 11-Oct-2010
					// This example places 2 images on the display with one flashed and moved.
					
					LIB(Image1,"SDHC/lift1.bmp?back=\\0000CD");	//load image1 from SD card 
					LIB(Image2,"SDHC/lift2.bmp?back=\\0000CD");	//load image2 from SD card 
					STYLE(BluePg, Page) {back=\\0000CD;}		//define style of page with blue background
					STYLE(StImg, Image) {curRel=CC;}			//centre image with respect to POSN cursor
					
					PAGE( MainPg, BluePg )
					{
						POSN( 199, 136 ); IMG( LeftImg, Image1,172,240,StImg);	// Position and draw 1st image on display
						POSN( 396, 136 ); IMG( RightImg, Image2,172,240,StImg);	// Position and draw 2nd image on the display
					}
					
					SHOW( MainPg );		//show page
					
					WAIT(2000);					//wait 2 seconds  
					HIDE( LeftImg );;			//hide left image and refresh page
					WAIT(2000);
					SHOW( LeftImg );;			//show left image and refresh page
					WAIT(2000);
					POSN( 396,136,LeftImg);;	//position left image under right image and refresh page
					
					// Sending 2 semicolons is equivalent to SHOW (currentpage);
					//You will see a blue border around the right image due to background transparency differences