DantaRandall1984

CALIFORNIA STATE UNIVERSITY, NORTHRIDGE
MICROTAC
A LOW POWER MICROPROCESSOR BICYCLE SPEEDOMETER/COMPUTER
A graduate project submitted in partial satisfaction of the
requirements for the degree of Master of Science in
Electrical Engineering
by
Randall C. Danta
January, 1984
The Project of Randall Danta is approved:
(~~-
O'Brien)
(Prof. R. Davidson - chairman)
California State University, Northridge
ii
Table of Contents
Chapter
1
2
3
4
5
6
7
8
9
10
11
Title
Page
Introduction
• • • • • 1
State of the Arts .
5
Design Goals
• • • •
• 9
Development Procedure
• 16
Calculations • • • .
• • • • • • 19
Design Tradeoffs and Decisions
. • 26
Hardware Design • •
• • • •
• 32
Software Design • • • • • •
• • 45
Test Procedure • • • •
• SO
Evaluation
• • • • •
• • 55
Marketable Design •
• • 58
References
60
Appendixes
A
B
c
Instruction Summary •
Software Design •
Software Listing
...
• • 61
66
• • • • • • 97
List of figures
Figure
1
2
3
4
5
6
7
8
Page
Title
Microprocessor Memory •
Address Display Circuit
• •
Mode Select Circuit
Distance Adjustment Circuit •
Sensor Circuit • • • • •
Sensor Component Carrier • • •
Clock Circuit •
Display Circuit • • • . • •
iii
• • • • 37
• • • • 38
39
• • 40
• • • • 41
•
42
• • 43
• 44
v .
ABSTRACT
MICROTAC
A LOW POWER MICROPROCESSOR
BICYCLE SPEEDOMETER/COMPUTER
by Randall C. Danta
Master of Science in Electrical Engineering
A microprocessor bicycle computer is described which combines the
features of low power
microprocessor
hardware
control
to
components
with
the
flexibility
of
provide a passive, frictionless instrument
for collecting, storing, analyzing, and displaying performance data
real time.
The instrument collects rotational data from the wheels and
crankset, and, in
clock,
in
produces
conjunction
a
with
selectable
an
internal
crystal
controlled
output display of speed, elapsed time,
distance traveled, average speed, crank speed, and gear ratio in either
metric or english units.
It is designed to be small, rugged, portable,
consume low power, and yet provide
the
user
with
great
utility
in
evaluating performance in real time.
Several hardware and software
design
of
the
Microtac
instrument.
unique low power inductive sensor
ferrous
and
non-ferrous
innovations
metal
are
embodied
in
the
The hardware design utilizes a
design.
without
The
the
sensor
use
rollers, or magnetic devices as commonly used on
of
detects
both
drag-producing
instruments
of
this
type.
The
software
design incorporates a number of specially developed
features which minimize memory requirements while
response, operating range and accuracy.
providing
real-time
High accuracy is achieved by a
unique adaptation of floating point mathematics, in conjunction with an
eight-bit digital adjustment switch.
reads mode and adjustment settings
adjustments
to
be
without loss of data.
instantaneously
The loosely threaded scan routine
on
each
pass,
incorporated
allowing
in the computations
Compact coding techniques enable the
iv
external
pure
code
of the instrument to reside within a single 1024 byte memory chip,
unique
program
and
control techniques allow execution to transfer between
main and subroutine level routines using only a three byte stack.
v
CHAPTER 1
INTRODUCTION
The innovation of microprocessor technology as
tool
has
a
product
design
created a flourish of improvements in electronic products of
every description.
Products using microprocessors can provide expanded
features, greater accuracy, smaller size and weight, and greater design
flexibility than their formerly electrical or mechanical counterparts.
To gain experience in electronic product design and to fulfill the
project requirements of the MS degree in digital electronics, I decided
to select a commonly known consumer product, evaluate its potential for
improvement
using
microprocessor technology, and develop a new design
demonstrating as many of these potential improvements as possible.
device
I selected to develop, based on
impr~vement
The
potential, personal
interest, and user research, is a bicycle.speedometer for
the
bicycle
racer and serious touring cyclist.
Previous
mechanical
years.
bicycle
speedometers
have
consisted
strictly
of
devices, with a few electronic versions appearing in recent
Older
electronics,
speedometers
normally
use
embodied
mechanical
in
hardware
combinational
or
logic.
mechanical and electronic versions have a limited capacity
information.
'
dedicated
Both
to
the
display
Devices found in the marketplace are almost always single
function units capable of displaying only speed, or possibly speed
and
mileage.
It
is proposed that the effectiveness of such an instrument could
be enhanced by
primary
appropriate
benefits
of
such
use
of
microprocessor
instrument
could
be
The
an effort is that a microprocessor version
could offer additional functions in a smaller space,
the
technology.
improved,
1
it
would
the
accuracy
of
be lighter, easier to
2
produce, have no moving parts, and
would
be
easier
to
develop
and
modify than a_mechanical or combinational logic counterpart.
In order to evaluate the
useful
to
examine
the
potential
for
added
features,
is
applications to which the instrument would be
subjected by the various classes of potential users.
the
it
In
addition
to
information provided by the classic single-function speedometer, a
serious cyclist is concerned with maintaining a regular pedal
selecting
proper
gear
ratios, accurately judging distances traveled,
An ideal
and elapsed time required.
would,
therefore,
display
training
instantaneous
and
speed,
miles, elapsed time, average speed, and a number
not
cadence,
available on the single function versions.
racing
instrument
crankset
RPM, trip
other
parameters
of
Ideally, each function
should be available during any part of the trip, and readouts should be
An adjustment should be provided to allow the
as accurate as possible.
user to neutralize variations in wheel
tire
pressure.
There
should
also
diameter,
be
a
spoke
provision
patterns
and
for converting
displayed values to either Metric or English units without loss of data
or
accuracy.
A device to provide the above functions requires sensors
to detect wheel and crankset movement, input switches to select mode, a
suitable
display,
and processing electronics to accumulate totals and
calculate desired outputs.
a
reasonable
length
of
In addition, the circuit should operate for
time
on
a battery charge, should introduce
little or no mechanical friction, and should be small and
functionally
easy to operate.
Important
features for such a device are, in large part, dictated
by the type of user.
There are several classes
of
serious
cyclists,
each with slightly different requirements.
Tourists
are cyclists who ride a bicycle for recreation, on tours
lasting from a few minutes to the greater part
traveled
can
range
from
a
few
miles
of
a
day.
Distances
to a few hundred.
Important
features for a bicycle speedometer designed for a tourist are
day,
distance
traveled,
speed,
expected time of arrival (ETA).
elapsed
time,
average
time
speed,
A speedometer for a tourist should
of
and
be
3
moderately accurate, not too expensive,
weather, and fairly. easy to use.
Distance
participate
riders,
in
like
multi-day
fairly
tourists,
rides
ride
rugged,
for
fun,
resistant
to
but
to
covering from a few hundred to a few
thousand miles, and lasting from two days to several months.
features
tend
Important
to distance riders are time of day, speed, elapsed time, ETA,
distance traveled on
distance
this
leg
of
the
service
definately
should
resistant
be
to
moderately
the
(leg
distance),
total
An instrument designed for this
traveled, and average speed.
type of
trip
weather.
accurate,
very
rugged,
and
Cost can be moderate since it
receives a lot of use, and learning to use it can be moderately complex
since the user will have many hours to experiment with it.
Road
racers
would
use
a
bicycle
speedometer
participating in, or training for, road races.
primarily
A road race is
a
for
mass
start event consisting of a single leg over streets or highways, and is
normally from 30 to 150 miles in length.
racer
Important features for a road
are speed, pedal cadence, elapsed time, distance remaining, gear
ratio, and average speed.
A road racing speedometer should be
low
in
drag, rugged, and easy to operate.
Sprinters
are
bicycle
racers
who
participate in short two-man
sprint races ranging from 100 to 1500 meters
in
only
for
a
few
minutes.
Important
cadence, speed, and elapsed time.
have
a
multi-function
or
features
length,
weather-proofing
are
lasting
a sprinter are pedal
An instrument for
sprinters
should
sequencing display since the sprinter will
have no time to make any adjustments once the race begins.
and
and
less
important
since
Ruggedness
sprints are held on
smooth banked tracks normally during dry weather, and often indoors.
A time
clock.
trialist
is a racer who rides a course alone against the
Important features for a time trialist are elapsed time,
cadence, gear distance traveled, and distance remaining.
be very accurate, especially with regard to
and low in drag.
time,
pedal
The unit must
moderately
rugged,
4
A pursuit racer participates
pursuit
races,
~n
two-man or two-team fixed distance
ranging from 1000 to 15000 meters.
for a pursuit racer are cadence, speed, and elapsed
and
Important features
time.
Ruggedness
weather-resistance are not highly critical since the event is held
on a track.
CHAPTER 2
STATE OF THE ARTS
Mechanical speedometers have been
needle
which
deflects
under
produced
shaft
and
its
years
having
The needle is supported
movement resisted by a hairspring.
by
Movement of the
needle assembly is caused by proximity to a rotating drum or disk.
rotating
a
magnetic influence to indicate speed by
pointing to numbers on a calibrated scale.
a
for
The
member
is
normally driven by a flexible shaft drive tied to
the rotating hub
of
the
transmitted
bicycle
wheel.
Rotation
of
the
hub
is
to the shaft either by direct drive or through a worm gear
arrangement.
An improvement over
driven
design
employed
the
in
hub-mounted
the
IKU
speedometer
is
turned
is
wheel
speedometer from Rolland.
device uses a plastic wheel about an inch in diameter which
and
the
This
rests
on,
by, contact with the surface of the bicycle tire.
The
plastic wheel transfers rotational motion to a flexible shaft through a
worm
gear.
While
the
IKU
design
produces
some
drag,
and makes
substantial noise, it has the advantage of requiring no adjustment
wheel
size.
for
Since the plastic wheel contacts the rolling diameter of
the bicycle wheel, it always turns at the speed that the
road
surface
is moving past the bicycle regardless of wheel diameter.
An older mechanical odometer attaches to the
near
wheel.
the
wheel
With
star-shaped
bicycle
fork
hub and is activated by a pin bolted to spokes of the
each
wheel
rotation,
geneva
wheel
which
instrument shaft.
front
the
pin
strikes
miniature
imparts a fractional rotation of the
The shaft rotation is accumulated and
on numbered barrels much like an automobile odometer.
5
a
is
displayed
p •
6
Newer designs
mechanical
of
drives
bicycle
and
speedometers
are
getting
quietly.
from
instead are switching to electronic sensors of
various types which produce less drag, are more reliable,
more
away
and
operate
The most common electronic sensor designs utilize Hall
Effect detectors acivated by magnets attached to moving
parts
of
the
bicycle wheel.
One
of
the
earliest
speedometers utilizes an
cadence.
commercial
analog
efforts
display
for
in electronic bicycle
both
speed
and
pedal
The device uses surplus magnetic tape recorder heads as Hall
Effect sensors and moving magnets glued to the rim of the front
The
moving
magnets
induce a voltage in the tape heads which charge a
capacitor in the instrument housing.
displayed
by
a
d'Arsenoval
only adjustment is
wheel.
a
The charge on
the
capacitor
movement on a linear printed scale.
variable
resistor
which
linearly
is
The
limits
the
charging rate for a given speed.
One
of
the
first
digital electronic bicycle speedometers to be
marketed commercially was the Digitac, using CMOS
and a liquid crystal display.
instantaneous
speed
only,
had
integer
miles
per hour only.
type, made from surplus magnetic tape
required
that
three
magnets
be
plugged
in.
It
The two
digit
display
The sensors were Hall effect
recorder
glued
was
no storage for mileage, no
metric mode, and had no wheel size adjustment.
displayed
logic
It had no on/off switch, instead running
continuously after the single nine volt battery
displayed
combinational
heads,
and
the
unit
to the wheel to activate the
sensors.
The
Cat eye
Velo
microprocessor-controlled
Cyclocomputer
bicycle
is
speedometer.
an
It
example
has
a
of
a
distance
1/10 mi.
of 52 feet per mile, and Speed, and Ave speed are accurate to
It is switchable for tire sizes 20, 22, 24, 26, 27' and 28
inches.
The
accuracy
Bar-chart
LCD displays Miles per hour in the range 0-40
read.
a
mode
selector,
sequence automatically from distance, speed, and
modes
to
of
somewhat
the
hard
Instead
MPH and is considered
7
time for two seconds on each display.
return
to
the
desired function.
This can require up to 10 sec to
It is operated by a 5 inch diameter
sensor ring which mounts on front wheel.
reading
since
batteries
were
It accumulates
installed.
It
is
the
also
odometer
capable
of
displaying average speed, and maximum speed.
Another
microprocessor
unit is the Digi Speed.
It is switchable
for tire sizes in the increments 20, 24, 26, 27, and 28 inches.
a maximum speed of 99 mph.
It has
It weighs 12 oz., has an On/Off switch, and
LED readouts, which update once each second.
The
Veltec
microprocessor
Pacer
2000
controlled
is
more
slightly
a
device.
sophisticated
It has a 70 mph maximum speed, is
adjustable for tire sizes 13 through 28-7/8 inch using
switches
to
set
accurate
to
25
resolution,
seven
wheel diameter within an accuracy of 1/16 in.
ft.
speed,
per
mile,
displays
distance
and average speed to 1.
MPH.
to
touch-sensitive
keys
to
select
stopwatch: average speed, and cadence.
modes
It is
1/100
mile
It uses magnets for
activating the sensors, and has an optional heart rate sensor.
eight
internal
from
It uses
speed, distance,
It displays elapsed time to
99
hrs 59 minutes, and distance to 255 MPH.
Perhaps
the
most sophisticated bicycle speedometer on the market
today is the The Entex Bike Computer.
speed
rounded
It displays
to the nearest integer MPH.
speed
and
average
It has a 2 character speed
display and in addition has a LCD "moving fencepost" display to give
qualitative
sensation
distance, alarm,
speed,
ETA,
optional
and
pedal
adjustable
for
clock,
of
stopwatch,
distance
cadence
movement.
peak
remaining.
detector,
The
and
functions
speed
memory,
provided
It has a low battery alert, an
It
is
tire sizes 0 to 99.9 inches by .1 inch increments.
It
feet in a 25 mile trip.
heart
rate
sensor.
switch.
a
by
500
At a rate of 25 MPH this results in an arrival
time error of only fourteen seconds.
has
are
destination
has an accuracy of 20 feet per mile, which means it can be off
MPH,
a
kilometers/miles
It displays a maximum speed of 99
switch, a rest/go switch, and an on/off
It weighs fourteen ounces.
Cadence is updated every
10
sec.
8
The stopwatch mode displays time
in
increments
of
one
tenth
second, but rolls over to 0 after 99 minutes and 59 seconds.
diameter is accurate to 5/100 inch, but the wheel
is
stored
in
volaile
random
access
memory
recalibrated each time the unit is turned on.
ETA
Destination
a
The wheel
diameter
(RAM),
of
adjustment
and
must
speed,
be
and
are computed when the function is first selected and the resulting
estimate is not updated again even if speed changes.
It uses 6 size aa
batteries which last only 2 days, and the unit is not waterproof.
CHAPTER 3
DESIGN GOALS
Design goals of a generalized electronic bicycle
established
speedometer
are
by listing the desirable functions, necessary adjustments,
accuracy, capacity, and operational considerations associated with such
a device.
There
are
many
possible
speedometer could perform.
others.
If
implemented.
cost
were
functions
Some are
nil,
all
of
the
which the idealized bicycle
more
general
following
interest
features
than
would be
As cost is realistically finite, features of a given unit
should_ probably
be tailored with the requirements of the given target
market in mind.
Probably
bicycle
the
speedometer
single
is
most
to
universally
display
desirable function for a
instantaneous
speed.
It
is
historically the one function included on single-function units whether
mechanical or electronic.
In addition to instantaneous speed, which
due
can
vary
considerably
to hills and headwinds, average speed is sometimes equally useful.
Average speed can be computed once the
elapsed
time
and
accumulated
distance are known.
Another speed function related to the distance remaining is
estimated destination speed. This is the speed necessary to reach the
destination
in the planned time, and can be computed once the distance
remaining and time remaining are known.
Another
speed
function
is
the
peak memory speed.
This is the
stored value indicating the maximum instantaneous speed reached
the trip.
9
during
10
Probably the second most desirable display is distance.
normally
the
second
function
included
in
two-function
This
is
units.
In
mechanical units, distance normally increments from zero for
of
the
unit,
or
100,000 miles).
hold
onto
information
or
the
capacity
of
when
display
the
power is removed.
distance
power
turned
life
the unit is reached (e.g.
Electronic units, on the other hand,
units commonly
replaced,
until
the
normally
cannot
Therefore, electronic
only
since
on.
When reset prior to a trip the
the
battery
was
last
distance since reset takes on the function of "Trip Distance".
An alternate distance function which can be used in place
in
addition
to
trip
distance, is leg-distance.
function which could be implemented
if
the
of,
or
This is an optional
users
wishes
to
record
distance into a leg as well as total trip distance.
The
inverse of distance traveled is distance remaining and can be
computed by knowing the total expected trip
distance
and
subtracting
be
implemented
the accumulated trip distance.
There are many time-related functions which could
in the idealized bicycle speedometer.
The most obvious is elapsed time
since the start of the trip or the current trip leg.
stopwatch
function
implemented
from
the
start
This is the basic
of
a
trip, and is
necessary if any of the average speed, or other time related
functions
are implemented.
Time
of
day
could
also
be provided as a speedometer function,
although a wristwatch duplicates this function quite effectively.
A stopwatch timer for leg times could be included for
into
the
speedometer
unit
to
avoid
the
need
convenience
for external timing
devices.
Related
to
time
of
day
and destination speed functions is the
estimated time of arrival (ETA) function.
The
ETA
can
be
computed
knowing the present time and the time remaining for a give trip.
11
Time remaining until arrival is another time function
that
could
be implemented once the speed (or average speed) and remaining distance
are known.
One of the most important functions for
cadence.
a
bike
racer
is
pedal
Expressed in Revolutions Per Minute (RPM), the pedal cadence
indicated how rapidly and how smoothly the rider is turning
mechanism
of
the
bicycle.
the
drive
Cadence can be computed knowing only the
period of revolution of the crankset.
The gear ratio can be computed using pedal speed and wheel
speed.
Such a display relieves the rider of memorizing a table of ratio values
for his particular cog selections.
Heart
rate and respiration rate are computed in a similar fashion
as the pedal cadence, but are harder to instrument because they require
physiological sensors attached to the rider's body.
In
addition
to the internally stored variables and computational
parameters, several user-adjustable input parameters are desirable.
Wheel size variation is the major reason that
parameters
are
impossible
for
preset
this type of device.
Any speedometer
device which reads wheel rotation and computes speed or
first
distance
know the wheel diameter to a reasonable accuracy.
bicycle wheels vary from 20 to 27 inches
inputting
Since typical
diameter,
a
method
Several methods
preset
values
or
are
possible.
computational
One
method
parameters
is
to
have
the
user.
method approximates the rolling diameter only, and cannot account
for different tire profiles, or respond to changes
Another
method
displays
in
tire
pressure.
is to let the user ride a measured distance and hold a
switch closed while the computer increments the
and
for
for the various
expected wheel sizes, with the closest choice selectable by
This
must
this information to the computer is necessary for successful
operation.
several
in
calculation
computed
distance
results.
calculation
When
the
parameter
correct
value
appears, the user stops pressing the switch and the computer holds onto
12
the last used trial value.
This method has a disadvantage in that
the
parameters are held in volatile memory and are lost as soon as the unit
is powered off.
Therefore, the adjustment procedure must
each
unit
time
the
is powered on again.
the
proper
readout is obtained.
repeated
A third method is that the
user rides a measured distance and then manipulates
until
be
hardware
switches
This method has the advantage
that the numbers are never lost, and the procedure needn't be
repeated
if the unit is powered off or the battery is changed.
If the unit conatins time of day or
time
of
arrival
functions,
then it is necessary for the user to input the time in order to get the
unit synchronized.
Using
this
The common wristwatch approach
method,
the
user
suitable
here.
the user holds a switch closed while the computer
increments and displays the computed
appears,
is
stops
time.
When
the
correct
value
pressing the switch and the computer begins
incrementing at regular clock speed
from
the
selected
value • . This
method has the disadvantage that it must be repeated when batteries are
replaced, but there is
acceptable
no
alternate
method,
and
this
is
probably
since owners of digital wristwatches perform this procedure
regularly.
Since the user may wish to interrupt a timed
trip
with
a
lunch
stop or other break, a pause switch may be desired in the design.
a switch causes the clocking mechanism to stop so
that
elapsed
Such
time,
and ·average speed are not affected.
A restart switch is usually a pushbutton which causes the software
to initialize.
It is used at the beginning of a trip or
if
power
to
the unit is interrupted.
Accessibility of switches
selection
should
used
during
operation
such
be possible from the operating position.
as
mode
Adjustment
switches can be less accessable as long as the adjustment procedure can
be
carried
out
effectively.
For instance, the wheel size adjustment
switch may even be located inside the housing if it can still
conveniently.
be
used
13
Mode switching is here used to mean selecting one of the available
functions
that
the computer can display.
Since mode selection can be
done during operation, the controls should be conveniently located
accessable
to the user while seated on the bicycle.
location for the computer is on the handlebars.
front
of
the
rider
so
the
distraction from the roadway.
display
The
can
The best mounting
This puts the unit
be
controls
and
in
observed with minimum
which
select
the
mode
should, most likely, be located on the front of the unit, preferably in
the vicinity of the display.
composed
The
mode
selection mechanism
can
be
of a rotary switch, an array of pushbuttons, toggle switches,
or other switch technology that allows activating one mode at a time.
Another option for mode selection is automatic cycle.
This is
to
have the various functions on a timer so that each mode is displayed on
timed intervals.
adjustments.
This technique relieves the
But,
the
user
cannot
user
bring
from
making
mode
up a specific display on
demand, instead he must wait until the cycle completes.
A metric/english
independent
of
the
switch
function
is
like
selected.
a
mode
Such
ajustment
but
is
a switch, if offered,
should operate independently of the mode, and should not affect
stored
time or distance totals.
Capacity of a bicycle speedometer refers to the largest number
can hold for a particular storage value.
of precision
deviation
to
which
between
the
a
display
displayed
is
Resolution implies the degree
presented.
Accuracy
is
their
trip
before
the unit runs out of storage space.
accuracy should be as high as possible,
resolution.
compatable
with
the
distance
figure
The
display
Likewise,
should not be displayed in 1/10 mile if it is only
accurate to + or - two
vary
to
For instance, it is inappropriate to display time in 1/100
seconds if the time counters are only updated once a second.
a
the
value and the actual correct value.
The capacity should be designed so that most, or all users are able
complete
it
miles.
between individual users.
Unfortunately,
accuracy
requirements
A racer may want to know his lap speed
14
down to 1/1000 second while a tourist may only need to
hours
have
elapsed
since he ate lunch.
the
how
many
Also, the desired resolution
varies with the magnitude of the displayed number.
and
know
As the trip
begins
total miles are under 1.0, the user may wish to see tenths or
hundreths of a mile displayed.
As the trip
mileage. passes
into
the
hundreds, a display in tenths of a mile may be unnecessary.
It is probably sufficient that the time of day and elapsed time be
displayed in one second intervals.
Stopwatch or lap times, if
provided, should be in
Capacity
of
tenth
or
one
hundreth
if possible.
Some distance
second
the trip time should be at least 24 hours.
riders may want longer trip times, for example, on cross-country
lasting
over
a
week.
tours
The distance display accuracy is determined by
how many divisions are counted with each unit of distance traveled.
speedometer
which
counts
each revolution of the wheel will not be as
accurate as one which counts spokes.
ten
If possible, for distances
miles, a display to 1/100 mile would be appreciated.
of the distance display should be at lease 200
higher.
A
miles,
and
under
The capacity
preferably
Top riders have completed 400 miles in a 24 hour period.
Operational
satisfaction.
considerations
are those parameters that affect user
One such operational consideration is power consumption.
Since the unit is to be portable, it must operate on a battery
pack of convenient size and weight. The battery should not have to be
If
replaced too often, and its cost should not be excessive.
rechargeable batteries are used, some consideration should be given to
recharging or replacement in the
contemplated as a charging means
are
field.
If
solar
cells
or supplementary source, sunlight
availability and power output versus surface area must be considered.
A near ideal solution would be to build a portable unit which operated
off a single 9 volt transistor radio battery for a reasonable length of
time.
15
A digital display should be used because it
is
easier
to
read,
offers better resolution~ and is more compatible to digital electronics
than available analog displays.
glance during day or night.
The display should be
readable
at
a
The display should be updated often enough
to be current, but should not jitter or change faster than is readable.
The wheel
size
computational
routines
update the display.
adjustment
adjustment
should
designed
This method
process,
be
sampled
often,
and
the
to use the adjustment immediately to
provides
good
feedback
during
the
and insures that stored values are not made which
commit the user to an initial adjustment selection.
Mounting of the unit should require minimum
bicycle.
The
requirement
mount
to
If possible there
or
with
handlebar
unit
should
be
be
external magnets to the wheels or crankset.
bags
or
other accessories.
with
durable
enough
to
resist
the
It should be
possible to remove the unit for safe keeping while the bike is
The
the
should
The unit should be easy to operate, and should not interfere
rider,
to
mounting procedure should be easily accomplished by the
user with only normally available tools.
no
modification
parked.
shock and vibration
encountered during use over rough roads, and should resist the
effects
of moisture and temperature.
The sensors used to detect crank and wheel rotation should
low
of
power consumption, and offer as little mechanical drag as possible
to the bicycle.
external
magnets
If possible, there should be no requirement
to
the bicycle.
operate satisfactorily regardless
bicycle is constructed.
a
major
possible.
factor
in
to
mount
The wheel and crank sensors should
of
the
materials
with
which
the
If possible, there should be one common sensor
design used for both crank and wheel detection.
be
be
marketability
and
Cost of the unit
should
will
be kept as low as
CHAPTER 4
DEVELOPMENT PROCEDURE
Building the hardware portion of the project required
the
design
and construction of the various hardware component subsystems including
the CPU board, clock board,
circuit,
and sensors.
dispiay
board,
interfaces,
mode
select
In addition to the intrinsic system components,
several development tools were produced including a
monitor
board,
a
memory expansion board, address and data display circuit, power supply,
and a cassette interface.
Development of the software portion of the
project
required
the
design, coding, and testing of the real time code for use on the target
processor.
handler,
This includes initialization code, main program,
sensor
display handler, mode select, selectable application programs
for each mode, and mathematical utilities.
were
a
The
.
mathematical
routines
adapted from library routines supplied by the manufacturer of the
microprocessor.
addition
to
All other code was designed and written as needed.
the
final
code
In
to run on the target processor, a cross
assembler was produced for use on the PDP-11, by adapting an 8080 cross
assembler,
and
altering
the
instruction
parse table to reflect the
instruction set of the target CPU.
Preliminary
steps
to
the
design
componets, and select a microprocessor.
were
to
review
low
power
Once this was done, the
means
to develop the hardware and software had to be obtained.
a development system having a microprocessor, memory,
the
prototype
interface
circuit
boards,
This required
card
slots
for
and means for entering and
revising code.
Once the development kit was built and
could
on the required memory expansion, power supply, address
proceed
display, monitor interface, and cassette interface.
16
tested,
design
17
Once the development kit was tested and operational, the interface
modules
could
be
designed
functions of the project.
architecture,
definition
This
registers,
microprocessor.
Once
was
and
built
effort
and
the
carry out the application
began
with
a
study
instruction
set
of
the
machine
developed.
to
was
understood,
a
of
the
selected
buss
usage
The buss usage for the development system
began with the buss lines assigned by the development kit, and extended
to a standardized utilization of the additional sensor, clock, and flag
lines
which
construction
control
the
of
individual interface boards was then undertaken.
the
application
functions.
These included the display board, clock
board.
After
construction,
the
board,
completed
The
and
design
sensor
interface
and
interface
boards
each
underwent unit testing to verify proper operation.
Once the interface boards
design was started.
the assembly
had
been
unit
tested,
the
software
The first step in the software design was to learn
language
and
selected microprocessor.
develop
programming
The next step was to
techniques
develo~
for
a rough plan for
the usage of data structures and registers, and develop algorithms
the
required
mathematical
computations.
the
Next came the
d~sign
program flow and how the various flags and interfaces would be
for
of the
tested.
A data-handling scheme was developed to handle the various counters and
computation buffers, and then the mathematical routines
and
coded.
established as utility routines.
initialization
and
scan
routines
divide
were
and
coded.
developed
executive to control the mode selection and major
all
modules
were
written
and
these
Finally,
the
which
act as the
function
execution.
they were unit tested for individual
functionality and proper response to the interface
usage
routines,
Once the utilities are written,
the major function routines werre designed
When
designed
Once certain repetitive functions were identified, such as
binary to decimal conversion and multiply· and
were
were
plan.
The
buffer
code storage were then optimized to eliminate repeated code
wherever possible.
18
Once the code was written and unit tested, the integration testing
phase
began.
project.
function,
software
smoothly,
This
The purposes of
and
Once
subsystems.
the
operation
testing.
in
integration
and
several
Once
the
the
in
both
the
were
interface
iterations
whole
to
design
integrated
user
are
testing
incompatabilities
correct
process resulted
further
proved to be the most time-consuming phase of the
of
design
product
was
validate
hardware and
was
operating
evaluated.
refinement
refined
the
as
far
practical, the project was ready for final testing and evaluation.
This
and
as
CHAPTER 5
CALCULATIONS
The primary size descriptor for a bicycle is the
measured
at
the
wheel
size,
approximate outer diameter of the wheel.
as
Normal ten
speed bicycles have 27 inch wheels and normal three speed bicycles have
26
inch
wheels.
Typical
bicycles
used
by
juveniles, such as the
Schwinn Stingray and most Bicycle Motocross (BMX) bikes, have
wheels.
wheels.
The
size.
second
most
with
24
inch
or
26
inch
important bicycle measurement is the frame
This is measured from the centerline of the crank spindle to the
of
the
seat
tube.
Ten-speed frames from most manufacturers are
generally sized in increments of 19, 21, 23, and 25
some
inch
A few bicycles made for smaller children have 16 inch wheels,
and some children's ten speeds are fitted
top
20
very
tall
men
use
a
inches.
frame as large as 26 inches.
Although
Normally a
reference to a 27 inch bicycle relates to the wheel size, not the frame
size.
The
power
including the
sprockets
train of a bicycle is divided into several components,
crankset
and
front
sprockets,
and. the rear drive wheel.
crank
arm
lengths
chain,
the
rear
The crankset assembly consists of
the pedals, crank arms, crank spindle,
Typical
the
and
one
or
more
chainrings.
range from 140 to 175 centimeters and are
measured from centerline of the crank spindle to the centerline of
pedal
spindle.
Crank
arm
length
affects pedal force versus travel
circumference, but does not influence the gear ratio calculation.
ratio
is
to
revolution.
range
Gear
affected by the size of the front and rear sprockets and the
size of the drive wheel.
related
the
the
Gear ratio is expressed as a distance
distance
the
bicycle
travels
during
one
Most standard ten-speed bicycles have gear ratios
of 45 inches to 100 inches.
crank
in
the
The higher numbers represent higher
gear ratios such as used when traveling downhill.
19
figure
The lower ratios are
20
used for climbing
shifting
uphill.
All
for
changing
mechanism
multi-speed
gear
bicycles
ratios.
experienced bicyclists is to select a gear ratio
The
which
incorporate
goal
of
allows
a
most
for
a
comfortable power output at a pedal cadence of 60 to 80 revolutions per
minute.
The formula for computing gear ratio is:
= CFr9nt
Ratio
Normal sizes for front
Normal
*
sprocket/Back sprocket)
sprockets
Wheel Diameter
range
from
36
tp
sizes for rear sprockets range from 13 to 36 teeth.
54
teeth.
The lowest
gear combination obtainable using these ranges and a twenty seven
inch
wheel is:
Gear Ratio
=
(36/36)
*
27
= 1.0 *
27
=
27 inches
The highest possible ratio from these ranges is:
Gear Ratio
Most
= (54/13) *
27
= 4.15 *
27
= 112
inches
standard ten-speed bicycles are sold with front sprockets of
40 and 52 teeth, and rear sprockets of 14 to
24
teeth,
resulting
in
gear ratios of 45 inches to 100 inches.
Cadence is the speed of rotation of the bicycle crankset,
expressed
in revolutions per minute (RPM).
average pedal cadence for that minute.
instantaneous pedal cadence.
This can
be
is
Cadence can be obtained by
counting pedal revolutions for a period of one minute.
an
and
This results in
A more useful figure is the
determined
by
timing
the
period of rotation of one crank revolution, and dividing this time into
60 to obtain revolutions per minute.
Cadence
For
= 60
The formula is:
/ Period of revolution
example,
if
it takes 2 seconds for the pedals to complete a
revolution, the cadence is computed as:
Cadence
= 60
(sec per min)/2 (seconds per rev) = 30 RPH
21
Elapsed
is
time
elapsed since reset.
computed
by keeping a running count of seconds
This running total can, at any time, be converted
to hours, minutes, and seconds for display.
The formula is:
total seconds I 3600 = HOURS + remainder
remainder I 60 = MI~~TES + SECONDS remainder
Distance is computed by keeping a running count of the
wheel
revolutions,
or a multiple thereof.
using a few predetermined mathematical coefficients.
= (wheel
= (wheel
revs
revs
*
*
of
This running total can, at
any time, be converted to miles or kilometers traveled for
Distance (mi.)
Distance (km.)
number
display
by
The formula is:
in. per rev I in. per mile
in. per rev I in. per km
Speed is computed by determining the number of wheel rotations, or
fraction~£
a wheel rotation traveled
in
one
second
and
using
the
following formula:
wheel revs
*
in. per rev
Speed (MPH)
= ------------------------ *
Speed (KPH)
= ----------------------- *
inches per mile
wheel revs
*
3600 (sec per hr)
in per rev
inches per kilometer
3600 (sec per hr)
Average speed is computed by dividing
elapsed time.
distance
traveled
by
the
The formula is as follows:
Ave speed (MPH)
Ave speed (KPH)
wheel revs
*
in per rev
3600
wheel revs
*
in per rev
3600
-------------------------------* Time
(sec)
inches per mile
= ----------------------- *
inches per kilometer
----------
Time (sec)
Calculations for use in a microprocessor are somewhat more complex
than the above hand computation
decision
to
revolutions.
store
a
spoke
methods.
count
One
instead
This results in larger . numbers
reason
of
in
a
the
is
the
basic
count
of
wheel
distance
total
22
buffers, but enables speed calculations to be carried out with
accuracy.
Another reason for greater complexity is the limited size of
the microprocessor registers.
bits
Since the
registers
are
only
wide, results of large multiplications would be lost.
the
greater
internal
calculations
are
all
integer
sixteen
Also since
processes,
results
division operations with long decimal remainders would be lost.
around these problems, several techniques were
basic
computational
incorporated
algorithms of the software design.
To get
into
of
multiply
and
divide
intermediate results become
technique
used
to
operations
neit~er
artifically
and
the
arrange them so that
too large, or too
modify
the
One technique
used to avoid overflowing the data buffers is to take into account
order
of
small.
Another
the magnitude of intermediate
figures is to take into account the expected size
of
the
inputs
and
outputs of each operation, and adjust them accordingly using left and
right shift operations. This allows the computational algorithms to
maximize
significant
buffer~.
intermediate
as
multiplying
dividing
figures
by
the
two.
d~ta
of
without
exceeding any of the
A one bit binary left shift has the same
number
Using
by
effect
two, and a right shift is the same as
this
technique,
a
small
number
can
be
artifically pumped up to a larger dimension before a division operation
and returned to its proper size after the division.
similarly
later.
be
right
shifted
prior
Large numbers
a multiplication and restored
to
Since numerical coefficients all must be expressed
values,
a
numerical
related
technique
coefficients,
and
is
to
right
can
use
shift
a
multiple
the
result
as
integer
of fractional
after
the
computation.
A normal bicycle wheel is laced with thirty-six
on
a
side.
A spoke
detector
eighteen
located on one side of a wheel would
normally be activated eighteen times
sensor
spokes,
per
wheel
revolution.
If
the
were situated over the point where the spokes cross in order to
inprove signal strength, the count per revolution becomes nine.
Wheels
of different diameter roll different distances in one revolution making
distance adjustment for wheel diameter necessary.
wheel
Also,
for
a
given
size, the rolling diameter is affected slightly by the thickness
23
of the tire casing and by the tire pressure.
It may
be
some
cancel
out
users
to
make
fine
adjustments
to
important
these
to
minor
inaccuracies.
The
fundamental
calculations
used
in
the
center around the basic calculation of distance
information,
hard-coded
using
wheel
rotation
algorithms, calculation coefficients and user
selected distance adjustment values.
involves
bicycle speedometer
The
basic
distance
calculation
the wheel diameter and spoke count, and results in a standard
coefficient of spokes per unit distance.
Spokes 5280 (ft/mi)
per =
mile
27
*
*
12 (in/ft)
*
It is computed as follows:
18 (spokes)
= 13445.42
pi (in/rev)
Since one kilometer equals .6214 mile, the above spoke coefficient
can be proportioned for metric use as follows:
Spokes per kilometer = .6214
Distance
*
13445.42 = 8354.9
traveled can be calculated when the spoke count is known
as follows:
Miles traveled = spoke count I 13445.42
Kilometers traveled = spoke count I 8354.98
Since it is desired to express the
tenths
of
distance
on
the
display
in
a mile (or km), the spoke coefficient can be divided by ten
to obtain a coefficient equivalent to spokes per tenth of a mile:
Tenths of a mile traveled = spoke count / 1344.542
Tenths of a kilometers traveled = spoke count I 835.498
Converting these distance coefficients to binary
results
following:
1344.5 (decimal) = 010101000000.1000 (binary) = 540.8 (hex)
835.5 (decimal) = 001101000011.1000 (binary) = 343.8 (hex)
in
the
24
To
capture
the
tenths
in
both
coefficients, and thereby gain
greater accuracy, the coefficients are shifted one bit left, to produce
the following:
= OA81
= 0687
1010 1000 0001 (binary)
0110 1000 0111 (binary)
The
differences
(hex)
(hex)
in wheel diameter and spoke count are taken into
account by comparing the least and greatest number of spokes
that
is
possible.
is
diameter,
obtained
is
expected.
expected
when
laced
The
the
with
fewest
wheel,
mile
This comparison leads to a maximum value necessary
for a distance adjustment register.
mile
per
of
The greatest number of spokes
smallest
forty-eight
spoke~
twenty
per
eight
expected
spokes,
per
wheel of twenty inch
the
greatest
number
mile is obtained when the largest
inch
diameter,
is
laced
with
twenty-four spokes, the fewest expected under any circumstances.
greatest
spokes
per mile
fewest
spokes
per mile
5280 (ft/mi) * 12 (in/ft) * 24 (spokes)
= ---------------------------------------
= 24201
20 * pi (in/rev)
5280 (ft/mi) * 12 (in/ft) * 12 (spokes)
= --------------------------------------- = 8643
28 *pi (in/rev)
Comparing these values with the nominal calculated value gives the
larges-t and smallest fractional adjustment that must be provided by the
distance adjustment register.
Adjustment 1
Adjustment 2
= 24201 l
= 8643 I
13445 = 1.8 or 180 %of nominal
13445 = .642 of 64 %of nominal
The adjustment buffer is an eight bit binary number with
nominal, or unadjusted value being 1000 0000 (binary) or 80 (hex).
the
The
limits of adjustment are all ones as a maximum, and a single one in the
least
significant
position
as a minimum.
When used as a multiplier,
the distance adjustment spans the required range as follows:
Largest = 1111 1111 (binary) = FF (hex) = 255 (decimal)
Smallest = 0000 0001 (binary) = 01 (hex) = 01 (decimal)
25
Compared
to
the
nominal
adjustment
position of 80 (hex)
= 128
(decimal), the ratios are as follows:
maximum= 255 I 128 = 1.99 or 199 %of nominal
minimum= 01 I 128 = .0078 or .78 %of nominal
The adjusted distance calculation used
is as follows:
adjusted . spoke count
distance = ---------------dist coefficient
The
distance
~n
the computing
adjustment register (hex)
* -------------------------
adjustment
80 (hex)
register
is
set
by
the
installation setup of the unit on the selected bicycle.
the
major
function
algorithm
routines
user during
It is used
by
which compute speed or distance related
results. .These include the speed module, the gear
distance module, and the average speed module.
ratio
module,
the
CHAPTER 6
DESIGN TRADEOFFS AliD DECISIONS
Selection of the microprocessor was driven
power
consumption,
architecture,
by
availability,
considerations
and cost.
consumption of most microprocessors using Transistor
(TTL)
The power
Transistor
technology is in the order of 200 milliamps at 5 volts.
Logic
This is
quite excessive for a battery powered system, since a battery can
supply roughly 20 milliamps for continuous duty.
the Complimentary Metallic Oxide Semiconductor
of
only
Microprocessors using
(CMOS)
technology,
by
comparison draw only 100 microamps, and are much more suited to battery
applications.
The choice of CMOS microprocessors is somewhat
Some
available
of
the
choices are the CMOS equivalents of the 8080,
2900, and 6800, and the RCA
devices
is
all
roughly
1800.
Since
equilavent,
primarily architectural
considerations.
decided
the
advantage
for
limited.
intended
the
power
and
choice
Here
the
cost
of
these
resolved itself to
RCA
1802
had
a
application because it supports
several directly accessable input output (I/O) flag lines.
The
other
processors may be better suited for large volumes of data exchange over
the data bus, but the RCA device won out because many of the
of
this
functions
system involve detection of several single bit functions such
as sensor and timing flag lines.
Once the 1802 was selected as the microprocessor, the choices of a
suitable development kit was limited to the ELF by Netronics, and Super
ELF by Quest.
the
advantage
The Quest unit comes packaged in a wooden
of
a
memory
address display.
boards.
motherboard
with
five
bus
and
has
The ELF has no address
display, and comes with only 256 bytes of memory, but it
large
box
does
have
a
connectors for expansion interface
Cost and availability being roughly equivalent, it was decided
to go with the ELF and add a memory expansion and address display.
26
27
The choice of appropriate
rotation
had
a
range
of choices.
detection means such as a
switch.
sensors
for
the
wheel
and
crankset
One choice is to use a mechanical
flexible
cable
to
activate
a
mechanical
This involves several moving parts and introduces considerable
drag and some noise.
activated
Another choice is to use
by a moving magnet.
a
Hall
effect
sensor
The Hall effect is simply the induction
of an electrical impulse in a coil when it comes near a moving
magnet.
Hall effect sensors are used in most other electronic speedometers, but
has the disadvantage of requiring
moving
parts
of the bicycle.
that
magnets
be
attached
the
necessity
numbers.
to
attach
the
The attachment is typically achieved by
the use of adhesives, pressure sensitive tape, or clamps.
to
to
the
magnets,
In
addition
there is the question of
The accuracy of the instrument in reporting
distance-related
measurements
is determined by the resolution with which forward motion
is detected.
I£
instrument
one
will
magnet
only
record
is
attached
counts
in
the
wheel,
then
one count per wheel revolution.
speed is to be displayed once each
accumulate
to
second,
increments
of
and
one
the
wheel
roughly plus or minus 25 percent!
accuracy
at
only
revolution,
or
error
I£ additional magnets are added,
the error is divided by the total number of magnets used.
percent
I£ the
instrument
approximately eighty-five inches, the speed display will have an
of
the
(i.e.
a two
20 MPH will be obtained if 12 magnets are used.)
This process will eventually result in a suitably accurate display, but
at the cost of much weight and extra parts.
Another
solution
is to detect the movement of the existing metal
structures such as the wheel spokes.
(magnetic)
materials
proximity detector.
However,
some
and
could
(a bar magnet
spokes
stainless steel alloys.
used
Most spokes are made
be
detected
surrounded
using
by
a
a
coil
of
ferrous
Hall
effect
of
wire).
on better quality bicycles are drawn from
The magnetic properties
of
stainless
spokes
cannot be counted upon to reliably activate a Hall effect detector.
28
Fortunately, another technique is available to detect the
spokes.
This
is
through
the
use of the Focalt effect.
bicycle
The Focalt
effect refers to the damping of eddy currents in an unshielded inductor
caused
when
Focalt
detector
containing
a
piece of conductive material is brought near to it.
is
constructed
using
a ferrite-core inductor.
oscillator
electronic
an
A
It senses any conductive material
brought near the inductor and switches a Schmitt trigger.
Common
digital
Liquid Crystal
displays
Displays
used
today
(LCD),
as
displays,
and
type
displays.
The discharge displays require up to 240 volt power
which
too
high
such
incandescent
discharge
is
displays
are Light Emitting Diode (LED),
vacuum flourescent, and gas plasma
for battery operation.
current to be consistent with battery life.
LED
displays
draw
20
milliamps
per
A popular
sunlight
Typical seven bar
segment
readable
for
the LED.
unreadable
indoor
in
direct
display is the incandescent
more
current
The best display solution for battery powered equipment
is the LCD display since it requires only nanoamps of current
drive
segment
normal
seven bar segment display which, unfortunately, requires
than
inputs,
LED displays use too much
readability, and at this brightness, are almost
sunlight.
various
and
low
voltages in the range of 6 to 12 volts.
Liquid crystal displays
have two disadvantages which must be overcome.
They require moderately
sophisticated
the dark.
passive
viewing.
LCD,
drive
electronics,
and they are not at all readable in
Because they produce no light of their own, and are strictly
reflective
devices,
an external source is required for night
Such an external light bulb draws far more current
and its use must be kept to a minimum.
momentary light to the LCD display is a
with
the
LCD
than
the
A pushbutton to provide a
suitable
solution.
To
cope
drive requirements, many suppliers offer LCD driver ICs
which latch the data, decode the segments, and alternate the
and segment voltage polarities, as required for operation.
backplane
29
Much of what determines the accuracY. of the time functions is
choice
of
a
time
reference.
In
modern
the
digital electronics, this
usually falls into a choice between a crystal oscillator and an R-C
network. A crystal oscillator utilizes a flake of quartz crystal which
vibrates when a current is applied.
it
and
The crystal has leads attached
changes electrical resistance as it bends to and fro.
to
Crystal
oscillators are very stable over wide temperature ranges, and result in
very
accurate
time
bases.
The
most
commonly
frequency used in watches, and hence available in
hertz.
quantity,
crystal
is
32768
A cheaper and less accurate approach to time base selection is
a Resistor- Capacitor (R-C) network.
wire
available
a
555
A typical
is
to
integrated circuit (IC) timer to operate in astable mode,
charging and discharging a capacitor
Flip-Flop.
implementation
through
resistors
to
switch
a
Such timer circuits are only accurate to a few percent, and
are subject to drift with changing operating temperature.
Memory requirements for the software code is 1024 bytes.
in
the
production unit must be stored in non-volatile memory, such as
PROM or EPROM.
current
The code
The production unit must also
components.
unit should
Candidate
The
consider
memory
power
choice
system
consumption
from
very
low
as
a
major
consideration.
chips are the Harris HM-6611 1024 bit CMOS PROM, and
is
PROM.
Code
storage
for
the
not dependent on current requirements since it
operates using a transformer power
downloaded
with
of a PROM memory for the production
the Intersil IM6603 1024 by 4 Erasable
development
operate
cassette
tape
supply;
and
the
Also,
the
code
memory
can
be
can
be
volatile.
Therefore, any commonly available RAM memory such as the 2101 256 by
4
TTL memory is acceptable.
Random Access Memory for buffers, scratchpad and stack requires 27
bytes. The prototype version requires the use of low power memory such
as the CMOS RCA 1823C 128 by 8 RAM chip. It is not vital that the
development system employ the same chip as the prototype, but helps
verify the design.
to
30
Cost of the development system
since
only
one
components
system is being constructed.
are
not
significant,
Selection of components
for the production version should pay attention to cost and delivery.
A primary design consideration for the software
the
implementation
of
the
counting
for
system
concerned
the spokes, time, and RPM.
Since the microprocessor supports only one hardware interrupt line,
was
decided
to
use
the
interrupt line for the spoke detector.
spoke counts are accumulated by a software
Interrupt
(ISR) which is invoked each time a spoke is detected.
counts are sensed by the scan
software.
occur.
routine
and
Service
it
The
Routine
The time and RP!-1
accumulated
by
the
scan
A scan loop was developed which does not wait for events to
Instead the scan loop falls through and
repeats
thousands
of
times a second, sampling the various flags each time.
The
1802 microprocessor provides several methods for invoking the
execution of main level and subroutine
most
level
software
modules.
The
simple method of program execution is to have one program counter
(PC) which responds to jump or branch instructions in the
method
would
work
code.
This
fine if each function module were a self-contained
unit including all necessary mathematical and Input output (I/O)
code.
For reasons of space, the mathematical and I/O routines were broken out
as utility subroutines in
order
to
avoid
duplicati?n
of
the
code
storage.
Use of the utility subroutines imposes some additional
on the software design.
complexity
Namely, the return address to the main routine
must be known when the time comes to
return
from
a
subroutine.
To
accomplish this, a pair of special routines were introduced to save and
restore program counters during calls
and
The
return
JSR
module
saves
the
callers
subroutine, and the RTS subroutine restores
address
after a subroutine has completed.
returns
from
address
execution
and
to
subroutines.
calls
the
the
return
Careful attention was given
to the software design so that only one subroutine could be executed at
a
time
from
a
given main level module.
Since subroutines are never
31
nested, one return address need be preserved by the JSR linkage module.
Use of a stack for subroutine linkage purposes is thereby avoided.
Initial entry of program
possible
only
via
code
into
the hex keypad.
the
of
individual
ELF control switches
function
of
the
system
is
Once the code has been entered by
hand, it can be written to tape, and later
Changing
development
be
restored
into
memory.
memory cells can be accomplished by using the
and
monitor
hex
keypad,
circuit.
or
by
utilizing
the
change
In either case, only hex machine
language code can be entered, and the exact address
and
program
code
must be known in advance.
The programs in memory can be executed starting from location zero
using the ELF control
utilizing
the
run
switches,
function
monitor it is necessary to
or
of
first
from
the
any
starting
monitor circuit.
enter
a
three
byte
location
by
To invoke the
jump
program
containing the starting address of the ROM monitor (FOOO) into location
zero of the development system memory.
executed
using
the
ELF
control
When the jump program
is
then
switches, the monitor is activated.
Commands for the ROM monitor are as follows:
1.
To
execute
a
program,
examine
a
memory
enter
00 followed by a 2 digit starting
address.
2.
To
location,
enter
01 followed by a 4 digit
starting address.
3.
To
change
a
memory
location,
enter
02
followed by a 4 digit
starting address.
4.
To
write
to
read
from
cassette,
enter
03 followed by a 4 digit starting
address.
5.
To
cassette,
enter 04 followed by a 4 digit starting
address.
6.
To scan memory, enter OS followed by a 4 digit starting address and
2 byte data word.
CHAPTER 7
HARDWARE DESIGN
The Microtac development system provides a hardware test
the
development
software.
signals
hardware
interface
of
the
and
unit.
all
operation
The
the
environment
finished
functions
a
field
test.
But,
it
has
so
the
is
interface
expected
system
completed
development system is not portable, and
actual
that
development
of
for
circuits and the application
The development system hardware simulates all the
production
performs
of
bed
with
in a
software
prototype design.
cannot
be
advantage
tested
of
in
The
an
allowing test
modifications to the hardware and software that a production
prototype
does not support.
The
by
development system is based on the ELF II microprocessor made
Netronics
microprocessor,
Inc.
The
a
limited
ELF
II
consists
memory
with
of
256
a
mother
byte
board,
capacity,
display, a HEX keypad for entry of data, and five expansion
a
a data
slots
for
adding interface circuits.
The Microtac development system consists of the basic ELF with the
addition of the following general enhancements:
1.
A expanded memory resulting in 1024 bytes of
program
storage
and
128 bytes of data buffer storage used to hold data.
2.
A memory address display used
to
locate
code
and
data
in
the
into
the
memory.
3.
A cassette interface used to download the
program
code
memory.
4.
A monitor circuit used to examine
program,
write
from
memory
memory,
change
memory,
run
a
to cassette tape, and read from cassette
tape.
32
33
5.
An enlarged capacity power supply
used
to
power
the
additional
memory and interface circuits.
In addition to the general development enhancements, the following
specific
interface
circuits
interfaces which simulate
were
the
developed
operating
to
provide
enviroment
of
specific
the
bicycle
speedometer:
6.
The distance adjustment circuit used to provide an eight-bit binary
distance adjustment to the speedometer system.
7.
The mode select circuit used to
provide
user
input
mode
select
signals to the speedometer system.
8.
The sensor circuit
used
to
provide
spoke
and
crank
detection
signals to the speedometer system.
9.
The clack circuit used to provide timing signals to the speedometer
system.
10.
The display circuit used
to
provide
output
displays
from
the
speedometer system.
At
the heart of the Microtac hardware design is the RCA 1802 CMOS
microprocessor.
uses
a
The microprocessor has an eight
sixteen bit memory address.
registers numbered 0 through F.
as
the
program
counter.
permanent subroutine
mathematical
arguments,
wait line is provided to
instruction
cycle
and
as
data
path,
but
There are sixteen general purpose
Any of the registers can be designated
Certain
PCs,
bit
registers
others
used
can
for
be
designated as
counters,
to
hold
memory pointers, or as flag registers.
disable
sequencing.
which has the effect of reseting
the
internal
microprocessor
A
clock
A clear signal line is also provided
the
microprocessor
registers.
The
microprocessor responds to interrupts over one interrupt line, IRQ, and
accepts input flags over four flag lines EFO through EF3.
lines
under
software
lines NO, Nl, and N2.
register,
is
control
Three output
cause activation of the output control
An additional input and output register,
available
the
Q
as a latched input which can be tested by the
34
software, and also as a hardware output line which can be turned on or
off by the software.
The Q line is not used by the speedometer
software, but is used to transfer serial data to and from the
cassette
interface.
Connected to the microprocessor via the data bus
chips
for
buffers
and program storage.
are
the
memory
The memory expansion circuit
uses TTL 2101 chips for code storage, and a
single
RCA
CDP1823C
byte CMOS RAM chip for data buffer storage.
(See Figure 1).
128
The address display for the development system is connected to the
address lines and the timing signal lines TPA, and TPB.
It provides
display
The display is
of the address on the address bus at any time.
used to indicate the position in memory
when
code
using
hex
keypad•
the
ELF
control
switches
and
is
being
software
(See Figure 2).
Also
connected to the microprocessor through the data bus are the
mode and distance adjustment switches.
position
scanned
It also gives an
indication of the address range of the program counter during
execution.
a
rotary
connected.
switch
which
The
grounds
mode
the
switch
is
a
nine
data line to which it is
Two of the switch positions are connected to microprocessor
hardware lines to provide the pause and reset functions.
When the mode
is switched to the pause position, the wait line of the
microprocessor
is held low, and the internal clock is temporarily disabled, so that no
instructions are executed until the mode switch is
pause
position.
When
the
mode
position, the clear line is held
reset,
and
begin
procram counter.
execution
select
low
is
causing
moved
switched
the
off
to
of
the
the reset
microprocessor
to
at location 0000 using register 0 as the
The other mode select positions are connected to
microprocessor data bus through tri-state logic gates.
the
When one of the
seven mode positions is selected, the rotary switch causes one of the
bits in the mode select register to be held low. When the mode
register is then read into the data bus
enable
control
line
of
the
by
activating
the
tri-state
logic gate, the bit pattern of the mode
35
select switch is placed onto the data bus,
software. (See Figure 3).
and
can
be
read
The eight position Dual Inline Package (DIP) switch used
distance
the
for
the
adjustment function is also connected to the data bus through
tri-state logic gates.
mode
by
register
is
The switch is set by the
read
adjustment
pattern can be read by the software.
to
the
and
when
the
into the data bus by activating the tri-state
enable control line of the distance
Connected
user,
logic
gate,
the
bit
(See Figure 4).
microprocessor Interrupt Request (IRQ) line is
the spoke detector latch circuit.
The latch
which
from the spoke detector circuit, and
receives
the
set
signal
receives the clear signal software
line.
is
a
D type
flip-flop
activation of the N2 output flag
v~a
The crank detector is connected to the microprocessor input flag
EF2.
(See Figure
5).
A component
carrier
electronics needed by the detector circuits.
provides
the
discrete
The detector circuits are
Focalt effect detectors using several discrete components, a transistor
pair
in
a
CMOS 4007 IC package, and an inductor coil wound around an
"E" shaped ferrite core.
(See Figure 6).
The clock circuit which provides the
1Hz,
1024 Hz,
and
32 Hz
square wave timing signals connects to the flag lines EF4, EF3, and the
32Hz LCD backplane line respectively.
crystal
oscillator
which
produces
The clock circuit consists of
a
square wave frequency of 32768
kilohertz, and two CMOS IC chips which count the
required slower frequencies.
a
signal
down
to
the
(See Figure 7).
The Liquid Crystal (LCD) display and associated
drivers
connects
to the data lines, the timing signal TPB, the TIME signal line, and the
output flag lines NO, and Nl.
number
1665
capable of
contains
device
displaying
which
time
The LCD display is an
consumes
or
decimal
nanowatts
numeric
digit
of power.
values
IEE
It is
because
it
a selectable decimal point between every pair of digits and a
selectable colon between groups of
reflective
450
eight
background
for
two
digits.
The
display
has
a
good visibility, and has edge pin mounting
36
for mating with a single inline package (SIP) IC
driven
using
a
socket.
An
LCD
is
voltage potential between the backplane and the front
plane to cause a display segment to become visible.
The voltage causes
the liquid crystal material to polarize, which makes it visible through
the front glass which is coated with a polarizing filter.
polarity
between
the
front
The
voltage
glass and the backplane must be reversed
periodically to prevent the crystal material from plating off onto
front
glass
and rendering the display segment opaque.
switching is accomplished by the display driver circuit.
the
This backplane
The
display
drivers
are CMOS 4056 ICs which provide a single digit latch for input
binary coded decimal (BCD) data, decode the data into display segment
lines,
drive
reverse
the
the
segments
potential
backplane frequency.
under
and
backplane
signal
(See Figure 8).
from
to proper potentials, and
the
externally
supplied
37
D7
D6
D5
D4
15
13
11
9
2
1
0
1
---
15
16
13
14
11
12
10 - 9
2
1
0
1
--
16
15
14
13
12
11
10 - 9
-
2
1
0
1
16 I - - 15
14 1 - 13
12 1 - 11
10 ~9
17
17
17
17
17
17
17
17
2
1
0
1
16
14
12
10
2
1
0
1
16
14
12
10
PGO
D7
. D6
D5
D4
15
13
11
9
2
1
0
1
--
15
16
13
14
11
12
10 ~9
+Sv
DO
:
D7
PGO
AO
E
L
F
:
A7
NO
N1
TPA
TPB
MRD
MWR
GND
B
u
s
s
---
16 ~ 15
13
14
12 ~ 11
10 ---9
PG 1
PG 0
,.---
2
1
0
1
2
1
0
1
-----
15
16
13
14
12
11
10 - 9
PG 3
PG 2
----
--
------
DO
:
PGO 9
AO
Al
A2
---
4 10 !--
0 11 1 9 12
1
8
:
2
3
A7
9
13
---
D7
AO
17
128 BYTE RAM
PG 4
--
....__ -Figure
1.
Microprocessor Memory
38
A7
A6
AS
A4
A2 13
Al 2
AO 3 5
~
+Sv
AO
A1
A2
A
A3
T
A4
AS
A6
A7
A
TPA
TPB
GND
LED
LED
DISPLAY
DISPLAY
14 +5 +5 1
7 GND
8 GND
+5 1
14 +5 +5 1
7 GND
8 GND
12
13
2
3
5
A3
A2
A1
AO
14 +5
7 GND
8 GND
12
13
2
3
5
--
----
D
1707
1707
1707
LED
DISPLAY
--
--
--
--
B
_....
NOT
T
u
s
s
......._
--
Figure 2.
Address Display Circuit
39
POSITION
ROTARY
SWITCH
RESET
v
1
l
PAUSE
SPEED
AVE
c
GEAR
RPM
T
L
w
E
A
I
M:S
6
12
A
I
R
T
J
GND_j
14
12
+5 16
D5 13
D4 11
15
~ ~~ ~
METRIC
SWITCH
,...._
+5v
CLEAR
wAIT
DO
D1
D2
D3
D4
D5
D6
D7
T!ME
4
'--- 10
4
5
+5 16 0
D7 13 3
D6 11
1 14 15
N1
NO
GliD
DIST
M H:M
E
D
A
T
A
--
lo-
T
I
M
E
NAND
--
----
--
,..~...
NOT
~-
B
u
s
s
....__ -Figure 3.
Mode Select Circuit
4 2 1-5
0 9 D3
3 7 D2
5 Dl
3 DO
,, .
40
8 bit DIP switch
I
7
6
5
4
3
2
1
0
e
e
a
o
o
o
o
o
I
I
I
I
I
GND
I
I
r
,.--
'
14
12
4
5
+5 16 0
D7 13 3
D6 11
15
6
10
12
14
+5 16
D5 13
D4 11
15
4
4 2
i--
5
0 9 D3
3 7 D2
5 D1
3 DO
.
+5v
DO
D1
D2
D3
D4
- -D
A
T
A
DS
D6
D7
B
u
s
s
NO
N1
GND
-
NAND
----
---
--
----
~-
NOT
--
-Figure 4.
Distance Adjustment
Circui~
41
CRANK SENSOR
SPOKE SENSOR
--~
-yo~
23T
51T
15
3~ 10
61-- 13
81-- 9
41-- 1
4
0
GND 7 0
GND 9 7
12
11 +9
Y'-
23T
51T
GND
GND
+5 16
21
8GND
12 GND
14 GND
16 +9
15
+5 16
4
0
0
7
12
31-- 10
71-- 13
81--9
41--1
11 +9
+5 14
+5 5
4 3
6 0 4
7 1 2
8 3
10
11
2
+5 v
-
--
D
A
T
IRQ
N2
A
B
-
EF 2
GND
u
s
s
--
-Figure 5.
21
8 GND
12 GND
14 GND
16 +9
COMPONEN T
CARRIER
COMPONENT
CARRIER
GND
GND
GND
GND
GND
.:;,;,;.
~
Sensor Circuit
42
1
4
21
GND 8
II
16 +9
.01
16 +9
9
12 M
16 +9
10
12 M
10
II
15
500pf
14
10
II
14 GND
11
t9
14 GND
11
e1
13
II
15
11
500pf
12
1800 pf
GND
12
12
Figure 6.
i3
3j0
~pf
13
Sensor Component Carrier
43
+5 16
+5 14
10M
11
1
3
12
4
0
6
GND 8 0
GND 12 10
15
5
4
0
2
GND 2 4
GND 7
32.768 KHZ
+5v
EF4
EF3
32HZ
D
A
T
A
1HZ
1024HZ
32HZ
B
u
s
s
GND
-----------------------------------------------------Figure 7. Clock Circuit
44
B 8:8 8
COLON
DECIMAL PT
0
. .
. .
j_
9-15
9-15
9-15
4 16 +5
0 7 GND
5 8GND
6
4 16 +5
0 7 GND
5 8GND
6
4235 1
4235 1
I
4
0
2
8
-I
BACKPLANE
.
4 16 +5
0 7 GND
5 8 GND
6
4235 1
9-15
4 16 +5
0 7 GND
5 8 GND
6
4235 1
I
15
2
14
•3
11
13
10
NANDI
~
+5v
DO
Dl
D2
D3
D4
D5
--
D
A
T
A
~
TPB
NO
N1
---
....
-
~--
NOT
B
u
s
s
AND
""""-
TIME
GND
456
1
4 10
0 12
GND 7 5 14
GND 8 4 16
GND 13 15
11
9
-Figure 8.
Display Circuit
T
+5
+5
+5
+5
+5
GND
CHAPTER 8.
SOFTWARE DESIGN
The software system is divided into several
and
several
subroutines.
Main
level
main
routines
level
routines
are distinguishable
because they all operate at the same hierarchical priority.
Main level
routines transfer control from one to another using jump, branch, or go
to statements.
subsequent
They do not use a stack to store a return address,
control
and
transfers must be targeted to a specific location.
Subroutines, on the other hand, are software modules which operate at a
subordinate
level to the main software routines.
They usually perform
a specific limited function in response to parameters which are
by
the
main
routine
Subroutines receive
subroutine
(JSR)
or
reside
control
using
statement.
All
in
a common storage location.
some
form
of
subroutines
call
the
a
subroutine,
subroutine
jump
to
When a main routine
execution of the main routine resumes as soon as
completes.
This
instruction does two things.
executes a jump
or
All
end with some form of
return, or return from subroutine (RTS) statement.
calls
passed
targeted
is
possible
because
the
CALL
It stores the present program counter and
to
the
subroutine.
At
the
end
of
the
subroutine the RTS instruction retrieves the stored program counter and
uses it as a jump target.
Thus the next instruction after
a
call
is
always executed when the called subroutine completes.
The
executive
scan routine.
following
a
modules include the initialization routine and the
The initialization routine (INIT) is executed only
reset
by
the
operator,
or
a power-on reset caused by
powering up the unit following a power interruption.
into
the
buffer
(SCAN) is
service
routine,
and
and passes execution to the scan routine.
the
It
writes
zeros
areas, sets up the dedicated program counters to the
subroutines and the interrupt
interrupts
once
main
executive
module
45
which
finally
enables
The scan routine
performs
a
number
of
46
functions.
the
1024
It acts as the main idle loop for the processor.
kilohertz
clock and increments the 1Khz counter.
the one second clock and increments the time counters.
mode
It senses
It senses
It reads in the
and distance adjustment registers with each pass and detects when
service by one of
necessary,
the
major
function
routines
is
required.
When
it causes execution to transfer to a major function routine
for service and display update.
The
major function routines each perform a specific computational
process to produce the display as selected by the mode
Execution
of
the
are
all
switch.
major function routines is under the control of the
main scan routine.
routines
select
Values
stored
used
as
inputs
to
the
major
function
in the buffer areas which are common to all
modules.
The speed module (SPEED) accepts a 16 bit count of spokes detected
in
the
last
second,
and
produces a four digit display representing
instantaneous speed in either miles per hour or
expressed
to the nearest tenth.
the
result.
per
hour,
The speed routine utilizes the metric
or English speed coefficient and the
computing
kilometers
di~tance
adjustment
register
in
Subroutines used are multiply (MPY) and shift
right (SHR).
The
detected
gea~
ratio module (GEAR) accepts an
since
the
last
8
bit
count
of
spokes
crank revolution, and produces a four digit
display representing the present gear ratio in either inches or meters,
expressed
to
the nearest tenth.
The gear routine utilizes the metric
or English speed coefficient and the distance
computing
the
result.
adjustment
register
in
Subroutines used are multiply (MPY) and shift
right (SHR).
The
pedal
cadence
module
(RPM)
accepts a 16 bit count of 1024
hertz pulses detected since the last crank revolution, and
produces
a
four digit display representing the present pedal cadence, expressed to
the nearest tenth.
The RPM module uses ·the divide (DIV) subroutine
computing the result.
in
47
The distance module (DIST)
detected
since
the
metric
to
or
register
the
traveled
nearest
English
1.n
a
32
bit
count
of
spokes
unit was reset, and produces a four digit display
representing the distance
expressed
accepts
tenth.
speed
computing
in
miles
or
kilometers,
The distance routine utilizes the
coefficient
the
either
result.
and
the
distance
adjustment
Subroutines used are shift left
(SHL), divide (DIV), multiply (MPY) and shift right (SHR).
The time module (TIME) accepts a 32 bit count of seconds
since
the
unit
was
reset,
and
produces
a
four
digit
representing the elapsed time in either hours and minutes,
and
seconds,
expressed
with
right
(SHR),
display
or
minutes
a colon separating the two digit pairs.
The time utilizes the divide (DIV), convert binary
shift
detected
to
decimal
(CBD),
and update display (UPD) subroutines in computing
the result.
The average speed module (AVE) accepts a 32 bit count
detected
since
the
expressed
to
the
nearest
tenth.
The
kilometers
used
by
the
per
average speed routine
utilizes the distance routine (DIST) to compute the distance
Subroutines
seconds
unit was reset, and produces a four digit display
representing average speed in either miles per hour or
hour,
of
traveled.
average speed routine are shift left (SHL),
divide (DIV), and shift right (SHR).
The
OUT4
routine
is
the
wrapup
routine for many of the major
function routines.
It accepts a 16 bit binary result
function
converts
routine,
and
calls
the
major
it to four numerical characters in Binary
Coded Decimal (BCD) format, stores the four characters
buffer,
from
in
the
output
the Update Display (UPD) subroutine to refresh the
display using the data in the output buffer.
It then jumps to the SCAN
routine marking an end to the major function execution cycle.
The utility subroutines in this system are a collection of modules
which provide often-repeated functions in order to avoid duplication of
code
in
the main routines.
Instead the main routine need only set up
48
the parameters and call
subfunction completed.
the
subroutine
which
returns
with
the
The multiply (MPY) subroutine accepts a 16 bit multiplier and a 16
bit
multiplicand
and
produces
a
32
bit result.
The multiplier is
stored, by convention, in general register F, and the multiplicand in a
memory storage location pointed to by general register D.
The returned
result is stored in the general register pair E, and F.
The Divide (DIV) subroutine, accepts a 32 bit dividend
and
a
16
bit divisor and produces a 16 bit quotient and a 16 bit remainder.
The
dividend is stored, by convention, in the general register pair E,
and
F,
and
the divisor in a memory storage location pointed to by general
register D.
The returned quotient is stored in the general register F,
and the remainder in general register E.
Shift Left (SHL) subroutine accepts a 32 bit binary number to
The
be shifted, and returns a shift
shifted
until
count
and
the
the high 16 bit word is non zero.
by convention, in the general register pair E,
result
is
32
bit
number
left
The input is stored,
and
F.
The
returned
stored in the general register pair E, and F, and the shift
count is stored in a memory storage
location
pointed
to
by
general
register D.
The Shift Right (SHR) subroutine accepts a shift count
bit
binary
number
and
a
32
to be shifted, and returns the 32 bit number right
shifted the
indicated
convention,
in the general register pair E, and F, and the shift count
in general register C.
register
pair E, and F.
number
of
bits.
The
input
The returned result is stored
and
by
the
in
stored,
the
by
general
The right shift subroutine is used to recover
from the effects of accuracy enhancement produced
subroutine
is
use
by
the
left
shift
of intentionally oversized computational
coefficients.
The Convert Binary to Decimal (CBD) subroutine accepts
binary
number
and
Decimal (BCD) data.
outputs
one
to
four
The input is stored,
a
16
bit
characters of Binary Coded
by
convention,
in
general
49
register F, the starting memory storage location pointed to by general
register D, and the character count in general register B. The
returned BCD characters are stored
buffers.
in
the
The display Update (UPD) subroutine
Binary
Coded
indicated
accepts
memory
four
storage
characters
of
Decimal (BCD) data, and outputs the data to the display.
The input is stored, by convention, in four successive
memory
storage
locations starting with the label OUTBUF.
The
interrupt
detector line.
service
routine
(ISR)
is activated by the spoke
Each time it is activated, it takes
other module in the system.
control
the
It
speed counter, distance counter, and gear counter.
then restores the machine status to the previous
interrupt.
any
It first saves the machine status from the
previously executing module and disables further interrupts.
increments
from
state
prior
to
then
It
the
It finally returns execution to the same location which was
executing before the interrupt.
other system operations.
In this way the ISR
is
invisible
to
CHAPTER 9
TEST PROCEDURE
The test
procedure
for
verifying
the
operation
of
the
unit
consists of downloading the software from cassette tape, and exercising
the unit through each of its functional modes.
assemble
the
development
kit
The first
step
is
to
motherboard with each of the interface
boards.
Insert the Cassette interface and monitor board (Giant Board) into
the
leftmost
bus slot of the ELF motherboard.
be oriented so that the component side faces
connector
position
Before
to
the
right.
inserting
the
component
sensor
side
interface
facing
board,
connect the nine volt battery to the battery terminals.
slot,
insert
right.
the
In
the
to the right of the Giant board, insert the sensor
and mode select board, again with the
right.
The Giant Board should
display
board
with
to
the
install and
In
the
next
the LCD display facing to the
Finally, insert the memory expansion
board
with
the
address
display LEDs facing to the right.
Plug the power supply into a llOv line source.
and
Connect
the
red
green supply leads to the input connectors in the upper right edge
of the
ELF
connectors
motherboard.
Connect
the
sensor
input
leads
on the upper edge of the sensor interface board.
and spoke
sensor
connector.
The
leads
three
should
be
connected
to
the
to
the
The crank
corresponding
lead connectors should be oriented so that the
black, red, and green color coded wires match
up
with
the
connector
sockets of the corresponding colors.
Set
off.
the battery switch on, and check that the spoke sensor LED is
Set the clock switch to the off position.
supply,
set the MP switch down.
Power
the
power
Toggle the LOAD switch down, then up.
This positions the program counter to memory location 0.
50
on
51
Enter the jump command to the starting location of the Giant Board
ROM Monitor by typing the following:
CO I, FO I, 00 I
Set
the LOAD switch off, and position the RUN switch to on.
causes the microprocessor to execute the jump to the monitor
awaits
an input command.
This
where
it
Type the cassette load command (04) followed
by the starting address (0000), and the ending address (0300)
for
the
cassette load as follows:
04 I, 00 I, 00 I, 03 I, FF I, I
Setup the cassette player, and plug into
a
llOv
supply
outlet.
Place the cassette containing the speedometer download program into the
cassette player.
cassette
Plug the download cable into the earphone jack of the
player, and the black and green audio connectors at the upper
left edge of the motherboard.
position
marked
Set the cassette player
"PB" for playback.
indicate 00 until the download begins.
cycle quickly through all addresses
to
the
Rewind the cassette if necessary.
Depress the "PLAY" lever on the cassette player.
should
volume
00
to
FF
The
address
display
The display should then
three
times,
finally
stopping at FF.
To
check
that memory is
Depress the
that the download was successful raise the MP switch so
protected,
toggle
the
LOAD
switch
down,
then
up.
"I" key to review successive memory locations starting with
location 0000.
The displayed memory contents for the first five
cells
should be as follows:
CO FO 00 EO 71
Set the LOAD and MP switches down, raise the RUN switch to reenter
the
monitor.
Enter
the monitor command to begin execution at memory
location 3, the beginning of the speedometer code, as follows:
00 I, 00 I, 03 I
52
The
speedometer
scan routine.
update
the
code will now initialize and begin executing the
It should not execute any of the
routines
LCD display until the one Hertz clock is enabled.
rotary MODE switch to the TIME (M:S) position.
on
function
Set the
or
Set the
clock
switch,
the side of the clock interface board, to the up position.
The LCD
display should begin accumulating and displaying elapsed time after the
first
second
has
(H:M) position.
(M:S).
When
elapsed.
Turn the MODE selection knob to the TIME
Hours and minutes should both be zero.
the
should be incremented.
and
the
minutes
Turn to (H:M).
to
elapses,
should continue to advance.
displays
of
the
The minutes portion of
should
time
now
portion
the hours and minutes display
the
back
seconds portion of the (MIN:SEC) display exceeds 60
seconds, it should return to zero,
display
Turn
contain
a
one.
As
time
This can be
verified by checking the two time displays periodically.
Set
the MODE select knob to the RPM position.
read zero.
Grasp the pedal of the bicycle simulator and rotate it in a
circular motion until it passes the crank detector.
still read zero.
passes
The display should
the
the display should
Continue rotating the crankset until
crank
detector
a
second
time.
the
in
revolutions
per
minute
(RPM).
crankset at faster or slower rates of rotation.
refreshed
with
each
sweep
of
arm
The display should now
display a number equivalent to the speed of rotation of
displayed
crank
the
crankset,
Continue rotating the
The display should
be
the crankset to show the new computed
rotational rate.
Return to the TIME display.
advanced
along
setting.
The accumulated distance display should be
that
with
clock
Notice whether the elapsed
time.
has
Set the MODE selector to the DIST
zero,
indicating
the RPM test caused less than a tenth of a mile of distance to be
accumulated.
display
zero
Set the MODE selector to the SPEED
as
long
as
display
should
be
setting.
It
should
the crank and wheel are stationary.
rotating the crankset to drive the wheel.
speed
time
Begin
At one second intervals
the
updated with the instantaneous speed of the
previous one second interval.
Rotate the crank faster
and
slower
to
i'
53
see how the displayed speed changes.
Compare the displayed speed
with
the speed obtained with the mechanical wheel mounted speedometer.
Stop
rotating the crankset.
Observe how the speed display decays to zero as
the wheel slows to a stop.
Switch the Metric switch from the Metric to
the English position and observe that
The
English
display
the
distance
display
changes.
should be approximately 62 percent of the Metric
display.
Return
to
the
DIST
setting.
The accumulated distance may have
exceeded one tenth of a mile, in which case, the distance display
be non zero.
will
Continue rotating the crank for a minute or so to observe
the increasing of the distance display.
Switch the Metric switch
the
and
Metric
to
the
display changes.
English
The
position
English
display
from
observe that the distance
should
be
approximately
62
percent of the Metric display.
Set
the
MODE
selector
to
the
AVE setting.
displayed should be substantially less then
Rotate
the
crankset
quickly
average speed increases.
display
decreases.
the
for a period of time.
the
display
should
be
speed.
Observe that the
that
the
average
Metric switch from the Metric to the
English position and observe that the distance
English
instantaneous
Stop pedaling and observe
Switch
The average speed
approximately
display
62
changes.
percet
of
The
the Metric
display.
Turn the clock switch to the off (lower) position.
switch
off then on.
Reenter the monitor command to begin execution of
the speedometer program at location
switch
to
speed.
Switch the MODE selector
positions.
the
on
Toggle the RUN
position.
03
Rotate
switch
as
before.
Turn
the
clock
the crank at a fairly constant
between
the
SPEED
and
AVE
Note that the average speed equals the instantaneous speed.
Crank faster and slower and notice that the average speed
track
the
instantaneous speed.
attempts
to
Stop pedaling and notice the decay of
the average speed display toward zero.
'
54
Turn the MODE to TIME and note the elapsed time displayed.
the
MODE
to
the PAUSE position and wait for a few seconds.
MODE selector back to the Time po'sition.
Notice that the
Switch
Turn the
display
has
not advanced during the time of the pause.
Lower
the
RUN
switch.
Leaving
position, raise the LOAD switch.
the
MP
Enter the NOP
switch
in
the lower
command
C4
into
the
switch
so
first three cells of the speedometer code as follows:
C4 I, C4 I, C4 I
To check that the change was successful, raise the
that
memory
is
protected,
toggle
the
LOAD
switch
MP
down, then up.
Depress the "I" key to review successive memory locations starting with
location
0000.
The displayed memory contents for the first five cells
should be as follows:
C4 C4 C4 EO 71
This overwrites the jump to the
hardware
monitor,
and
reset to directly execute the speedometer code.
and MP switches down, raise the RUN switch to begin
speedometer
code.
observe
that
allows
a
Set the LOAD
execution
of
the
Turn to the time display and observe that the time
is incrementing properly.
and
instead
Turn to the speed display, rotate the
the speed display operates properly.
selector switch to the RESET position, then back to the
crank
Turn the MODE
TIME
display.
Notice that the time is advancing, but that it was reset to zero by the
reset mode.
Turn
Check the distance mode to verify that it too is reset.
the MODE selector to the GEAR position.
and observe that the gear ratio is displayed.
Rotate the crankset
Count the teeth
of
the
front and back sprockets and compute the actual gear ratio as follows:
(39T/16T)*27
= 65.8
CHAPTER 10
EVALUATION
The
evaluation phase attempts to provide an accounting of how the
unit performs in light of the design objectives.
evaluated
The various mbdes are
based on functional performance of the development system in
the test bed environment.
The user evaluation also comments on some of
the operational and subjective aspects of the design.
The
Time
display
seems
to
perform
well as designed.
second update frequency seems acceptable, and the accuracy it
is very good.
The
provides
Possible improvements could be obtained by enlarging the
display from four to six digits, to avoid the
modes.
The one
hours,
minutes,
and
seconds
necessity
could
then
of
two
time
be displayed
simultaneusly.
The
RPM
display
seems to perf?rm very well to the design goals.
The display is refreshed each crank sweep, and this is satisfying
a
user
point
of
view.
from
The displayed value seems accurate, and the
invarying nature of the display during use tends to give confidence
in
the accuracy of the display.
The Speed display also seems to be a success.
The displayed value
matches that obtained from the mechanical device, and
fairly
steady
when
pedaling at a smooth rate.
the
display
is
Unlike the mechanical
device, the electronic unit does not make noise, nor
does
it
produce
the drag characteristic of the mechanical unit.
The
average
speed
display
operates as expected.
The displayed
result matches the instantaneous speed on short runs as expected.
average
also
climbs
The
and falls in a predictable manner as incremental
changes are integrated over time.
55
56
The
gear
functional
display
displays.
is
probably
The
the
least
successful
of
the
displayed gear ratio varies several points
above or below the actual computed value during operation.
Unlike
the
RPM display, which is steady and solid, the gear display seems somewhat
unsteady.
Although the display averages to the
unsteady display would probably
accuracy of the gear display.
tend
to
computed
affecting ·the
stored
results.
the
degrade confidence in the
The Metric switch performs as designed, especially
not
result,
in
regard
to
The user is never committed to a
unit of display, and can change from Metric to English at
will.
This
is a good feature which will help gain user acceptance.
The
LCD display is very readable in daylight.
For night viewing,
it would benefit.from some sort of external illumination.
switch
seems
to
provide
good
selection
The
of the mode.
rotary
In darkness,
however, the legends for the mode switch position need to be marked
illuminated.
The
knob
for
problems. · It unist be solid
sustain
damage
if
the
the
and
knob
rotary
switch
user
has
two
potential
or
the
unit
securely mounted
is roughly handled.
danger of injury should be considered in knob
is not exposed to an undue hazard.
in
a
production
version,
may
On the other hand,
selection
so
that
the
Size and power consumption of
the development system is excessive for portable use.
that
or
both
of
these
It
is
problems
presumed
would
be
corrected.
Response
to
the
wheel
adjustment
seems
adequate.
exercised on all wheel sizes and spoke patterns, the
While not
adjustment
to successfully cancel wheel variations on the types tested.
position DIP
switch
adjustment issue.
seems
to
be
a
good
design
solution
seems
The eight
to
the
It can be readily set during fine tuning, and is not
lost when power to the unit is removed.
Response to
scrambled
display
change
until
in
the
mode
next
sometimes
display
leaves
an
refresh.
functions updated each second the incorrect display
incorect
or
In the case of
remains
for
less
57
than a second.
incorrect
In the case of the crank related refresh displays,
information
pedaling at the time.
data.
could
remain
the
quite a while if the user is not
The problem is not fatal,
nor
does
it
affect
Suggestion for improvement is to test for a change of mode, and
if detected, clear the display without waiting
interval of the new mode.
for
the
next
refresh
CHAPTER 11
MARKETABLE DESIGN
A marketable design for the described
incorporate
most
of
the
design
and
bicycle
speedometer
operational
features
would
of
the
development system model.
The major difference is that an
unit
have the code downloaded from cassette tape.
does
not
need
to
Instead, the code is permanetly
Programmable
Read
Only
Only Memory (EPROM) chips.
stored
Memory
in
Read
Only
operational
Memory
(ROM),
(PROM), or Erasable Programmable Read
The selected memory chip
for
a
prototype
production run is the Intersil IM6603 4096 bit PROM.
Two of these 1024
by 4 memory devices would provide storage for the lK
byte
memory
required
for
the
software.
The
of
program
Random Access Memory (RAM)
required for the buffers and counters would be accommodated in the same
RCA CDP1823 128 byte CMOS RAM that is used on the development system.
The
sensor design would follow the same principle of operation as
•
in the development system version, but would
integrated
circuit
specially
developed
incorporate
for
the
an
improved
purpose.
The RCA
CA316.5E is a single chip electronic switching circuit which
place
of
takes
the
the two 4007 chips and two sensor component carriers used in
the development system implementation.
The
display
drivers
would
be
replaced
with a single Intersil
ICM7211 display driver capable of latching data and
digits.
This
replaces
driving
four
LCD
the four discrete 4056 digit drivers, and the
4028 digit selector chips presently in use.
The four tri-state hex latches in the
development
system
design
would be replaced by two tri-state octal latches which provide the same
function in half as many chips.
58
59
The unit would be packaged on a single printed circuit board which
would
hold the discrete components as well as the IC chips and the LCD
display.
and
The unit would be packaged in an enclosure to allow
portable
use.
mounting
The power supply would be from a single nine-volt
battery.
The Mode select switch
presently
would
probably
a
rotary
switch
as
used, and the Metric/English selector would again be a slide
switch or a toggle switch much like in
distance
be
adjustment
the
development
system.
The
switch would also continue to be as now, embodied
in an eight position Dual Inline Package (DIP) switch.
The prototype unit would be assembled by hand soldering components
to
the
PC board.
In larger quantities, the production would probably
incorporate wave soldering or other techniques commonly employed in the
electronics industry.
though
local
acceptance.
area
If
the
The unit, in
bicycle
shops
proto~ype quan~ities,
in
order
to
access
would be sold
the
market
product was well received, then plans of further
production could be entertained.
9
REFERENCES
Binary Arithmetic Subroutines for RCA COSMAC Microprocessors. RCA
Corporation (Somerville, New Jersey: RCA, 1977. Publication ~~M-206)
CMOS 1800-Series LSI Product Selection Guide. RCA Corporation
(Somerville, New Jersey: RCA, 1977. Publication MPG-180D)
"Electronic Aids to Quicken Your Pace". Lieb, Thom.
P.37 of num.6 of vol. 23 of Bicycling, (July 1982)
"Inductive Proximity Detector Uses Little Power". Fichtenbaum,
Matthew L. P.112 of num.2 of vol.49 of Electronics, (22 January 1976)
User Manual for the RCA-CDP1082 COSMAC Microprocessor. RCA Corporation
(Somerville, New Jersey: RCA, 1977. Publication MPM-201C)
60
'
APPENDIX A
Instruction Summary
In all registers, bits are numbered from the least significant
(LSB) to the most significant bit (MSB) starting with 0.
bit
Register D is the accumulator.
Register DF is the carry bit of the accumulator.
Register P contains the number of the register used as the program
counter.
Register X contains the number of the register used as the memory
pointer.
R(W) is the register designated by W, where W is the X or P register or
a general register designated by a number N (0 through F).
R(W).O is the lower-order byte of R(W)
R(W).l is the higher-order byte of R(W)
NO is the least significant bit of the N register.
The notation:
M(R(N))->D ; R(N)+l means that the memory byte pointed
to by R(N) is loaded into register D, and register R(N) is incremented
by 1.
REGISTER OPERATIONS
INSTRUCTION
MNEMONIC OPCODE OPERATION
INCREMENT REG N INC
DECREMENT REG N DEC
INCREMENT REG X IRX
GET LOW REG N GLO
PUT LOW REG N PLO
GET HIGH REG N GHI
PUT HIGH REG N PHI
lN
2N
60
SN
AN
9N
BN
R(N)+l
R(N)-1
R(X)+l
R(N).O->D
D->R(N).O
R(N).l->D
D->R(N).l
.I
MEMORY REFERENCE
INSTRUCTION
MNEMONIC OPCODE OPERATION
LOAD VIA N
LDN
ON
LOAD ADVANCE
LDA
4N
LOAD VIA X
LDX
FO
M(R(N))->D
FOR N NOT 0
M(R(N))->D
R(N)+l
M(R(X))->D
61
62
LOAD VIA X AND
ADVANCE
LOAD IMMEDIATE
LDXA
72
LDI
F8
STORE VIA N
STR
STORE VIA X AND STXD
SN
73
M(R(X))->D
R(X)+l
M(R(P) )->D
R(P)+l
D->M(R(N)
D->M(R(X)
R(X)-1
DECREMENT.
LOGIC OPERATIONS
INSTRUCTION
MNEMONIC OPCODE OPERATION
OR
OR IMMEDIATE
EXCLUSIVE OR
EXCLUSIVE OR
IMMEDIATE
AND
AND IMMEDIATE
SHIFT RIGHT
OR
OR!
XOR
XRI
Fl
F9
F3
FB
M(R(X))
M(R(P))
M(R(X))
M(R(P))
AND.
ANI
SHR
F2
FA
F6
SHIFT RIGHT
WITH CARRY
SHIFT LEFT
SHRC
76
SBL
FE
sm.c
7E
M(R(X)) AND D->D
M(R(P)) AND D->D
R(P)+l
SHIFT D RIGHT, LSB(D)->DF
; 0->LSB(D)
SHIFT D RIGHT, LSB(D)->DF
; DF->MSB(D)
SHIFT D LEFT, MSB(D)->DF
; 0->LSB(D)
SHIFT D LEFT, MSB(D)->DF
; DF->LSB(D)
SHIFT LEFT
WITH CARRY
OR D->D
OR D->D ; R(P)+l
XOR D->D
R(P)+l
XOR D->D
ARITHMETIC OPERATIONS
INSTRUCTION
MNEMONIC OPCODE OPERATION
ADD
ADD IMMEDIATE
ADD WITH CARRY
ADD WITH CARRY
IMMEDIATE
SUBRTACT D
SUBTRACT D
IMMEDIATE
SUBRTACT D
WITH BORROW
SUBRTACT D
WITH BORROW
IMMEDIATE
SUBTRACT MEMORY
SUBTRACT MEMORY
IMMEDIATE
SUBRTACT MEMORY
WITH BORROW
ADD
ADI
ADC
ADCI
F4
FC
74
7C
M{R(X))+D->DF,D
M(R(P))+D->DF,D ; R(P)+l
M(R(X))+D+DF->DF,D
M(R(P))+D+DF->DF,D ; R(P)+l
SD
SDI
F5
FD
M(R(X))-D->DF,D
M(R(P))-D->DF,D ; R(P)+l
SDB
75
M(R(X))-D-(NOT DF)->DF,D
SDBI
7D
M(R(P))-D-(NOT DF)->DF,D
SM
SMI
F7
FF
; R(P)+l
D-M(R(X))->DF,D
D-M(R(P))->DF,D ; R(P)+l
SMB
77
D-M(R(X))-(NOT DF)->DF,D
63
SUBRTACT MEMORY SMBI
WITH BORROW
IMMEDIATE
7F
D-M(R(P))-(NOT DF)->DF,D
; R(P)+l
BRANCH INSTRUCTIONS - SHORT BRANCH
INSTRUCTION
MNEMONIC OPCODE OPERATION
SHORT BRANCH
NO SHORT BRANCH
(SEE SKIP)
SHORT BRANCH IF
D=O
SHORT BRANCH IF
D NOT 0
SHORT BRANCH IF
DF=l
SHORT BRANCH IF
DF=O
SHORT BRANCH IF
Q=l
SHORT BRANCH IF
Q=O
SHORT BRANCH IF
EFl=l
SHORT BRANCH IF
EFl=O
SHORT BRANCH IF
EF2=1
SHORT BRANCH IF
EF2=0
SHORT BRANCH IF
EF3=1
SHORT BRANCH IF
EF3=0
SHORT BRANCH IF
EF4=1
SHORT BRANCH IF
EF4=0
BR
NBR
30
38
M(R(P))->R(P).O
R(P)+l
BZ
32
BNZ
3A
BDF
33
BNF
3B
BQ
31
BNQ
39
Bl
34
BNI
3C
B2
35
BN2
3D
B3
36
BN3
3E
B4
37
BN4
3F
IF D=O, M(R(P))->R(P).O
ELSE R(P)+l
IF D NOT 0, M(R(P))->R(P).O
ELSE R(P)+l
IF DF=l, M(R(P))->R(P).O
ELSE R(P)+l
IF DF=O, M(R(P))->R(P).O
ELSE R(P)+l
IF Q=l, M(R(P))->R(P);O
ELSE R(P)+l
IF Q=O, M(R(P))->R(P).O
ELSE R(P)+l
IF EFl=l, M(R(P))->R(P).O
ELSE R(P)+l
IF EFl=O, M(R(P))->R(P).O
ELSE R(P)+l
IF EF2=1, M(R(P))=>R(P).O
ELSE R(P)+l
IF EF2=0, M(R(P))->R(P).O
ELSE R(P)+l
IF EF3=1, M(R(P))->R(P).O
ELSE R(P)+l
IF EF3=0, M(R(P))=>R(P).O
ELSE R(P)+l
IF EF4=1, M(R(P))->R(P).O
ELSE R(P)+l
IF EF4=0, M(R(P))->R(P).O
ELSE R(P)+l
BRANCH INSTRUCTIONS - LONG BRANCH
INSTRUCTION
MNEMONIC OPCODE OPERATION
LONG BRANCH
LBR
co
NO LONG BRANCH
(SEE LSKP)
LONG BRANCH IF
D=O
NLBR
C8
LBZ
C2
M(R(P))->R(P).l
M(R(P)+l)->R(P).O
R(P)+2
IF D=O, M(R(P))->R(P).l
M(R(P)+l)->R(P).lO
64
LONG BRANCH IF
D NOT 0
LBNZ
CA
LONG BRANCH IF
DF=l
LBDF
C3
LONG BRANCH IF
DF=O
LBNF
CB
LONG BRANCH IF
Q=l
LBQ
Cl
LONG BRANCH IF
Q=O
LBNQ
C9
ELSE R(P)+2
IF D NOT 0, M(R(P))->R(P).l
M(R(P)+l)->R(P).O
ELSE R(P)+2
IF DF=l, M(R(P))->R(P).l
M(R(P)+l)->R(P).O
ELSE R(P)+2
IF DF=O, M(R(P))->R(P).l
M(R(P)+l)->R(P).O
ELSE R(P)+2
IF Q=l, M(R(P))->R(P).l
M(R(P)+l)->R(P).O
ELSE R(P)+l
IF Q=O, M(R(P))->R(P).l
M(R(P)+l)->R(P).O
ELSE R(P)+l
SKIP INSTRUCTIONS
INSTRUCTION
MNEMONIC OPCODE OPERATION
SHORT SKIP
(SEE NBR)
LONG SKIP
(SEE LNBR)
LONG SKIP IF
D=O
LONG SKIP IF
D NOT 0
LONG SKIP IF
DF=l
LONG SKIP IF
DF=O
LONG SKIP IF
Q=l
LONG SKIP IF
Q=O
LONG SKIP IF
IE=l
SKP
38
R(P)+l
LSKP
C8
R(P)+2
LSZ
CE
LSNZ
C6
LSDF
CF
LSNF
C7
LSQ
CD
LSNQ
cs
LSIE
cc
IF D=O, R(P)+2
ELSE CONTINUE
IF D NOT 0, R(P)+2
ELSE CONTINUE
IF. DF=l, R(P)+2
ELSE CONTINUE
IF DF=O, R(P)+2
ELSE CONTINUE
IF Q=l, R(P)+2
ELSE CONTINUE
IF Q=O, R(P)+2
ELSE CONTINUE
IF IE=l, R(P)+2
ELSE CONTINUE
CONTROL INSTRUCTIONS
INSTRUCTION
MNEMONIC OPCODE OPERATION
IDLE
IDL
00
NO OPERATION
SET P
SET S
SET Q
NOP
SEP
SEX
SEQ
DN
EN
EN
C4
WAIT FOR DMA
OR INTERRUPT
; M(R(O)->BUS
CONTINUE
N->P
N->X
1->Q
65
RESET Q
SAVE
PUSH X,P TO
STACK
REQ
SAV
MARK
7N
78
79
RETURN
RET
70
DISABLE
DIS
71
0->Q
T->M(R(X))
(X,P)->T
(X,P)->M(R(2))
THEN P->X ; R(2)-1
M(R(X))->(X,P)
R(X)+1 ; 1->IE
M(R(X))->(X,P)
R(X)+1 ; 0->IE
INPUT OUTPUT BYTE TRANSFER
INSTRUCTION
MNEMONIC OPCODE OPERATION
OUTPUT 1
OUT 1
61
OUTPUT 2
OUT 2
62
OUTPUT 3
OUT 3
63
OUTPUT 4
OUT 4
64
OUTPUT 5
OUT 5
65
OUTPUT 6
OUT 6
66
OUTPUT 7
OUT 7
67
INPUT 1
INP 1
69
INPUT 2
INP 2
6A
INPUT 3
INP 3
6B
INPUT 4
INP 4
6C
INPUT 5
INP 5
6D
INPUT 6
INP 6
6E
INPUT 7
INP 7
6F
M(R(X))->BUS
; N LINES = 1
M(R(X))->BUS ;
; N LINES = 2
M(R(X))->BUS ;
; N LINES = 3
M(R(X))->BUS ;
; N LINES = 4
M(R(X))->BUS ;
; N LINES = 5
M(R(X))->BUS ;
; N LINES = 6
M(R(X))->BUS ;
; N LINES = 7
BUS->M(R(X)) ;
; N LINES = 1
BUS->M(R(X)) ;
; N LINES = 2
BUS->M(R(X)) ;
; N LINES = 3
BUS->M(R(X)) ;
; N LINES = 4
BUS->M(R(X)) ;
; N LINES = 5
BUS->M(R(X)) ;
; N LINES = 6
BUS->M(R(X)) ;
; N LINES = 7
R(X)+1
R(X)+1
R(X)+1
R(X)+1
R(X)+1
R(X)+1
R(X)+1
BUS->D
BUS->D
BUS->D
BUS->D
BUS->D
BUS->D
BUS->D
APPENDIX B
Software Design
66
67
..............
•....
..••
...... ... .....
..... " .
......
..
........ .. .... .......... "'"'.. .,.; ....•
...... ..."' .."'...., ..,... ... ... ......••
....
....... "" ... ...,.
..... ... ....
....,.
.... .. ...... ..•.
.
..
0
u
u
0
u
0
::J
a.
0
u
a.
0
u
u
0
:a
0
0
E
0
u
0
0
0
0
~
..l
a.
u
u
................
20 OCT U
MICROTAC
PA:E
1.001
TABLE Of COUrEUTS
DESCRIPfiOH AND BREAKDOWN
PRO~RlH
OUJPUTS
Q
•
•
•
•
•
•
2
•
• , , • • • , ,
INPUTS , , , , , , , , , , , , , , ,
JhiEH~AL REGISTER USAGE
, , ,· , , , , , o , , • , • • • • • • •
F~G:E~SIN~ &ESC~IPTION ~hO OP~RATING PROCEDURES
• • • • , • • •
RESTklCTlO~S
HA~O~~RL
llRLES
NlCFOTAC
ITEMS , , , , , , , • • •
~OUT(N[
SCA~
HJUII~E
SPEED
~GUTlN~
RUUTI~E
G~l~
~P•
DIST
Tl~E
AV~
QIJT4
LOGIC
PhOGkA~
!~IT
15
16
,
SUB~O~riNE
~~~
SUU~L~TlNE
S~L
s~:~~~Uf!r;~
S~R
SUHRJUT!N£
c~o
su~~o~rr~£
UPD
SUB~O~ri~£
JZ~
SUB~O~Tl«£
, ,
, , ,
,
hiS SUoROUfiNF. • • ,
,
•
• , ,
11
18
19
20
RG~'C1~2
,
•
II
12
PDUTl~E
,
•
•
10
N~~~~~E
,
•
o •
ll
H
~py
IS~
•
•
,
, ,
MDUTl'E
P~UTI~E
•
o
. . . .. .. . . .
, , , ,
t•tERFAC£5
A~O
•
l
4
5
6
1
8
9
,
,
,
•
Ill
••
21
22
. . .. .. .. .
e
e
e
e
II
23
24
25
26
27
26
"'
00
MICROTAC
P~OCRAM
20 OCT 8l
DESCRIPTION AND
PACE
2
BREAKOD~N
········~·········lllllllllllllllltllllllltlllllllllllllltllllltllllllllllltllllllflllllllllt••·············
•
•
DescriPtion:
1
I
1
2
Pro~ra~
9
10
1
l
11
12
1
1
4
S
13
'
6
The M1crotac Low Power Bicycle Spee~ometer/Computer used a taroet run ~odule
lK bytes in size. The Run ~cdule is downloaded into the develoP~~nt system
tro~ cassette tape, It is intended that the prototype have tne run module
Durnea Into EPROHS, It is expected tnat the production version nave tne run
modele tn ROM, or in the ROM of a co~binat1on kOM/CPU microprcessor version,
8
14
7
8
~~
I&
9
17
18
19
20
21
22
10
II
12
13
14
23
16
SCAN . . . . s.:an
H
25
17
18
~a1or
2t.
• 19
I 20
1 21
I 22
27
2a
29
3D
Jl
l2
IS
1 2J
I 24
f 25
a
H
I
34
• 27
j5
:So
• 28
i 29
37
I 30
la
39
1
40
41
1a
43
44
31
• ll
I 33
• 34
1 35
• lo
I l7
•
ProqraT BreaKdown:
rne
~a1or
soft~are
co~ponents
of Mlcrotac area
Executive control ModuleJ;
INir •••• Inltlall~atlon
module
mo~ule
1
1
function routines;
1
•
SPF:r.o ... compute Speed
Cf,R.,,.coapute Gear
RP~ ••••• Compute RP"
~!St •••• :c~pijte Distance
TI•E •••• Co•Pute Klapsed Time
OUT4,,,,0utput 4 cnara.:ters
1
Uttlltv Subroutines!
~PY
••••• ~ult1PlV Subroutine
DIV,,,,.Dlvlde Subroutine
S~L ••••• snltt Lett Subroutine
SHR ••••• snttt Rtgnt Subroutine
CbD •• ,,,Convert ~lnary to Decimal suorouttne
UPD,,,,,Upd•te UISPldY Subroutine
JSk,,,,,Ju~p Subroutine
krs ••••• Rcturn suoroutlne
ISR,.,,.Interrupt Service Routine
•
tllllllfltltllllllltllfltllflltJIIIIIflllllllllfllllllllltlllllflllflll~fllllillltllllllfllllllllllllllttl*l
~
\.0
20 OCT 83
IIJC~OTAC
PAGE:
OUTPUTS
•••••••••••••••••••••••••~••j••••••••••a•••;••••••••••••••••,••••••cMtta••••••••••••••••••••••i•••••••••••••
4&
1
41
2
4&
•
~9
)
!;I)
!;
51
6
52
53
54
7
8
55
56
1\)
51
58
S9
60
9
11
12
I)
14
15
ol
16
6~
6)
17
• 18
04
19
6~
~6
21
67
22
£8
23
69
70
24
71
i2
13
20
2S
2&
27
28
H
29
75
30
ll
32
H
34
76
11
H
n
iiO
~I
82
8)
lS
l6
37
38
•
the Spoke Detector latch,
Execution of the OUT4 tnstr~ctton bv the CPU causes a pulse to appear on
I/0 line 14 • the RESET-IRO.FLAG,
.
The RESET.IRO.fLAC Is connected to activate the reaet logic ot the Spoke
Oet~ctor Latch,
RES~l.IRO.fLAG • true each OUT4 execution tor one instruct~on cvcl~.
I)
Res~t
2l LCD Dlspl~y Enable
.
Execution ot the OUTl Instruction bV the CPU causes a pulse to appear on
J/0 line 13 • the £N~BLE-~ISPLAY.FLAG.
•
tne E~~8L£.DlSPLAY.fLAC Is connecte~ to activate the latchlnQ loqtc ot
tne DisPlay Driver clrcutt.
.
£NAaL£.DISPLAY.fLAG • true each curl execution for one tnstructlon cvcle.
)) LCD DlSDl~V D~te
.
.
~hen tne EN-~LE.DlSPLAY.fLAG ts true, DISPLAY-DATA ln the output I/0 buffer ls
outcut to tne Oat~ Loolc of the Dlsplav Drtver ctrcutt.
T~P Data Sus Is one 8YT~ wtde,
rne lo• or~er 4 olts ls tne al91t select - Binary 0•15
T~e ntqn or~er 4 blts ts th~ data for that d191t • Binary o-1~
Tne ~~s~J~y dl~lts ~re flll~d as OISPLAY.DATA for each digit ts sequenttallv
mu~~1 to tne Display Driver circuit,
DISPLAY.DATA - valid durlnq each DUTl execution tor one Instruction cvcle.
41 Dlst,nce 'd1"stment Select
r.xeC•ltl"n ot the INl Instruction by the CPU causes a PUlse to appear on
110 line II • the DIST.ADJUST.fLAG,
The DIST.ADJUST-fLAG is connected to activate trl state loqic to p~t the
whrel ajJust~ent value onto the data bus.
PI~T.AOJuST.f~AG • true each INI execution tor one Instruction cycle,
5l ~o1e ~~lect
Execution of tne IN2 1n&truction bV the c~u causes a PUl$e to appear on
liD llne •a - toe ~OD~~SE~ECT.f~AG,
Jne ~OUE.SELECT.fLAG 1s connected to activate trl state loqic to put the
~oje sel~ct value onto the data bus.
·
~OD~.SELE~T-fLAC • true each IN2 executl~n tor one instruction cycle,
•
••••••••••••••••••••••••••••a••••••••••••••••••••••••~••••••••••••••a•••••••••••••••••••,•tollllltltlltlttc
.......
0
20 OCT 83
II lCROlAC
PAGE
4
Ill PUTS
,,,,,,,,,,,,,.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,~r••~••••••'••••••••••'''*'''''''''''''''''''''''''''''''''4''''
I
85
ao
I
I
I
2
3
4
67
8Q
89
~
90
91
92
9)
6
I
ll S~o~e Detector Input
The Spo~e Detector latches the SPO~E-FLAG Input high.
The SPOKE-fLAG Input I& connected to activate the hardware Interrupt
ReQuest (JROl line each time a spoke 1s detected.
SPOYE-FLAG - true until reset each time a &POke Is detected.
f
I
7
8
9
10
H
11
95
9b
12
~·
.I
ll
14
IS
16
17
·~
99
100
101
102
ta
l~l
19
20
I0 I
105
t!l9
21
22
2l
24
2S
110
Ill
1!2
t2a
Ill
:;!9
1no
!07
to a
26
27
114
)0
II~
ll
JIG
)2
117
)j
tl(l
#4
ll"l
• 15
1:10
J6
1<1
37
l8
19
40
41
42
4l
122
12)
124
t•s
121,
127
I
Detector Input
CranK Detector causes a sQuare ~ave to apPear on the CRANK-FLAG Input.
rne CPA~K-FLAG lnout ts connected to activate the CPU event flaq M2 CEF2l.
Ef2 Is ~ollej bV the Mlcrotac software.
C~AU~-FLAG - true wh1le the cr&n~ ls near crank detector.
21
Cran~
T~e
ll 1KHz Squar~ wave Clock Inp~t
The !KHz clock line causes a ~quare wave to appear on the IKHz.rLAG Input.
The 1KI'z-FLA~ Input 1s connected to activate the CPU event tlaq ll (EFl).
Efl ts ~ollej bY the Mlcrotac software.
1K"z-FLAG - true 1000 times oer second on a so• duty cvcle.
41 !Hz Square ~~ve Clock Input
Tne I~Z cloc~ ltne causes a iQuare wave to appear on the 1Hz-FLAG Input.
rne tHz-FLAC. Input Is connected to acttvate the CPU event tlaq t4 CEF4l.
Ef4 ts Polled bV tne M1crotac software.
1Hz-fLAG - true once per second on a so' duty cycle.
5) DIStance
Ad1ust~~nt
onen tn• DIST-AOJJST-FLAG 15 true, tne DIST-ADJUST Value held in the wheel
6lze S•ltch Is lno~t to the 1!0 butter of tne CPU.
Tne Data Bus is one BYTE wide.
Tne nor•~l pos1t1on Is ao HEX (10000000 btnarvl represtntlna a 27 inch wheel
•ltn no a11ust~ent.
fhe DIST-AOJ~ST switch is set by the operator once durlnq installation
ot the ~lcrotac untt,
DI~T-ADJUS1 - valid durlna ea~h IN! execution tor one Instruction cycle.
6) ~01P.
~nen the
HQDE-&ELECT-FLAG is true, tne ~ODE-SELECT value held in the mode
select s•ltch Is Input to the 1/0 b~ffer of the CPU.
·
rne Data aus is one BYTE wide.
The S>ltcn can ce set to one ot 8 poslttons.
The MO~g-~F.LECT switch 1& set by the operator as otten as desired dur1na
operation ot th~ H1crotac unit.
HJOE-SELf.CT - valid d~rlna each IN2 execut1on for one instruction cycle.
1
1
I
lllll;lllillfllllllllllllflll;llllfllllllllll.llli*II.II-IIIMIMIIIIIIIIIIII,IiMifll~•••tlllllfllllllllllll•l
......
1-'
KlCi!OTAC
INJERN~L
20
~EGJSTER
USAGE
ocr n
p~(;E
s
''''''lltttlttltllttl~t•t••••••••••••rltllltlttltllllttnttlltllllllltlttltttltttltlltttrtrrrtttjt•••••••••••
129
•
t
I
llO
I
2
lll
I
132
I
4
Ill
I
5
IH
135
136
137
I
I
6
7
STACK.PJINTlR (SP)
I
8
I
9
ll&
I 10
J5P-PC
f<!S-PC
HT5.NETUPN.ADORgss STORAGE
13~
I
11
ZfkJ-PE~iSTE~
140
t
12
•
I
THE 16
GENE~AL
~&lN~PR1GRA~-COUNT~R (PC)
INTEP~UPT.SERVICE.ROUTINE
R7
R9
RA
~ODE-REGISTER
148
I 20
I 21
I 22
• 23
I
I
ClGIT_CJllUTf:R
&IT-CDU~TlR FOR ARITHMETIC OPE~ATIONS
•FMJUI.P~INTER X (gXCEPT DUkiNG IHlt '
ISR)
E~TKNSIJ1.0f.RF FOR DOUBLE L~HGTH ARGU~E~TS
ARGU~EUT.I (AHGl) IN ARITHMETIC COMPUTATIONS
1~2
• 24
THi F.VE,T fLAG REGISTER (R7.0) lS
CRA~K.FL~G
15~
• 25
I 26
I 27
156
I 2a
157
I 29
1~~
C~l~~-fLAG
160
t 30
I ll
I 32
151
I l3
fi.A~S
1 (,2
lfil
li4
I
15>
lai
lb7
H
I 38
I l9
16&
169
170
I ~0
t 41
I 4«
171
171
I H
t 44
173
17t
I 4S
I 46
•
RC
RD
RE
RF
1KriZ-CL3CK.FLAG
IHZ-fL~~
RP~-D¥~RfLO~.FLAG
~fA~.aVE~FLG~.FLAG
IHZ-EDGF..fLAG
AR£ ACTIVE HIGii
US~D
AS FOLLOWS!
(01) BITO:
(02) BIT 1:
(04) BIT 21
BIT l:
(10) 811 4:
(20) biT 5:
(40) BIT 61
(80) RIT 7J
)4
35
I 3i
t
I
llll
CENF.qAL kEGS R4,R5 ARE DEDICATED PC'S FOR LINKAGg SUBROUTINES
T~ESE SU6ROUTINF.S ARE ENTERED EACH TINE THAT REG IS ASSIGNED AS PC
151
154
1~~
RS
R8
Dt:LH .CJIJNT!:R
14i
R4
R6
STOkAGE
DIST.ADJUSt.REGlSTER
I ll
I 16
J 17
I 18
I 19
Rl
112
Rl
tt:"I'Oi<~RY.SCRI.TCHPAIJ
I 14
I IS
:45
IIi
147
RO
(ISR) PC
EVE~T.fLAGS.REGISTER
142
Hl
144
151
I
]
141
150
PURPOSE REGISTERS ARE UTILIZED AS fOLLOWS!
kEGISTER (R6,1) IS USED AS FOLLOWS:
(f~l UlT
(f"O) lllT
SP~EO_FLAG
(fij) BIT
Dl~IA~CE-f"L~G
CF7) BIT
TH~
~~D!
G~-~-FLA;
~P~-f'l.A~
Tl•£.(ri"Pil'll-FLAG
O;
1:
2:
3:
(Efl BIT 4:
(Ofl BIT 5:
(llf') illT 61
Tl•E-CHN:SECl.f'LAG
HnAGf._SPF:ED-FLAG
•ETkll'.ft.AG
(7Fl BIT 71
r~£ ~O~E ~E~ISTER FLAGS ARE ACTIVE LOW
(fLAGS 0·6 ARE ALL 1 EXCEPT THE SELECTED MODE IS O.)
iL'G 7 IS: 0 fOR METRIC, 1 fOR ~NGLISH DISPLAY,
5
1
i
I
••••~••••••••••~~••••••••••~••••••••••••••••;•••••••••••••~••••••••••••••••••••••••••••••••••••••••r••••••••
"-J
N
20
~ICROT.I.C
ocr u
PAGE
6
PROCESSING OESCRIPTIOM AND OPERAtiNG PROCEDURES
ttilllttl••••llltltllltalttllillllllllllllllllilllllltttlltlllllllttl~tlttlllllllllltllllillltllllllttltllll
I
116
177
I
I
I
I
2
178
•
l
119
1
1
4
ISO
Ut
1
1a2
1
1
ta)
IH
185
S
6
1
Q
9
1 10
I
Processing Description
InitiAlization occurs when the CPU Is reset, This clears the butters
and scratcnp~d reQtsters, and initializes program counters tor the interrupt
service routine and other utility subroutines which llBVI: de"dicate<l PCs,
~t the end of 1ntt1al1zat1on interruptG are enabled, and the ISR beQlns
accumu1Jt1n~ $po~e counts under control of the spo~e interrupt line.
I
189
190
191
1 12
1 ll
t It
inltlaliz&tion mainline proqra~ e~ecution tails 1nto the scan routine,
Sc5n routine c~ntrols oper~t1on ot the svste~ until the syste~ ls again
reset. The job of the scan routine 1s tu sen5e tleqs, maintain cran~ RP~
ana G~~R counts, and pas' control to the major tunctlon routines tor periodic
ProcesslnQ and 1isp1av upj~te,
1 16
rne
1~2
17
1~3
lij
194
195
195
197
198
19
20
23
lhe utility subroutines are usea bY the major tunctton routines to produce
i99
24
~atne~atic~l results, shift bUtter values, and update tne displaY.
Tne
utilities ~re true subroutines because control Is passe~ from, and returned
to, ~any possible proqram points. the utility subroutines nave· a
11n~e1• ~•cnanism for passinQ control and storing the return PC which save~
!o6
til
taa
2G~
2~!
2~2
~Ol
20~
'lG5
·~G
207
2oa
1
11
• 1s
21
22
25
t 2&
1 27
1 28
• 29
• 10
I ll
I 12
~tter
Th~
m~jor tunctlon routines read counts trom the butters, per~orm reqatred
c~lculatlons, and update the display with resulttnQ data.
~he
t~nctlon routines operate like subroutines, bUt are actlvatej at the
same •atn proqra~ level as the scan routine. Tnis saves stack dePth, and
ls cossl~le because major function routines are always stnQle thread, and
al-avs return to SCAN wh~n finished,
~~tne~dt!cal
~a1or
stac< 1ectn. All dat.a passed to or trom a ut1l1tv subroutine Is store:l ln
tne 1ota butters oy convention, No aata is passed via send data olocKS,
callin< parameter lists or other mechanisms,
1
ll
•
)4
213
214
•
)ij
The pro•ram is downloaded to the development system from ca~secte tape.
Code l~ ;or~anently stor~d ln prototype or production versions on RO~.
The pro1r•• ts activate~ by hard~are reset ~hen the MOUE switch Is turned
to tno R~5iT position,
t
~o~e
1
1
19
40
The
21$
21&
217
b~~
11sDl~yed.
1
11&
1
-~~
2!G
211
212
1 35
• 3&
1 17
I
~I
42
,3
•
I
Pro•r~m
Oper~tinq
switch
Proc~dures
~etermtnes
whiCh of the available tunctlons are
prnce~sed
Input data Is provtded ifi real time based on th~ action ot the blcvcle wheel
and cranlset to whicn the M1crotac sensors are applied.
wheel a~just~ent data is provided bV the setting of the wneel edjust switch.
;
1
C
;tlitlllllara•l••••arilltiiiCIIIIII,IIItltiiiiiUitll•tiiiiOIIIIIIIIIIIIIIIIIII#Itiltlllllllllll~lltllllllltt
'I
w
14ICHOTAC
RESTRlCTIOIIS
220
221
<122
221
224
225
226
227
228
229
21•)
211
2)2
2ll
234
235
216
2l7
218
239
241J
441
H2
243
244
20
ocr n
PACE
1
···························-················································································
I
2
The ~tcrotac proQram ia onlv runnable while rest~ent on the Microtac har~ware.
)
•
5
6
7
CONSTRAINTS
operation time tollowin; reset ts 24 houra.
time counters overflow and return to zero.
Atter 24 hrs the elapsed
~axt•u•
8
9
10
II
12
ll
14
IS
16
17
18
1!1
20
21
22
23
24
25
~axt~u~ atstance ts lOO miles tollowin; reset.
counteri overflow and return to zero,
After lOO miles the distance
~a•l~uT. ~P~ ts 180,
After 180 RP~ tne 1KHZ clock no lon~er Provides adequate
resolution tor an accurate display, althOU9h the tunctton continues to work
in a lo-er accuracy mode.
oo:oo:oo to
Nint~u~
ttae resolution is 1 second over the range
Hlnt•u~
di&tance resolution is .1 unit whether 1n miles or km.
Htnt~uM
averaqe speed resolution 11 .1 unlt in
Coastin~
Roc~lnQ
Of
cr~niC
~etric
24:00;00,
or £nqlish untt&.
causes the RPM readlnQ to decay to zero by deQrees ln about l
s~c.
the crank past the crank detector wtll glve a falsely high readinQ
RPM,
I
lllllllllllllllllllllllllflllllllllllfllll~llllltiiMIIIIIItllfllllllllllllllllllltlllllllllllflltlllllllllll
......
.p..
20 OCT 8J
MlCROTAC
HARO~AkE
2H>
H7
Ha
PAGE
JNJEkfACES
................................................ , ...... j~···················,·······························•
'
1
2
l
H'l
250
251
4
5
6
·~·
25t
7
Hl
a
BS
9
10
II
256
251
2SB
12
2~9
14
15
16
17
13
26(1
2bl
262
18
19
20
2t>)
2?4
., :..s
21
22
21
256
20
26~
26q
2;r.
24
25
2o
271
212
lH
214
.7
29
19
lv
215
<n
ll
12
211
~78
})
279
2bV
14
15
lb
37
ld
19
261
2&2
2iil
234
2a5
28&
•o41
2a7
288
42
1 41
•
•••••••••••CLOCK MODULE
Tloe Cloc~ ~o~ule produces t~ree square wave o~tputsr
I~H~ Square ~ave Clocl l~put used to drive the CPU event flaQ ll (£f3), (lK~Z.fL
1Hz Square ~dVe Clock Jnput used to 1r1ve the CPU event flaQ 14 (EF4), (1HZ.FLA~
I
..
•••••••••••CRANK SENSOR
The Cran~ vetector produces a square wave output when t~e cran~ 1s near
tne cranK detector, the Crank Detector output is connected to the CPU
£ve~t fla~ 12 {EF2l 15 the CRAH~.FLAG.
•••••••••••SPOKE SENSOR
Tne SPo~e Detector procJuces a sQuare wave output wnen a spoke ts near
the Spo(e Detector. The latc~ed sPoke detector output 1s connected to
the CPU ~ar1ware Interrupt Pe1UtSt (lHQ) line. (SPOK~-fLAG)
I he iPor.e detector Iaten Is cleared by a stqnal over the l/0 line 14, (RESET.IR~
..
•••••••••••DISPLAY
MOI~Ul.E
accepts output data fro~ the CPU Data Bus and dlspl&ys the
1~ta ln nu•dn readable for~.
the Dls~la~ Driver circuit latcnes tne DISPLA~.DATA on the Data ~us wnen t~e
JlsPI~Y laLcnlnq loQlc 1s actt~atej ov a hlOh leVel on tne ENABLf..OlSPLAY.fLA4,
rne Ddt~ ~us Is one eYTE wtde,
tne lo• order 4 bits is tne diQlt select - Binary 0-15
rn~ nlqn or1er 4 bits IS t~e data tor that d1q1t - &!nary 0•15
rne ~~s~lav ~1qlts can be filled se~uentlallY as OJSPLAY.DATA tor eac~ dlq1t
ts •u~•l to tne Olsplay Dr1v~r circuit.
1~e
Dl~Play
~o1Jle
•••••••••••~Qpg SELf.CT MODULE
The ~o1e ~~lcct module 1s a an 8 position rotary sw1tcn with pulluo res1stor3
tle1 to the contact poles,
Tnc ·~de SPlect s•1tch 1s conn~cted to the CPU oata su& throuQ~ tri state
la·Jlc. rne ~ode Select ~odul~ places tne mo~e sel•ct value on tne Cpu Data
eos wnen the tr1 state lOQlc is activated ~V t~e KODE.S~LECT-FLAG.
,,,,,,,,,,,DISTANCE ~DJUSTM~NT MOOU~E
Dlst•nce A~lustment module Is a an i position DlP s~1tcn, connecte~ to tne
D•ta &us thro~~h tr1 state loq!c. It Places the Distance A~l~stment VdlUe
on the Cau D~t~ aus ~nen t~e trl state lo91C Is •ct1v~te~ bY the DlbT-~DJUST-F~~
The Dat•.Rus Is one BYTE ~ide.
In~ nor••l po,ltlo~ 15 ao HlX (IGOOOOOO binAry) represent1~Q a 27 inch •neel
•ltn no adJustment.
Tne DlST.AOJUST s~ltc~ 11 let bY the oper~tor once durin~ tnst~llation
ot tne ~lcrotac unit.
r~e
CP~
1
1
a
•
*llflllllllllflllllilllll,lillllifllllllllllllllf#llllllflllllllllflllilllllllljlflliiiiiiiNCillllitl~llllll
'-I
lJ1
20
loiCROl'AC
&A~LES
A~D
ocr n
i'AGE
9
ITE~S
ODOOOODODOD~DDDODODDODDDDDOODDDDOOODDODDOODDDDDDOODODOODOODOOODDDODDDDDDDDDDDDODDDDDDODDDDDDDDDDDDDDDDDODDOD
290
291
292
Hl
2'H
295
296
297
29o
2')9
300
301
lD2
)OJ
104
D
0
o
t
••
2
3
4
••••••••••• aurrERS
•.
OSHlfT I BYTE
A:OHlfl I ilUF:
ARG2 2 BYTES
OUTS<lF 4 bYTES
tl~E-CDUNTf.R 4 BYTES
fli'~-COli~•TER 2 BlTE:j
Tt>'.P 2 BYTES
Gdi<.CU~tfl'ER 2 1\Y'ti::S
DIST.COUNTEP 4 UY1ES
SP~~D.CJUHTER 2 B~TES
l:iH_s;,VE l BITf.S
••
•••••••••••FLAGS
•.
RESU-HO-FLAG.
[I:A:JI.C:-OISPi.At-FLAG.
DIST.ADJUST.fLAG
0
0
o
0
0
ll
0
0
0
0
310
D
0
0
D
0
0
0
D
D
D
0
0
D
0
0
0
D
D
[)
311
0 22
SP.J~f:.!'~AG
::>
312
H 3
)14
D 2l
0 H
D 25
CilA~;r_fLAG
D
U
D
115
116
317
318
)!9
l2J
u
}I)'S
lO&
107
lC8
109
0
0
0
0
0
0
!I
6
7
8
9
HI
II
12
11
14
15
16
17
18
19
20
21
26
27
28
29
30
l1
r,
D
D
0
0
ll
D
D
0
0
D
0
"IICf:.~f.Lf.CT-FLAG
\KIIZ-fL~~
IHZ.fL'G
••
•. • • ••• • • • • OATA
•,
OlSPt,AY-DATA
OIST.ACJUST
i<OOE-SEt.E:CT
'
0
0
D
0
0
0
0
ODOOODODDOODDDODOvODODDODODOOOOODDDOODDDOOOODODODDOOOOOOOOOODDOODOOODDDDODODDDODODOOODDODODDDDDODDOOODDOOODD
"'"-1
0'\
77
0
...
"'...
u
0
...
0
... ......
.
... .
.... ... ...
... ..."' ...
..• "'"' .•.
.. .... ..
..
u
•
u
..
•
0
..
•
..
a:
•
•
...
0
..
..
u
~
..
. .. ..
..........
...
0
•
u
..
•
%
•
..
....
.."'""
u
0
u
a:
..
•
MICROTAC PROGRA~
I Nil ROUrttl£
)27
)28
32!1
llO
HI
332
lll
314
3lS
PAGE
11
·······················¥····················································································•
ROUTINE
I
'•
ONCE
POWER•ON RESET
• 2
•'
••
•••
•
lH
'f
))7
338
139
•
•
•
340
20 OCT 8l
~OGIC
,.l~iTILIZATION
,,EXECUTE~
)
4
5
6
7
8
9
10
11
12
ll
• u
•
fOLLO~ING
•• PO~ER•ON RESET CAUSES EXECUTION TO BEGIN AT LOCATION 0
..PC IS RO
•• !NIT IN)TIALIZES REGISTERS, POINTERS, AND BUfFERS
..
INTERRUPTS
INITIALIZE lSR PC
I•ITilLIZE JSR PC
INITIALIZ£ RTS PC
lNITIALIZf. DATA POINTER
Ih!TIALIZE STACK POINTER
Zt::f/0 BUfFERS
EN~BLE INTEHRUPTS
DIS~BLE
•••
•
•
•
•••
•
•
···········································$·············,··················································
i•
I
....,
Oo
~ICROTAC
..
LOGIC
PROG~A~
SCAli ROUTllli:
343
f
t
lH
'
345
l'6
•
•
H7
lH
•
•
2
l
4
S
lH
3S()
)51
f
'
7
8
9
l52
•
10
3H
3~4
f
*
o
1\
v 12
,,SCAN SENSES RISING EDGES Of THE 1 KHZ,, 1 HZ,, ANO CRANK INPUTS
, ,SC,:l l~C!.E'IEIITS TI~E CUUNT£RS AND UPDATES TU£ DlSPLAY
C~ UNTIL nar~~are reset
!£ IKHz.CLDCK rls!nQ edqe detected
Increment RPHC'fR
l£: ~PI!CTR overflows
Set RPM.OVERrt.OW.FLlG
E:llllti:
t:lllU:
.tt
rtstnq edqe
CHANK
tuuu:
)$9
lbP
301
Increment TI~E-C:OUNTEII
Set 111Z-FLAG
tt:CU:
:U: CllAIIf..fLA/0 on
lE ~OPE
GEAR
P~OCESS GEAR
l6 2
• 2u
f:.:.uu:
361
• 21
1t MOflE : RI'M
364
J7 I
l12
•
J~
)13
'
31
JH
• 12
ns
*
•
=
4
ll
H
•
35
]18
f
16
l7ll
• 11
PI<(1Ct~S5 TIME
ii:to!ll::
1£ ~::l!JE " AY£
P~ocr.ss AVE
HI
•
lf,;
H~
• 411
' ~1
H~
• 38
191
l92
• 56
l~6
3a7
)89
>a;
190
~:we
t:uou.:
39
• 42
• 43
+ U
• 4S
f 46
• 47
f 49
' 49
Jll~
t
~llo~:
J:E
=
'
4
*
•
•
•
lf
"
37 G
l6l
f
•
•
)71
Hu
•
•
PllOCESS RPII
t:l.i!llli:
Etil::lE
:U: 1HZ-nAG on
U: u:JDE : SPEEO
PkOCESS SPI:'EO
£'"tlJ:l:
CLf.AR SPf.E!>.COUilTEfl
.U: ~JOf. : OIST~NCE
?POCES5 DlSTANCO:
u:
~
T!Hr.
•
..
f
•
GEJ.R
GEAR-OVERfLO~-fLAG
on
PRDCESS GEAR
f:!..l:tlE
E!ICU:
.t£ HOPE : RPM
1£ RP".OVERfLOW•fLAG on
PROC£SS RPM
~::uc1;:
E:IIC.l£
EUill£
£:;:;;.co
•
~etecte~
=
Et::llE:
4
•
•
•
IE IHZ.CLOCK rtslnq edoe
• 14
f I'S
• 16
f
17
t 18
' 19
lH
)67
ltil
1!\9
lH
•
¥
• 11
' 22
• 23
24
' 25
o 26
• 27
• ~8
f 29
ll
•
Set CRAilK-Ft.AG
lSf>
H7
16~
P~C&
•
detected
l~~
3~6
......,,,,,,,,,,,,,,,,,,
lO OCT 83
......••............. ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,.,,,,,,,,,,,,,,,,,,,,,,,,
~
t
•
•
•
*
f
t
•
*
a
~
··¥····~···········~····~···~···········~··~········*··················*··········~·························
.......
'-0
~lCROfkC
.
SPEED
194
)9~
39t.
l91
Ho
HJ
•oo
•a1
~~2
4(1)
4C~
405
4vo
~07
to a
407
PRJGHAH LOGIC
20 OCT 83
PAGE
11
ROUTI~£
··························································································$·················'
INSTANTANEOUS SPEED IN MPH Oft KPH
1
CF SPOKES Ill ONE SECOND
•••
'•' 2) ,,SPOKE COUNT
COUNT IS
I» SPDCTR
4
.. •• , •••
•
SPEED.COUNTER
DIST.ADJUST
•• 56
•4
: ADJUSTED SPEED COUNT
,,CO~PUTES
,,US~S
~AlNiAI»ED
••
~Pr
~ULTIPLY
f
SPEED.CDUNTE~
1~ ~f.TklC.FLAG
• 15
TkUE:
AR~l : Mf.TkiC.SPEtD.COEfflClENT
tLSt MKT~IC.FLAG fALSE
ARGl : ENGLISH.SPEED.COEFflCJENT
tuuu:
~PY;,,,,,MULTlPLI SPEEO.COUNlER * ARC!
SHR,,,,,,SHlfT RIGHT ARGI lO CORHECt "AGNITUDE
ZERO SPEEO.CDUNTER
OUT4,,,,,UPOATE OISPLA1 USING BIU~RY RESULT IN ARG1
• 16
i<:J:Uilt<
1
8
9
t HI
• ll
••
• 12
• 13
• u
........,...................................•.......................................... ,,....
••
•'
•
•
•'
'•
~.··············
00
0
MICROTAC
G~Ail
PRJG~AN
LOGIC
20 OCT &l
IIOUTINE
PAGE
14
.
'·················••*···························*······~·*•••·················································
1
••
GEAR RATIO BASED ON NUMBER OF SPOKES PER CRANK REV
f
411
'
~12
t
2
Ul
t
3
414
t
4
415
t
5
416
•
417
418
f
6
1
f
8
119
t
~2Q
f
9
10
CO~PUTES
421
f
412
• 12
~2l
t
11
~H
~25
~26
• 14
427
42ij
t
429
4lD
431
1l
f
IS
t
f
16
17
19
f
19
t
t
20
21
•
,,USES SPOKE COUNT lN 8 BIT GEAR-COUNTER
,•
1t GEA~.OVERFLO~.FLAG fALSE
MPI., •• ,.~ULTIPLY PIST.ADJUST f GEAR-COUNTER
SHH,,,,,,SHIFT 32 BIT AR;1 TO CORRECT MAGNITUDE
GEIR.COUNTER : ADJUSTED GEAR COUNT
1L ~ETRIC.fLAG TRUE
ARGI : ttETkiC.GEAR-COEFFICIENT
ELSE: ME"!RlC.fL~G fALSE
ARC! : ENGLISH-GEAR-COEfFICIENT
~::oou:
.,Pt •• ,,,,MULTIPLY
G£AR-CDUNTER t GEAR-COEFFICIENT
SIIR., •• .,SHIFT ARGI TO CORRECT MAGNITUDE
'L~~ G~AR_OV£~fLOW.rLAG TRUE
SET AkGI=Zi::RO
ADJUST~D
E!i:llt
•
t
t
f
t
f
t
f
f
•
f
f
f
f
t
CLEAR GEAR.COUNTfH
CLEAR GEAR-OVERrLOo_FLAG
CUT~ •••• ,UPDATE DISPLAY USING RESULt IN ARGl
iEI~R~
•
~··················································~·····································*············4·····
co
I-'
HICROTAC
RP~
PRO~R'~
LOGIC
20 OCT 83
PAGE
15
R~UTl~E
• • • • • • • • • • • • • • , • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • f • • • • • • • • • , •• , •
4lJ
4H
4)5
431>
4}7
439
H~
HO
Hi
U2
Ul
444
us
H6
•
1
••
2
l
4
•'
•'
5
6
7
•
a
• 109
f
• 11
,.C~~PUTES CHANK REVOLUTIONS PER S~CDND
,,USES COUNt Of 1 KHZ CLOCK TICS DURING ONE CRANK REVOLUTION
,,COUNT IS "AINTAINED IN 16 BIT RPHCTR
..
1~
FALSE
•• ,,,.DIVIOE RPM.COEFFICIENT BY RPM.COUNTER
R?~-~VERFLOW.FLAG
~IV
lf'Cl ;:
~L~E
H?~
RP"-O~ERrLOW.FLAG
TRUE
Sf.T ARG1~ZERO
i:!iOlE
ZEHJ RPM-CUUNT~R
• 12
ZE~J
•
OUT4,,,,,UPOATE DISPLAY USING RESULT IN ARGl
.
1)
• u
R~M-OVERFLO~.fLAG
iEIUIHI
•
•
•'
•'
f
•
•'
•
•'
·············································································~·''''''''~··········f·········
CXl
N
20 OCT 8)
NICROTAC PROGRA~ LOGIC
DIST ROUT!Il~
448
f
f
4Sl
t
452
•
2
l
4
5
0.
•
TOTAL DISTANCE TRAVELED IN MILES OR KILOMETERS
,,USES COUNT UF SPOKES DETECTED SINCE RESET
STO~ED IN DISCtR
••
AHGI :a 32 BIT DIST.COUfiTER
,,CO~PUTES
,,COUST lS
451
'
454
'
•
7
8
SKL •••••• LFFT SHIFT ARGI 10 LOCATE "S6
DSHlfT • &II COUHT TO MSB
f
9
lE
451
451i
*
*
10
11
A~G-2 • M~T~IC.DIST.COEFFICIEUT
ELSE: »EfRIC-FL~t; FALSE
APG-2
ENG~lSH.DIST-COEfflClENT
EUUL~
=
4b2
• IS
~61
• 16
¥ 17
• 16
' 19
DIST-AOJUST
MP'/,.,. •• :•ULTlPLY ARG1
ARG.2
A~GI "' AOJUSrt:D UISTAIICE:
Srt~ ••• ,,,SHifT ARG1 RIGHT 10 CORRECT MAGNITUDE
' 20
OUT4,,,.,UPOAiE DISPLAY USING RESULT IN ARG1
• 21
i~IJau
~ob
~il
.
f
f
'
•
•
t
f
TRUE
12
f 13
• 14
46&
'
~fTRlC.FLAC
459
460
461
404
465
16
•················-··········································································~·········*··4···
l
,,DISTANCE kOOTlNE
44~
45~
4~5
4~6
PAGE
$
o
'
OIV • ., ••• OIVIDF.: OtST-COUNTER liY ARG-2
4
AR~-2
~RGI ;
•
= RAW
DISTANCE:
'
*
~
•
..•
··········································•t••······························································
OJ
w
HICROTAC
11~~
FRJGRA~
....
LOGIC
R~urr~r.
..................................................• ,
~70
~71
~72
473
~H
47S
476
417
~78
<H
<;30
41il
•
•
•
••
••
1
2
J
4
5
b
7
9
9
• 10
• II
• 12
4P,~
t
4H
• 14
4!:4
4E5
' 15
• 16
' 17
.S6
I)
~&"I
• ta
·•? Ci
t,~.!
"
•
•
•
~?2
4~3
• 23
•H
·~·
4H
• 25
4o9
1~0
1195
497
!9
20
21
22
• 26
•
20 OCT 83
lJM~.COUNTER
ARG.2 : 3600 (5£CONOS PER HOUR)
D!~ ••• , •• Ol~IDE ARG1 BY ARG-2 TO GET HOURS
l£ MQO£ ~ HR:~IN
CUh,.,,,,CO~VENT HOURS TO OECI~AL
JUIBUF 2,3 = HOURS
ARG! : ~EM-INDEk Of FIRST DIVISION
S~H ••••• ,SHlFT ARGI RIGHT 16 &ITS
AHG.2 : SO (SECONDS PER ~INUTEl
DIV.,,,,,OIVJD~ AkGI BY ARC.2 TO G~T MINUTES
C8D,,,,,,CDHYERT HlMUTES TO D£Cl~AL
JUT~Uf 0,1 : MINUTES
£LSi •ODE = ~JN:SEC
ARGI :&E~AINOEk OF FIRST DIVISION
S~~ ••• ,,,SHIFT ARGI RIGHT !6 BITS
APC.2 = 60 (SEC tER Ml~UTE)
DIV •••••• ~IVIDE ARCI BY ARG-2· TO GET MINUTES
CaD,,,,,,COnvERT ~~~UTES TO OECI~I~
~~TaUF
2,3
=
~XhUIES
•• ,,,,SHlff RE~AINOER RIGHT 16 BITS TO GET SECONPS
CBD,,,,,,COHVER1 SECONDS TO O~CIMAL
OUT8UF 0,1 = SECOUDS
S~P
27
~LUlE
2a
UPD,,,,,,UPDATE DISPLAY USING BCO DATA
I~
SOUBUF
17
~···················~·····························~·
• ,CO~PUfES ELAPSED TIME SinCE RESET
,,DISPLAYS RESULT AS 4 DIGITS HRIMlN Ok HIN&SEC
,,USES Tl~CTR T~ COUNT TICKS OF l HZ CLOCK
AkGl •
PAGE
•
'
~
•
•
f
•
'
•*
•
•
'•
•
f
•
•
•••
~
•
•*
····················································4····$············~····················*~···············
00
+>-
MICROTAC
PROCRA~
LOGIC
......,,,,,,,,,,,,,,,,,,.........,................
20 OCT 83
499
AVE ROUfiNE
..........................................
,............... ,,
' 1 ,,AVERAGE SPEED ROUTINE
SOG
'
501
502
50)
f
f
3
4
f
504
505
f
f
5
6
7
AVERAGE SPEED TEAVELED SINCE RESET
,,USES T31AL DISTANCE AND TOTAL TIME
,,DIST SPO~£ COUNT STOR~D IN OlSCTR
,.TI~E COU"T STORED IN TIMCTR
•• G~TS DISTANCE BY EXECUTING A PORTION Of DIST ROUTINE
,,SHifT COUNTERS fOR DIST AND TIME USED TO IMPROVE ACCURACY
506
•
8
ARGI ;
501
508
'
9
• IG
509
510
' 11
' 12
~II
f
*
2
ll
TI~E-CGUNTEH
S8
•
f
f
f
f
f
f
SHL,,,,,,SHifT ARGI LEfT TO IMPROVE ACCURACY
A~G.2 ; 3600 !SECONDS PER HOUR)
OJV,,,,.,OIVIDE ARGI BY ARG-2 tO GET HOURS
U:~P = S!llt'Tr:D HOURS
, ,CODE SHARE!) oiTII DIST
ARGI • 32 »IJ CIST-COUUTER
S~L •••••• LfFT SHIFT ARGl TO LOCATE NSB
OSHIFT : SIT COUNT TO MSB
U: ~C:Ti<IC-fLAG TRUE
AR~-2 : ~ETRIC.PIST-COEffiCIENT
ELSE MffRIC-fLAC fALSE
~PG-2 ; ENGLISH-DJST-COC:fflCIENT
'
•
f
512
51)
514
515
516
517
51Y
'
•
'
•
•
519
• 21
E!IUH
t
520
' 22
OJV, ••••• ~IVIDE DJST-COUUTER BY ARG-2
A~G-2 " RAW DISTA~CE
ur.l ; OIST-ADJIJS1
~PV.,,,,,"ULTIPLY ARGI
ARG-2
~RGI : ADJUSTED DISTANCE
,.E~O Of CDDF. SHARED WITH DIST
DIU,,,,,.DIUIDE ARGI bY ARG-2 TO GER RA~ AVE
•
f
f
14
15
16
17
18
19
20
,.C~~PUT€5
PAGE
521
• 2)
522
• H
52]
524
S2S
526
527
f
f
5~8
52~
5lO
f
f
*
*
25
26
27
28
29
)0
' ll
• 12
*
~!<Gl ~ RAW ~VE
SH~ ••• ,,,SHIFT ARGI RIGHT TO CORRECT
O~T~ •••• ,UPDATE DISPLAY USING RESULT
a.:;:~:u~u
f
•
f
•
*
•
•
'
•
f
MAGNITUDE
IN ARGI
*
*
~
• ...................................•................•.•.......•.........................................••
,.,
00
I.JI
NICROTAC PROGRAM LOGIC
OUT4 ~OUTINE
532
~H
SH
:B5
Slb
S37
SlS
5)9
540
541
542
su
SH
545
2~
OCT 81
PAGE
19
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••..
•
DECIMAL AND UPDATE 4 DIGIT DISPLAY
•
•• 21 ,,ASSUMPTIONS ONf TOENTRY!
IN
HEG
f
l
• 4 ,,RlSULTS AT EXIT
•'
,,CJ~V~RT ~EG
••
•••
f
,,SIN~~¥
5
t;
7
s
9
• 10
• 11
• 12
~NU~BEH
f CONVE~TED TO BCD
,,FOUR BCD DIGITS STORED IN OUTBUf
,,LCD DISPLAY IS UPDATED FHOM OUTBUF
,,JUMPS 10 SCAN ON E~lT
,,HE~
..
DIGIT-COUNTER z 4
• ll
ARGl TO DECIMAL
OUTBUF = CO~VERTEO ARGl
U?O,,,,.,UPDATE DISPLAY USING DATA IN OUTBUF
• 14
IIEI..J!HI
CBD,,,,,,CO~VE~T
'...............................•....................•........•........................••............. ,
•
•
•••
••
••
......•
00
0'1
KJCROTAC
PRDGRA~
Sll~ROUTlkf.
I<P1
LOGIC
20 OCT 83
PAGE
20
••••••••••••••••••••••••••••••••••••••••••••• , •••••••••••••••••••• , ••••••••••••••• ¥ •••••••••• ~ •••••••••• , , , ,
H7
su
549
5~()
SSt
552
S~l
5';4
555
556
~57
ssa
:;~'i
SE>C
561
562
•
••
••'
f
•
'•
t
2
l
~
s
6
9
' ICI
' lt
' t2
• ll
t H
• IS
'
*
DQ fOP. t6 BITS OF ARGI.LOW
SHIFT A~~~ RIGHI
:u; CARRY IS I
~DO ARG.2 TO RESULT
•
'
7
8
16
•
•• MULtiPLY SUBROUTINE
•• ASSU•PTJO~S ON ENTK~I
•• MULTIPLlfR IN LON HALF OF ARGt (REG f)
•• ~<.~OR¥ POINTER (REG D) POINTS TO START OF 2 B~TE MULTIPLICAND
..RESULTS AT EXIT:
•• AHGt (REG E,f) CONTAINS )2 BIT RESULT (E,F z BYTES 3,2,\,C)
EUI.lU:
SHifT ARGI RIGHT t BIT
1!: CAPRY ON
SET ~SB OF ARGl.LOW
!:!101£
561
• 17
i:~C:l(l
'564
• 1B
k~ZUatl
'•
•'
'
'
f
••
•w
•
••
•••••••••••••••••••••••••••••••••••••••••••••••••• 4, •• , •••••••••••••••••••••••••••••••••••••••••••••••••••••••
00
'-I·
~ICROTAC P~OGRA~
LOGIC
20 OCt 83
PAGE
21
DIV SUBROUTINE
566
567
56iJ
569
570
571
5i2
573
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ,,,,,,,,,,,,,,,4,,, ••••••••••
'' 1 ,,DIVISION SUBROUTINE
•'
• 2
,,ON E~lRYI DIVIDEND IN REG E,f (ARGI), MEM PTR. (REG D) POINTS TO 2 BYTE DIVISJR
'•
•• ~t EXIT: QUOTIENT IN REG f, REMAINDER IN REG E, REG C,D CORRUPTED
)
•
'
•
4
•• ~ETURNS ZERO (E,f) If DIVISOR IS NULL
5
1£ DIVISOR " 0
ii:LL!Il.li
6
f
'
•
1
8
574
•
9
575
576
• 10 OVI.:
• tl
QQ UNTIL BIT-COUNTER
ZERO
LErT SHIFT ARGI (DIVIDEND) 1 BIT
' 12
577
SH
579
58l
~01
'
1]
58~
• 20
• 21
' 22
5li9
563
18
19 DSHI
592
59)
• 27
~H
'
sn
597
S'H
:>99
LOO
6C1
602
60)
604
605
6C6
607
608
DECNE~~NT
CLEAR
' 26
:::;ceo
BIT BIT-COUNTER (RC)
~SS
•
•
•
~
SUBTHACT DIVISOR fROM
ARG1-HIG~
(RE)
~
EUOtt
37 DVR:
l£ ARGI BYTE l " ZERO
• l9
• 40
llt:IUII.U
Etltll£
• n
••
I)V~:
• 38
• 42
•
••
Of BIT-COUNTER SET
lNCPEME~T ARGI LOW (Rf)
LEfT SHifT ARGl
L£ CA~~V NOT SET
ADD DIVISOR TO ARGI-HIGH (RE)
i:L::i£ CA~U SET
29
• u
'
'
EUDll::
' H
'
•
sr:r
INt:RE~t:NT ARGI
~Sa Of 16
' JO
' 36
•
•
BIT-COUNTER (RC)
OF 16 BIT 811-COU~TER (RC)
SEi
uQ •niLE
' 2S I>VCI
• l2
l3
34
• 35
~SB
li:: CI.Rf•V
•H
• t5
•
•
•
•
t:Hll£
• 23
5SIIJ
591
595
BIT-COUNTER (RC) " ?O(HEX)
.
LEfT SHifT BIT-COUUTER (RC)
1t :AIIf!V SET
SUBTRACT DIVISOR rROH A~Gl-HIGH
i:LSE
ADO DIVISOR TO ARGI-HIGH
' 14
• 15
' 16
' 17
sa7
'
•..•
tucu:
SET
=
5a2
533
584
556
•
SET ARGI : ZERO
~~fr
~::;ccJ
!!i.:I~i!:l
~
••
SHIFT BIT-COUNTER 2 BITS
•
......................................................................
,
....
"•
,............................... ,•
00
00
~~C~DtlC
SHL
LOGIC
PRD~PA~
20 OCT 83
PAGE
22
SUI~OUti~E
6li
••····················f·····························~'·~········$································~·······~·····
•
l
,,ToO
LEfT SHifT SUaROUTINE
2
AT ENTRYI
••
• )
•• REG E,f
A 32 BIT BIUARY NUMBER ID BE SHifTED
•
• 4
,,RD
STORAGE LOCATION fOR SHifT COUNT
•
5
••
EXIt:
• 6
,,REGJS:£R
E,r LEfT SHifTED ARITHMETICALLY UNTIL HIGH WORD liON ZERO
•'
' 7
,,THC SioiFT COUNT IS STORED AT TH£
StORAGE LOCATION
~17
f
&18
619
••
CO WHILE
621
622
621
' 9
o 10
f II
t 12
• 13
t 14
62~
• ts
t~~c~
625
II
17
610
611
611
61)
614
~15
620
~26
HEGISTE~
,,ASSU~PTIC~S
f
CD~TAINS
~>
~~SULTS
f
0~
PAI~
I~OICAT~O
*
*
•
8
,,kEGISIER C
UQ
CO~RUPTEu
A~Gl BYTE 3 ; 0
~HILE SHifT-COUNT
LESS THAN SHLHAX (8)
SHIFT ARGI LEFT I BlT
JNCREHLNT SHIFT-COUNT
t~O~O
IE~P
~
~'IU~a
SHift-COUNT
'
••'
'•
•'
'
•
····································································#·····················~·············f····
00
\.0
MICROTAC PROGRAM LOGIC
SnR SUBROIJTI ~r;
629
629
.
20 OCT 8l
PACE
2l
................•.............•.......•...•.•.....••.... ,................................................... .
't
t
1
,,TWJ REGISTER RIGHT SHIFT SUBROUTINE
630
6)1
612
I
5
, ,ASSU~PTIOHS At ENTRY!
,,RE~ ~.F CONTAINS A 32 BIT BIHARr NUMBER TO BE SHIFTED
,,LJw BVTE OF Rf.G C CONTAINS THE SHIFT COUNT
•• ~ESULTS 0~ EXIT:
633
634
I
'
6
7
,,REGISTER PAIR E,F RIGHT SHIFTED ARITHMETICALLY
.. R!:GISTEII C COHRUPTED
6lS
I
II
,,
636
f
9
00 UNTIL SHIFT-COUNTER c 0
f
t
'
2
l
4
6)7
I 10
SHirT ARGl RIGHT 1 BIT
6)3
I 11
DECRE~ENT
639
640
• 12
' 11
'
ElltlCO
iliUll!!
SHIFT-COUNTER
I
t
t
f
1
t
o
t
.
'
t
····························································································~·····••••t•••••
1.0
0
LOGIC
~~C~~TAC PHO~R~~
ceo
642
6H
5H
645
646
641
Q.;ii
649
~50
651
652
653
6H
655
65b
657
65ii
6,9
660
661
662
56)
PAC£
24
•
•·······························································f············································
TO DECIMAL SUBROUTINE
• 2I •••• CONVERT BJ,ARY
•
AT ENtRY:
•
• l
16 KIT
IN REG f
POINTER
CREG
D)
POINTS
TO
LOWEST
BYTE
Of
OUTPUT
BUFFER
•'
• :;• ,,DIGIT COUNr IU REG 8,0
•
,,RESULTS AT EXIT:
•• 67 ,,eCO
••
EQUIVALENT OF RESULT IN OUTPUT BUFFER
IS LOST
8
••
•'' 109 ,,PEG S,C,D CORRUPTED
••
CLEAR ouTaur
• II
~SSU•PTIONS
,,BI~A~Y
!~PUT
,,M£~0Rl
f
,.C~ERfLOW
• 12
SAVE
• ll
• 14
t IS
' 16
QC FOM 16 BirS Of ARG1
SH%FT AR~! LEFT 1 BIT
Lfi: CARR)' IS I
8UfF~R-POINTER
ADD 1 To ouraur_o
• 17
• 1C
• 19
f
20
'
21
o&4
• 22
• 21
565
•H
6~6
20 OCT 83
sue~ourtNE
• 25
'
DO FOR 4 OICITS
U: DICIT :a 9
SET DIGlT::ZERO
SET CARRY • 1
E:IIOU:
EIIODiJ
~:lDI.e:
;:~~~~
et:I"<:~
•
•
•
•'
•
•
••*
•
•
····~····························································,··········································
1.0
1-'
HICROTAC PHOGRA~
UPO SU~ROUrl ta:
f.68
t69
o
f
671
o
•
673
~
2
l
.,
S
6
1
o7~
•
675
676
671
678
' 8
'
9
• 10
• ll
619
6a 0
' 12
• I3
6B1
'
6H
t
'
6i2
t•4
6&!;
20 OCt 8l
PAGE
lS
't ··················*··························································································
't
1
.,DJSf'l.H UPDU£ SUc!ROUl'lNt:
610
~72
LO~IC
*
•
U
15
16
17
n
,,ASSUMPTIONS AT E~TRYI
,,bCD VALUES IN OUT8Uf,l,2,t,O
,.II~SIJLTS AT EXIT:
,.ADDS DlGlf S IN OPPER 4 &lTS OF OOfBOF bYTES
•• !lEG B,C,O,£ CORRUPTED
t
t
t
t
••
•
OUTBOF-3
00 FJR 4 DIGITS OF DISPLAY
1£ DIGIT : 0
lE DIGIT o: 2 1 OR 3
o
"E~~~Y~PDlNTEk :
SET DIGIT zr BLANKING-COO£
i:IIQU:
EUOle:
CO~CATENATE THE DIGIT ~lTH DIGIT NU~BER
our •••••• OUTPUT OlGlT TO DISPLU
E~~CJ
l!t.zuau
o
*
*
t
'
o
*
t
•
•
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
•
1.0
tv
~ICROTAC
P~uG~A~
LOGIC
••••••••••••••••••••••••••••• , ••
687
oBij
689
690
671
>>2
691
~H
695
6~6
697
698
6~9
700
701
702
•
'
••'
•
l
2
l
4
5
6
1
8
9
' 10
• 11
•'
•
•
•
•
•
•
•
20 OCT 83
SUBRDUTINE
JS~
12
ll
14
15
16
,,,,,,,,,,,,,,,,,,,,,,,,,,,.~,,,,,,,,,,,,,,,,.,,
,,"JSR' SUBROUTINE
,,EXECUTED EACH TIME A SUBROUTINE IS CALLED,
,,R4 IS DEDICAT£0 PC fOR THIS SUBROUTINE,
,,EXECUTION BEGINS BY SETTING PC~ R~ CSEP R4),
,,TriE ~EIT TWO ~YIES fOLLOWING THE SEP INSTRUCTION
,,ARE ASSU~EO 10 CONTAtH THE ENTRY POINT OF THE
,.S~SPOUTINE TO BE EXfCUTEO,
,,SUrl"OUTI~E "JSR" SAVES THE CUR~EN? PC (RO)
,,AN CHANGES RO TO THE NEW ENTRY POINT,
,,EXECUTION Of THE NEW PROGRAM BEGINS BY SETTING
,,PC : RO,
R~TURN-~DDRESS.STORAGE 3 MAIN.PROGRAH.COUNTER
~AIN-PRJGRA~.COUnTER = NEXT WORD IN OLD CODE EXECUTION
S[T TO RESUME EXECUTION USING MAIN-PROGRAM.COUNTER
i~IU~~
PACE
26
•••••••• $.,,,,,., ••••••••• ,,
*
*
''
'
*
•
•
•
••
••
$
••
•
······················································································f·····················
\0
w
MlC~UTAC
RTS
~kOGk~~
LOGIC
20 OCT Sl
PAGE
21
S~BRGUTl~~
···································$····································~··································~·
10•
705
101>
101
1oa
70?
"/lf;
Hl
712
lll
•
'•
'•
•
•
1
2
l
'
5
6
7
••• RTS' SUbROU1INE
IS DEDICATED PC fOR THIS SUBROUTINE.
•• EXfCUTlOH BEGIUS BY SETTING PC: RS (SEP RS).
•• ~~ C"ANGES RO TO TKE RE•ENTRY POINT.
..PE•EXECUTIJN Of THE NEW PROGRAM BEGINS BY SETTING
..PC " 110.
..~5
..
•
••
•
: RETURH-ADDRESS.STORAGE
•
••' 109 Sf.T tO RESUME EXECUTION USING MAIN.PROGRAM.COUNTER
'
•........................................•............•.............. ,....•...................................•'
(j
~~lN.PRJ~R~H.COUNTER
ic:Iua:.~
\.0
"""
""'
MICROTAC
ISR
PROGRA~
LOGIC
20 OCT 83
PA:Ot
2a
.
....................................................•.•.......•.... ,,,,,,,,,, .......•.......................
71S
716
717
718
'f
f
f
'
1
2
3
4
.,INTERRUPT SERVICE ROUTINE
,,PC IS Rl, DATA POINTER K IS R2
•• INITIATED BY HARDWARE RESPONSE TO HIGH L£VE~ ON IRQ LINE
•• IRQ LIN£ IS CONNECTED TO SPOKE DETECTOR CIRCUIT
•• T~E~EFOR£ ISR IS EXECUTED ONCE EACH TIME A SPOKE IS DETECTED
,,ISR lNCRE~ENTS SPOKE COUNTERS FOR GEAR, SPEED, AND DISTANCE
719
f
S
72~
f
~
721
722
'
721
724
na
o 9
o 10
f 11
f 12
' 1)
• 14
729
f
1$
730
1 )1
732
f
f
16
AfSTJ~~
17
il.i;;:tU~t.
725
12~
727
f
1
••
9
STACK :
f
f
f
•
'
o
•
~ACHINE STATUS
IIIC~f.~<.n SPEt:O.COUNTER
l!IC~E:Mr:NT DIST.COUNT<:R
f
•
o
•
lNCPE~ENT GEAR.COU~T£"
~E:AP.COUNTER HAS OVERFLOWED
1~
t
SE:i GEAR.COUNTER.OVERFLOW.FLAG
c:ll:ll::
•
•
CANCCL HA~O~A~£ IRQ
•
f
STATUS FROM STACK
UITi::RilUPT
~ACHINE
....................................................•..•.•..,.. ..........•..............•....................'
• 18
f'ROM
f
••
'
~
'-0
IJI
96
..•••••
......
. ..
...... ..,"'" .......
•
ld
•
..
:z:
..
•
(J
•
..
0
..
..
z
..
..
::>
..
.....
. .
.... ".., ....*
... .. .. ....
..
ld
•
•
•
a
r..
•
•
a
•
..
ld
..
...
Q
"'
::>
..."'
....
.."'
'
ld
.,""' .....
...
-c
ld
u
"'
>
c
••CO:
Cl)
-c
'-1. to-1 r.J
IJ
.. ""
"""'""~c
,._OtuU
,...,..rtc,r...
"'"'"'
...."""'"'.. "'
...
f-UC&IC
v,a:,:.o
...........
....:: ..,_.,.
:.JZ:~O
... MalO
~
=>
..
0:
0
"'
....
0
...
APPENDIX C
Software Listing
97
ERR LIN£
AOOR
PA::;;
MICROTACH • VER, 27•0CT•83
81 92 &l Bol
TITLE
LIST
"MIC~OT~CH
• VER,
27•0CT·8~"
!CROSS REFERENCE
X
:1
I
4
5
MICROPROCESSOR CONTROLLED BICYCLE SPEEDOMETER
RUNS ON RC~ 1802 ~ICHOPROCESSOR
~EOUIRES SPECIAL INPUT SENSOR HARDWARE AS fOLLQWS:
Ef2:
CHA~K DETECTOR INPUT
Efl:
1 KHZ, SQUA~E WAVE CLOCK INPUT
Ef4:
I Hl, SOUAR£ ~AVE CLOCK l"PUT
SPDK~ OET£CTOR JMPUT
JROI
1~11
S~L£CT FOR 0 SIT DISTANCE ADJUST~ENT SWitCH
IN2:
SELECt fOR HODE SI::L£.CTOR S;.!ITCH
6
1
8
9
10
l1
12
ll
"
,,
lb
·~
20
21
1):)02
22
0 1HJ)
1
THE 16 GENERAL PURPOSE R~GISTERS ARE UTILIZ[Q AS fOLLOWS:
HO [QU
0
;~AJN PROGRA" COUNTCR (PC)
1
IINTER~UPT SERVICE ROUtiNE (lSRl PC
Rl EOU
R2 £00
2
ISTAC~ POINTER (SPl
R) EOU
l
I
R' EQU
~
;JSH PC
P~ EOiJ
5
;RTS PC
R6 ~UU
&
;RTS HETURN ADDRESS STORAGE
R7 EOU
1
IZERO REGISTKU I EV~WT FLAGS REGISTER
Rft EOU
B
ll~~POHARY SCk~TCHPAD STORAGE
R9 EOU
9H
I~OOE R~Gl&TER I OIST ADJUST REGISTER
RA EOU
OAH
;DELAY COUNT~R
RB EQU
OBH
IDIGIT COUNTER
RC EOU
OCH
!BIT COUNTER FOR ARITHMETIC OP[HATJQ~S
RD EOU
ODH
;M£MOHY POINT~R X (EXCEPT DURIHG I~IT' I~R)
P£ EOU
OEH
;EXT~NSION OF Rf PO~ DOUBLE L~NGTH ~~~u·~~rs
RF EOU
OfH
IA~GUHENT 1 (ARGI) IN AUlTHM!flC CU-PUTAflJNS
GENER•L ~EGS P4,R5 'RC DEDICATED PC"S fOR LI~'AGE SUbROUtiNES
THESE SUhPOUTI~~S AkE ENTERED EACH Tl~~ THAT H~G IS ASSI~~EO AS PC
I
15
lt.
11
:n
I
0~00
ut.QI
~%4
~..
Q~lQ~
2~
0~06
26
1)307
21
o:;n
29
0009
•.•
QQ[)~
lv
o:.o11
ll
32
ll
H
REQUIRES OUTPUTS CONU[CTED AS FOLLO~S:
OUTJ:
LCD D!SPL~i ~~ABLE
OUT4:
HAPDwARE IRQ hfS~T LIN~
oooc
0~()0
1)%£
OJOF
j:;,
36
37
)ij
TU£ tVt:NT t"LAG REGISTER (R7.0l IS USED AS fOLLOWS:
BIT 01 1 KdZ, CLOCK FLAG (Oil
err 1 CHA~K FLA~ (02)
1 HZ, FLAG (04)
UIT 2
BIT l
BIT 4
RPN COUNT£~ OVERFLOW FLAG (10)
RIT •
GEAR COU~TER OVEkFLO~ fLAG (20)
Sit •
C~A~K EDGE FLAG (40)
BIT 7
1 UZ £DC~ fLAG (80)
fLAGS ARE ACTIVE HIGH
l9
1~
41
47
43
,,
H
4b
n
40
49
Sv
51
52
5)
1)001
Q.)02
0004
S4
09v&
GfRF
RPMf
SPDi'
DSTf
THE
EQU
EOll
EOIJ
EOU
~DOt
REGIStER (R6,1)
~BIT 0 •
;BIT 1 :
04~
;BIT 2
;BIT l :
08H
OIH
02ri
=
IS USED AS FOLLOWS:
GEAk FLAG (FE)
RF~ fLAG (fQ)
S?EEO FLAG CFa)
DISTANCE fLAG (F7)
\.0
co
EQR LIN£
ADDR
55
0010
S6
0020
57
0040
sa
HlCROTACH • VER, 27•0CT•Ul
61 B2 83 B4
Th~F i'.:QU
TMSf EOU
AVE:f" fQU
METF EOU
ooao
'.i~
l
60
l
I
I
61
62
6l
OuOO
~~
OOCQ
NIIL t:Oll
ShLMAX EOU
65
2
10a
;BIT 4 : TIME CHR:~INl FLAG (Er)
20H
;8IT S : TIM~ (MI~IS~Cl FLA; (Of)
40H
I~IT & ; AV~RAGE SPEED FLAG (Sf)
80H
;&IT 1
~~TRlC FLAr. (7F)
THE MODE aEGISTEH f"LAGS AkE ACTIVE LD~
FLAGS 0•6 AR~ ALL 1 EXCEPT THE SELECT~D ~DO~ IS 0,
FLAG 1 IS 0 FOH M~THIC, 1 FOR ENGLISH DISPLA¥,
=
08
0
;BI~AHY ZERO
;MAX SHIFT L~FT VALG£
I
I
66
ASSEMB~Y
EQU
fLAG EQU
Z~~O
6i
0'J07
69
70
11
0(•09
~00~
0~~19
ADJUST EOU
72
0000
73
H
OO·H
•JOC2
7a ooos
PC f.~U
ISI<PC ECU
HSP EOU
JSRPC t:OIJ
RTSPC EOU
JS~SAV EOU
SAVE EOU
19
I
~0
l
o&
PA:>E
uov7
7S
0Qii4
76
iivv5
11
ouo6
LOU
~~IN
EQUAT£S:
R7
IZERO RF.G IS REG 7,1
Rl
;FLAG REG JS hEG 7,0
R9
JHDD~ R~G IS REG 9.1
R9
;ADJUST REG IS REG 9,0
~0
;REG
;Ri::G
:REG
;Rt:G
lkEG
IRI:G
;REG
0 IS PC FOR ALL EXECUTI3N EXCEPT
ld~
5
6
8
IS
IS
IS
IS
IS
IS
PC FOR ISR
STACK POINTf.k DURING ISR
PC FO~ JSR LI~Ki~G PHnGRAH
PC f"OR RTE ~lNKAGE PR3G~A~
SAVE R~GISTER FOR RETURN AODkESS
TEMP SAVE AREA
DOH
;ST~HT
CF
ME~DRY
OFOOOH
IEX~CUTED UPON
JdRAHCH TO RUM
ill
R2
114
115
il6
R8
I
2
4
' SUaROUilNES
END Of 'YJTLE" MODULE
I
81
..
i2
nRG
ijj
ao
66
e7
PAGE ZERO
I
RESET:
0000
CO FO 00
LBil
HAADW~RE
RESET
HO~ITOR
\0
\0
ERK l..liiE
ADOR
Bl Bl Bl 84
B'l
90
91
HICROTACH • VER. 27•0CT•9l
,....................•......................................................
' >> "AlN PROGRAM SEGMENT
I
I
92
94
<<
I
95
96
,
START OF '!NIT' MODULE
1
1
J
I
I
ONCE fOLLO~ING PO~EH•ON RESET
POWt:R•ON RESET CA~SE$ EXECUTION TO BEGIN AT LOCATION 0
PC IS RO
INU llllTlAL.lZES Rt:GI!'II'ERS, POlll'tEilS, ANO BUFnRS
1
,INlT:
..................
;START ~·················································¥···''''
Of
ROUTINE
97
9e
l~ITILIZATIOU
911
tOO
101
102
10)
EXECUT~D
tC4
COOl
EO
10~
OCIH
DIS
1~6
coos
7t
DO
DB
SEX
1SET PC ; X TO CAUSE JHME:DlATE ADDRESSING
;&iSAilLE INTERRUPTS
lfD~CES "DO" lNTO X,P REGS
;CAUSES ~E~ORY POINTER X=REG D
IKEfPS PC=Rt:G 0
0
Ol>OH
IOi
10&
10!1
110
111
112
(101)6
0008
f'B 0!
b1
ttl
()00&
AI
oor.c
fij OJ
IH
uov9
000~
ra
BE
.JSfii'C
;GET J$1< P~GE
;Sl'llHf. IN Hf.G ·1,1
IGET JSH ADDR
CIOIC
fB lA
A2
12
1111:
AO
0021
ra a4
fJ~I2)
1:12
PLO
LDl
PHI
Oj24
ilD
PH I
fa Ol
B5
fB 87
123
f•(JI
12·:
12!.+
~'JI H
t:tt>
CiiH
A7
127
l:!:j
O•JI~
117
135
<JSI1
PHI
vOlE
AC
12
11
0r11S
r,~
Q<)
129
1.01
JGET lSR PAGE
Rt:G 1.1
JGET ISH AllDRESS
;STORE IN REG 1.0
SijB~OUTI~£ PC
JSTORE Jll
0011
(•020
f~
A4
121
122
1l0
Ill
1 J i.
133
1H
lNlTlAL.lZE lSR PC
L(ll
<lSR
Pill
JSRPC
LDI
>ISR
PLO
ISRPC
l~l?IALIZE JSH LINKAGE
>JSP.
PLO
J&RPC
;STORE IN RKG 4.0
IhlllALIZE HTS LINKAGE SUBROUTlN£ ~C
LOl
<RTS
r:;ET ll"tS PAGE
i'Ul
RT:;PC
;srOfiE IN f<EG 5.l
LOI
>fiTS
; Gf.T HTS ADDR
PLO
riTSPC
;STUH£ IN REG 5.0
lUITlAL.lZE zgRJ SYTES
LOI
liOH
;Gf"T Zt:Rrll:i
PLO
fLAG
; U:i>O t"l.AG kt:G
l'HI
Zt:RO
ICilEAH: ZEIW 111'1'0::
HllTl1.LIZt: r.rs" AND STACI( POIUTEilS
LDI
>ISRSAVO
;G~T TOP Of STACK
Pl.U
HSP
ISTURt; IN RI::G 2.0
v'J0f
vult
119
120
~
···························································~·················
9)
114
115
Ill)
117
11&
p~:;e:
i
AS
n oo
LDl
AODR~SS
RSP
liD
; 1\IJMP St' TO AllOVr: s·r.<CK
Jlri!T MEMORY Pf'liiiTEtl
CISRSAVO
RSo'
RD
JGEJ &TACK PAG~
;si:T SP (R.:G 2l rnli P~GE
; Sf. I' HEM Pill NTI':R ( ~t:G ll)
fOI\ PAGE:
llo
117
116
1)9
14•)
1U
Zf.I!O
0025
BUff£~
AREII
ltiiT1:
OG25
ao
o)~26
H
0029
32 2t:
00
GLO
SMI
sz
RD
>llllf
INIT2
;GET MEMORY l'OI~TER
;COMPARE TO LOWiST BUFFER
;JUMP ~HEN OONE
L.OCATJJ~
1-'
0
0
ERR LINE
AODR
MlCROTACH • VER, 27•0CT•83
Ill b2 83 84
142
on A
97
CHI
IU
IH
145
0028
73
STXD
oo~c
30 25
146
002E
002F
0030
EO
:ex
70
00
RET
DO
H7
14B
149
150
ISl
ISl
151
f>R
lhiT21
I
1
1
LBR
PA:JE
4
ZERO
;GET 0
;STORE IN M(O) AND DECREMENT REG 0
lNlTI
;LOOP FOR NEXT BrTE
;PREPARE TO LEAVE INIT
0
;SEt PC=X TQ CAUSE l~HEDIATE ADDRESSING
;ENABLE INTERRUPTS
;fOHC£5 •oo• INTO X,P REG
ODOH
;CAUSES MEMORY POINTER X:REG 0
;KEEPS PC:REG 0
SCAN
:LEAVE INIT ' COMMENCE SC4N
END OF •INtT• MODULE
1-'
0
1-'
€RR I.IH£
ADOR
81 82 Ill 114
155
lSD
,........................................................•...................
'I START Of 'SCAN'
,' ..................................,..............
~···························
15~
16~
I
1? I
162
I
SCAN:
ltbl
16·\
!55
l66
lEd
lt.B
1~'l
.171)
171
112
113
lH
P5
001\
~1
G0)2
f.\ ) f
O;;Jr,
~1
;ST~RT Of SCA~ ROUTlNF.
SC1.10 SENSES RlSlNG t:OGES OF Til£ 1 KHt., t lit., J.MO CRJ.NK IIIPUTS
SCAU ALSO RE~DS MODE AND DlSi ADJnSTMENT SWITCH SETTINGS
SCAN Tol£:11 UPilAT£5 THE INUHtiAI. 1'\::JOE AflD ADJUST Ri::GlSTERS
lF TK£ MDDK SELECTED BY THE OP,RATOR IS GE'R 0~ RPM
THE DISPLAY IS UPDATED ~lTH EACH CRANK SWEEP
lf THL KODE IS OTHEkWlSE
tHE Dl$PLJ.Y IS UPDATED ONCE PER SECO~O
SCAH INCREMENTS TIME COUNtERS •HEN l HZ EDGES ARE SENSED
CLgAR EDCF FI..GS
GLO
fLAG
&NI
3FH
PLO
FLA~
!I~
RE~D
11'i
1ao
ool~
f9 Of
lot
:92
I iil
tH
HS
0037
()0)8
i\0
6~
l~P
(lo)jq
t\9
PHI
o.n~
&9
I~P
COlil
H
Lhl
?LO
PLO
18b
187
;GgT fLAG K~G
;CLEAR 1WO EDGE fi.AGS
;HESTO~E FLAG REG
lh MOD£ AND DISTAHCE AOJU~TMEHr ~~OM gxrEKNAL SETTl~~S
;GgT AODR~S~ Dr T£HP.O
:.TE"'PQ
:SEt ~£MO~Y PO&NTFR TO TE~P.O
RO
;INPUT ~OD~ TO aCCU~UL~TOR 'T~~p
OAH
;STURE CONT!MTS IH ~OP~ R~G
1400£
O'lll
!IUPUT DlST ADJUST TD ArC ' T~~p
;St~R~ CO~r£~TS IN ~~JilST R~G
ADJUST
•••••••*•
tn
QOH
f9 00
•••••••••• 102~ HI CLUCK R~L~T£0 PROCESSlMG
tiiNC On 1 KHZ CLOCK
TEST FOR lNPUT 1N WHII.E fi.A5 OFF
:G~1' CO!IT£:!TS liF f'I.A\, IH.:G
GLO
fLAG
A~l
0\H
;1~ST 1 KHZ F~AG
SNZ
)5C~N2
;JUMP lf 1 KHZ FL~G ALREADY ON (!IU Ol
863
>SCA~l
IJU~~ IF 1 KHZ lN~UT STILl. OFF
Rl51NG EUGE OF t ~"z CLOCK IJETECTEIJ
SUMP 2 &ITE RPH CQIItlT£1l
;Ggr AO~HESS OF RP~ COU~¥£R
>~P~CTRO
LDl
191
f),J;':i
~~
Pl,(l
19o
OC•\b
C.H7
r.:,} ~9
fO
!.()~
l'C 01
~Ill
1)
OOH
fJ
!>TXD
L!'X
00-18
00'.()
H
STXC
a1
GLO
tao
109
l>·l
! 'II
19?.
19)
O'HC
O?.ID
OOlf
OIHI
81
t' 01
ll
~7
)~
ljU
IH
1>5
~~~
2UV
201
202
203
204
2V5
:HJ•lf.:
206
OOH
2a1
!i
MOOUI.~
l'.i7
ISS
! ";~
171
p~:;£
MICROTACH • VER. 2l•OCT•83
oosc.
1C
00
cs
f'# 10
~llC.:l
R~
;~'i'Jr1t'".
01H
JGET CUATIYTj OF
11 NC~t:>lt:~ r C0 1JNT
;H~STO~~
;GET
OOH
~)
RP~ClR.O
~~~CTH,O
CONTE~rs
or
SET RPH COU~lTE:R
~
:INCi<t:llt::r;l' Ci111ill !1'
OVERFI.OW FLAG If lb liT
fLAG
~GET
1011
;I.ONC SK P lr
IE~SE S£
RP~
CON
~~!S
0~
OEC
VOINT~R
~PMCTR.I
J~E~TDkE kP~CTR.a
LSt;f
ORI
1"1 i-li::G
5
Co\K~~
D~C
SE r
POINTER
COU~rER ~V!RfLOWS
FLAG R~G
C~k~Y
DfF
OVERVI.O~
FI.'G
1-'
0
N
EFcP. LINE
208
209
210
.tDDR
f9 01
A7
0057
)6 50
0059
00511
fll FE
l~
50
211
lt 2
21)
214
215
2\6
217
218
2l'i
oosc
&7
A7
0)50
ORl
PLO
BR
SCA112:
83
GLO
ANI
PLO
SCANl:
220
87
225
OiJ'.i!:
fA 02
226
227
0060
,0062
]() 70
l4 I>A
229
229
230
0~04
87
0065
231
oo~7
rg 42
1.1
01~8
H
006A
)5 70
0~6C
{)1)60
87
fA
47
C~AH~
.
RELATED PROCrSSING
''''**''''
SYNC Orl CRANK
TEST FOR CRANK INPUT ON hHILf. fLAG IS StiLL Off
;GET CO~TENTS OF fLAG REG
GLO
fLAG
;TEST CRANK fLAG (BIT ll
ANI
!12H
BIIZ
>SCAN6
;JUMP }F CRANK FLAG ~LREAOY 0~
~N2
>SCAI<7
fJUMP If CRA~K INPUT STILL OFf
LEADING £DGO: OF CRANK DETECTED
f'I,AG
GLO
IG~T CONTENTS Of FLAG REG
Okl
;SET CRANK AND CHANK EOGE fLAGS
42H
;RESTOn£ FLAG REG
fLAG
PLO
222
223
0050
6
ISET 1 KHZ fLAG J~ EITHER CAS£
;RESTOR£ fLAG REG
;JUMP TO NEXT STEP
IRPM fLAG ALREADY ON
;JUMP If l KHZ INPUT STILL ON
>SCANl
fALl. IN!; EDGE OF CLOCK UETECT~D
RESf.l l KHZ FLAG
;GET.CONTENTS Of fLAG REG
FLAG
;CLEAR I KHZ fLAG (SIT 0)
OfEtl
fLAG
IR~STORE FLAG REG
OlH
FLAG
>SCAN)
••••••••••
nt
224
PAG£
MlCROTACH • VER. 27•0CT•9l
Bl 82 Bl 84
0'>52
Oil54
OJSS
2)2
END Of CRANK
2H
~H
2H
2)(,
70
>SCAN7
:JU~P TO NEXT STEP
;CRAIH( FLAG ALREADY OU
>SCAN7
1JU~P If CRANK INPUT STILL ON
ll2
rULING EDGE OF CR~NK OF.Tf.CT~D
fLAG
;GET CONTENTS Of FLAG ~EG
GLO
OfOH
;CLf.AR CRANK fLAG (BIT I)
AI< I
PLO
fLAG
1 RESTOR£ fLAG Rt:G
2)7
2lti
219
HO
006F
PROCESSI~G
BR
SCAhbl
ro
241
242
5CAN7:
0070
243
244
245
2·\6
I
1
uLO
61
0071
0?11
OG7S
f~
(Jt
H
9•l
0017
f.·-)7&
ij'/
2~J
25~
COH
HI
2·H
21!i
250
251
252
I HZ RELATED PROCESSING **'***'''*
ON I HZ CLOCK
f'LAG
;GET CONrE~TS OF FL~u REG
Al'll
04~
IT~IT I HZ fLAG
:JUMP IF I HZ rLAG 0~
IH•Z
>SCANIO
tll'4
>SC:4:-IIl
;JU~P IF l HZ INPUT GFF
RISING EDGE Or 1 HZ CLilCK DETECTKD
S~T I HZ FI.A:;s
GLO
f"I,AG
;G~T CONTINTS Of FLAG REG
OR I
6411
;S~T I HZ 4HD I HZ ~DC~ fLAGS
PLD
FLAG
;~ESTOR£ FLAG ri~G
BUMP T1~E COUhTER
l..vi
>l'IMC'l'R;)
;GET AOOR ~f TI~C:TR.O
PLO
f<D
;SlT M~MOni P~INTEH !NEG 0) TO Tl~:TH.O
LllX
:G~t CONTiNTS OF TIMCTR.O
:InCREMENT CUUhT
ADJ
OlH
STXU
;RE~TORE Tl~CTH.O & DEC POIHTER
;GET CONTEnts Of TI~CTR.l
LOX
ttftttfftt
SY~C
0~7~
2SS
);" 96
f9 &4
A7
256
0078
ra oa
251
2':dl
0070
0•)7f.
fQ
<:59
oc.7r
2o0
OOQI
~tl
00ij2
AD
fC 01
H
fO
I-'
0
w
ERR LINE
262
261
264
265
266
AODR
o~~l
0085
0086
0087
0089
81 82 8) 84
MICROTACH • VER. 27•0CT•8l
ADCI
Sl':CD
LOX
ADC1
STXD
LOX
AllCI
STXD
1C 00
1l
fO
7C
7)
oo
fo
267
268
008A
00~5
7C 00
269
27u
0080
7l
271
ooa£
)0 96
272
27)
0090
37 96
0092
ij]
009)
fA fB
217
21&
IJG~S
~1
279
00~6
28)
0096
iP97
0099
87
fA 40
l2 A7
284
285
H6
2S7
268
289
290
0098
99
009C
fA 01
C2 01 If'
00~£
2'11
B:l
29]
2H
2~5
296
~Cj1
29&
29~
]~0
OOAI
99
)01
031.2
OOH
f4 02
C2 01 69
](J~
)I)J
)04
305
)0~
307
li'J6
JC 9
)10
3 II
l12
I)OAJ
cou
&7
)14
OOAB
ll~
OOAA
fA 80
J2 E6
)1]
OOH
7
>SCANll
;JUMP TO CONTI~UE
11 HZ f'LAG ON
>SCAN! I
;JUMP If l HZ INPUT STILL ON
FALLING f:OGE or l HZ CLOCK DETECTED
GLO
fLAG
;GET CONTENTS Of' fLAG REG
ANI
or&H
/CLEAR l HZ fLAG (BIT 21
PI,O
/RESTORE fLAG REG
FLAG
8R
[;4
,
SCAN! I:
290
2iH
2il.
OOH
U:OE
COUNT If CARRY SET
JRF.STORE TIMCTR.I ' DEC POINTER
;GET CONTE~TS Of TIMCTR,2
!INCREMENT COUNT IF CARRY SET
JRESTOHE TI"CTR,2 ' DEC POINTER
JGET CONTENTS Of' TIHCTR.l
JINCREMENT COUNT IF CA~RY SET
;RESTORE TIHCTR.l ' DEC POINTER
tiNCRf~ENT
SCANIO:
274
275
276
OOH
'*'''''**'
DETERMINE
GLO
fLAG
IF SERVICE REJUIRF.D tfffffffff
;GET fLAGS
Alii
40H
iTEST CRANK EDGE fLAG
bZ
SCAN12
JJUMP If' Off
CRANK EDGE OETECTED • CHECK fOR CRANK DEPENDENT MODE
SETTIN~S
TEST fOR HOD£ " GEAR
G~I
MODE
;GET CONTfUTS Of HOD£ REG
;TEST GE~R fLAG (BIT 0)
ANI
GF:flf
GEAR
Lbl
;If' ON JU~P TO GEAR RJUTINE
CLEAR GEAR COUNTER AND OVERfLO• fLAG
LOI
>Gt:f<CTRO
;GEf ADORESS Of G~RCTWO
PLO
RD
15fT MEMJkY POINTE~ (REG 0) Tn G£RC!H.G
t;IH
ZERO
;G£T ZERO R~G
;ZfHO GEAR COUNTER
suo
IZ~RO GEAR COUNTER
STXD
GLO
fLAG
;GET CONI~~rs OF PLAG REG
AI! I
OOfH
;CLEAR GEA~ COU~TEH OVEfifLOW fLA~ (OIT 5)
PL(J
fLAG
:RESTON~ f~AG ~i~
CHECK FOR MODE : RPM
;iOO~
GHI
:GET MGUE REG
ICHEC~ RP~ fLAG (diT 11
Ard
RPMf
LBZ
;Ef OU JU~P TO RP~ ROUTINE
RPM
URO 2 BYTE RP~ COUNTER ~NO DVE~fLOW f'L~G
Li.H
;G£T ADOR Of RP~CTR,U
>RPI<CTRO
JIET ME~GRY POINtER (REG 0) TO RP~CJR.O
PLO
RO
;~~T z~~n ~ec
Gill
ZEI!O
;ZfRO NPMCTk,O & DEC P01Nf£H
S'fXO
srxo
lZt~O HP•CIH,1 ' DEC POl~TER
fLAG
1GtT CO~T~~rs Of' fLAG ~~G
GLO
~Ill
u~fH
1CLEAR RPM COU~TER OV£~fLOW fLAG CBIT 4)
;RlSTOR~ f'LAG REG
fLAG
t
PLO
SCAN12:
f'LAG
;GET fLAGS
GLO
ANI
SOH
TTEST 1 HZ EDGE FLAG
sc.uus
I•IUHP IF Off'
BZ
,_.
0
.p..
ERR
Ll~E
ADDR
8t
&<
83 84
)16
117
)ICj
00-C
OOAD
OO~f
322
l2J
lH
ns
326
327
328
00~2
u'lc4
OllilS
001:16
0087
99
n o•
c2 oo t::a
re
Pt.~&
a
RISING EDGE OF I HZ CLOCK DETECTED
TE::iT FDA CLOCK DE:Pt::NDENT MOD£ SE'CTINCS
TEST FOR MODE
SPEED
GHI
MOO£
JGET COnTENTS OF MODE REG
JTEST SP~ED FLAG (Sl1 2l
ANI
SPC.F
LDZ
SPr:£0
JIF ON JU~P TO SPEED ROUTINE
Z~RO 2 BYTE SPEED COUNTE:R
;GET AOPR OF SPOCTR.O
LDl
>SPDCTRO
PLO
liD
JS£T ME:MOHV POINTER (REG D) TO SPD=rR.O
JG~T ZERO 'REG
GHI
ZERO
S'fXO
JSTOR& Z~RO IN SPDCTR.O ' DEC POI~TER
STXD
:STORE ZERO IN SPPCTR.t ' DEC POINTER
=
liB
320
321
MXCaOTACH • VER. 27•0CT•83
11
AO
97
13
1l
TEST fOR HOD£ m DISTANCE
GHI
MO&E:
;GET CONTENTS OF' ~ODE REG
ANI
DSTF
;T~ST DISTANCE FLAG (BIT l)
LbZ
DlST
1IF ON JU~P TO DISTANCE RJUTI~E
329
HJ
HI
COBS
99
c,r,a·~
fA
H2
COilS
C2 01 8?
vOilE
OOi>F
OGCI
99
fA 10
GHI
ANI
C2 01 Ol
LBZ
3H
340
00 4
00 5
9~
CHI
fA 20
~NI
341
H2
OJ 1
C2 01 OA
(I~
lll
TEST fOR MODE a TIME
3l4
3)5
3H
))7
~DOE
THHF
TINE
JGET CONTENTS or HOOE RE'JTEST TIME (HRIHlN) FLAG (UlT 4)
IIF ON JUM~ TO Tl~E ROUTINE
Ba
)4)
344
OGCA
99
345
J4&
ooc~
~nco
FA 40
c2 o2 44
H~
OuuO
99
)5~
'Jj~l
)51
0)~)
fA 01
H Db
MODE
TMSF'
TIME:
LllO:
TEST FOR MODE
Gill
MODE
ANI
AVEF'
LBZ
AVE
GE:T CONTENTS OF MODE REG
IESY Tl~E (MIN:SECl FLAG (BIT 5)
IF ON JUMP TO TI~E ROUTINE
= AVE
JGET CONTENTS Of ~ODE REG
;TEST AVERAGE FLAG (~IT 6)
JlF OH JUMP TO 'VERAGE SPEED ROUTINE
347
HB
TEST
)~2
)5)
)54
OODS
00D6
)5~
QQI)8
3'.6
O~DB
u
n
c-
M(lD~:
BIIZ
KOOE "'
GLO
20
01
tr
MOO! • GEAK ' GF.AR COIII!'fER HilS 0Vr:f<f'LUW£D
JGET CONTENTS OF HOC~ NEG
Gf:RF
IIEST GEAR FLAG (ACTJU~ LO~)
;IF' OFf' JUMP
>SCAtl13
C£AR Ot::TECTED
JC~T COIITF.NTS OF fLAG R~G (ACTV Hll
FLAG
20H
JTEST GEAR COUIITER OV£FFLO~ FLAG (BIT 5)
GEAR
;IF Oh JUMP TO ~EAR ROUTINE
FOil
Gill
Atii
~NI
Li>IIZ
SCAN I ) ;
J57
)~8
351
lo~
OOi:IB
LO!JC
Jbl
rJ.J~£
fA 02.
lA <:6
GiJ!:O
B7
99
.16~
363
3f.4
3&5
00£1
000
n 10
CA 01 69
TEST FOR MODE : RPH ' RPM COUNTF.~ HAS OIKNFLO~ED
CHI
MODE:
;GEl CONT~QT6 Oi KQDi NEG
AHI
~P~f'
;TFST RPM fLhG CaCT!VE LOW)
&~Z
)SCANI~
Jlf UFF JUKP TO NEXT STEP
IIOOE
RPM DETECT~D
GLO
fLAG
IGET CONTE~!S Of FLAG HEG
AUl
10~
IT~ST R~H COUHTER OVERfLD~ fLAG (aiT ~)
LBNZ
RP~
llF ON JUKP TO RPM RUUTlME (ACTJV£ HI)
=
Hi>
367
ltJ&
)6'1
00€~
r,o::o
SCAtl14:
SCANlS:
E~D
Of l HZ RELI.TE:O iiODE CIIECKS
.....
0
Ln
106
"'
.....
M
oC
."'....
:0
~
0
"'
...
z
u
..."'
.
....
0
....
"'
"'0
0
0
....
..
"""'I
"'....::>
u
0
.......
I
"'"'>
....
:
u
0
"'....
u
0
a
... ..
" .
"'
...
z
u
•
z
u
0
0
"'a>
z
:..1
:0:
•...
...
- ...
"'
"' ...
N
0
<0
a:
n
Q
c
"'"'
0
0
... o-N
............
......z ..........
...
"'
ERR LINE
AOOR
Ill e2 Ill U
374
)75
l16
"ICROTACH • VER. 27•DCT•8l
PA~E
10
,,..................•.................•.•.....................................
>> MAIN PROCESSING ROUTINES <<
,.•.............................•....•.......................................
I
I
]11
na
179
180
STARr OF 'SPEED' MOOULE
361
H2
~································,······················~·····················
)a)
1
164
SPEED:
:START OF SPEED ROUTINE
I
CCHPUTES lHSTANT~~EOUS SPEED IN "PH OR KPH
I
USES COU~T OF SPOKES lN ONE SECOND
1
SPOKE COUNT IS M~INTAINEO IN SPPCTR
]ij:)
186
387
388
J
lo9
;
)qr,
0•)!:8
191
~OE.t.
H2
oon
fi If>
AD
@9
)9)
394
HS
B6
H7
QO~C
H"-
''"':o
liC·Ei::
;';.19
4o~
GvEr
Af
91
a•
04
SET POINTER TO ~ULTIPLICAHD
LDI
>SPUCTRl
JGET ADDKESS OF SPDCTR.I
PLO
RD
;SE'f I'IE 1WRT POUl'l'ER TQ SPDCTR.l
GLO
ADJUST
;G~T CONTENTS OF DISTANCE ADJUST R£G
ADJUST IS A ~ULIIPLIEW FRO~ .5 TO 1.5
IT IS A BlNARY NUMBER SHlfT€0 LEFT 1 PLACES
TH~R£FORE ND ADJUSTMENT 1~ 1.0 IS ENC00£0 AS 10000000 aJV~Rl
fQI,~OwiUG ~ULTlPLY, THE H£SULT CAN BE RIGHT SHlfiED 7 dlfS TO
PLO
Rf
;STORE IN Rf.G F
GHI
ZERO
!GET CONTENTS OF 2EPJ ~EG
PHI
Rf
;STllRE U:RO lU RE<; f.l
S~P
JSRPC
;MULTIPLY SPEED COUNI flY ADJUST
OU
<MPY,)~py
JADDP~SS Of "ULTIPLY SUBROUTINE
E,f c ADJUSTED SPEED COUHT SHlfT£0 L~FT 1 BITS
ooro
02 91
405
QOf2
ra
4116
4r,7
4(Ja
00f4
QGf5
AD
40~
(;(jf7
13
'JF'
STORE ADJUSTED VALUE BACK I~ 2 BYTE SPDCTR
LDl
>SPOCTHO
IG~T AUDR~SS Of SPDCTR.O
PLO
RO
ISET MEMOal POINTEH TO SPOCTR.O
GLO
!IF
;GET llVTI:: 0 Of' RSS!Jl.T
:>TXIJ
;STORF. IN SPOCTf:.O I. DECREMENT PJISTER
Gill
Rf
;GET tll'ft: I Of ll£SI.ILT
•;tO
r,,),'B
50
S'•'H
'111
402
CORH~CT
40)
40~
G"Jro
11
!!f
411
413
OOF9
99
414
OOfA
41~
OOrC
fA 80
0 1)1
()7
41~
417
•l&
419
f8 02
4:ll
ll'Jff
0101
0102
0104
422
0105
30 00
·00
BF
F8 AD
U"
421
424
425
0:26
RO
;STORI: IN I;PI>CTil.l
ADJUSTED SPEED COUUT IN SPDCTR
WHEtHER TO PR~PARE METRIC OR ~~GLJ~ij kt:SULT
GHl
KOl>E
;G!;T CCHITt:HS Of .~ODE iH;G
At:l
Nf:Tl"
;TEST KfTRIC f'I,AG Cf.JT 7)
LBZ
SPE~Dl
;JU~P If M~lRIC fLA~ D~ (ACTIVE L)~)
M~TRIC FLAG OFF, TkEH~fOIIE CO~PUTE IN ENGLISH UNITS
2A~ IS EGGLISH COEffiCiENT SHifTED LEFt H BlrS
LDl
02H
JGt:T ~VT~ I OF ~NG~ISH CJEfFICit:NT
PHI
Rf
ISTORE Ill REG ~'.1
LDl
LADH
;G~T ~YTE 0 Of ENGLlti" COEfVlCIE~T
PLO
Rf
;STURE lN Rf.G r.O
BR
>SPEED2
;JUMP TO CDM~ON SPEED PR~CESSING
blTlRMIN~
412
,
SPE~Dl:
0107
f8 04
446 IS
LOI
;~ETRIC FLAG ON, COMPUTE Ia ~ETRlC UNITS
COEFflCIE~T SHIFTED LEfT 8 &ITS
;GET RYTE I Of ~ETRIC S~EED
MET~lC
04H
COKffi:IENI
1-'
0
'-I
EP.II Ll•IE
4'27
42&
429
430
HI
4)2
43>
434
4H
U6
Hl
08
439
ADi>ll
0109
01a
!HOC
er
ra
AF
PHI
LOI
PLO
01()0
IJ4
SPE:E02:
SEP
01 r;~
02 91
0110
FQ 0£
48
11
JSTORE IN REG F,1
!GET BYTE 0 OF METRIC SPEED COEFFICIENT
!STORE 1~ REG F,O
AC
04
0114
Cll lE
n
4oi~
0116
0118
vl19
011A
Ht.
Hl
CI1C
HO
411
'
I
0118
11
AD
97
7)
H
co
ICOHHON SPEED PROCESSING
JSRPC
;HaLTlPLY ADJUSTED SPOKE COUNT BY SPEED CUEFflCI
<Hf?Y,>Mf'Y
;AOOR OF ~?Y SUBNOUTINE
E,F : Bl~ARY SPE~D • 256
RIGHT SHIFT RESULT
OEH
IGET SHIFT COUNT
LUI
!SET SHIFT COUNTER
PLO
RC
rSHlFT
SEP
JSRPC
;ADOR Of SHIFT SUBROUTINE
<SHR,>SHR
Dll
&J~ARY SPEED IN REG F
;Zl~O 2 BYTE SPEED COUNTER
!GET AODR OF Sfi'OCTP.,O
LDl
>SPDCTRO
;S~T M~MORY POINTF.R (REG Dl TO SPD:TR,O
PLD
RD
GHl
ZERO
!GET ZEiiO REG
;STORE ZEKD IN SPDCTR,O & D~C POI~T£R
STXD
STXD
!STORE ZERO IN SPPCTR,1 ' DEC POI~ItR
OIJT4
JJUHP TO UPUATt DISPLAY AND ~XlT
LBH
i)ll
I
0112
448
449
RF
48H
RF
p•:;e:
I
0111
H2
-'4-l
.;44
HtCRDTACH • VER, 27•0CT•8l
iii 112 Bl B4
02 82
I
I
END OF "SPEED" MODULE
t-'
0
00
1!:~11
LIIIE
ADOR
MICROTACH •
ill 82 8) 84
,
451
454
45)
Y~R.
p~;e
27•0CT-8l
12
, •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• $ ••••••••
START Of •GEAR• MODULE
454
I
I
4~5
, ••••• $ ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
456
4S7
GE:ARt
;
;ST~RT
OF GEAR ROUTINE
458
COMPUTES GEAR RATIO BASED ON NUMBER OF SPOKES PER CRANK aEV
USES SPOKE COUNT I~ 8 BIT GERCTR
45~
460
~61
4~2
4t\)
464
46S
466
467
468
469
470
411
4"12
01\f
(j\20
C122
0124
0125
Ot2t;
0127
97
fli"
AI'
lO 5C
I
89
40,0
oi;l)
~IH
OIB
OI<C
"'"'~·
4af-
0120
()1 2f
~e1
r.t 10
40.~
01)1
:H
02 'il
4~0
Olll
1"8
491
H2
4'iJ
o: 15
AC
utlo
0117
~4
f~
10
AD
4~)
v)
~J
4%
H7
490
i'.l9
suo
11::
0139
Ol)il
OllC
CtlO
f3 II
AD
ar
~llf
H
9f
!>()
0140
01U
rA 90
013~
SOl
502
SOl
C~AOK
REV
WIT~JUT
OVERFLOW
GEARt:
GLO
ADJUST
;GET COnTENTS OF DISTANCE AOJUST~~NT REG
ADJOST IS A HULTIPLIFR f!<OH .5 TO 1.5
lT l& A RINAI<V NU~aER SHlFIED LffT 1 PLACES
THER£f0H~ ~0 ADJUSTH~"T 1= 1.0 IS ENCODED AS 10000000 Sl~'R¥
FDLLO~lNG MULtiPLY, IHE llESOLT CA~ KC RIGHT SHIFTED 7 BITS TO CORRECT
I'LO
Rf
;STO~~: A.OJUST IN AHGt (REG f)
GHI
zuw
;G!:T cor;:..::.r:; IIF' zrua Rt:G
P~I
Fir"
;Z!:RO liPI'F.:R BY'fl:: Of AR(il
LDI
>GERCTR1
;G~T ADDk~SS OF G~RCfR.I
PLO
PD
;SE:T l'f.I<OllV POYNTER TJ Gt:RCTR.O
SlP
JS~PC
;CALL MULTIPLY SU~ROUTINE
OJ
<KPV,>~Pl
;ADDR Of ~P¥ SUtiHUUTI~E
MloL':"!PL¥ f•IWO:JCE:S THE R~:sut.T: E,f = Gf:RC'fllff
LLl
7H
;Gr:T SHifT COUNT = 1
?!.0
SEP
4~~
~9S
GEAR PROCESSING
GERCTR HAS COIINTED SPOKES fOR ONE
~Hl~
;
0129
0129
~H
40.4
~ORMAL
;EXECUT~D
47~
•HI
'ia2
Ul
A~II
l2 29
OJ
414
476
411
479
;GET CONTENTS OF FLAG REG
fLAt:
;TEST GE~R CTR OVERfLO~ fLAG (BIT 5)
20H
llZ
><;EAI<I
;JUKP JP OVERfLOW fLAG Off
GEAR COO~TiR OVERFLOW fLAG DETt::CTED
INDICATES COASTJhG
THEREfORE SET DISPLAY TO ZERO
GHI
ZEIIO
JGET ZEI<O
Flil
Rf
;ZERO IIEG f.S
IZEI<O !lEG f,O
PLO
Rf
BR
>GEARS
;JUMP TO UPDATE DISPLAY ' EXIt
GLO
81
;'A 20
99
RC
JSRPC
1 1 1l ~tiiF'T COliNTEH
;SHI1T E,F ~EGIST~RS
;AUD~ OF' StllFT SU"ROUTINE
;&TU~F;
<SHk,>5HR
VALUE BACK I~ GERCTR
>GERCTRO
I~ET ADDUESS Of GERCTU.O
PLO
Ri>
;SE'f MEMORY POlNoER l'iJ G~RCTR.CI
GLD
Hf
;G~T LOW SITE: OF ADJUST!~ GEAR CJONT
STID
;STORE IN G~RCTR.O
Grti
Rr'
; G.ET illCH BtTl'; OF AO..iUSTt:O Gf:AR =JONT
SlH
~0
; STORE 111 GERC'fR .1
DEI~R~l~E wHETK£R TO PkEP~RE RET~IC GR E~CLI~H RESULT
GHl
MODE
1GF.:T CONTEGTS OF MODE kEG
ANI
METf
;TEST MI::TRJC fL.l.G (BIT J)
D~
PLACE
LOI
~OJUSTED
I-'
0
1.0
i:RR LINE
~DOR
81 82 Ill Bt
OIU
l2 40
ra or
50"/
0145
0147
:)Ja
0\U
5(J<J
014A
~04
505
~06
5 Ul
•Ha
!>11
S12
OHD
515
516
511
f8 ou
t.F
lO 51
'>20
521
52}
!if
0150
0152
f8 6)
Af
f8 00
O!H
0154
,
D4
015f.
fa 01
kC
521
01
~28
ul5il
0] 3£
OiSC
Ol5£
1.0
529
5)0
fQ
II
91
1l
!>)6
015F
ClbO
Olbt
Olt-2
5l7
OlD;
f'A Of
[>joj
C;lb:'>
0166
co
5>4
5)9
HO
S41
01\
I
OI~P.
SlS
PROCESSING
JSRPC
GEA~
IMULTIPLY ADJUSTED SPOKE COUNT•G~A~ COEFflClENT
<~PV,>,.;py
;AODR Of MPY SUBROUTINE
"PV RETU~NS DINAR¥ GEAR VALUE IN kEG f STILL LEfl SHIFT£~
IHGIIi SHIFT RESULT
I
•til
;Gr:r :;uxrr cou.n
LDl
PLO
RC
; STO~t: IN REG C
SEP
JSRi'C
1 SHUT
IADOH OF SlllfT SUBROUTINE
<SHR, >SIIR
Db
GEARS:
;BISARY GEAR RATIO nN REG f
CLEAR 2 IIYTE C.~AR COUNTER
I
LOI
>GERCrRO
!GEt ~[)DkESS OF C.F.RCTR.O
i'LO
llD
;SET ME~DRY POINTER (REG Dl TC GERCTR,O
Gill
ZERO
;Gt:T ZERO RF.G
ST:\D
;ZERO G~AR COUHTER
STXD
;ZEkO GE~R COUUTEH
GLO
fLAG
;GET CC~Tt:•TS Of FLAG REG
AIll
OOFH
!CLEAR GEAR COUWT~R OVERfLO~ FLA~ (SIT Sl
PLO
FLAG
rRESTORE FLAG REG
LIIR
ouu
rJUMP TU UPDATE DISPLlY A~D EXlT
I
END or 'GEAR' MODULE
SEP
02 91
vi 59
~]2
GEAR2;
METRIC fLAG DETECTED, COMPUTE IN METRIC UNITS
LOI
0011
!GET NETHlC GEAR COEfFICIENT (LEFT SHifTED 7 BIT
PHI
Rf
rSTORE IN REG f,l
LOI
6.lH
rGF:T BYTE 2
PLO
Rf
;STORE IH REG f,O
1
526
5)~
>Gi:AR2
JJUMf IF METRIC fLAG ON (ACTIVE LOw)
METRIC FLAG OFF, COMPUTE IN EHGLISH UWITS
LDI
OFH
rGET ENGLIS~ COf.ff HI ~YTE
;STO~E IN REG F,1
I'Hl
llf
OOH
rGET E~GLISH GEAR CO~f"FICIENT l~EFT SHifTED 7 8!
LDl
PLO
rSTOFE I~ REG f,O
RF
>GEAR)
IIR
JSRANCH TO COM~ON GEAR PROCESSlN.
6Z
ca:ARl:
COMMON
0!5)
~H
~l!
13
,
0140
014f
SH
5t5
P4:il:
;
518
519
,
r.;
51)
514
MICROTACH - VER, 27-0CT-Bl
I)
&1
~7
02 82
,
I-'
I-'
0
!:RR LINt:
AODR
;
1
SiS
SH
547
54&
54S
550
551
55~
016C
~NI
559
51;0
0!6E:
91
')iii
0! bf"
fjf'
St.~
0170
0171
10 t;2
AF'
I
56b
I
~71
0111
017l
0175
(11-lb
0118
CJH
017A
017f.l
re ~g
ra oo
~e:
i!f
97
oc
vJ7E
F'8
Ali
57o
ot7r
0~
579
CIAO
02 B9
0162
f"B QD
5~~
5tl1
s~l
vto4
AO
S64
0195
~7
ss•,
~~~&
o1&1
~I C!&
7l
H
~a~
ota:.
OJQU
59G
O!&C
LOI
PLO
LUI
PHI
PLO
017C
50~
RPM II
~r
577
!>87
Off"
fLAG Of"F
PROCEED WITH NORMAL RPH PROCESSING
r.ti I
Pill
576
sas
FLA~
OV~Rf'LOW
~E:
575
5&2
t"J.AG
tOH
>RPMI
I
St.S
572
513
514
REVOLUTI)~
IC£T CONTF:NTS or f'[.AG RI::G
:TEST RPM OVERFLOW FL~G (BIT 4)
ez
IBRANCH TO NO~MAL PROCESSING If
RP~ OVERFLO~ fLAG DETECTED
INDICATES COASTING
OUTPUT ZERO TO DISPLAY
IGET CONTENTS OF ZERO. IIE:O
r.HI
ZERO
; z~:ko REG f ,I
PHI
Rf"
i'LO
l<f"
;Z'"IlO REG r.o
;JU14P TO UPDATE DISPLAV ' EXU
llR
>RP•2
GLO
&1
H 10
12 1l
557
559
)10
HOiiUL£
;
1)!69
OHA
Sb8
"~PM"
HPMI ISTART Of RPM ROUTIHE
CO~PUTES CRANK REVOLUTIONS PER SECOND
USES COUNT or I KHZ CLOC~ TICS DURlNG ONE CRAijK
COUNT IS MAINTAINED IN 16 BIT ~P~CTR
5S4
555
569
STARt Of
', •••••••••••••••••••••••••••••••••••••••••••••••••••••• *••••••••••• $., •••••••
552
5:;)
567
14
, , ••••••••••••• f ••••••••••••••••••••••••• $ • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • ~.··
54]
5H
56)
5o4
PA:O£
MICROTACH • VER, 27•0CT·8l
Ill &2 Ell 84
87
f"A £f
u
co
02 82
09H
llE
60H
Rf
ZERO
1GET BYTE 0 OF' DIVIDEND
JSTORf: Ill ~E'G E.O
;GET P.Hi:: 2 Of O!VlDENil
;ST:";R~ IN ll£G f.1
;GET CO~T~NTS OF ZER~ REG
RE
;STI.llit: ZER::J
I~i
Rf"
;STOHf:
IN fiEG F' .0
12 BU DIVIDEND IS NOW SET IN
Z~ilO
R~G
Rf:G E.l
E,F
ADDRESS OF RPMCTH.I
PDHITER Til ~PKCTR.l
JS~PC
;DIVIDE OIVIDEND BY ~PM COOUT
sr.l'
<lJIV,>OIV
;ADO~
Of
OIV
SUbROUTINE
Ob
HPN2;
;BINAR~ HPM IN REG f
I
ZfRO 2 bYTE RPH COUNTER ~NO OVERFLOW FLAG
>RPHCTRO
;G~T AODH OF ~P~CTR,O
LPI
~0
;S~:1r Ht:i-tOI<r (>CIINTER (R<~G 0) TO RP~O::TR.O
PI.O
ZERO
;f.E'II' ZERO H~G
CIH
STXD
IZ~RO RPMCTH.O & DEC POINTER
s·,·xo
;ZERO RP~CTR,I ' DEC POI~rt:R
IGIT CO~TENfS OF FLAG ~~~
CLO
HAG
Alji
JCI·EAR RPM COU~ITr:R OVERfL:Hot F'I.AG (BIT 4)
OEf"H
PI,O
;RESTO~£ FL~G REG
FL~G
;JUHP TO· Ui'DATt: DISPL!.Y A:ID t::XIT
LllR
OUT4
LDl
PLO
>RPMCTRI
;G~T
Rll
JSET ~EMOf!Y
~91
5'i2
END OF "RPM" MODULE
I-'
I-'
I-'
ERk LINE
ADDR
594
1
597
:
598
5'i9
6GO
DlSTI
6G7
509
oO!I
61()
611
;START Or DISTANCE ROUTINE
TOTAL DISTANCE TRAVELED IN MlLES DR KILOMETERS
USKS COUNT or SPOKES DETECTED SINCE RESET
COUNt IS STORED IN DISCTR
CO~PUT£S
018F
01'11
ull2
019l
fiiH
AD
1~
~£
7~
A£
72
o1n
'0198
8f'
72
01~9
b11)
Cd9A
hF
f8 .:10
617
OHC
~.
61~
1)1~0
619
[)
0191:
04
0) 24
6:tu
ut~o
r&
6<1
622
t2l
v1A2
~0
OIA3
01 H
99
F4
ou
tH
OIA&
)2
ilO
626
627
01A8
CIU
ra a1
628
OlAf!
ftlAD
50
OIAE
Jc
OlllO
0182
0 !iH
fa
6<~
PUT DISTANCE COUNT IN REG F.,r
;GET ADDRESS or DISCTR,l
LUI
>DISCTRl
;SET MC~ORY POI~TER T~ DISCTS.l
PLO
RD
;GET
BYTE l Of' OIStANC~ CJUNT
LDXA
:STORE IN R£G E,l
f'Hl
RE
I,OXA
JGET B~TE 2 or DISTANCE COUNt ' ADVANCE POlSTER
7STOR~ IN REG £,0
RE
PI.O
;GET BYTE 1 or DIST COUNT £ ADVA~CE POINTER
LOU
;STORE IN REG r.t
Rf
Pili
;GET BYTE 0 or DIST COU~T ' lDVAUCE POINTER
LDXA
Pf.O
Rt'
;STORE IN ~~G r.o
>!;SHIFT
;Gf.T ADO~ESS OF OIST SHifT COUNTER
LDI
;STOHE IN "EMJRY P~INTEH
.
RO
?LO
;FLOAT L~i'T TO ~SB
SEP
JSRPC
;APDHESS or LEFT SHirr SUBROUTINE
Ill;
<SHI.,>SHL
;GET ADDRESS or ARG2,0
>ARG20
LDI
JS£T "~~DRY POinTER TO ARG2,0
RD
PI.O
;G£T CONTENTS OF HOD! REG
HODE
GliJ
;TEST METRIC fLAG
Mr:TF
ANI
;JUHP !f METRIC FLAG ON (ACTIVE L~~l
liZ
>DISTI
~ETRIC fLAG Off, COMPU7E IN ENGLISH UNITS
;GET UYT~ D DF ENGLISH ~1ST CO£fFI~JENT
otH
LOI
zsrn~£ 1~ AHG2.C & 0£CR~MENT PQl~fER
ST~ll
OAH
JGf.T BYTE 1 Of ENGLISH OIST COlFfiCiiNT
LDI
;STORE IN AMG2,1
RD
STR
;JUMP TU COM~OU OIST~NCE PROCESSl~~
ilR
>DlST2
Fa 12
611
614
615
o2'i
00
START Of 'DIST' MODULE
:•••···································¥····~·······*········$··············~
I
019~
Cl'i~
61~
~l
H
t·~
QA
Bb
t.ll
~.n
6ll
t.H
idS
tn
ota~
OIST1:
8'1
7l
fQ Oo
50
1;37
Lf•I
~~ETRIC
87H
STXO
Llll
STII
I
06H
RO
FLAG
OETECT~O, CDHPUTE IN ~ETRIC UNITS
;GEt OYT~ 0 Of ~f.TklC DISI CO~f'f'I:IENT
;STO~E
ARG2,G & ~ECRE~E•T PUl~fER
IN
;GET BYTE 1 or METRIC OISf COE,fJ:IiNT
;SIO~E IN AHG2.1
;COMMON DlSTAHCE PROCESSING
JSHPC
;OIVIOE E,r Bl A~G2
;ADDR OF DIV SU~NOUTI~E
<DlV,>OH
P.F.G f' " BINARY DISTANCJ:; • 2
7GET ADOkESS Of ARG2,0
>ARG20
Llll
F;O
zSSEf MEMOHY POINTER TO ARG2,0
PLO
;GET 3YTE 0 or RESULt
GLO
Rf
STXD
;STDR~ IN ARG2,0 ' DICRE~EUT PDI~f~R
1GET U~TE I Of RESULT
Gill
Rf
DIST2:
OJ~
ol9
&196
04
6i0
0187
v2 B9
6n
ota9
fH
64-i
tH
O!Si!
f6 0]
AD
6U
f·46
IS
:••··········································································
595
596
601
602
60)
604
605
606
PA;;£
HICROTACH • VER, 27•0CT•83
81 82 Sl 04
Ol~C
Sf'
01:!0
OliH:
1l
9r
SEll
[18
.....
......
N
ERR LINE
647
648
649
651)
6~1
652
65l
AOo)R
Olflr
OICO
OIC1
OIC2
OICJ
OIC4
OIC!>
Bl 82 Bl 84
65Y
Ar
97
Bf'
Dt
02 91
I
OIC7
OIC8
01CA
I
9~
n
40
C2 02 68
659
o6o
61.'1
ra oo
0~~
OICD
O!Cf
OIDO
0 1tl I
6(;.()
IJI:>}
AC
667
668
669
670
0104
C!1D5
Ot
0107
CCI 02 82
6c2
66)
1,64
671
&72
STii
CLO
PLO
CIII
PHI
SEP
DR
50
09
654
655
656
657
MICROTACH • VER. 27•0CT•B3
I
I
I
A~
72
FC G5
~
3 31::
I
'
J
Pk:OE
u
;:STURE IN ARG2.1
1CET CONTENTS OF ADJUST REG
!STORE IN ·REG F,O
!GET CONTENTS OF ZERO REG
;STORE ZERO IN REG 1".1
:MULTIPLY BINARY DIST BY DIST ADJUSTMENT
<14P~,>MPY
I ADDR OF NPY SIIBIIOUTlNI::
~EG ~.r : AOJUSfED fiiNARr DISTANCE • 256
DECIDE WHETHER TO RETURN TO AVE
:GET CONTENTS Of MODE REG
GHI
MODE
ANI
AVEl"
ITEST AV£HAG£ SPf.ED fLAG (BIT 6)
AH]
;JUHP lF kOO£ : AVE
LIIZ
END Of' CODE SHARED WITH AVERAGE SPEED ROUTlNF.
CONTINUE DIST PROCESSING
SHIFT E,F RIGHT TO CORRECT
:SHlf'T COUNT SAVE RE~ISTER
LOI
>DSHir:t
;STORE 1~ ME~ POJNT~R
PLO
1<0
;GET SIUfl COlltiT
LDXA
JAOO STAHDA~D SHIFT VALUE
ADI
05H
;STORE IN SHIFT COU~IER
PLO
riC
!SHirT REG E,f
sr.P
JSRPC
DB
IADDR Of' SHifT SUBROUTINC
<SHR,>SHR
BINARY OIST IN REG F
IJUMP TO UPDATE DISPLAY AHO EXIT
OUT4
LB"
I!D
ADJUST
Rr
ZERO
Rf'
JStlPC
END Of 'DIST' MODULE
......
......
w
ERR Llll£
ADDR
MJCROTACH • VE:R. 21•0CT•8l
Ill 82 8l 8'
675
676
61i
6H
I
67'1
;
6&0
681
662
TJM£1
I
;
oal
684
68~
608
OIDA
OIDC
OlilD
6~9
010£
690
691
692
69)
OIOF
OlEO
OlE!
694
b95
696
6'H
6•)8
o99
1va
AD
72
tiE
72
AE
72
BF
OIE4
AF'
o lr:s
i'8 Ol
AD
fil 10
7l
f8 0£
OIE7
(;I E8
OI~A
70l
704
705
OI~F
702
ra oa
01£2
(dEl
(;lEa
OlEO
OIEE
701
70&
0 11'1
101
708
709
Olf2
Olf4
72
50
Dl
1,2 ll9
99
n 20
C2 02 15
710
711
112
17
,............................. ~··············································
START Of 'TIHE' MODULE
,,.....................................••....................•................
674
666
687
PA:::E
Olf7
Olf9
71)
otn
1'8 04
~0
f8 02
'114
I;!F'C
~8
715
716
') l F'D
97
o:rr. lia
717
0! F"f
u4
71il
~2JO
0 l Sl
11~
720
721
722
0 202
Ol04
c.~r.s
AC
(1,
72)
0206
03 lE
72~
0203
726
020A
f'9 Ol
AD
i'8 10
1H
JSTART Of TI~E ROUTINE
COMPUTES ELAPS~O TIME SINCE RESET
DISPLAYS RESULT AS 4 DIGITS HR:MJN OR MIN:SEC
USES TJMCTR TO COUNT TJCKS Of 1 HZ CLOCK
PUT TJME·COUNt (SECONDS) IN REG E,f
JGET ADDRESS Of TIMCTR.l
LDI
>TINCTRl
;SET MEHURY ~OIUTER TO TI~CTR,l
PI.O
RD
LDXA
;GET CONTENTS Or TIMCTH,) ' AUVANC~ PJINT~n
;STORE i~ ~EG E.1
PHI
RE
JGET CONTE~TS OF TIMCTR 0 2 ' ADVA~CE POINTER
LDXA
;STOkE IN REG E,O
RE
PLO
;GET COUTENfS Of TIHCTR,! ' AOWA~CE POINTER
LDXA
;STORE IN REG f.1
PHI
Rf
LOXA
JGET CONIENfS Of TI~CTR,O ' ADVANCE POINTER
;STORE lN REG f,O
Rf
PJ.O
HR)
IN ARGUHE~T 2
PUT 3600. (SECONDS PER
. Lf•I
;G~T A00kf.5S Of AKG2,0
>AHG20
PI,O
JSf.T HEMOHY POlNT£R IJ ARG2,0
RD
;G~T bYT~ 0 Of ARGUME~r
LDI
10H
STXll
JSTORE IN ARG2,0 t U~C POINTER
;GEl
bYTE 1 Of ARGUH~NT
LI.II
OEH
;STORE.IN ARG2,1
STR
1<0
SEP
;DIVIDE SECONDS 81 3iOD TO GET
JSRPC
JHR5 IN RlG f ' REMAI~DER JN REG E
;ADDR Of DIY SUB~OUTI~~
DB
<DIV,>OIV
GHI
MODE
1G~T CONTENTS OF ~ODE R~G
;TEST HJN:SEC fLAG (~CTIVE LOW)
JNl
20H
;JUMP IF MJDE : HI~:SEC
l.B~
TIME!
~Oil[ a HP:MIN
STORE HOUkS IN OUTBUF,2,3
LPI
>OUTOUFl
;GET ADDRESS OF OUTRUF,l
PI.CI
liD
JSt::T "E~OllY POINTER Til OUTBUF',l
LUI
~H
;GI::T DIGIT COU.H
1-LO
kB
;STORE IN REG 11.0
GHI
ZERO
;G~T CONTENTS ~F ZERO ~EG
Plil
kll
;STORE Zf.R<l HI R<:G !1,1
S~P
JSPPC
;CON~ERf HkS TO DECIMAL & STOR~ IN JUTb~F 2,3
DR
<ChD,>C8D
JADDH OF CfiD SU~ROUTINE
PUT AEKAINOER Of FIRST DIVJSJON IN REG F
!.r>I
160
;GET SIIIF't COUNT
PLO
kC
;Sl'Ok~~ Ill SHIFT COUNTt:R
SEP
JSf<PC
;SHlf'f RJ::G E,f'
DD
<SHR,>SHR
;AOOR OF S~JFT SUBHOUTJNE
STGRE bO. CSECO~DS PER HINUT£) IN ARG2
LDI
>ARG20
;GET AOOHESS OP ARG~.o
PI.O
RO
;SET MEliOR¥ POINTER TO ARG2,0
........
~
ERii t.INE
121
l:lij
129
Hu
7H
13l
AOOR
02011
0200
r•20E
020F
0210
0211
Bl Bl 81 84
fi lC
l3
97
50
D4
02 b9
02ll
,
lO lS
7H
1H
lH
73~
139
140
H1
142
T~HOW
n1s ra
to
AC
iH
Ol li:
143
H9
0213
021D
r•21i:
'V220
0221
02<2
75(J
02<!)
04
i51
752
753
754
Q224
02 119
0226
'•223
ra
los
u2H
v22h
022C
C22D
744
H5
146
H7
HA
7~6
757
75&
759
H.•)
nt
762
H>
775
04
A<I
f~
1)2
1>8
[J4
03 St
0 3 l£
~:ns
n'i
~0
'•2ll
vdS
r.2l7
02)9
v2lA
r12la
iJ~ >C
02)£
OHf
CiHl
170
"Ill
1i ~
113
774
97
f8 10
AC
765
766
76;j
n 1c
1)
022F
0211
0232
10~
101
•• 01
AD
[l~
re ot.
~0
~
8 02
~0
04
Ol 51
04
Ol 7f
co 00
)I
18
60D
~ MINISEC
HOURS fROM FIRST DIVISION
PUT REMAINDER INTO DIVlOF.UO (REG E)
LOI
1bD
tGET SHifT COUNT OF 1 WORD
i'LO
RC
I STOHE • IN SHifT COUNTER
SEP
JSRPC
!SHifT REG E F
UB
<SHR,>SHR
;ADDR OF SHitT SUBMOUflNE
PUT 60. (SEC PE~ MINUTE) lN A~G2
J,IJJ
>ARG20
;GET ADDRE:SS OF ARG2.0
PLO
liD
ISii:T Xt:MORY POINTFR TO ARG2.0
LIJl
bOO
1 GI::T l\YTii: 0 Of Af!G2
STXO
JStORE IH ARG2.0 ' DEC POINTER
GHl
ZERO
JGET CONTENTS OF ZERO REG
STR
~D
1 STOllE ZERO IN ARG2 .1
SEP
JSRPC
;DIVIDE TO GET MINUTES lN f, SEC 1~ E
oa
<PIV,>OIV
JADDR Of DlV SUBROUTINE
STORE RESULT I~ OUT8UF
;GET AODRf.SS OF OUTijUF.l
LDl
>OIITOUFl
PLO
RO
JSET MEHORI POlNTEH TO OUTBUF.l
JGEr DIGIT COIJ~T OF 2
t.Ol
02H
PLO
~tl
;5TO~E IN REG R,O
IFILL OIJTijUF 2,1 WITH MINUTE COUNT
SEP
JSRPC
;ADOi OF CBO SHBROUTINE
DB
<CBD,>CBD
C~NVERT Rli:MAlUO~R TO GET SECONDS
LiH
H.O
;GET SHIFT COU~T
PLO
RC
1STORE IN SHIFT COUNTgR
.SFP
JSRPC
JS~IIFT RlGS ~,F
OH
<SHR,>SHR
JAUDR OF SHifT SUBRO~Tl~E
TlME2:
>OUTSUrt
;GET ADD~~SS Of OUTSUf.l
LL•l
(•J,O
7SEI ~EMORY POINTE~ TO OUT8Uf.l
kD
LDI
:>2H
JGKT OlGIT COUNT OF 2
f'LO
;STORE IN kEG B.O
RB
Si:P
JSRPC
;FILL OUTBUF 0,1 WIT~ SECONDS CDa~r
DB
<Cbt>,>CBD
JADDH Of CaD SUBROUTINE
SEP
JSRPC
;UPDATE DISPLAY FROM OIJTBUf
DB
<IJPD,>UPD
;AODR OF UPD SUB~DUTI~C
SCAN
LllR
JR~TURN TO SCA~ PROGRA~
TI~Etl
0217
Ci21B
0219
PAGE
;GET lH'TE 0 Of ARG2
;STORE IN ARG2.0 ' DEC POINTER
Zi:RO
n:t:T COtlTENTS Of ZERO REG
Gltl
RD
I s'TORE Ill ARG2. 1
STR
JSRPC
JDIVIDE REMAINDER BY 60
St:P
<OIV,>DIV
JAOOR Of DIV SUbROUTINE
DB
&TORE MINUTES IN OUTBUf.O,t
;JU~P TO COMMO~ PROCESSING
>TlHE2
iiR
LDI
suo
733
lH
MJCROTACH • VEH. 27•0CT•8l
;~COf.
AW~Y
END OF 'TIME' "DOULE
1-'
1-'
Vl
ERR LitlE
ADOR
J
J
START OF •AvE• MODULE
,,.....................................................•......................
ROUTINE
AVE
' I ;AVERAGE SPEED
AVERAGE
TEAVELED SINCE RESET
DISTANCE AND TOIAL TIME
'' OIST TOTAL COUNT
STORED IN OISCTR
,' GETS
TJKE COUNT STORED IN TIMCTR
BY EXECUTING A PORTION Of DJST ROUTINE
,' SHIFT DISTANCE
COUNTERS FUH DIST
TIME USED TO JHPRUVE ACCUHACY
PUT TlME COUNT lN REG &,F
'' LOI
>TlHCTR3
;GET ADDRESS OF TIMCTR,l
PLO
RD
JSET ME14011Y POINTt:R TO TIHCTR.3
180
7Sl
782
781
7H
COMPUT~S
US~S
SPO~E
7&5
186
181
7&8
0244
GH6
OH7
IJ2U
vH9
02U
v24a
f8 08
AD
72
LOXA
PHI
LOlA
PLO
BE
72
AE
12
1H
&24C
bF
800
But
0240
72
024E
AF
603
;;r,4
OHF
P2Sl
&OS
~252
Dt
a~G
c2s1
0) 24
0255
FB 01
AO
f8 E1
a•n
ra o1
A()
ar,1
&08
8Q9
810
lill
i12
Rll
02~1
02~i
02H
73
02~8
o<so
ra oo
81~
~15
025!:
&16
02~f
50
04
02 il9
~11
o2c1
ra or
8211
0201
0264
AD
ilf
&21
02os
13
822
Olb~
9F
BIB
819
au
ul67
13
s2s
v2&s
co ot
0268
0260
026E
fil OE
&H
82i'>
627
828
8l9
SP~ED
AND
7&9
79&
191
na
19
~············································································
111
718
119
192
79)
794
795
79&
797
PA:;i:
MICROTACH • VER, 27•0CT•83
Bl B2 83 84
AD
04
a~·
J GET CONTE:~TS OF T IIICTR, 3
;SNRE IN REG &,1
1GET CONTENTS OF TIMCTR.2
RE
;STOHl'.: IN Rf:G E,O
L~XA
1GET CONTEITS OF TI~CTR,l
Ptll
Rf
J STORI:: ltl Rt:G F ,1
LPXA
!GET t:DtiTE:tiTS OF TlliCTR,O
PLO
RF
!STORE IN Rr:G ~·.o
SHIFT E1 F LEFT TO IMPROVI:: COM~UTATlONAL ACCU~ACY
LDI
>ASHIFT
1GET APDR~SS OF AVE SHIFT COUNTER
Pl.O
RO
!STOllE IN I<E:IIOitY POINTI::R
Sf.P
JSRPC
!SHIFT LEFT
OS
<SHL,>SHL
:~DOHESS or SHL SU"ROUTIUE
~~~IDE TIME COUNT BY 3600. (SECONDS PE~ HOUR)
HOURS (SHIFTED LEFT H SIT:S FOR t<CCIJRACO 0630, ;: OEIOill
LD1
>AHG20
!GET ADOHI::SS OF AHG2.0
p(,Q
RO
1 SET ME~ORY NIIiTf:R TO ARG2 ,0
LDl
OE1H
JGET BYTI: 0 OF OIVISON
STXO
;STORE IN ARG2,0 AHO DECREMENT Pll~TER
LDI
OOH
IGE:T I!YTE 1 OF DIVISOR
STR
RP
I STOHl:: I~ AllG2 ,l
SEP
JSRPC
JREG f,E = SHIFTeD HOURS, R~HAIHDER
DB
<OIV,)DlV
;AODH ~f OlV Sul!kOUTlNE
SAVE SHifTED HJURS IN TEMP
LDl
>TEMPO
!GET ADDRESS OF TEMP,O
PLO
P.D
JSI-:'r MUIORY POIIITER T:l T;:l4P,O
GLO
Rf'
1 GET I< I:<; F, 0
STXD
;S~ORf. Ill TE~P,O ' OECRE~ENT POI~TER
Gtll
RF
1 GE·r REG F ,1
SUD
I STORE IS Tt::«P .1
USE PART Of ~IST ROUTINE TU CCH~UT~ DISTANCE TRAVELED SO FAR
L~R
OIST
;kKTURN DIST IH E,F (LEFr S~lf'TE~ l SITS)
AVi:ll
;DIVIDe DIST BY TI~E TO GIT AVERAGE SPE£0
LOI
>TE:MP1
!GET APDRESS Or TE~P.1
PLO
RD
1 SET MEMORY POINTER TO TE'iP,l
SEP
JSRPC
JREG F a AVERAGE SPEED LEFT SHifTED N BITS
RE
f-'
f-'
0\
EiiR LiN£
8)0
831
832
&H
814
815
816
ADDR
bl 82 8l B4
026F'
02 1:19
027l
97
0272
Bf.
027)
A£
fS 00
AD
72
'
831
0274
0276
0217
838
0278
rc
SH
840
027.1.
r7
0278
AC
04
Ol 3£
co 02 62
au
842
au
au
845
846
027C
027D
G27F
MlCROTACH • VER, 27•0CT•8l
01
,
I
PAOE
20
DB
<DJV,>DIV
;ADDR OF' DlV SUBROUTINE
CLEAR REMAINDER AND SKIF'T RESULT TO RECOVER
CHI
ZERO
;GF.:T ZERO
PHI
R£
;CLEAR REG E,l
PLO
R£
;CLEAR I<EG £,0
LDI
>DSHIF'T
;AODR OF SAVED SHIFT COUNT
Pt. a
RD
;SET MEMORV POINTER TO DSHirT
LOU
;GET DSHlFT VALUE
APl
OlH
;BUMP Bt STANDARD SHifT AMOUNT
Slol
;SUBTRACT ASKIF'T VALUE
RC
PLO
;STORE IN SHIFT COU~TER
SEP
JSRPC
;SHIFT REG E,F
<SHR,>SHR
DB
IADDR OF SHIFT SUBROUTINE
LBR
0Ut4
;JUMP TO COHNON EXIT POINT
END Of 'AVE' NODULE
~
~
-...!
ERR i..JN£
ADOR
Bl B2
8)
au
an
B4
MICROTACH • VER. 27•0CT•8)
Pl::E
21
,......•....................................................................
~
J
.,...............................• ,,,,,,,,....................................
J
850
851
&52
851
85'
8S5
J
OUf41
8~6
857
&59
as-.
&60
961
START OF 'OUT4' MODULE
JCONV~RT KEG F TO DECIMAL AND UPDATE 4 DIGIT DlSPLlK
ASSUMPTIONS OM ENTRY:
HIHA~Y ~N~~SER IN REG F
~E::lULTS AT £XU
REG F CO~VERT~O TO DCD
fOUR BCD DIGITS STilR£0 IN OUTRUF
LCD DISPLAY IS UPDATED fROM OUTBUF
JUMPS TO SCAN ON EXIT
852
aH
0282
fQ
ij65
on~
AB
CONVERT
LDI
PLO
LDI
Sb6
0205
0201
il2 ij;
0289
t"Q 04
Ai)
D4
610
S11
02811
04
il7;!
028C
Dl 1r
SIHARY KPH OR KPH IN REG F TO DECIMAL
!GET DIGI~ COUNT :4
Rll
!STORE IN REG B.O
JGET ADDRESS or OUTBUF,l
>OUTBUFl
PLO
RD
;SET MEMORY POINTER TO DUTBUf.l
;CONVERT BINARY ~EG F TO DECIMA~
SF.P
JSRPC
;AODR OF CBD SUBROUTINE
OR
<CSD,>CBD
UPDATE DISPLAY
!UPDATE DISPLAY FROM OUTBUF
SEP
JSRPC
JAODR OF UPD SUBROUTikE
DB
<UPD,>UPD
028!
co
RETURN CONTROL TO SCAN ROUTINE
LBR
SCAli
lkETURN TO MAIN SCAN PROGRAM
661
&61
8b8
~~"
04
Ol 51
,
04H
81)
~14
875
676
811
00 l1
END OF 'OUT4' MODULE
1-'
1-'
00
ERR LINE
ADDR
NIC~OTACH
81 112 8) 84
bat
:
;••••············,····································$···········~~·······~·
I
Ea2
8o4
·a~s
I
9H>
I
997
MPY: ;START OF IIULTIP~Y SUBROUTINE
ASSUMPTIONS ON ENfRYI
MU~TIPLIE~ IN REG F (ARG1)
~EMORY POINTER (~~G 0) POINTS TO ST~Rr Cf 2 SYTE MULTIPLICAND
kESULfS AT E~IT:
REG E,F CONTAIN 32 BIT RESULT (E,f: BVTES 3,2,1,0)
a:.o
~91
an
693
oH
St:T FOR t6 81T MULTIPLICAND
0291
02?3
0294
i!H
899
o;.oo
Qn5
~ljl
t)
i.9b
0297
f8 10
AC
91
ac
:..c:
Bt:
~(i4
0298
2C
9f·
H
90~
0299
9u5
u29A
~JJ
OHB
8Ji"
~29C
Sf
909
0211)
H
~10
CHr:
911
<i-12
o~9r
:"r
~13
J& A9
02l1
02:.2
10
H
9te
o;.Al
'J2H
917
(•21.5
20
'Je;
H
il£
91&
02A~
~
•;2:..1
920
~2A9
9!
eo:
u:
921
9~2
C2A9
n1
o2a
9;::
76
92>
02A8
(I~
~2~
02AC
92ti
02AD
H
16
'it27
02A£;
;G~T Bif COUNT : 16.
;STORE I~ REG C.O
;GET CONTEHlS Of ZERO ~~G
;STORE ZEHO JN PKC C.1
PLO
I<E
;StUH~ Z~HC IN kEG £.0
PHI.
RE
:EIOhE Z~~1 IN R~G E.l
SHifT NEXT biT Of MULTIPLit:R f<JGIIT INTO CARR1
MPL: ot:c
RC
IDECR~~ENf UJT COUNrE~
CHi
iif
IGI~l' U£G f.l
!:iiR
ISIIIfT RIGHT t ~lT
Plil
;~KSTORE ~EG f.l
llF
GJ,O
1Gt::T f.F.:C; f .0
F<f
SlikC
;SiitFI RIGHT WITH CARRY
PLO
Hf
II<E::;TOHf: HEG F • 0
Bllf
>MPS
;~RA~CH IF NO CANRY
Cl.~llr DETt:CTED ADD ARG2 TO R~SULT
RD
.
lUC
;JNCH~~eNT ~E"DRY POINTER
MPAI GLO
RE
!Gin' ~EG E.O
AOO
IADO PEG E TO ARG2
i'LO
F<<:STO~E: 11n; e:.o
RE
o~:c
RD
ID~CRf:~E~T K~~OUY PDI~IER TO ARG2.1
cax
I<E
;GET CD~f~~TS OF RKG E.l
we
;ADD AF<G 2.1 TO REG E.l ~ITH CARRY
?HI
;R~5TOHK REG £.1
I<E
I
SHifT ARGl RIGHT ONE BIT
IIPSI GHI
RE
;GET kEG [.1
SHRC
1SHifT RIGHT WITH CARRY
Pili
RE
;RESTDF<E REG E.l
GLO
RE
1CET CONTENrS Of R~G t:.o
SHRC
;5HifT RIGHT ~ITH CARRY
PLO
RE
IRESTO~E P.EG E.O
&N!'"
>141'
IJUH~ iF ~0 CARRY
CHI
Rf
;GeT CUNt~SiS Of REG F.l
I< CARRY ON SET HSB ' SHIFT INTO ~~SULT
Ohl
BOH
;SET HS3
LDJ
tOil
PLU
RC
ZERO
RC
Gill
Pili
901
9H
~ODULE
I
ai9
!II~
START OF •Mpy•
~······································~·····································
aaa
goa
22
I
ao
902
PA:l£
I~·······································$······~·····························
>> UTILITV SUBROUTINES <<
879
880
·~::.
o96
097
• VER. 27•0CT•8l
A£
92a
u2~.r
3a 85
929
930
02&1
:.;
9)1
0282
··~
80
1-'
1-'
\0
EI<R LINE
ADDR
81 82 8] 84
9)2
93]
9H
02114
Bf'
02115
8C
935
Ol66
0238
H 98
05
931.
foll
93&
PAt:!:.
MICROTACH • VER. 27•0CT•8l
'
,
'
MTI
PHI
RF
:RESTORE REG F.l
GLO
RC
>MPL
RTSPC
JGET BIT COUNTER
JLOOP UNTIL ALL 16 BlTS PROCESSED
JRETURM FROM SUBROUTIUE
BNZ
SEI'
23
END OF •MPY' MODULE
1-'
N
0
ER!< LlNE
ADDR
PA~I!:
MlCROTACH • VEil. 27•DCT•83
oH 1!2 Ill 84
24
942
,,,........................... ~·········~·················f····················
11~3
I
941)
9U
START OF •orv•
~ODUL£
944
H5
,I •••••••••••••••• *''''''''''"''''''''''''''''*'''''···················~····~·
~46
DlVl ;START OF
9-17
I
,,
,,
94o
949
950
I
951
952
953
I
~54
SUBROUTINE
ON ENTRY&
DIVIDEND lU REG E,F (AIIG1)
ME~ORY POINT~R (REG 0) POINTS TO 2 BYTE DIVISOR
R~SULlS AT EXIT:
~UOTIENT IN REG F
~f.MAIHDER IN REG E
~~G C,D COFRUPT£0
RE1URNS ZEkO (E,r) IF' DIVISOR IS NOLL
DIVISIO~
ASSU~PTlONS
9SS
95~
957
02B9
':158
02t:A
72
H C7
959
HO
02'>C
(IQ
'0280
H
02flf
v2CO
02Cl
'.11
IIF
~66
02C2
02Cl
9~1
02C4
AF
CO oH 23
li2·:7
20
'111
o2ca
ra
~72
1'20
C7
~61
%2
9~3
964
9~5
9oe
Sf>;l
97f)
l>t:
lE
:.c
90
CHECK fOR NULL DIVISOR
LDXA
BNZ
>01
LDN
RO
!INZ.
>01
ZEPO DlVISOK DETECTED •
GHl
ZERO
PP.J
RE
Pt.O
RE
PHI
Rf
rGET HIGH BYTE OF DIVISOR
;JUMP IF NOil•ZERO
JGf.T LO~ f>YfJ::
JJU~P lF NDN•ZEi!O
CLEAR RESULl AHO EXIT
;GET 7.EIIOS
;CLEAR REG E.1
;CLHR RI::G E.O
ICloEAR Rt:G f.l
PLO
F.r
JCLEAR REG F.O
L~R
DVN
JJU.'IP TO EXIT
011 ;DIVISOR 0~ • RESTORE POINTER
DEC
kD
IRI:5ET POINTER TO START OF' PlVlS:lR
~OW SET TO WORK DIVlClNG
LDl
90H
;Sf.f l rERA:i"lr!tl COUtiT
Pt.O
RC
;STilHI:: COUNT Hl REG C.O
DVL; GLO
RF
;G<:T DlVIO~NO B'lTC: 0
SHL
;SijlfT LEfT
Pl.O
Rf
IRr:s·;oRE BYTe:
Gill
Rf
;lii::T ~Ht: l
SHLC
;IHlFT WIT~ CARRY
973
9H
o<en
SF'
~2CC
975
C1CO
FE
Af
'J7b
971
C2Cf
7f.
~1&
CJ2QO
!lf
1'1'1
RF
;
"17~
(J~f)\
&£
Rt:
~;,c
~2n2
~&1
98~
G20l
1£
At:
<jg
7E
GI,O
SHLC
[•l,O
NE
;GET 1>HE 2
;Snlfl' WITH
I RJ::Pt.o\Ct:
Gill
R£
;G£T uYT£ l
SHLC
ac
Pill
GLO
o~cc:
02£H
903
H4
985
ogs
~eo
02~ij
9e7
o2o9
'ioa
02ur.
0207
o2oA
989
v2i>B
990
0200
9F
or:
fE
10
tiE
Ja tc4
SHL
INC
GLO
flllf
n
SK
~t:Pl.t.CE
;SHifT
l!E
RC
RO
RE
>OSI.
~lTH
CA~R'l
CARRY
I REPLAn;
I GET Hi:RUlOII COUNTt:R
;SHifT
;POINT TO t.RG2.0
;GET RE:G t:,O
;JU~P IF N:J Ct.I!RY
;J::LSE &U~THaCT
~H
02Ct;
~E
PLO
kE
;R~PLACt~
S~2
020f
20
DEC
RD
I PO lilT tO lll::XT OIGlT OF AIIG2
~~~~G
E.O
1-'
N
1-'
ERR LINE
99)
994
995
996
991
999
AODR
02EO
02£1
01£2
77
lO E\1
02i':4
t'4
02£5
A£
2D
02£6
(i2E1
o2.:a
9E
100)
1004
02£9
on A
Bf
2C
n
OSA: ADD
PLO
IJEC
GHI
ADC
14
1002
ac
I
tu05
1006
021:8
02EC
!C01
02i::E:
1009
c:tro
IF
IOG9
1 ·~I 0
lOll
02f1
02Pl
F'9 tiO
02f1
02f6
02f9
62fC
7F
jan
IUC
RF
!F'INAL DIVIDE STEP•4DJ~ST
!GET CORRECT ADJUSTKENT POLARITr
RD
RF.
>DVM
lAUD DIVISOR B•CK ON
ITO CORkECJ fO~ fiNAL SUBTRACT
;JUIIP IF CARRY
I EI.SF.: ADD
;R~PLACE REG £.0
Jll£CR~HENT DIGIT POINTEH
;GET IIEG E.l
;ADD WITH CARilY
:;2fr
H:
:) )fhJ
1D
I
DVC:
~E
1.102
13
f4
102J
(';~j5
I r,24
~1C6
A£
2D
1025
o1n1
9£
0)08
74
I J:l7
1 r. 2 ;,
OJC>
)0 10
1 C,l'i
0)08
QJOC
F7
o i:io
2rl
9!:
17
10~2
lu45
I OH.
SHL
HC
GLO
BDF'
,\DD
PLO
DEC
GHI
ADC
BR
oa
'
ISHlF'T
RE
RD
RE
>DVR•t
JJU~P
RE
RD
k£
1 SUB'tRACT
;REPLACE REG £.0
!POINT TO NEXT DIGIT
;Ga::T l<lG E.l
;
(• J(•£
030F'
(j)IQ
DVM: SH
PLO
llt:C
GHI
A£
;SIIBTR~Cr
Sl~b
PHI
~E:
IOl~
I Q.j)
IOH
DVR
XOii
•d~l
lOF;
I 0>9
104()
t:l41
8011
IIC
lf'H
In I 8
loiS
!(; 20
1021
1•122
1036
I 031
INC
ORI
f'LO
;RESTORE REG E.l
JPECRF.MENT ITERATION COUNTER
IGET h~~ lTE"ATION COU~TER
lAND BI~Ar.Y 01111111 TO CLEAR MSB
IJU~P IF ~0 CARRY
I ll!iMP DUOTIEN'r
JF'LAG NEXT OPERATION AS SUBTRACT
;OTKEHWISE SET F'OR ADD
;CHECK COU~TER
ILOO~ U~TIL ZERO
;AT END CHECK REMAINDER ADJUST
llVL
IF
F'3
IOH
Btlr
RE
RC
RC
7FH
>S+5
RF'
:ADDITION ROUTINE
:RgPLACE REG E.O
JPOI~T TO NEXT BYTE OF ARG2
1GET REG E.l
; ADD WITH CARIU
LIINZ
LlliJF'
SKP
O:if'll
0104
OSM; PHI
DEC
GLO
ANl
R£
I<D
RE
Arll
o;~rr.
1012
25
1GET REG E.l
JSIJ8TIIACT
1JUMP TO COMMON PROCESSING
C4 02 CB
Cl Ol 11
)9
1)!1
lOll
>OSN
AC
t'A lF
1015
1\ll b
10)0
l u 11
RE
p~:;E
I
999
ton
GHI
SMB
BR
9i:
tO(;Q
1001
1012
lull
1014
MICRDTACH • VERo 27•0CT•83
81 ill Ill 84
fiE
I ilt:PL,\CE
PE
>H5
;GEr ~EG E.l
;JU"P Jf UOT ZERO
;Gt.:T PF;G F..O
;JU~P IF Zi:l\0
IGET ITER4TION COUNIER
;SHif'T
I
0311
9f.
l!VRI Gtll
iltiZ
f•ll<
H 17
WJi4
Oi15
~~
liJI7
8C
GLO
El?..
GLO
l22l
Rr:
>DVN
RC
0)18
0119
n:
r;:;
SHL
SHL
~;u
9E
G<il
RE
C. liB
Cf'
031C
OHE
fB 80
LSDF'
XRI
ADJ
BOH
SOH
F'C
oO
;T~ICf.
;GI::T P!>G £.1
;JUMP !f' CARl<\'
;ELS~ FLAG ONE MORE DIVIDE C\'CLE
.....
N
N
123
......
......"'
z
.
=>
0
...
..."'"' ""
:::>
II)
~
:E
0
u
r..
z
~
:::>
...
""...
... ..."'
0
0
...
""0
"'
0
"'...I
......
u
..
::::>
0
...•
a
0
:a:
.
...u . >
...
...
>
"' ...
=
...
u
... "'...z ...w z
"'
w
"'
u
>
11.1
Q
.
Q
0
.....
Q
oC
0
14
u
"
"'
-o--
"'
::0
......
... ...
..."'
... u
.. ..
Q
0
ID
"'
o·
"" "'...
0
Q
c
0
a-~
...
...
N
0
...
......z ___ .,._
r-iDG'O ...
•
.....""
otii ...
V')llt
00000
ERR L Ill£
ADDk
IU &2 113 114
105)
IOH
10$5
1056
IQS7
IObl
1064
1v&S
101>6
1067
OlH
H
Cl2S
AC
Cl2b
9E
H lS
cnr.
107l
1014
1015
0129
8f
llllb
1017
Oj2.1.
03211
fE
AF
1070
1019
I Gfr'J
1Jl2D
032£
I OH
032f
&e:
10&2
lObi
Olll
A£
IOo4
OIH
1085
Cllll
OlH
9!:
1£
t r,-: a
Ol2C
'
g;
7E
aF
llf
;R~PLACf.
RE
>SiiL1
;GI::T THIRD lllTt:
1 SrtlFT
IRF.PLACE
JG~T FOURTH UITE
;SHifT
;Wf.PL.\CE
;l~CPl~ENT SHIFT COUNTER
:G~T SHIFT COJNT
:CO~PAHE WITH ~AX
;LOO~ If CUU~T UNDER LlKIT
RC
RD
RTSPC
JGET SHifT COU~T
;STORE FINAL COUNT I¥ INDICAtED
;RETURN FROM SUBROUTINE
I~C
OH6
&C
CI.O
SMI
BNZ
10~2
OHB
O))C
OHD
0138
ICI:T ZF.ROS
:CLEAR SHifT COUNTER
I'HI
IC
0317
ZERO
RC
i.;ET MSB
Gill
RE
BNZ
iJUMP If NOT ZERO
>SHL2
UPPER WORD NON SIGNifiCANT • PROCEED WitH 2 WORD SHifT
GI,O
iGET LSB
RF
SilL
JSHHT LEF"£
;REPLACE
no
Rf
GHI
;GET SfCOND BYTE
Rf
SHLC
;SIIlH
eg
0)J9
1095
I09e
GHl
?LO
0135
ono
to:;g
H9l
'
;TWO ~EGISTER LEfT SHIFT
ASSU"PTIOUS AT ENTRY;
REG E,f CONTAINS A l2 BIT 8lNARY N~NBER TO BE SHifTED
RD => STORAGE LOCATION fOR SHifT COUNT
RESULTS ON EXIT:
REGISTER PAIR E,f LEfT S~IfTED ARITHMETICALLY UNTIL
THE HIGH WORD NON ZERO
T~E SHift COUNT IS STORED AT THE INDICATED STORAGE LOCATIJN
~EGlSTER C CORRUPTED
GLO
SIILC
PLO
Gill
SHLC
PHl
1G90
1091
1094
27
SHL11
.11)27
tvab
ten
p~~E
,........•............•.•..•.•....•.............•..............•....•........
,'' START Of SKL "OOULE
,SHL;
,''
J
,''
lObO
1061
1062
1C72
• VER, 27•0CT•8l
=··········································••*·······························
:
1059
1059
1068
too9
1070
1071
NIC~DTACK
7E
rr oa
lA 26
ac
so
RE
RE
RE
RC
RC
SHI,MAX
SHL21
GLO
STR
SEP
DS
~~FFER
;
I
END Of 'SHL' SUBROUTINE
.....
N
+:-
EAR Llllt
AOOR
Bl 112 aJ &4
,
1100
I
1101
.
SHRI
1104
11G5
I
,'
1106
I
I
I
I
OHE
&C
Cl)f
11341
l2 50
fJt:
0342
f6
lilt;
OHl
&E
1117
llU
(IH4
dE
IIIII
OHS
OHS
1120
0347
A£
gr
llH
1122
034&
01411
SF
1123
o;.;~
ar
1124
OHS
1b
OHC
H
0340
2C
1130
START OF SHR MODULE
, •••••••••••••••••••••••••••••••••••••••• $ ••••••••••••••••••••••••••••••
1102
110)
1125
ll26
1127
112a
1129
29
,
:•••····································································
1098
1099
1107
1108
1109
1110
1111
:112
1111
! 114
1115
PA~£
HJCROTACH • VER. 27•0CT•8l
Gill
76
lD JE
0350
05
GLO
BZ
SIIR
PHI
Gl.O
SHRC
PLO
GHl
SHRC
PHI
Gt.u
SHI1C
PLO
DEC
BR
76
Ol4E
IT~O REGISTER RIGHT SHifT
ASSUMPTIONS AT ENTRY:
REG E,F CO"TAINS A l2 BIT BINARY UU~BER TO BE SHIFTED
LOW IIYTE Of REG C CONTAINS THE SHIFT COUNT
RESULTS ON EXJt;
REGISTER PAtk E,F RIGHT SHIFTED ARITHMETICALLY
REGISTER C CORRUPTED
SHill I
RC
>SHRI
RE
RE
RE
.
RE
!IF
IIF
~F
Rf
RC
>SHR
IDO~IE
SEP
RTSPC
;END OF SHR NODULE
IGET SHifT COUNTER
rJUIIP If ZERO
;GiT CONTE~rs OF R~C E.l
ISHIFT RIG~! (MSU 6E~JH£S ZERO)
IREPLACE REG E.l
1GET CU~TEHTS OF REG E.O
ISHIFT RIGHT WITH CARRY
JkEPLACE Rr; E.O
IG~T CONT~~TS OF REG F.l
;SHIFT ~ITH CARRY
;REPLAC~ REG F.1
;GET CONTENTS OF REG r.O
;SHirT WITrl CARRr
;REPLACE ~EG F.O
JDECREkENT SrllFZ COUNtER
;LOOP UNTIL DONE SHIFTING
SHl.-TJHG
;RETURN
FRO~
SUBROUTINE
1-'
N
lJ1
ERR LIUE
ADDR
81 82
8)
84
PA:O£
MICROTACH • VER, 27•0CT•8l
29
1133
,,.........•..................................................................
1134
IllS
:
1112
I
STARr Of 'C91!' MODULE
...
1117
,...........................,
1118
:
1130
I
CBO: ISTAkT Of CONVERT BINARY TO DECJKAL SUBHOUTI.E
I
ASSUMPTIONS AT ENTRY:
I
Bl~ARX 16 BIT INPUT lN R[G F
I
MEMORY POINTER (REG 0) POINTS TO LOWEST BYTE OF OUTPUT BUFFER
DIGIT COUUT IN R~G 8,0
RFSULTS AT EXIT:
BCD EQUIVALENT ~r RESULT IN OUTPUT BUfFKR
OVERFLOW IS LOST
REG B,C,D CORRUPTED
1139
1140
1141
:tn
114l
1144
I ItS
1H~
1147
tlU
115Q
0151
OlS2
11~1
115~
035!>
11.&9
03~1
GLO
PHI
LDI
I'LO
HS
B9
fa 10
AC
1153
1
11~4
1155
l!Sb
1157
0356
CH1
Ol~a
~~~
OlS~
Yll
1159
035A
!HO
1161
O)~C
II!
lll5rl
10 56
oJ;r
&o
1163
II o4
1\65
1166
1167
1168
116<
1170
1171
11 7 2
IIi>
IIH
11n.
117 ~
1177
1178
111'1
11 ao
1181
1182
1101
1134
12
OHIO
AB
hi
9S
0)02
AB
0 l6l
OH·I
Ail
(I
&l3e.5
Olb&
())b7
AD
ar
n:
AI'
oJte
91·
OH'I
OlH
7F:
0}0!;
(;HC
v l~jj)
OlbC:
0370
Ol12
sr
llf
00
1E
50
H OA
lb 7l
50
JG~T DIGIT COUUT
JS&Vg UNOISTUHB~O DIGIT COU~T
IGET CONVERSID" RADII
ISfOR~ IN lTCRATION COUNTER
1011
RC
JGI::T ZEROS
ISTORE ZERO IN fiRST BYTE
~B
10ECR£~ENT DIGIT COUNTER
DEC
GLil
;GET DIGIT COUUTER
P.8
llZ
>CBD2
JJUMP If DJNE
lllC
;E!.SE BUMP POINTrR TO Nr:X f 1:\YTE
HD
IIR
;LOOP TO PROCESS NEXT BtTE
>C801
CB02:
;PUT MASTER BUffF.R POlNTE~ I~ REG 8,0 (TE~P STORACE)
;GET ~E:HORI POINTER
CLO
RD
SAVE
;STORE IN SAVE REG
i'LO
CliO):
; !!ESTORE DIGIT COUNIEH COPY
;GET UNDISTURB~D DIGIT COUNT
Gill
RB
118
;PUT l~ WORKING ?ART Of REG B
PLO
GLO
SAVE
IGi::T ORIGINAL IIUf POINTER
PO
PI-~
I STOllE Ill REG 0
SHIFT LEfT INTO C"RRY
GLO
RF
;cr:r Ri::C: r.o
SilL
JSIHf'l'
Pl.D
; RES'l'OR~~ II HE 0
RF
CHI
Rr
;Gr~T ••rr::: 1
SHI.C
JSHlfT ~tTH CARRY
RF
PHI
;Rf.STUI<E
J
Slllft CARRY Blf II~TO NEXT DIGIT
:GET NEX'l' BYTE Of SUffER
CB04:
LDN
RO
;SHIFT «ITH CARRY
SnLC
;I<I::I'LACI:::
STR
RD
C~RRY TO HIGHER DIGIT loHtW >9
()Ail
JSUI!T~ACT 10
SHl
)$+]
;JUMP If OVEa lEN
l.lf<f
;ELSE RESTORE DIGIT
STR
RD
GHI
STR
50
RB
R8
cu;.uc OUTPUT llUffER
CilOI:
97
115~
1162
~··························~··················
ZC:RO
RO
.....
N
0\
ERIC LIN£
ll8S
I ISO
1187
11il8
t1li~
1190
1191
1192
1191
1194
1195
1196
ADOR
Olll
0374
ul7S
0377
on a
12 7A.
i!:Z.
20
30 6:,
BR
Of.C
Ci1051
0378
2C
BC
Ol1E
DS
one
DEC
GLO
2!1
ea
Ol1A
UlH
MICROTACK •
61 62 8) il4
DF.C
GLO
&tiZ
3A 61
,
SEP
VE~.
PA:;&
27•0CT•al
RB
RB
>CBi>S
RD
>CB04
JPOINT TO NEXT BYTE
;GET DIGIT COU:~T
J EX IT WHEN Zt::RO
JPOINT tO NEXT DIGlT
;LOOP TO PROCESS NLXT DIGIT
RC
RC
>CBOl
RTSPC
JDECREHENT ITERATION COUNtF.R
JGET NEW COUNTER
!LOOP UNTIL ALL 16 BITS PROCESSED
JRETURN FROM SUBROUTINE
lO
I
END OF 'CBD' MODULE
......
N
"-1
ERR LINE
ADDR
81 112 Bl U
1198
HICROTACH
~
PAGE
VER. 27•0CT•83
31
,.............................................. ,,,,,,,,,,,,,,,,,,,,, ........ .
1199
START Of 'UPO' KODULE
1200
121)1
1202
1203
12H
,,,,,,,, ••••••••••••••••••••••••••••••••••••••••••••••••••• ,,f ••
,
UPOI
,,
,
,'
I
120S
1206
1207
t2.Ja
120~
1210
1211
1212
,,
0181
SET MEMORY POINTER TO OUTBUF.l
>OUrBUfl
LDI
PLO
~0
SET DIGIT CDUNftR a 4
OlSZ
f'8 04
[,OJ
0184
A6
PLO
1219
OH'S
t"8 112
1221)
0387
~t
Q)ijij
f& )0
OHA
AC
onr
D21
1222
t 221
1224
1225
1221>
12<7
122~
I Z29
123(1
OlBB
ro
o 1a;;
01ar
50
391
97
~
019:!
G 191
1215
1236
0)96
12)7
OHA
12i8
1219
1240
Ol9B
2£
039C
OHO
Ol9E
ac
n
so
Ol9f
6l
2£1
LfJI
lOll
PLO
RC
LDX
ANI
STR
ez
01~8
ouo
OlAI
OlA2
12H
1249
03A4
1250
03.1.5
OfH
1!0
>UPD2
DIGIT NOT ZEHO
ZERO
GHI
no
RE
&R
>II POl
AC:
JQ 'lC
UPD21
01?5
GI.O
8!:
I
,
,
ez
5[)
LPI
STH
DEC
Ofli
f<O
GLO
RC
UPOl:
I
I JUMP TO BLANKING ROUTINE IF DIGif : ZERO
;JUMP TO OUTPUT THIS DIGIT
,
;DIGIT " ZERO TEST FOR BLANKIHG
liE
12 9C
re or
aa
TEMPLATE FOR DIGIT l
;ZERO UPPER 4 BITS OF DIGIT
UPDll
32 95
l2ll
1244
IH5
1446
1247
I
Sf:T COUNTER TO BLANK ONLY 2 LEADING ZEROS
LDI
02H
I
PLO
II!:
J
fA Of
12lt
12ll
12 )4
1241
1242
1241
411
k8
Sf:T DIGIT
o;bc
••••••••••
ISTART Of DISPLAY UPDATE SUBROUTINE
ASSUMPTIONS lT ENTRY:
BCD VALUES IN OUTBUf'.3,2,l,O
RESULTS AT EXIT:
ADDS DIGIT S IN UPPER 4 BITS OF OUTBUF BYTES
REG B,C,D.E CORRUPTED
f8 04
AD
121)
1214
1215
1216
1217
1218
,,~
JJU~P TO OUTPUT If ~LANKING CTR c ZERO
;GET BLANKJ~G CODE (Fl
;STOR( 1~ THIS DIGIT (RIGHT 4 UUS)
IPECkEMEHT BLANKING COUNTER
kE
lOR BCO DIGI'r VALUE WITH DIGIT TEMPLATE
>UPDl
014
l2
u
ac
n·
10
STR
RD
OUTPUT DIGITI/DIGIT
OUT
lH
DEC
liB
GLO
RB
>UPORET
liZ
MORE DIGITS TO OUTPUT
I
JDECREHE~T DIGIT COUNTFR
JTEST FOR RE~AINING DIGlfS
JJUMP TO EXIT WH£~ ALL DIGITS OUl'PUr
cr.o
IIC
,
Sd
1011
;SET
T£HPL4T~
FOR N£Xf DIGIT
......
N
00
Efll\ LINE:
12~1
t2'5l
1251
1254
1255
1256
1257
ADOR
MICROTACH •
B\ B2 (13 8.
0 }47
OlA8
AC
lO &8
03AA
03U
05
V£~.
fLO
llC
BR
>UPDl
UPDRET:
SEP
RTSPC
END OF DISPLAY UPDATE
,
I
I
p,:;s;
27•0CT•8l
32
#RESTORE TEMPLAT~
!LOOP TO PROCESS NEXT DIGIT
:RETURN FROM SUBROUTINE
SUBROU1l~E
END OF 'UPO' MODULE
......
N
1.0
£fiR LIN!:
ADDR
b1 82 113 84
1259
!:!61)
)3
START
Dr
'JSR' MODULE
,.................•.....•.....•..........................•...................
1261
1264
1265
I
I
I
126&
1267
1268
1269
1270
1271
1212
121l
EXECUTED EACH TINE A SUijRQUTINE JS CALLED,
IS DEDICATED PC FOR THIS SUBROUTINE,
EXECUTION BEGINS 8Y SETTING PC~ R4 (SEP R4),
THE NEXT ToO BYTES FDLLO~JNG THE SEP JNSTkUCTION
ARE ASSUMED TO CONTAIN THE ENTRY POINT Or TdE
SUAROUTINE TO BE EXECUTED,
SUBROUTINE 'JSR' SAVES THE CURRENT PC (RO)
IN CHANGES RO JO THE NE~ ENTRYoPOINT,
EIECUTION or THE NE~ PROGRA~ BEGINS BY SETTING
PC
RO,
R4
=
1214
EXITJ:
lllAB
OlAB
DO
127'i
neo ouc
'iO
1201
OlAO
86
1292
OHi
;jo
0)80
A6
46
12Sl
12H
12fi5
PAGE
,............................................•.............•.................
I
I
I
1261
1262
1275
1270
1271
1278
HICRQTACH • VER, 27•0CT•83
our
0381
eo
1H6
0.!!:>2
46
1281
Olol
AO
1288
1<189
1290
0)64
lO AB
:;o;p
RO
;EXIT AND BEGIN EXECUTING NEW SUBROUTINE
;LEAVE H4 POINTING HERP.»
JSAI ;START Of JSR ROUTINE
Gill
RO
;GET HIGH BYTE Of MAIN PC
;STORE IN R6
Pili
1!6
GLO
RO
;GET LOW BYTE OF MAIN PC
PLD
R6
;STORi: lN R6
LOA
R6
;GET BYTE 1 OF JUMP ADDRESS
;STO~E
lN RO
.
PHI
llO
LOA
R6
;GET &YTE 0 Of JUMP ADDRESS
I'LO
RO
;Sl'ORE IN RO
BR
>EXITJ ;JUMP TO EXU
END Of JSR HODULE
I-'
w
0
i:f<R Llll£
AOPR
;
START Or 'RTS' MODULE
J
1296
;•••·····························································'*''''$'''''
PS IS 0£DICATED PC FOR THIS
EX£CU!JOU BEGINS
PC = RS (SEP RS).
12i7
12H
1299
SUB~OUTINg.
B~
IJ01
PC : RO.
1)02
'
;
OlE.&
OlS6
00
1)1)8
C3a7
9&
13v9
lllO
1 )11
Ol::~e
dO
fllil9
i6
AO
30 86
IHt
1 J07
0)34
Ollll>
EXlTil:
SEP
RO
;EXIT AND IILSUME EXECUTING MAIN PROGRAM
;LEAVf k5 POINTING HEHO>
RTS; ;START OF RTS ROIJTINl::
Gill
R6
;GET HIGH BYTE or HAlN PC
Pill
110
JSTORE Ill RO
GLO
Pli
;GET LOW ~YT£ OF MAIN PC
PLO
P.O
JSTUR£ lN RO
811
>EXITR JJUMP TO EXIT
Hll
llU
SETTl~G
An CHANGES RO TO THE RE•ENTRY POINT.
RE•F.XECUTION OF THE NEW PROGRAM BEGINS BY SETTING
1300
llt2
34
,,......................•...•...•.•.•..•. *···························~········
1292
1293
1294
lBS
1303
tl•H
HGS
H:a:
KICROTACH • VER. 27•0CT•U)
Bl Ill Ill 114
END
or
RTS MODULE
._.
w
1-'
t:RR LINE
ADDR
~ICROTACH
111 &2 B) 114
• V£R, 27•0CT•8l
P~G£
35
1316
1 )17
;••·····················*·········~~·······················*••••••*•·~·······
1318
1
1319
, ..••.•.•.•..••••...••.•..•....•••••••......... $.
,,; •.•..•...••....••......•..•
START Of 'ISR' MOOUL£
132(1
1.121
022
1321
IJ.ol
1325
l 326
I
=··························································~············4····
;
ISRRET:
I
UU&AVE OLD X, P AND INCREMENT RSP
RET
IRETURN FRD~ IhTf.RRUPT AND ENABLE fURTHER IRDS
JL£AVE ~~ POINTING HERE>>
ISR: 1ENTRY POINT Of INTEHRUPT SERVICE ROUTINE:
PC IS Rl, DATA POINT£R X IS R2
INiliATEO HY HARDWAHE kESPONSE TO HIGH LEVEL ON IRQ LINE
IRC LJNE IS CON~ECTED TO SPOKE DETECTOR CIRCUIT
THER~FD~E lSR IS EXECUTED ONCE EACrl TIME A SPOKE IS DETECTED
ISH INC~~ME~TS SPOKE CDUNTEdS fOR GEAR, SPEED, AND DISTA~:£
IT THEN EXITS LEAVING ITS PC READY fOR NEXT IRQ
Ol8D
1!21
1323
1329
Ol&D
70
(il!ll:
22
039r
OJCO
7ij
lllO
1331
1332
1)33
llH
l)JS
I 336
IH7
13)&
1339
1340
1311
1 J.l2
lHl
t 3H
lHS
IH6
tlH
llB
0 lC l
22
73
'J3C2
vl<:J
73
!352
1)5}
uJC9
7C
OlC6
H
OlCC
ro
l)~lj
~~51
tl s l
llSS
1;S6
1357
I )~iJ
IH9
tJOO
SAVE MACHINE STATUS ON STACK
~EMORY POINTER R2 E) ISRSAVO+I
DEC
RSP
~DECREMENT SP TO ISRSAVO
SAV
!PUSH REG T (OLD X,P) IN ISRSAVO
DEC
RSP
~DECREMEUT CP TO ISRS.VI
STXD
;PUSH ACCU~ULATOR IN ISR5AV1 A~D ~~C RSP
SHRC
;S~IFT CARRY RIT IHTJ ACCUMULAtOR
STXD
;PUSH ACCU~ULATOH IN ISHSAV2 AND DEC ~OINTER
lUCREM~NT SPOKC COUNTERS
7o
ro
o1c:. rc
"/)
·H~7
~lCB
ro
tH9
03C4
o $CJl
OlCf
~JiiO
rc
01
OfJ
01
73
fO
r,o
I 3 ot
0l
~I
1C
llti:<
f)JQj
1j
U304
fO
7C 00
1361
1J64
1365
1)66
>> INT£RaUPT SERVICE ROUTINE <<
1
CdC5
0307
73
11&7
0308
0309
fO
7C oo
llh
0308
1l
BUMP 2 BYTE SPEED COUNTER
;GCT CO~T~NTS Of SPDCTR,O
LOX
;iNCR~~ENT COUNT
01H
AOI
s·rxo
;RESTORE SPOCTR,O & OECREME~I POl HER
;GET CO~TENTS Of SPOCTR,t
LDX
ADCJ
IINCPE~E~T If CARRY S£T
OOH
;RESTORE SPDCTk.l L O£CHE~ENI P[JINTER
STXD
L1U:4P 4 BYTE DISTANCE COUNT£R
;GET CONT~ITS Of DIS:TR,O
Lr•X
AfJI
OIH
;INCREMENT COUNT
STXO
;k£ST05E OISCTR,O & JECRE~ENT POINTER
LOX
;G~T CONTE~TS Of rJSCTR.l
;,r,ci
OOH
JI~C~EHENT COU~I If C•~R¥ SET
STXIi
;RESTOHE DI3CT~.I & DECkEMEhT ?OIMIE~
LOX
;G'T CONTI~IS Of DISCTR,2
OOH
;I~CRE~ENT COUUT If CA~RY SET
ADCI
STXIJ
;RESTO~E DISCTR,2 & D~CREM~NT POINl~R
L[JX
1GET CONTENTS OF DISCTR,l
AOCI
OOH
;INCHEHENT COUNT If CANRV SI:T
STXD
1R£STOR£ DISCTH,l ' DECHEHENT POINlER
.....
w
N
ERR L.IIIE
AOOR
ill 82
8)
f'A~E.
HICROTACH • VER. 27•0CT•8l
114
)6
1369
1310
ro
071
030C
ll72
OlDD
1)13
OlDF
fC Gl
11
OlEO
87
ll1&
O)f.l
03£2
r9 20
llH
01£~
A1
OJES
64
1>74
U1!)
1376
1311
cs
11~0
l)ljS
BUMP 2 BYTE GE'R COUNTER
;GET CONTENTS Of GERCfR.O
;INCREMENT COUNT.
;RESTOR£ AMD ogCREKENT POINTER
STXD
C~ECK WHETHER 8 SIT COUNTER HAS OVERfLOWED
If SO, SET CEAR COUNTER OVERfLOW fUG ~NO CONriNU£
;G€T fLAG R£G
GLO
FLAG
JLONG SKIP If OVERFLO~ orr
LSNf
JELS£ ~ET GEAR COUNTER OVEKFLO~ FL~G
20H
ClRl
JRESTORE fLAG REG I~ EITHER C~SE
PLO
fLAG
LOX
AOl
J
J
'
J
1}81
I ldl
I le l
13a4
1)85
ll86
ll8l
I
C~HCEL
OlH
JRO SIGNAL
OUT
4H
~~STORE
MACHINE STATUS
~2
t.Ol
PLO
RSP
OH:9
O)E:A
ill Eo
011:6
Ol£8
llQ9 "alEC
rs 18
I
72
LPXII
f£
12
:>»L
t.OXA
30 110
llR
>ISRU'I~
>ISIIRET
;CANCEL
HD~
IRQ AND ADVANCE SP
re~o OF RCGIST£R SAVE AREA
;SET MEMORY POINTER
;POP S»lFTED ACC AND INCREMENT SP t~ lSRSAVl
:RESTORE CARRY
;POP ACC AND ADVANCE SP tQ lSRSAVO
JJUMP TO EXIT POINT
1 HO
1)91
1392
)
END Of "ISR" MODULE
1-'
w
w
ERR Ll'IE
AOOII
ll94
119!1
1402
Hul
1404
HOS
1406
110"/
,
ORG
0400
sur:
04CO
llSHlfTl
ASHIFT:
IHOI
0402
0~0)
c \0~
14•1~
1~09
o4n7
IUO
Q109
0409
ARGll:
ARG20:
DS
OS
OS
DS
uur~un:
ilS
OIIT~IJF21
DS
OU!t<Ut"l:
IJS
OS
nurr.uro:
Tl~Cfllll
TI~CTit21
flS
OS
DS
OS
OS
o-:·H
14i4
tHOC
RP~CTRII
HIS
0~{;0
ll~MCTIIOI
DS
1~1&
(1;)£
O•l0F
·r~f'I.Pl:
OS
040il
Tl~CTHII
Tli'.CTa<O;
nr.;·o:
Gf.HCTiH:
1H9
HlO
0410
iHII
0-ll2
1~21
C•H3
1422
1123
1424
1425
OH4
Gt:RCTRO:
IJJSCTNl;
Oli\CTi,2:
IJISCTIH:
HIS
0416
OISCi'Rii:
SPGCI'R I:
SI'DCTf:G:
141~
142~
C417
OH8
1427
OU9
H20
041A
H2!1
1-IJJ)
1411
1412
ISHSAV2:
ISRSAVI:
ISR,SI.VOI
JPLACE BUfFERS ON
0400H
1412
1411
1117
PA:;~
l1
START Of 'BUFFERS' MODULE
0105
Ol:l6
1411
NICROTACK • VER, 27•0CT•Bl
,..............................................................,,..•..•......
.,............................................................................
ll~6
1197
1na
1399
1400
);;01
Bl 62 Bl 84
IJS
OS
OS
OS
OS
OS
OS
OS
DS
!iS
OS
OS
P~GE
4
I
I
1
1
1
1
1
1
1
1
1
1
1
1
I
I
1
1
I
1
I
I
1
1
1
I
1
END 07 'bUFFERS' MODULE
I-'
w
.j::-
$
135
......
'"'
CD
...•
u
0
...
I
.
"'
...
a:
>
::z:
u
...
oC
0
Q
z
"'.... "'
0
z
...
0
....,"'
•
"'
""
"'"
.... "'"'
Ill
"'"'
0
."' ....."
n
t'l
...
...z
~
a:
a:
u
0
"'....
a:
"'"':r
..;:)
"'
...
Ill
Ill
'
~1CPJTACH
• VER. 2l•OCT•83
PAGE
J9
SY>Ii.\OL UBLE
~
0007
lS.~lrl'
0401
a
C:\Dl
c~~s
ADJUST
AVE
QOOO
ilUf
015&
0111.
Cij02
0009
0244
04(10
015f
Oil04
il: SCTA 1
:l!STI
OSHlfT
cj! ~n
~414
D
lil SC:TRl
(JlST2
04~0
OS~
02E9
Q)!'L
,2Cil
ov~
E
000)
Ollf
015C
FXITJ
CEAiH
OJOB
OHB
Gf.lR
0411
011!&
tl
00~~
I'll T
lSR
IS?$AV1
QliiO:
lS~i'C
0129
0411
0001
0001
041~
lSilSAV2
0418
;:.?'iAV
00%
0%0
L
ocos
MEH
!'iE.,A5
G~Rcno
APG20
AVE)
0401
0268
c
CBD
0361
02C7
Ci104
OISCTRO
Ill Sf
OSA
DVC
OVR
FLAG
GEARl
GEiiF
1N1T2
Cllul
[;I
DISCTRl
0412
OIV
021!9
osrr
0008
DVM
OlH
EXITR
GEAR2
Gf.RCTRI
03116
0140
INlTl
0025
OHIO
OlAC
0006
Oil09
0291
041&
lSi<RET
JSR
II
I! ODE
ARG21
AVEF
oaos
0402
0040
0151
0368
OHS
.
016f'
021::4
02F"0
0311
0007
0151
0001
002E
ISR.SAVO
ou:.
JSHPC
MAIN PC
0004
MPA
02A2
ilOOO
~1
0001
~2
0060
02A9
02d2
04H
0002
~s
0005
~b
Oe>ub
PSo
Rl
R7
R~
to,;.)
vOO'i
OOC·O
~~
Rl.\
00011
RC
0000::
H
OOOA
DOGE
~f.SI::T
0:)00
F:f"
OOilf
~(-:.1
~?~1
011)
111'1!2
0182
0400
i<~•CTRl
OH9
040C
lii'~f'
0002
~SP
0002
;ns~c
000')
SHE
01l(18
SCAN
~031
SC~t•12
"~· ::" i
~
~~';.L
112~8
' ;1~
OuOli
;;nauf2
04Q~
~~
i'S
OUH
ouraun
MPY
ourauro
04il7
0006
000)
0007
MT
028~
OUTilUF1
RO
R4
0406
0000
0004
RS
0008
S·:'A'05
uil£6
ScA142
SCl.>l7
S•ll..
OOA7
0057
0124
StiLl
0050
032&
S~L~AX
0070
0008
I'd~
013£
SHIH
Ol~O
RPMCTRO
MTS
SCANlO
SCANU
SCAN6
SHL2
SP
SPIJCTRl
SPE:EDl
0416
0!00
SPDF"
!i004
SPEED
0000
Ti't~f
OOl!l
TH\CTRO
0403
TEMPO
'rlMCTR1
'f J i<GRl
0·\0d
0020
0J9C
'flH;,:
010~
TIHI::l
UPD
UPDRET
037F
UI'Dl
OHil
OlAA
:u:RO
0007
s:~"
11
009~
src~r"o
0417
~f.'C2:Dl
0107
.~.•?1
Tl~CTkl
Tr~f.2
HJ£
0409
02)5
T~Si'
UPD2
0195
LIP:>J
oooa
SCAII13
SCAN)
STACK
s
Ojl\7
0090
00£6
OOi>A
0338
0006
OOE8
o)40F
04Dfl
0215
1-'
w
0\