A000047 Arduino, A000047 Datasheet - Page 72

MCU, MPU & DSP Development Tools Mega2560

A000047

Manufacturer Part Number
A000047
Description
MCU, MPU & DSP Development Tools Mega2560
Manufacturer
Arduino
Series
-r
Type
MCUr
Datasheets

Specifications of A000047

Processor To Be Evaluated
ATmega2560
Interface Type
USB, I2C, SPI
Dimensions
4 in x 2.1 in
Operating Supply Voltage
5 V
Contents
Board
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
ATmega2560
12.2.2
12.2.3
12.2.4
2549M–AVR–09/10
Toggling the Pin
Switching Between Input and Output
Reading the Pin Value
If PORTxn is written logic one when the pin is configured as an output pin, the port pin is driven
high (one). If PORTxn is written logic zero when the pin is configured as an output pin, the port
pin is driven low (zero).
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 accept-
able, as a high-impedant 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 12-1
Table 12-1.
Independent of the setting of Data Direction bit DDxn, the port pin can be read through the
PINxn Register bit. As shown in
ing latch 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.
page 73
value. The maximum and minimum propagation delays are denoted t
respectively.
0
0
0
1
1
shows a timing diagram of the synchronization when reading an externally applied pin
0
1
1
0
1
summarizes the control signals for the pin value.
Port Pin Configurations
X
X
X
0
1
Output
Output
Input
Input
Input
I/O
ATmega640/1280/1281/2560/2561
Figure 12-2 on page
Pull-up
Yes
No
No
No
No
71, the PINxn Register bit and the preced-
Pxn will source current if ext. pulled low.
Output High (Source)
Output Low (Sink)
Tri-state (Hi-Z)
Tri-state (Hi-Z)
Comment
pd,max
Figure 12-3 on
and t
pd,min
72

Related parts for A000047