TEA Getting Started Guide
Last Modified: 2007-12-18
find:

basket

Acroname Robotics PDF webpage version TEA Getting Started Guide PDF

Related
Products

Product image for Brainstem GP 1.0 Module
Brainstem GP 1.0 Module
Product image for BrainStem Moto 1.0 Module
BrainStem Moto 1.0 Module

Contents

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. 

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. 

Note

Watch out for programs that may automatically append a .txt extension onto a text file name. 

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. 

Tip

If you typed the file incorrectly, the console displays error messages indicating mistakes.  Make the changes, save the result, and try compiling again. 

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, 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. 

Tip

Steep.  load, and launch are just three of the Console commands.  For more documentation and a list of other available Console commands, read the Console section of BrainStem Reference

What's Next

Check out the Getting Started section for a complete list of resources to guide you through the BrainStem architecture. 

Look at some of our example programs to learn more about the language or to use as a starting point.  The example browser is available under the 'Support' tab. 

BrainStem
Resources

 
 
voice: 720-564-0373, email: sales@acroname.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy
© Copyright 1994-2010 Acroname, Inc., Boulder, Colorado. All rights reserved.