111
8018P–AVR–08/10
ATmega169P
The following code examples show how to do an atomic write of the TCNT1 Register contents.
Writing any of the OCR1A/B or ICR1 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 TCNT1.
15.3.1
Reusing the Temporary High Byte Register
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.
15.4
Timer/Counter Clock Sources
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 (CS12:0) bits
located in the Timer/Counter control Register B (TCCR1B). For details on clock sources and
Assembly Code Example
TIM16_WriteTCNT
1:
; Save global interrupt flag
in
r18,SREG
; Disable interrupts
cli
; Set TCNT
1 to r17:r16
out
TCNT
1H,r17
out
TCNT
1L,r16
; Restore global interrupt flag
out
SREG,r18
ret
C Code Example
void
TIM16_WriteTCNT
1( unsigned int i )
{
unsigned char
sreg;
unsigned int
i;
/* Save global interrupt flag */
sreg = SREG;
/* Disable interrupts */
__disable_interrupt();
/* Set TCNT
1 to i */
TCNT
1 = i;
/* Restore global interrupt flag */
SREG = sreg;
}
相关PDF资料
ATMEGA169P-16MCU MCU AVR 16K ISP FLSH 16MHZ 64QFN
AT91SAM7XC256-CU MCU ARM 256K HS FLASH 100-TFBGA
PIC16LF874A-I/P IC MCU FLASH 4KX14 EE A/D 40DIP
PIC16F84-10/SO IC MCU FLASH 1KX14 EE 18SOIC
AT91SAM7XC128-CU MCU ARM 128K HS FLASH 100-TFBGA
PIC18F2458-I/SO IC PIC MCU FLASH 12KX16 28SOIC
PIC18F4455-I/P IC PIC MCU FLASH 12KX16 40DIP
AT91SAM7X256-CU MCU ARM 256K HS FLASH 100-TFBGA
相关代理商/技术参数
ATMEGA169PV-8MU 功能描述:8位微控制器 -MCU AVR 16K FLASH 512B EE 1K SRAM 5V RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
ATMEGA169PV-8MU SL383 制造商:Atmel Corporation 功能描述:MCU 8BIT ATMEGA RISC 16KB FLASH 2.5V/3.3V/5V 64PIN MLF - Tape and Reel
ATMEGA169PV-8MU 制造商:Atmel Corporation 功能描述:IC 8BIT MCU AVR MEGA 8MHZ 64-QFN
ATMEGA169PV-8MUR 功能描述:8位微控制器 -MCU AVR LCD 16KB FLSH EE 512B 1KB SRAM-8MHZ RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
ATMEGA169V 制造商:ATMEL 制造商全称:ATMEL Corporation 功能描述:8-bit Microcontroller with 16K Bytes In-System Programmable Flash
ATMEGA169V_06 制造商:ATMEL 制造商全称:ATMEL Corporation 功能描述:8-bit Microcontroller with 16K Bytes In-System Programmable Flash
ATMEGA169V-1AC 功能描述:IC MCU 8BIT 16KB FLASH 64TQFP 制造商:microchip technology 系列:AVR? ATmega 包装:托盘 零件状态:停產 核心处理器:AVR 核心尺寸:8-位 速度:1MHz 连接性:SPI,UART/USART,USI 外设:欠压检测/复位,LCD,POR,PWM,WDT I/O 数:53 程序存储容量:16KB(8K x 16) 程序存储器类型:闪存 EEPROM 容量:512 x 8 RAM 容量:1K x 8 电压 - 电源(Vcc/Vdd):1.8 V ~ 5.5 V 数据转换器:A/D 8x10b 振荡器类型:内部 工作温度:0°C ~ 70°C 封装/外壳:64-TQFP 供应商器件封装:64-TQFP(14x14) 基本零件编号:ATmega169 标准包装:160
ATMEGA169V-1AI 制造商:ATMEL 制造商全称:ATMEL Corporation 功能描述:8-bit AVR Microcontroller with 16K Bytes In-System Programmable Flash