
80C196KB USER’S GUIDE
inputs are tied to electronic devices instead of switches,
as most external pulldowns will not hold 20 mA to 0.0
volts.
Writing to a Quasi-Bidirectional Port with electronic
devices attached to the pins requires special attention.
Consider using P1.0 as an input and trying to toggle
P1.1 as an output:
ORB
IOPORT1,
#
00000001B ; Set P1.0
; for input
XORB IOPORT1,
#
00000010B ; Complement
; P1.1
The first instruction will work as expected but two
problems can occur when the second instruction exe-
cutes. The first is that even though P1.1 is being driven
high by the 80C196KB it is possible that it is being held
low externally. This typically happens when the port
pin drives the base of an NPN transistor which in turn
drives whatever there is in the outside world which
needs to be toggled. The base of the transistor will
clamp the port pin to the transistor’s Vbe above
ground, typically 0.7V. The 80C196KB will input this
value as a zero even if a one has been written to the port
pin. When this happens the XORB instruction will al-
ways write a one to the port pin’s SFR and the pin will
not toggle.
The second problem, which is related to the first, is that
if P1.0 happens to be driven to a zero when Port 1 is
read by the XORB instruction, then the XORB will
write a zero to P1.0 and it will no longer be useable as
an input.
The first situation can best be solved by the external
driver design. A series resistor between the port pin and
the base of the transistor often works by bringing up
the voltage present on the port pin. The second case can
be taken care of in the software fairly easily:
LDB
AL, IOPORT1
XORB AL,
#
010B
ORB
AL,
#
001B
STB
AL, IOPORT1
A software solution to both cases is to keep a byte in
RAM as an image of the data to be output to the port;
any time the software wants to modify the data on the
port it can then modify the image byte and copy it to
the port.
If a switch is used on a long line connected to a quasi-
bidirectional pin, a pullup resistor is recommended to
reduce the possibility of noise glitches and to decrease
the rise time of the line. On extremely long lines that
are handling slow signals, a capacitor may be helpful in
addition to the resistor to reduce noise.
12.3 Output Ports
Output pins include the bus control lines, the HSO
lines, and some of Port 2. These pins can only be used
as outputs as there are no input buffers connected to
them. The output pins are output before the rising edge
of PH1 and is valid some time during PH1. Externally,
PH1 corresponds to CLKOUT low. It is not possible to
use immediate logical instructions such as XOR to tog-
gle these pins.
The control outputs and HSO pins have output buffers
with the same output characteristics as those of the bus
pins. Included in the category of control outputs are:
TXD, RXD (in Mode 0), PWM, CLKOUT, ALE,
BHE, RD, and WR. The bus pins have 3 states: output
high, output low, and high impedance. Figure 12-4
shows the internal configuration of an output pin.
270651 – 77
Figure 12-4. Output Port
62
数控原理与维修
http://www.agreenleaf.cn
Содержание 80C196KB Series
Страница 1: ...November 1990 80C196KB User s Guide Order Number 270651 003 http www agreenleaf cn...
Страница 59: ...80C196KB USER S GUIDE Figure 11 7 Ideal A D Characteristic 270651 37 55 http www agreenleaf cn...
Страница 60: ...80C196KB USER S GUIDE Figure 11 8 Actual and Ideal Characteristics 270651 38 56 http www agreenleaf cn...
Страница 61: ...80C196KB USER S GUIDE Figure 11 9 Terminal Based Characteristic 270651 39 57 http www agreenleaf cn...
Страница 70: ...80C196KB USER S GUIDE Figure 13 5 Reset Sequence 80C196KB Reset Sequence 270651 45 66 http www agreenleaf cn...
Страница 83: ...80C196KB USER S GUIDE 270651 80 Figure 15 14 AC Timing Diagrams 79 http www agreenleaf cn...
Страница 84: ...80C196KB USER S GUIDE 270651 81 270651 84 Figure 15 14 AC Timing Diagrams Continued 80 http www agreenleaf cn...