I/O Ports; R0 And R0Io Register - Abov MC80F0304 User Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

MC80F0304/08/16

9. I/O PORTS

These ports pins may be multiplexed with an alternate function
The MC80F0304/0308/0316 has three ports (R0, R1 and R3).
for the peripheral features on the device. All port can drive max-
WRITE "55
" TO PORT R0 DIRECTION REGISTER
imum 20mA of high current in output low state, so it can directly
H
drive LED device.
0C1
0C0
H
R0 direction
R0 data
0 1 0 1 0 1 0 1
7 6 5 4 3 2 1 0
BIT
as output or input. A "1" in the port direction register configure
All pins have data direction registers which can define these ports
0C2
H
H
R1 data
the corresponding port pin as output. Conversely, write "0" to the
0C3
H
R1 direction
I O I O I O I O
PORT
corresponding bit to specify it as input pin. For example, to use
7 6 5 4 3 2 1 0
I: INPUT PORT
bered bits as input ports, write "55
the even numbered bit of R0 as output ports and the odd num-
" to address 0C1
(R0 port
O: OUTPUT PORT
direction register) during initial setting as shown in Figure 9-1 .
H
H
All the port direction registers in the MC80F0304/0308/0316
Figure 9-1 Example of port I/O assignment
have 0 written to them by reset function. On the other hand, its
initial status is input.

9.1 R0 and R0IO register

R0 is an 8-bit CMOS bidirectional I/O port (address 0C0
H
). Each
ed to them in 1-bit units with a pull-up selection register 0 (PU0).
I/O pin can independently used as an input or an output through
the R0IO register (address 0C1
). When R00 through R07 pins
setting the corresponding bit of the open drain selection register
Each I/O pin of R0 port can be used to open drain output port by
are used as input ports, an on-chip pull-up resistor can be connect-
H
0 (R0OD).
R0 Data Register
ADDRESS: 0C0
RESET VALUE: 00
H
ADDRESS: 0F8
RESET VALUE: 0000 0000
H
R0
R07 R06 R05 R04 R03 R02 R01 R00
H
PSR0
PWM3OE
PWM1OE
EC1E
EC0E
INT3E
INT2E
INT1E
INT0E
B
Input / Output data
Port / INT Selection
R0 Direction Register
ADDRESS: 0C1
H
0: R11, R12, R03, R00
1: INT0, INT1,INT2, INT3
R0IO
RESET VALUE: 00
H
Port / EC Selection
1: EC0, EC1
0: R04, R07
Port Direction
0: Input
1: Output
0: R10, R11
Port / PWM Selection
R0 Pull-up
ADDRESS: 0FC
1: PWM1O, PWM3O
Selection Register
RESET VALUE: 00
H
H
PU0
RESET VALUE: ---- 0000
ADDRESS: 0F9
H
B
Pull-up Resister Selection
PSR1
-
-
-
-
AVREFS
BUZOE
T2OE
T0OE
0: Disable
Port / TO Selection
1: Enable
1: T0O, T2O
0: R05, R06
Selection Register
R0 Open Drain
ADDRESS: 0C8
H
R0OD
RESET VALUE: 00
H
R12/BUZO Selection
0: R12 port (Turn off buzzer)
1: BUZO port (Turn on buzzer)
Open Drain Resister Selection
R10 / AV
0: R10 port
REF
Selection
0: Disable
1: Enable
1: AV
REF
port
Figure 9-2 R0 Port Register
In addition, Port R0 is multiplexed with various alternate func-
(address 0F9
) control the selection of alternate functions such as
H
tions. The port selection register PSR0 (address 0F8
H
) and PSR1
external interrupt 3 (INT3), external interrupt 2 (INT2), event
46
November 4, 2011 Ver 2.12

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents