5 port p4 (p47 to p40), Toshiba – Toshiba TMP87CP24AF User Manual
Page 58
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.5 Port P4 (P47 to P40)
Port
P4
is
an
8
-bit
input/output
port,
and
is
also
used
as
an
external
interrupt
input,
a
timer/counter
input/output
and
a
serial
interface
input/output.
Input/output
mode
is
specified
by
the
corresponding
bit
in
the
port
P4
input/output
control
register
(P4CR1).
It
can
be
selected
whether
output
circuit
of
P4
port is Push-pull port or Sink open drain individually, by setting P4CR2.
When
used
as
a
timer/counter
output
and
serial
interface
output,
respective
P4CR1
should
be
set
to
"1"
after P4 output latch is set to "1".
When
used
as
an
input
port,
external
interrupt
input,
timer/counter
input
and
serial
interface
input,
respective P4CR1 should be set to "0" after P4CR2 is set to "0".
During
reset,
the
P4CR1
is
initialized
to
"1",
and
configures
port
P4
as
an
output
mode.
Also,
port
P4
output latch is initialized to
" 1
".
P4
(0004
h
)
R/W
P4CR1
(OOOC
h
)
P47
S02
P46
SI2
P45
SCK2
P44
SOI
P43
SI1
P42 ; P41
SCK1
PWM
PDO
P40
INT3
TC3
(Initial value:
1111 1111)
P4CR2
(002D
h
)
(Initial value: 1111 1111)
P4CR1
Port 4/1/0 select
(Set for each bit individually)
0: Input mode
1 : Output mode
Write-
only
7 6 5 4 3 2 1 0
(Initial value: 0000 0000)
P4CR2
Port 4/Output circuit control
(Set for each bit individually)
0: Sink open-drain output
1 : Push-pull output
Write -
only
Figure 2-7. Port P4
Note 1: Ports set to the input mode read the pin states. When input pin and output pin exist in port P4
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.
Note 2: The P4CR1 and P4CR2 are a write-only register. It can not be operated by the read-modify-
write instruction (Bit manipulation instructions of SET, CLR, etc. and Arithmetic instructions of
AND, OR, etc.)
3
-
24-58
2002
-
10-03