
90
ATtiny40 [DATASHEET]
8263B–AVR–01/2013
The Output Compare Register B contains an 8-bit value that is continuously compared with the counter value
(TCNT1L in 8-bit mode and TCNTH in 16-bit mode). A match can be used to generate an Output Compare
interrupt.
In 16-bit mode the OCR1B register contains the high byte of the 16-bit Output Compare Register. To ensure that
both the high and the low bytes are written simultaneously when the CPU writes to these registers, the access is
performed using an 8-bit temporary high byte register (TEMP). This temporary register is shared by all the other
12.10.6
TIMSK – Timer/Counter1 Interrupt Mask Register
Bit 7 – ICIE1: Timer/Counter1, Input Capture Interrupt Enable
When this bit is written to one, and the I-flag in the Status Register is set (interrupts globally enabled), the
35.) is executed when the ICF1 flag, located in TIFR, is set.
Bit 6 – Res: Reserved Bit
This bit is reserved and will always read as zero.
Bit 5 – OCIE1B: Timer/Counter1 Output Compare Match B Interrupt Enable
When the OCIE1B bit is written to one, and the I-bit in the Status Register is set, the Timer/Counter Compare
Match B interrupt is enabled. The corresponding interrupt is executed if a Compare Match in Timer/Counter occurs,
i.e., when the OCF1B bit is set in the Timer/Counter Interrupt Flag Register – TIFR1.
Bit 4 – OCIE1A: Timer/Counter1 Output Compare Match A Interrupt Enable
When the OCIE1A bit is written to one, and the I-bit in the Status Register is set, the Timer/Counter1 Compare
Match A interrupt is enabled. The corresponding interrupt is executed if a Compare Match in Timer/Counter1
occurs, i.e., when the OCF1A bit is set in the Timer/Counter 1 Interrupt Flag Register – TIFR1.
Bit 3 – TOIE1: Timer/Counter1 Overflow Interrupt Enable
When the TOIE1 bit is written to one, and the I-bit in the Status Register is set, the Timer/Counter1 Overflow inter-
rupt is enabled. The corresponding interrupt is executed if an overflow in Timer/Counter1 occurs, i.e., when the
TOV1 bit is set in the Timer/Counter 1 Interrupt Flag Register – TIFR1.
12.10.7
TIFR – Timer/Counter1 Interrupt Flag Register
Bit 7 – ICF1: Timer/Counter1, Input Capture Flag
This flag is set when a capture event occurs on the ICP1 pin. When the Input Capture Register (ICR1) is set to be
used as the TOP value, the ICF1 flag is set when the counter reaches the TOP value.
ICF1 is automatically cleared when the Input Capture Interrupt Vector is executed. Alternatively, ICF1 can be
cleared by writing a logic one to its bit location.
Bit
76543210
ICIE1
–
OCIE1B
OCIE1A
TOIE1
OCIE0B
OCIE0A
TOIE0
TIMSK
Read/Write
R/W
R
R/W
Initial Value
00000000
Bit
76543210
ICF1
–OCF1B
OCF1A
TOV1
OCF0B
OCF0A
TOV0
TIFR
Read/Write
R/W
R
R/W
Initial Value
00000000