Java Reference
In-Depth Information
into RAM for execution. The RAM holds the program's stack and heap. Programs
can access both free RAM and EEPROM space. The processor executes up to
8000 instructions per second.
Four of the pins are used for power, ground, and reset. Another four pins are
used for serial communications with the chip to load programs and debug them.
Sixteen pins provide general-purpose I/O. These can handle digital-to-analog and
analog-to-digital conversions, serial I/O, pulse modulated output, and pulse input.
The serial interface provides for programming the module. The programs
are saved in the EEPROM and program execution begins after a reset. Virtual
Peripheral (VP) objects run UARTs, pulse-width modulators, timers and other
services, and use minimal system resources. The company offers a development
system with an IDE for developing, downloading, and debugging programs on
the module.
The Javelin Stamp runs a downsized version of Java with a small subset of the
usual classes. In the next section we discuss how to program the Javelin and give
a demonstration of a Javelin program that uses the general-purpose I/O pins to
obtain data from a sensor and send it over a serial line.
24.9 Programming the Javelin Stamp
The Javelin Stamp provides an interesting example of a Java hardware platform.
Of all the Java processors discussed above, it offers the most restricted set of
bytecode instructions and the most limited number of classes. It does not conform
to the CLDC framework and instead offers even fewer capabilities (but more than
the JavaCard). However, it is low cost and fairly simple and straightforward to
use. For many microcontroller applications, its capabilities suffice.
Parallax intended the Javelin to be as easy to use as its popular Basic Stamp
modules [16,17]. The company provides a development board with a small bread-
board (see Figure 24.3(b)) for experimentation and tests. To get to know the
system you can place LEDs, buttons, and other circuits on the breadboard and
connect them to the Javelin module's 16 general-purpose I/O pins, which are
accessible to Java programs running in the module.
The Javelin Stamp's interpreter differs in several ways from the JVM that
comes with your desktop SDK. For example, there is no multitasking or multi-
threading. Instead you can use a timer object to allocate times for tasks to run.
As mentioned earlier, six commonly needed functions are provided by the VPs
that come built into the Javelin's firmware. These VPs include a timer, UART for
serial communications, PWM (Pulse Width Modulation) for pulse train genera-
tion, DAC and ADCs. You can install up to Six VPs at a time. They run in the
background and so use a minimal amount of processing time and resources. Each
VP requires one or more of the 16 available I/O pins.
The Javelin processor offers no garbage collection, so once you create objects
they exist until the module is reset. This places tight restrictions on the number
Search WWH ::




Custom Search