Timer1 Single Execution

Wow, I'll be studying this all day!

I'm guessing you're asleep now, but here are just a few quick questions:

  1. It appears you're using pin 9 just as a generic output pin, and not as the hardware output pin of Timer1. Is that because of the loop design of your interrupt routine, and the PWM toggling of the timer hardware pin would not work? I understood it was more accurate to use a hardware output pin, which doesn't require the overhead of a call to "digitalWrite()". Would your design be just as accurate with any output pin?

  2. Why do you change the LED pin to an input pin inside the interrupt function?

  3. If you have the time, could you run a test at a few longer intervals, like 1,000us, 10,0000us, 100,000us and 1,000,000us, to see if the error you showed (+/-3us) multiples also? If it stays within 5-6us at longer times, I think this accuracy may be OK. It doesn't matter if the actual shutter period is different from what you asked for (11us vs 12.5us). It matters that each successive iteration be consistent with each other, so there is no flicker in the camera motion capture. I don't expect to be shuttering under 50us, probably not under 100us. It is also critical that the timer always shut off when it is supposed to, which it appears your interrupt has achieved.

  4. What is that Oscilliscope you've got? It is a Windows based system? I think I need it, and I don't want to wait until Christmas! Are they affordable?

  5. Last time I posted, you sent to a link to your own forum with an explanation of hardware timers. It was very helpful. Is there a link that explains the programming of the Atmel AVR registers that a weekend warrior can understand? Something like "Atmel Timers For Dummies."

I'll be playing around with your code today and post again this evening (after you've had your breakfast).

You really spent a lot of time on this. Thank God there are gurus like you out there who give back so much to others. If it weren't for people like you on this site, as well as the OpenGL and Visual Studio forums, my project would never be possible.

Until tonight....