Java and the Train System


Interfacing the Existing Train System to Java

It would be possible to interface the existing train system, written in Interactive-C/MC68HC11 assembler to a Java application running in the host-computer (pooh or rabbit).

Using Java as an Implementation Language

It strikes me that the most useful view of an embedded system composed of a lot of rather weedy processors such as the MC68HC11 is that one has a host machine, which is fully-Java-competent (that is it runs a fully-implemented JVM). Within this host machine, each processor appears as an instance of a class peculiar to that processor. For example, for the existing choo system, we might have a class HandyBoard, for which a constructor might take a Runnable object as argument. Thus
    HandyBoard(r1)
is a Java object that in effect loads the run method of a Runnable object r1 into a Handy Board Clearly, one could only have as many instances of the HandyBoard class as one had Handy Boards. This has the nice property that we get a kind of simulator for free. We could have a PseudoHandyBoard class for which the call
    PseudoHandyBoard(r1)
simply makes a Thread which runs r1. Now, typically for crisply exact real-time performance, much the behaviour of the HandyBoard is characterised by interrupt-routines. To deal with this we'd have another constructor:
    HandyBoard(r1,runnables)
where the array of runnables (or some other structure) is in effect an array of interrupt routines.

How might we implement this

On the face of it, implementing HandyBoard objects might seem to need a non-standard JVM. No doubt somebody could hack such a capability into Eliot's JVM. But portability would suffer. A different approach might be as follows: