OK – so it is a poor
title for the page…
Your controller will need memory to store, probably, three things:
- Some kind of monitor to communicate with a host computer for downloading
- The actual micromouse code itself
- Working information such as variables and maps of the maze.
Depending upon your controller design, you might do without a monitor
program. If you keep all code in an EPROM, you can burn in revisions,
plug them into the controller board and off you go. The advantage of this
approach is that EPROM is non-volatile. If you lose the power, the code
stays put. It would be embarrassing to accidentaly kill the power to your
mouse as you approach the maze and have to run back for a reload. Another
plus is the relatively limited battery power you may have available. With
you code in EPROM, you can ust leave your mouse switched off until it
is ready to go. Similarly, a battery change is no big deal, the code will
still be there when you have finished.The disadvantage is that EPROMs
need programmers and these can be expensive. Erasing EPROMs also requires
a special eraser and this can take some time. If you have all these things
(programmer, eraser and time) then you may well want to go for this option.
Monitors often come with ready-made controller boards or are available
for simple reference designs for a number of controllers. The monitor
software will probably live in an EPROM which you may not even have to
program. Your code will then live in RAM. Remember that this is likly
to be volatile – lose the power and your code goes with it. You can buy
or make non-volatile RAM devices to overcome this problem. The advantage
in terms of development is that the monitor comes with a number of handy
routines. These may include facilities to communicate with a host while
the program is running and to download new versions of your software.
The communications features can be particularly useful during development
as your program could send a stream of diagnostic data back to a PC so
that you can see what is going on. Software changes can be very rapid
– a new version of your code may take a second or two to download to the
controller. This is ideal if you want to fine-tune some parameters on
Variable storage will be in RAM. Don’t skimp on this. Not only is RAM
cheap, you may actually find it hard to get hold of small RAM devices.
Without a good search, however, you are unlikely to find many microcontrollers
with enough on-chip memory to satisfy the needs of your mouse. While you
can store a maze in about 64 bytes (how is left as an exercise for the
reader :), there will be a considerable overhead in terms of the code
needed to process that. Leave aside for a moment the general variables
that you need such as location, speed, heading and so on, what about the
The simplest approach would be to store the maze in a 256 byte block
of memory with each byte representing a single cell. One such memory block
could store all the data about the presence of walls along with other
flags such as whether or not that cell had been visited before. Single
bits are enough for these items and are easily enough to encode.
Another such block could be used to calculate the routes to the goal
for algorithms like the flood-fill. This block should be regarded as temporary
so that it can be re-used frequently to optimise the route. Yet another
block might be used along with it to calculate or store the best (not
necessarily the shortest) route for the speed run. A memory block may
be set aside to store hints for the searching algorithm to try and ensure
an effective search of the maze.
If you decide to do a more classic tree search, you may well find that
you need a large stack – especially if you write a recursive maze searcher.
Other methods of finding the goal may require a stack or queue while they
IOn a typical microprocessor, 32k EPROM and 32k RAM requires two memory
devices and probably an address latch. For relatively little circuit complexity
(apart from all those wires if you are wiring by hand) you get plenty
of memory to do with as you please.
Naturally, the hairy chested types (of either gender) who fancy a go
at a vision guided mouse may have other problems – good luck to them.