I am trying to program timer one on an ATTINY84. I found the avr folder (C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include) and all sorts of useful functions inside it. One of the folders helps with interrupts which includes the timer interrupts.
To start out I want to blink the led using the timer one interrupt. What does the 1<<xxxxx syntax do? I see this in other peoples code, but I do not understand it.
Here is a code snippet I found online. I do not understand the bottom 5 lines with the << syntax. I know that << is a shift operator, however I do not understand why it is followed by a register or bit.
//set timer1 interrupt at 1Hz
TCCR1A = 0;// set entire TCCR1A register to 0
TCCR1B = 0;// same for TCCR1B
TCNT1 = 0;//initialize counter value to 0
// set compare match register for 1hz increments
OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
// turn on CTC mode
TCCR1B |= (1 << WGM12);
// Set CS12 and CS10 bits for 1024 prescaler
TCCR1B |= (1 << CS12) | (1 << CS10);
// enable timer compare interrupt
TIMSK1 |= (1 << OCIE1A);
(where the snippet came from)
I would have used timerOne.h however it comes up with an error when I use an attiny84 instead of an Atmega328. At the moment I am using the internal 8MHz clock and p7 for my led. I am debugging using the ATMEGA328 since many of the registers are the same and it supports Serial.print().