A000047 Arduino, A000047 Datasheet - Page 141
![MCU, MPU & DSP Development Tools Mega2560](/photos/15/92/159244/arduinomega2650front_sml.jpg)
A000047
Manufacturer Part Number
A000047
Description
MCU, MPU & DSP Development Tools Mega2560
Manufacturer
Arduino
Series
-r
Type
MCUr
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
- Current page: 141 of 444
- Download datasheet (10Mb)
16.3.1
16.4
2549M–AVR–09/10
Timer/Counter Clock Sources
Reusing the Temporary High Byte Register
The following code examples show how to do an atomic write of the TCNTn Register contents.
Writing any of the OCRnA/B/C or ICRn Registers can be done by using the same principle.
Note:
The assembly code example requires that the r17:r16 register pair contains the value to be writ-
ten to TCNTn.
If writing to more than one 16-bit register where the high byte is the same for all registers written,
then the high byte only needs to be written once. However, note that the same rule of atomic
operation described previously also applies in this case.
The Timer/Counter can be clocked by an internal or an external clock source. The clock source
is selected by the Clock Select logic which is controlled by the Clock Select (CSn2:0) bits
located in the Timer/Counter control Register B (TCCRnB). For details on clock sources and
prescaler, see
Assembly Code Example
C Code Example
TIM16_WriteTCNTn:
void TIM16_WriteTCNTn( unsigned int i )
{
}
; Save global interrupt flag
in r18,SREG
; Disable interrupts
cli
; Set TCNTn to r17:r16
out TCNTnH,r17
out TCNTnL,r16
; Restore global interrupt flag
out SREG,r18
ret
unsigned char sreg;
unsigned int i;
/* Save global interrupt flag */
sreg = SREG;
/* Disable interrupts */
__disable_interrupt();
/* Set TCNTn to i */
TCNTn = i;
/* Restore global interrupt flag */
SREG = sreg;
1. See “About Code Examples” on page 11.
“Timer/Counter 0, 1, 3, 4, and 5 Prescaler” on page
(1)
(1)
ATmega640/1280/1281/2560/2561
169.
141
Related parts for A000047
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
![A000082](/images/no-image3.png)
Part Number:
Description:
Daughter Cards & OEM Boards ARDUINO UNO PROTO PCB REV 3
Manufacturer:
Arduino
![A000083](/images/no-image3.png)
Part Number:
Description:
Daughter Cards & OEM Boards ARDUINO SHIELD PROTO KIT REV 3
Manufacturer:
Arduino
![A000081](/images/no-image3.png)
Part Number:
Description:
Daughter Cards & OEM Boards ARDUINO MEGA PROTO KIT REV 3
Manufacturer:
Arduino
![A000080](/images/no-image3.png)
Part Number:
Description:
Daughter Cards & OEM Boards ARDUINO MEGA PROTO PCB REV 3
Manufacturer:
Arduino
![K000007](/images/no-image3.png)
Part Number:
Description:
Development Boards & Kits - AVR ARDUINO STARTER KIT W/ UNO REV3
Manufacturer:
Arduino
![A000064](/images/no-image3.png)
Part Number:
Description:
RF Development Tools ARDUINO SHIELD WIRELESS PROTO
Manufacturer:
Arduino
Datasheet:
![A000065](/images/no-image3.png)
Part Number:
Description:
RF Development Tools ARDUINO SHIELD WIRELESS WITH SD
Manufacturer:
Arduino
Datasheet:
![A000035](/photos/15/87/158783/gettingstarted_tmb.jpg)
Part Number:
Description:
Development Software Getting started w/Arduino
Manufacturer:
Arduino
![A000031](/photos/15/88/158818/arduinoethernetshield_tmb.jpg)
Part Number:
Description:
Ethernet Modules & Development Tools Ethernet Shield for Arduino
Manufacturer:
Arduino
![LILYPAD](/photos/15/93/159314/lilypad_3_tmb.jpg)
Part Number:
Description:
MCU, MPU & DSP Development Tools LilyPad Arduino Main Board
Manufacturer:
Arduino
![A000005](/photos/24/11/241196/13t9275-30-web_tmb.jpg)
Part Number:
Description:
ARDUINO NANO Board
Manufacturer:
Arduino
Datasheet:
![A000056](/images/no-image3.png)
Part Number:
Description:
Ethernet Modules & Development Tools ETHERNET SHEILD PoE FOR ARDUINO
Manufacturer:
Arduino
Datasheet:
![A000048](/photos/18/99/189989/4243185_tmb.jpg)
Part Number:
Description:
ATMEGA328 MCU IC W/ Arduino UNO Bootloader
Manufacturer:
Arduino
Datasheet:
![X000001](/images/no-image3.png)
Part Number:
Description:
Memory Cards MICRO SD CARD 1GB WITH SD ADAPTER
Manufacturer:
Arduino