Datasheet
2018 Microchip Technology Inc. Data Sheet Complete DS40002060A-page 83
ATtiny4/5/9/10
Timer/Counter unit are: Normal mode (counter), Clear Timer on Compare match (CTC) mode, and three types of Pulse
Width Modulation (PWM) modes. (“Modes of Operation” on page 71).
12.11.2 TCCR0B – Timer/Counter0 Control Register B
• Bit 7 – ICNC0: Input Capture Noise Canceler
Setting this bit (to one) activates the Input Capture Noise Canceler. When the noise canceler is activated, the input from the
Input Capture pin (ICP0) is filtered. The filter function requires four successive equal valued samples of the ICP0 pin for
changing its output. The Input Capture is therefore delayed by four oscillator cycles when the noise canceler is enabled.
• Bit 6 – ICES0: Input Capture Edge Select
This bit selects which edge on the Input Capture pin (ICP0) that is used to trigger a capture event. When the ICES0 bit is
written to zero, a falling (negative) edge is used as trigger, and when the ICES0 bit is written to one, a rising (positive) edge
will trigger the capture.
When a capture is triggered according to the ICES0 setting, the counter value is copied into the Input Capture Register
(ICR0). The event will also set the Input Capture Flag (ICF0), and this can be used to cause an Input Capture Interrupt, if
this interrupt is enabled.
When the ICR0 is used as TOP value (see description of the WGM03:0 bits located in the TCCR0A and the TCCR0B Reg-
ister), the ICP0 is disconnected and consequently the Input Capture function is disabled.
Table 12-5. Waveform Generation Modes
Mode
WGM
0
3:0 Mode of Operation TOP
Update of
OCR0x at
TOV0 Flag
Set on
0 0000 Normal 0xFFFF Immediate MAX
1 0001 PWM, Phase Correct, 8-bit 0x00FF TOP BOTTOM
2 0010 PWM, Phase Correct, 9-bit 0x01FF TOP BOTTOM
3 0011 PWM, Phase Correct, 10-bit 0x03FF TOP BOTTOM
4 0100 CTC (
Clear Timer on Compare) OCR0A Immediate MAX
5 0101 Fast PWM, 8-bit 0x00FF TOP TOP
6 0110 Fast PWM, 9-bit 0x01FF TOP TOP
7 0111 Fast PWM, 10-bit 0x03FF TOP TOP
8 1000 PWM, Phase & Freq. Correct ICR0 BOTTOM BOTTOM
9 1001 PWM, Phase & Freq. Correct OCR0A BOTTOM BOTTOM
10 1010 PWM, Phase Correct ICR0 TOP BOTTOM
11 1011 PWM, Phase Correct OCR0A TOP BOTTOM
12 1100 CTC (
Clear Timer on Compare) ICR0 Immediate MAX
13 1101 (Reserved) – – –
14 1110 Fast PWM ICR0 TOP TOP
15 1111 Fast PWM OCR0A TOP TOP
Bit 7 6 5 4 3 2 1 0
0x2D ICNC0 ICES0
– WGM03 WGM02 CS02 CS01 CS00 TCCR0B
Read/Write R/W R/W R R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0