ATmega88PA Automotive Atmel Corporation, ATmega88PA Automotive Datasheet - Page 75

no-image

ATmega88PA Automotive

Manufacturer Part Number
ATmega88PA Automotive
Description
Manufacturer
Atmel Corporation
14.2.2
14.2.3
14.2.4
9223B–AVR–09/11
Toggling the Pin
Switching Between Input and Output
Reading the Pin Value
Writing a logic one to PINxn toggles the value of PORTxn, independent on the value of
DDRxn. Note that the SBI instruction can be used to toggle one single bit in a port.
When switching between tri-state ({DDxn, PORTxn} = 0b00) and output high ({DDxn,
PORTxn} = 0b11), an intermediate state with either pull-up enabled {DDxn, PORTxn} = 0b01)
or output low ({DDxn, PORTxn} = 0b10) must occur. Normally, the pull-up enabled state is fully
acceptable, as a high-impedance environment will not notice the difference between a strong
high driver and a pull-up. If this is not the case, the PUD bit in the MCUCR Register can be set
to disable all pull-ups in all ports.
Switching between input with pull-up and output low generates the same problem. The user
must use either the tri-state ({DDxn, PORTxn} = 0b00) or the output high state ({DDxn,
PORTxn} = 0b11) as an intermediate step.
Table 14-1
Table 14-1.
Independent of the setting of Data Direction bit DDxn, the port pin can be read through the
PINxn Register bit. As shown in
constitute a synchronizer. This is needed to avoid metastability if the physical pin changes
value near the edge of the internal clock, but it also introduces a delay.
timing diagram of the synchronization when reading an externally applied pin value. The max-
imum and minimum propagation delays are denoted t
Figure 14-3. Synchronization when Reading an Externally Applied Pin value
DDxn
0
0
0
1
1
Atmel ATmega48PA/88PA/168PA [Preliminary]
PORTxn
summarizes the control signals for the pin value.
INSTRUCTIONS
SYSTEM CLK
0
1
1
0
1
SYNC LATCH
Port Pin Configurations
PINxn
(in MCUCR)
r17
PUD
X
X
X
0
1
Figure
XXX
Output
Output
Input
Input
Input
I/O
14-2, the PINxn Register bit and the preceding latch
t
pd, max
Pull-up
0x00
Yes
No
No
No
No
XXX
t
pd, min
pd,max
Comment
Tri-state (Hi-Z)
Pxn will source current if ext. pulled low.
Tri-state (Hi-Z)
Output Low (Sink)
Output High (Source)
and t
in r17, PINx
pd,min
respectively.
Figure 14-3
0xFF
shows a
75

Related parts for ATmega88PA Automotive