English
Language : 

ST7265X Datasheet, PDF (53/166 Pages) STMicroelectronics – LOW-POWER, FULL-SPEED USB 8-BIT MCU WITH 32K FLASH, 5K RAM, FLASH CARD I/F, TIMER, PWM, ADC, I2C, SPI
ST7265x
I/O PORTS (Cont’d)
9.2.4 Bit manipulation on Open Drain Outputs
As mentioned in Section 9.2.2, software should
avoid using bit manipulation instructions on the DR
register in open drain output mode, but must al-
ways access it using byte instructions. If bit manip-
ulation is needed, the solution is to use a copy of
the DR register in RAM, change the bits (using
BRES or BCLR instructions for example) and copy
the whole byte into the DR register each time the
value has to be output on a port. This way, no bit
manipulation is performed on the DR register but
each bit of the DR register can be controlled sepa-
rately.
9.3 I/O PORT IMPLEMENTATION
The hardware implementation on each I/O port de-
pends on the settings in the DDR and OR registers
and specific feature of the I/O port such as ADC In-
put or true open drain.
Port B (without Option Register)
PB[7:0]
MODE
floating input
push-pull output
DDR
0
1
Switching these I/O ports from one state to anoth-
er should be done in a sequence that prevents un-
wanted side effects. Recommended safe transi-
tions are illustrated in Figure 36 Other transitions
are potentially risky and should be avoided, since
they are likely to present unwanted side-effects
such as spurious interrupt generation.
Figure 36. Interrupt I/O Port State Transitions
01
00
INPUT
floating/pull-up
interrupt
INPUT
floating
(reset state)
10
OUTPUT
open-drain
11
OUTPUT
push-pull
XX = DDR, OR
The I/O port register configurations are summa-
rized as follows.
Table 14. Port Configuration (with Option Register)
Port
Pin name
Port A PA7:0
Port C
PC7:4
PC3:0
Port D
PD7:0
PE7:6
PE5
Port E
Port F
PE4:3
PE2:0
PF6:4
PF3:2
PF1:0
Input
Output
OR = 0
OR = 1
OR = 0
OR = 1
floating
floating
with interrupt
open drain
push-pull
floating
floating
with interrupt
push-pull
floating
floating
with interrupt
push-pull
floating
floating
with interrupt
open drain
push-pull
floating
open drain
push-pull
floating
with pull-up, if se- open drain (with
lected by option pull-up, if select-
byte see Section ed by option byte
15.1)
see Section 15.1)
push-pull
floating
open drain
push-pull
floating
open drain
push-pull
floating
True open drain
floating
push-pull
floating
True open drain
High-Sink
No
No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
53/166
1