MetaCricket: A designer's kit for making computational devices - 0 views
-
All Cricket devices have a built-in bidirectional infrared communications channel, which is used for Cricket-to-desktop communication (when downloading programs to a Cricket, or viewing sensor data) and Cricket-to-Cricket communication.
-
Cricket Logo is based on an iterative, interactive model of project development. It includes a “command center” window; instructions typed into this window are instantaneously compiled, downloaded to a Cricket, and executed, giving the system the flavor of an interpreted software environment such as LISP, BASIC, or FORTH.
-
The MetaCricket software system is based on a virtual machine, written in PIC assembly language and running on the Cricket, and a compiler for the virtual machine running on a desktop development computer
- ...13 more annotations...
-
It is straightforward to implement an interpreter-like interface, where user commands are transparently compiled, downloaded, and executed.
-
Built-in infrared communications routines include a protocol for reading and writing to this external EEPROM, and for asking the virtual machine to begin execution of byte codes already loaded into the EEPROM.
-
Users write programs for the Cricket in Cricket Logo, a dialect of Logo specialized for the Cricket virtual machine. Essentially, there is a one-to-one mapping between statements in Cricket Logo and primitive functions built into the virtual machine. This makes the implementation of the compiler far simpler than typical compilers.
-
The compiler includes an interactive mode—a text window where user expressions are compiled, downloaded, and executed in one step when the user presses the return key. A portion of the Cricket's memory is set aside for these dynamic programs.
-
we have found that a debugger is not necessary because of the interactive and incremental style of project development that occurs when using the Cricket.
-
The infrared protocol includes the following capabilities: Check that a Cricket is present and ready for other commands. Write a byte to the Cricket's EEPROM. Read a byte from the Cricket's memory. Begin program execution from a particular memory address.
-
User-level primitive functions compile to one, two, or three bytes of object code for the Cricket virtual machine.
-
The Cricket virtual machine has two process threads: a foreground process and a background daemon. In most Cricket programs, the foreground thread handles all the work, but for some tasks, the background daemon is valuable. For example, the background daemon can be used to instigate a periodic activity, or take action when some event occurs.
-
There are hardware-specific primitives for interacting with on-board Cricket hardware. Motor commands set state (on or off), direction, and power levels for each of the two integrated motor drivers. Analog sensor primitives (sensora and sensorb) return a value (0 to 255) for each of the two voltage inputs. These inputs also may be interpreted as digital values using the switcha and switchb primitives. There is a pair of primitive functions for generating tones on the piezo beeper: beep and note, the latter taking pitch and duration arguments.
-
One foreground thread plus one background daemon Daemon fires when provided Boolean expression makes false-to-true transition