Note
1:
There
are
four possible
states
of
the
Status
LED:
Bit
7
Bit
6
State
of
LED
1
1
1
1
LED
OFF
LED
is
red
LED
is
green
LED
is
yellow/orange
Note
2:
The
ACK*
signal
to
the
computer
is
an
active
low
pulse.
This
means
that
when
a
byte
of
data
has
been
accepted,
the signal
should
go
to
for a
duration of
at
least
5uS
and
then
return
to
1
NMI
Timing Diagram
1.8yS
\
/
VALID
<
FOR
<
~ x
/
_y
m
99jiS
m
Wi
m
W////////////////f,
SOFT-
WARE
,
m
w
¥////////////////,
5(iS
Notice,
from
the
timing
diagram
shown
above,
that
data
from
the
computer
is
only
guaranteed
valid for a
period of approximately 3uS. Therefore, reading data
from
the
computer Data
Port
must
be
done
immediately
upon
entry
to
the
NMI
Service Routine.
BUSY
and
BUSY*
will
be
initiated in
hardware
for a
period of
90uS.
To
guarantee
that
they
stay active for the
duration of the Service Routine, they should
be
turned
on
in
Port
1
(Write)
soon
after
reading
the data.
The
ACK*
signal
should
be
turned
on
for a
period of
5uS
at
the
end
of
the
Service
Routine and
turned
off
at
the
same
time
as
BUSY
and
BUSY*. An
example
of
a
basic
NMI
Service
Routine
follows:
GET
DATA FROM
PORT
;
start
of
routine
PUSH AF
IN
A,(0)
PUSH
BC
PUSH
DE
PUSH
HL
LD
B,A
LD
A,14H
OUT
(D,A
;
process data byte
and
s
POP
HL
POP
DE
POP
BC
POP
AF
SAVE THE OTHER
REGISTERS
SAVE THE
DATA
BYTE TO
B
FAULT
OFF,
BUSY
AND
BUSY* ACTIVE
SEND
IT
TO
COMPUTER
;
RESTORE STACK
RETN
;
RETURN
FROM
NMI
This
is
a very basic routine
and
ignores
the
status
LEDs
and
piezo buzzer.
Ideally, the
current
state
of
this
port
should
be
stored
in
RAM
and
the
appropriate
bits
turned on.
25