| TEA - Getting Started Last Modified: 2008-10-06 | | |
| Acroname Robotics | |||
| Overview This guide walks you through the basics of TEA. For complete documentation, including a language reference, all library files, and extensive documentation of the TEA virtual machine (VM), refer to the TEA section of the BrainStem Reference on our website. A link to the Reference can be found through the menu to the right. Before You Begin To compile, run, and load TEA programs, you need the Console program, which is platform-specific and can be downloaded from the Acroname Download Center . If you haven't yet done so, we suggest downloading the Console application and completing the Console Getting Started Guide before you begin working with TEA. About TEA The Tiny Embedded Application (TEA) language is a subset of the C programming language. TEA has integer math operations, simple looping constructs, conditional statements, and parameterized subroutines. It is ideally suited for simple control loops, sequencing behaviors in robotics, and other tasks that can be offloaded from the main controller of a complex system. TEA is precompiled, enabling conditional compilation, macros, and inclusion of other files. Programs are typically very small and have no memory allocation, structures, or objects. All variables are stack-based; the stack can be very small on some environments so minimal recursion is possible. Syntax It's possible to learn the TEA language by purchasing a book on C programming. The main difference between the two languages is that TEA does not handle pointers or arrays (although it is possible to implement a small array following our TEA stack array example ). The best way to get a feel for TEA sytnax and conventions is to view an example that illustrates a TEA program. Writing and Compiling TEA Programs TEA files are text files so you can use any text or code editor to write TEA programs. Simply save programs with a .tea extension into your aUser subdirectory.
Program compilation is done through the Console application using the Console command "steep". The compiler translates the file you wrote in the TEA language into the virtual machine's specific instructions (opcodes). Compiling a TEA file creates a .cup file and places it in the aObject subdirectory of the brainstem directory. These object code files can be run anywhere the TEA Virtual Machine is implemented, regardless of platform. Keep in mind the file slot size restriction for the module you are using. You can work around the size limitation of program slots by using the TEA library file aMulti, which provides routines for multitasking. You can view several programs that call the aMulti library in the BrainStem examples section. The BrainStem Reference documents all TEA library functions. Example The following steps demonstrate writing, compiling, and executing a program. This program simply displays a text string and exits. Create a new text file named "code1.tea" in the aUser folder. The aUser folder is in the main brainstem directory. In the file, type the following: #include <aPrint.tea>
void main()
{
aPrint_String("Hello World\n");
}
To compile the file, open the Console application. This application is located in the aBinary folder under the brainstem directory. Type the following console command in the input area at the bottom of the Console and select Enter. steep "code1.tea"
The steep command tells the console to compile the specified program into an object code file that can run on the TEA Virtual Machine. This code is stored in the aObject folder in the main brainstem directory. The compiled file has a ".cup" extension. Remember - Steep TEA into a .CUP.
To run the program from a BrainStem module, you need the interface cable appropriate to your host computer platform. To store the program in a BrainStem module slot, use the load command. Each module has multiple file slots, numbered from zero. For example, the GP 1.0 module has 11 slots (numbered 0-10). To load the file "code1.cup" into slot 0 on module 2 (the default module number), type: load "code1.cup" 2 0
in the Console input area. To run the program in slot 0 on module 2, type: launch 2 0
"Hello World" displays on the Console from the program instance running on module 2.
What's Next Additional resources are available through the BrainStem Technology menu, to the right. A good next step would be to:
Revision History:
|
| |||||||||
Related Links: | ||||||||||
| voice: 720-564-0373, email: sales@acroname.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy © Copyright 1994-2012 Acroname, Inc., Boulder, Colorado. All rights reserved. |