11.07.2015 Views

ATMega chip full datasheet - UCSD Department of Physics

ATMega chip full datasheet - UCSD Department of Physics

ATMega chip full datasheet - UCSD Department of Physics

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ATmega48A/PA/88A/PA/168A/PA/328/PFigure 16-1. 16-bit Timer/Counter Block Diagram (1)CountClearDirectionControl Logicclk TnTOVn(Int.Req.)Clock SelectEdgeDetectorTnTOPBOTTOMTimer/CounterTCNTn== 0( From Prescaler )OCnA(Int.Req.)=WaveformGenerationOCnAOCRnADATA BUS=OCRnBFixedTOPValuesICFn (Int.Req.)OCnB(Int.Req.)WaveformGenerationOCnB( From AnalogComparator Ouput )ICRnEdgeDetectorNoiseCancelerICPnTCCRnATCCRnBNote: 1. Refer to Figure 1-1 on page 2, Table 14-3 on page 84 and Table 14-9 on page 90 forTimer/Counter1 pin placement and description.16.2.1 RegistersThe Timer/Counter (TCNT1), Output Compare Registers (OCR1A/B), and Input Capture Register(ICR1) are all 16-bit registers. Special procedures must be followed when accessing the 16-bit registers. These procedures are described in the section ”Accessing 16-bit Registers” onpage 117. The Timer/Counter Control Registers (TCCR1A/B) are 8-bit registers and have noCPU access restrictions. Interrupt requests (abbreviated to Int.Req. in the figure) signals are allvisible in the Timer Interrupt Flag Register (TIFR1). All interrupts are individually masked withthe Timer Interrupt Mask Register (TIMSK1). TIFR1 and TIMSK1 are not shown in the figure.The Timer/Counter can be clocked internally, via the prescaler, or by an external clock source onthe T1 pin. The Clock Select logic block controls which clock source and edge the Timer/Counteruses to increment (or decrement) its value. The Timer/Counter is inactive when no clock sourceis selected. The output from the Clock Select logic is referred to as the timer clock (clk T1 ).The double buffered Output Compare Registers (OCR1A/B) are compared with the Timer/Countervalue at all time. The result <strong>of</strong> the compare can be used by the Waveform Generator togenerate a PWM or variable frequency output on the Output Compare pin (OC1A/B). See ”Out-8271D–AVR–05/11116

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!