User`s guide
I/O Ports LZ87010 Advance User’s Guide
6-2 1/15/03
6.1 Theory of Operation
From the point of view of the world outside the LZ87010, inputs and outputs are asynchro-
nous, as no reference clock is provided.
From the LZ87010’s point of view, reads and writes can take place at the rate of one every
Peripheral Clock (PCLK) cycle. This is the same as the instruction rate.
6.1.1 General-Purpose I/O Ports
The general-purpose I/O ports are Port 0, Port 1, Port 3, Port 5, Port 6, Port 7, and Port 8.
All of the ports except Port 5 and Port 8 are bit addressable.
General-purpose I/O ports can be both read and written. When a ‘0’ is written to a general-
purpose I/O port, a LOW level is driven continuously. When a ‘1’ is written, the pin is driven
HIGH for one Core Clock (CCLK) cycle, then the output driver is tri-stated. An internal
weak pull-up resistor maintains the HIGH level after this drive is removed. Figure 6-1
shows a general-purpose I/O port.
The output state of a general-purpose I/O pin is not altered when using it as an input. To
use a general-purpose I/O pin as an input, one must first write a ‘1’ to it. This will turn off
the output driver after one CCLK cycle and leave the pin in a high-impedance state (con-
sisting of pin capacitance and the internal pull-up resistor with a nominal value of 90 kΩ).
The general-purpose I/O signals can drive a minimum of 4 mA when LOW.
NOTE: Pins P3[7:6] do not have internal pull-up resistors. These two pins also serve as I
2
C pins SCL and
SDATA, and the I
2
C specification requires open-collector signals. When using these pins as general-
purpose I/O signals, external pull-up resistors of approximately 90 kΩ should be supplied externally.
If a single 8-bit port is used for both inputs and outputs, care must be taken not to write a
‘0’ to any of the pins used as an input. Reading a port and then writing the same data back
to it will turn any input bit whose state was read as ‘0’ into an output that drives ‘0’ contin-
uously. Read-modify-write instructions, including the bit-manipulation instructions ‘SETB’
and ‘CLR bit’, will also have this affect. In general, it is best to avoid using the same port
for both input and output bits. When this is unavoidable, the port should be manipulated by:
1. Reading the port by copying it to a register, as in ‘MOV A,PORT’.
2. Performing the desired operation on the port bits.
3. Explicitly masking the input bits to ‘1’, as in ‘ORL A,#0xF0’ for a port whose
4 high bits are inputs.
4. Writing the port back, as in ‘MOV PORT,A’.
6.1.1.1 Idle and Stop-Mode Current
When the logic level is LOW, current flows continuously through the pull-up resistors. This
current continues to flow in low-power modes (Idle Mode and Stop Mode). To minimize
power dissipation in low-power modes, general-purpose I/O ports should be set HIGH.