1) TCCR0A = 0;// set entire TCCR0A register to 0.
2) TCCR0B = 0;// set entire TCCR0B register to 0.
understand line 1 & 2 that both registers are set to 0.
but not clear how the CTC mode turn on with code used in line#3. as the entire TCCR0A = 0x00;
for CTC mode WGM01 = 1; but i don't know the default WGM01 bit state. if WGM01 in TCCR0A is 0
then "how the left bits shift operator along with bitwise OR operator change WGM01 = 0 to WGM01 = 1" which is for CTC mode turning on.
same is the case for below line#4 h registers are set to = 0x00;
// turn on CTC mode
3) TCCR0A |= (1 << WGM01);
// Set CS01 and CS00 bits for 64 prescaler
4) TCCR0B |= (1 << CS01) | (1 << CS00);
WGM01, CS01, CS00, and OCIE0A are names of individual bits in the corresponding 8 bit registers. Each of these bits is defined as a number from 0 to 7 that corresponds to the bit in the register it represents. This is defined in an #include file for the appropriate microcontroller. So shifting 1, WGM01 times places a 1 in that bit location in the TCCR0A register. If one looks at the assembler code that the C compiler generates from this line, it will show that it may have used a set bit instruction to set the bit number assigned to WGM01, rather than using a shift instruction. Using shift is C's way of saying to set an individual bit.
So shifting 1, WGM01 times places a 1 in that bit location in the TCCR0A register. If one looks at the assembler code that the C compiler generates from this line, it will show that it may have used a set bit instruction to set the bit number assigned to WGM01, rather than using a shift instruction. Using shift is C's way of saying to set an individual bit.
it tells us that shifting a bit 1 place in C language set the corresponding bit in timer0A or timer0B
mean that "TCCR0A |= (1 << WGM01)" set it to WGM01 = 1; if this the case will it may not be more simple to
code it as TCCR0A = 0x02; ?
Yes, it is more simple. The trade off is that using the shift method with the name of the bit shows the name of the bits you are setting. One could include the explanation in comments instead to indicate this.