Timer Fundamental: DIff. between OCR1A and OCR1B

Hi Everyone,

I have trying to learn timer fundamentals of Arduino and I am currently working with the following code from
http://letsmakerobots.com/node/28278. My questions are:

  1. what is the difference OCR1A and OCR1B? Why OCR1A is used here instead of OCR1B? And, why there are two of those registers which are apparently possess the same functionality? Is there an example where both of these are used?

  2. Instead of asking this question here, some may advice that I change the code and use OCR1B and see myself what happens? But I am not sure how to analyze the result. Like is there a graphical tool where I can see time evolution plot of various register?
    Thanks
    Bu

/* Arduino 101: timer and interrupts
   1: Timer1 compare match interrupt example 
   more infos: http://www.letmakerobots.com/node/28278
   created by RobotFreak 
*/

#define ledPin 13

void setup()
{
  pinMode(ledPin, OUTPUT);
  
  // initialize timer1 
  noInterrupts();           // disable all interrupts
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1  = 0;

  OCR1A = 31250;            // compare match register 16MHz/256/2Hz
  TCCR1B |= (1 << WGM12);   // CTC mode
  TCCR1B |= (1 << CS12);    // 256 prescaler 
  TIMSK1 |= (1 << OCIE1A);  // enable timer compare interrupt
  interrupts();             // enable all interrupts
}

ISR(TIMER1_COMPA_vect)          // timer compare interrupt service routine
{
  digitalWrite(ledPin, digitalRead(ledPin) ^ 1);   // toggle LED pin
}

void loop()
{
  // your program here...
}

You need to read the datasheet for the 328p, section 15, "16-bit Timer/Counter1 with PWM"
for all the intricacies of the 16 different operating modes. OCR1A and 1B are not treated
the same in all modes.

For the PWM generation modes each register controls one PWM channel (pins 9 and 10).

Here I think you can use 1B instead as there are two interrupt bits in TIMSK1
for 1A and 1B compare matches - and two different ISRs.