Program design
The program is a simple text oriented program suitable to run on a disposable
MS-DOS computer. Even an 8088 should be sufficient to keep timing.
The other constraint was that the computer should have a standard
configuration. Because I am using the parallel port for the
electronics package, the printer
is connected to a serial port. This does limit the choices for
printers, but I have found an HP500 to be a very nice choice.
Note that some printers are built so that many lines must be
printed before you start seeing any text. It is best if you can
find a printer where you can basically see the line as it is being
printed.
The program is written in C. I am using an ancient version of Borland C
on the computer where this runs. However, compiling it on other computers
should not be too difficult.
The program is available as a ZIPed archive,
and is really quite small.
The following files are the major files in the program.
- pinewood.h
This is a configuration file which has all of the common definitions
in one place. Towards the top of this file, there are a few definitions
which are important. The first is PRINTER which specifies
where printer output is to go. The standard place is com1
or com2, but can be set to a disk file (e.g. printer)
for testing to avoid using lots of paper. The other definition that
is interesting to change is KB_INTERFACE which allows the program
to be controlled (and thus tested) without the track electronics in place.
These definitions should be settable at run time instead of being
compiled into the program, but I never made that change. There are a
number of other parameters which specify the number of lanes, maximum
number of cars, etc. In general, these are generous enough and don't
need to be changed.
- pinewood.c
This is the main program, and implements many of the commands available
from the user interface.
- pmon.c
This file, which I originally obtained from the net a long time ago,
and was originally authored by Stanley Sutton, is used to do timing
on the track. This can do timing to microsecond accuracy, but I cannot
poll the track that fast anyway, plus all the resolution I need is
millisecond, so all works quite nicely.
- run.c
This program is what actually runs the race.
The current strategy is compiled into the program. You are welcome
to change it, but that will require modifing the program to deal with
the new strategy. I have some old code for other scheduling ideas
at the end of the file.
- edit.c
This file implements the editor for maintaining the database.
Note that this is quite primative, but does what we need.
- report.c
This file is used to produce the various reports from the program.
- log.c
Everything which is written to the printer is also written to a log
file. This allows reprinting the information once the race is over,
and also allows for an out when the printer eats a sheet of paper.
- utility.c
This file holds some misc functions which don't really belong elsewhere.
The procedures page has a section on operating
the program. The basic operation is reasonably simple. Getting set up for a race
is somewhat more complex, and handling those "odd situations" on the fly may
take a bit of creativity.
Consider this program a starting point.
You can make use of this program as it is, possibly just using the
test mode. It works quite well for small scout packs with no setup.
You can also use this program for ideas to construct your own program.
Last modified 27 May 2006
Questions or comments can be sent to
Dave Regan.