Readme.doc
file included with that distribution. If you plan to use TinyVM
under CygWin, don't forget to read the Windows Notes.
make
.
/dev/ttyS0
or COM1
).
bin
directory to your PATH setting. Remove
previous versions of TinyVM from your PATH.
cd examples/view
tvmfirmdl
(Wait for double beep)
export CLASSPATH=.
tvmc View.java
tvmld View -d
This particular example yields a linked binary file
of about 3 Kb. It takes approximately 30 seconds to
download. As soon as the LCD shows a standing man
figure, you can press Run
to start the
View program.
This example allows you to test sensors
and motors. Press View
to select a
sensor or motor. Press Run
to activate or
passivate a device. Press Prgm
to
change sensor mode or motor power. To exit this
program, press On/Off
. The program
can be rerun as many times as you like (starting
with 0.2.0).
tvmfirmdl
Fast firmware downloading was added in TinyVM 0.2.1:
tvmfirmdl --fast
(Note that fast firmware downloading may not work under CygWin 1.1.x).
Alternatively, you can use any of the firmware downloaders available in the public domain, such as Dave Baum's firmware downloader included with NQC :
nqc -firmfast $TINYVM_HOME/bin/tinyvm.srec
Donwloading the firmware will take a couple of minutes at most. The counter will reach 970 or so. Then you'll hear 2 beeps, and the LCD will show a number in the 200s or 300s. This means TinyVM's firmware is in program-download mode.
The number shown in the LCD is the battery power level. For fresh batteries, it should be around 340. I've had TinyVM work with a battery power level of 212, but I do not recommend using it if the power level is below 250.
TinyVM allows other firmware to get downloaded when it is in program-download mode. (You can always get to program-download mode by switching the RCX off and on).
tvmc
instead of javac
.
Note that tvmc
is simply a script provided
for convenience which calls javac
with
a special -classpath option value.
NOTE: Do not add lib/classes.jar to your CLASSPATH setting. This will affect other JVMs.
If you try to compile a TinyVM program using only javac
,
the compiler will not be able to find TinyVM APIs, which are
located under lib/classes.jar. If you try to place classes.jar
in the CLASSPATH before calling javac, some of the core Java classes
from classes.jar might be confused with core Java classes from the
JDK's classes.zip file.
Some classes from the JDK's classes.zip (or rt.jar) file might work with TinyVM, as long as no native methods are involved. However, this hasn't been tested and it is not recommended.
tvmld -o <class>.tvm <class>
This will produce a .tvm
file which you can download into the RCX.
To download a previously linked program, run:
tvm <class>.tvm
The linker
(tvmld
) can also download programs
directly to the RCX. Simply
pass a -d
option to it, instead of
-o
, as follows:
tvmld <class> -d
You should see the number of bytes downloaded divided by 100 in the LCD. If nothing happens, make sure the RCX is in range, and try again. If you hear beeps, kill tvm, switch off the RCX, wait until the IR tower's light is off, and try again.
mod
10.
The linker (tvmld) will dump a list of classes and signatures
if you pass a -verbose
option to it.
To take an example,
could mean that a NullPointerException exception (class index 7) was thrown in a main method (method signature 0). To facilitate identification of stack traces, you will also hear a low buzz (like system sound 4) and the LCD will show a wedge right below sensor 2.
NOTE: Uncaught exception traces will suspend your program. To continue, press On/Off.
private
,
final
or static
whenever possible.
main
methods.