2 portpi (p17to p10), Toshiba, Q pii – Toshiba TMP87CP24AF User Manual
Page 55
Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

TOSHIBA
TMP87CM24A/P24A
2.2.2 PortPI (P17to P10)
Port
PI
is
an
8
-bit
input/output
port
which
can
be
configured
as
an
input
or
an
output
in
one-bit
unit
under
software
control.
Input/output
mode
is
specified
by
the
corresponding
bit
in
the
port
PI
input/output
control
register
(P1CR).
Port
PI
is
configured
as
an
input
if
its
corresponding
P1CR
bit
is
cleared
to
"0",
and
as
an
output
if
its
corresponding
P1CR
bit
is
set
to
"1".
During
reset,
the
P1CR
is
initialized
to
"0",
which
configures
port
PI
as
an
input.
The
PI
output
latches
are
also
initialized
to
"0".
Port
PI
is
also
used
as
an
external
interrupt
input,
a
timer/counter
input/output,
and
a
divider
output.
When
used
as
secondary
function
pin,
the
input
pins
should
be
set
to
the
input
mode,
and
the
output
pins should be set to the output mode and beforehand the output latch should be set to "
1
".
It
is
recommended
that
pins
P11
and
PI
2
should
be
used
as
external
interrupt
inputs,
timer/counter
input,
or
input
ports.
The
interrupt
latch
is
set
at
the
rising
or
falling
edge
of
the
output
when
used
as
output
ports.
Pin P10 (INTO) can be configured as either an I/O port or an external interrupt input with INTOEN (bit
6
in
EINTCR). During reset, pin P10 (INTO) is configured as an input port P10.
STOP
OUTEN
PICRi
Data input
Data output
Output latch
PI
(
0001
h
)
R/W
P1CR
(OOOB
h
)
Control output -
Control input
4
3
2
Q pii
Note: i = 7 to 0
P17
P16
P15
TC2
P14
PPG
P13
DVÜ
P12
INT2
TCI
P11
INTI
P10
7
6
5
4
3
2
1
0
(Initial value :
0000 0000)
(Initial value :
0000 0000)
P1CR
I/O control for port PI
0 : Input mode
Write
(Set for each bit individually)
1 : Output mode
only
Figure 2-4. Port PI and P1CR
Example : Sets P17, P16 and P14 as output ports, P13 and P11 as input ports, and the others as function
pins. Internal output data is "1" forthe P17 and P14 pins, and "0" forthe P16 pin.
LD (EINTCR), 01000000B
; INT0EN<-1
LD (PI), 10111111B
; P17<-1, P14<-1, P16<-0
LD (P1CR), 11010000B
Note 1
Note 2
Ports set to the input mode read the pin states. When input pin and output in exist in port PI
together, the contents of the output latch of ports set to the input mode may be rewritten by
executing the bit manipulation instructions. Pins set to the output mode read a value of the
output latch.
The P1CR is a write-only register. It can not be operated by the read-mod ify-write instruction
(Bit manipulation instructions of SET, CLR, etc. and Arithmetic instructions of AND, OR, etc.)
3
-
24-55
2002
-
10-03