Q about OCF2: Output Compare Flag 2

hi,

I'm confused about the language in the (Atmega8A) OCF2: Output Compare Flag 2 description:

• Bit 7 – OCF2: Output Compare Flag 2
The OCF2 bit is set (one) when a Compare Match occurs between the Timer/Counter2 and the data in OCR2 –
Output Compare Register2. OCF2 is cleared by hardware when executing the corresponding interrupt Handling
Vector. Alternatively, OCF2 is cleared by writing a logic one to the flag.

Is that not the same thing? How can it be cleared by writing a 1 to the bit?

  TIFR = (1 << OCF2);

Note: Do not use a bitwise-or. A simple assignment is correct.

How can it be cleared by writing a 1 to the bit?

That's the way the latch is wired to the bus. A write cycle with a one clears the latch.

does this exception apply only to the TIFR register?

I think you should learn to fish. When you can answer the following questions you will be able to answer your question for yourself...

Why should a simple assignment be used to clear the OCF2 flag? What is wrong with using a bitwise-or?

Wrong in the sense that it will change the execution of the program or that it is simply unnecessary?

ok, found it. A tricky one. They should have made a note in the datasheet.

Excellent job researching!