[Solved] Using Timer1 to count external source and generate waveform

I'm trying to use the counter on the Arduino to take a signal and divide its frequency down. Ie, generate a 10kHz signal from a 1MHz input, etc. From reading through the ATmega328P datasheet, it seems like I should be able to do this right at the hardware level.

I've posted my code below. Timer1 is reading the input signal correctly and returning to 0 when it hits the ISR1 value. However, pin 9 (PB1) doesn't seem to be being toggled. I want pin 9 to output the state of OC1A, which if I understand correctly should be toggling with every rising edge of the input on pin 5.

Any help with this would be greatly appreciated!

void setup(){
pinMode(9,OUTPUT);


TCCR1A=0; //Reset control registers for Timer 1
TCCR1B=0;

cbi(TCCR1A,WGM10);
sbi(TCCR1A,WGM11);
sbi(TCCR1B,WGM12); //Fast PWM with ICR1 as TOP
sbi(TCCR1B,WGM13);

sbi(TCCR1A,COM1A0); //Toggle pin 9 on compare
cbi(TCCR1A,COM1A1);  

sbi(TCCR1B,CS10); //External clock source on pin 5
sbi(TCCR1B,CS11);
sbi(TCCR1B,CS12);

ICR1=100;

TCNT1=0;


}

void loop(){
delay(10);
}

I just thought I'd try to clarify the issue a bit further, in case I wasn't clear enough in my original post.

My desire is to generate a lower frequency output based on a higher frequency input. I'm using Timer/Counter 1 to do this on the ATmega328p in the Duemilanove I have. It is my understanding from the datasheet that, in the Fast PWM mode, I should be able to accomplish this on a hardware level within the chip by having the counter look at ISR1 for the TOP value to compare against and using that compare match to toggle OC1A which can be tied to digital pin out 9.

As it stands, the counter is operating as expected in so far as it's counting the input pulses and and resetting to 0 when it reaches the value input for ISR1. However, I'm having difficulty getting the output to di/o pin 9 to work as I hope. The datasheet says that PB1 (pin 9) needs to be set as output, and that outputting OC1A to PB1 is an alternate function. It was my understanding that by setting the pinMode to output and by setting the two appropriate bits in TCCR1A that the 328p would understand to toggle the arduino pin 9 every time the counter had a compare match with ISR1. Unfortunately this is not the case, and pin 9 is behaving exactly like the other digital i/o pins. I suspect there's a simple gap in my understanding of how to set up pin 9 as an output tied to OC1A.

Any help would be greatly appreciated, I've been racking my brains the past few days on this one, and since I'm still pretty new to this arduino stuff I suspect there's something simple I'm overlooking. Thank you

i'm trying to do something similar to what you describe and was curious as to whether you ever resolved the issue or took a different approach altogether. were you able to get it functioning as you hoped, and if so, would you mind elucidating?