This is a simple question, and I'm almost embarrassed to ask it - but I just want a second opinion: I have an application involving the ATmega328P, for which some measurements I'm making involve noting elapsed time between pairs of interrupts. In hindsight, I should have included a crystal instead of just relying on the internal 8 MHz RC oscillator, but I'll make that change in a subsequent version of the PCB. For now, I just want the few prototypes that I already have to work sensibly with the MCU just running off the internal RC. Most of the discussion out there on AVR RC oscillator calibration centers on setting OSCCAL to a better value than what was included in the so-called factory cal - which, to my dismay, apparently has a +/-10% tolerance for the 328P! My question is, given that I have the means to measure the RC oscillator frequency, wouldn't it be better to just make that measurement and define F_CPU to be that value in my code? Again, I only need to do this a few times in order to facilitate more detailed lab testing of my initial prototypes. I understand, of course, that the RC is both temperature and Vcc dependent, but I'll live with that for now in favor of simply improving on the lame factory cal. Next time, I'll just add the external crystal and bypass caps.
Thanks,
Jim