Tektronix 494AP Water Dispenser User Manual


 
Theory
of
Operaton
-
494[l4g4Ap
Service,
Vot.
1
Keyboard
Check
Subroutine.
This
subroutine
is
called
when
the
main
scan
routine
detects
a change
in
the
keyboard
matrix
which occurs
when
a
key
opens
or
closes.
A key
opening
usually
signifies
that
an action
has been
completed,
whereas
a
closure
indicates
that
an operation
or
action
is
requested
by the
user;
there-
fore,
the two are
treated
differently
by the
cpu.
Because
mechanical
keys
tend
to bounce
when
they
open
or close,
the subroutine
must
debounce
each
key
change.
To
debounce,
the
subroutine
calls
up the
timel
subroutine.
This
sets
a
number
into
the
internal
timer
and starts
it
running.
When
the
timer has
timed out,
in
about
a
millisecond,
the
keyboard
subroutine
again
scans
the row and
compares
this scan
with
the scan
before
the
debounce
check.
lf
the
scan
does
not com_
pare,
the
routine
assumes
the
key change
was a
bounce or
glitch,
and
it returns
to
the main
scan
routine.
lf it
does compare,
the routine
then recognizes
that
a
key state
has changed
The
routine
then checks
to
see
if
this
is
the first
scan
that looked
for
a key
change
after
it
has outputted
previous
information
to
the master
processor.
lf it is
the
first
pass
then
the
routine
causes
the
CpU
to re_
scan
the
full
keyboard
matrix
to ensure
that
th€re
is not
a
phantom
key closure.
lf
this is
the second
or
subse-
quent
pass
and
an
actual
key
change has
occurred,
the
routine
then notes
if
the key
change
was
an
opening
or
closure.
lf
the
change
was
an
opening
the CpU
memory
is
updated
to the fact
that
the key is
open.
lf a closure
has
occurred,
the routine
will
then
check
the column
that
has
the
closure
and
output
a
new key
address
onto
the output
stack.
This addr€ss
consists
of
the
key's
row
and colsmn
location.
After outputting
the address,
the subroutine
returns
to scanning
the
remainder
of
the
keyboard
matrix.
Frequency
Coder
Subroutine
Check.
This
subrou-
tine is called
when
the
main scan
routine
detects
a
change
in
the
frequency
coder switch.
Like
the key-
board subroutine,
this routine
also
debounces
the fre-
quency
coder
switch
after
every change
to
ensure
that
the switch
code has
changed:
lf a real
change
is noted,
the
routine
proceeds
to determine
the
direction
of
the
change.
The frequency
knob
outputs
a
two-bit
code
with only
one bit
at
a
time changing as
the
control
is
rotated.
The
direction the
knob
is rotated is
determined
by
the
pro-
perty
of a
gray
code,
generated
by an exclusive-OR
log-
ical
operation
within the
CPU.
The
previous
state
of
one
bit
is compared
with
the
current
state of
the other
bit. Down
{counterclockwise
rotation)
yields
unequal
inputs, whila
up
(clockwise
rotation
)
yields
the oppo-
site. The
bit that
indicates
direction
is
inserted
as
the
MSB
for the
frequency
coder
byte. This byte is
then
loaded
into
the
output
stack.
The
subroutine
then
returns
to the
main
scan
routine.
Output Subroutine. After each scani
the CPU
checks
its output
register
to
see if any
information
needs
to be
output.
lf it
needs to be
output,
th€
output
subroutine is called
up;
if
not,
another
scan is start€d.
The output subroutine
checks a
number
of
things
before
it outputs any
information
to the
output
register.
lt
first
determines if
the
CPU
is on its first or initial scan
after
a
reset. The first
scan will contain more
than
one closure.
All of
these
closures
must be
output
before
it continues.
On
all scans
that
follow,
the
routine looks
for
more
than
one closure
by
checking
the numbEr
of entries into
the
output stack.
lf more
than
one
closure
has been
entered,
the
output
routine aborts. This eliminates
out-
putting
phantom
key
closures.
The routine
is now ready to
output
information.
lt
pulls
a key address from
the
output stack
and
looks
up
the
code from
a look-up
table
in
RoM.
This key code
is
loaded
into
the data
port
or output buffer.
The
appropriate
poft
P24 or P25
(
pins
35
& 36)
is
pulled
low. The routine continuously
reads the
frequency
coder
and
updates
its
memory
while it
is waiting
for
the
rnaster
processor
to
read
the
data in
the
output
buffer.
Once the data has
been
read, P24
or P25
goes
high
and
the subroutine starts
to
check
the
output stack
for
more key closures.
When
the
output stack is empty,
the first
scan
flag is rescinded and
the
cPU
returns
to
its
main scanning routine.
a
o
o
O
o
o
o
o
o
o
o
o
o
o
o
a
o
o
O
o
o
o
o
o
o
o
e
o
o
o
o
O
o
o
o
o
o
O
o
o
o
o
o
o
7-100