Overview

In the examples within, you will see two different types of programming.  Not just the language, but the architecture of the program.

The examples for the Basic Stamp illustrate in-line control code.  The main module contains all the logic, control equations and time delays necessary to control the robot.  This code is generally in a loop (or loops)  and repeats until the robot's task is done.

The examples for the 68HC912B32 illustrate a real time executive.  A timer is programmed to produce a real time interrupt at a periodic rate (every 16.384 milliseconds in the first example).  Most, or all, control happens in the interrupt driven software.   There is still a "main" module which initializes the processor and the real time interrupt and then runs in "background" mode where it executes in whatever time is left over after the real time interrupt routines have completed.  The precise timing of control equation code in the real time executive has a lot of advantages when you go to more complex PID type designs in which the calculations must be correlated with the time that occurs between calculations.