Go Down

Topic: Need help with no prescale timer settings (Read 2336 times) previous topic - next topic


Greets to all!

I've been working thru the Atmel 328 manual studying the timers, and seem to have a fair understanding of most of the registers and settings. One that is giving me a bit of confusion is the setting for "0 Prescale".  From the datasheet it says on all 3 counters that this should provide CLK_io which I take to be the 16mhz on the Arduino Uno.

I am only studying interrupts and have a scope set for rise-to-fall period measurements.  With zero prescale I'm expecting to get a 62.5 nano-sec pulse - but what I'm seeing is much slower.  I've tried on all 3 timers... and still never see that 16mhz period.  Obviously I've missed a very important concept along the way.  All the other timer/prescale settings work in a fairly predictable manner - just the PS0 is bumming me out!   Any ideas?    :~

=Alan R.
The completion date of a software project is 2 weeks from any given date.


You can't expect an ISR to operate in one instruction cycle.

Show your code and perhaps someone can suggest ways to improve it.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


I don't think there is any real coding help needed (not to be smug!) - I have any number of common sketches that demo setting up ISR's and timers and just edit either the OCRxA value when prescaleing, and also have all the Prescale bit settings in place, commented out.  I just uncomment the one I want to try.  Most work fine and as expected.

I guess I just need some clarification as what to expect when using any TTCRxA/B with bit 1 set to 1. In all 3 timers this setting is called "No Prescale - CLK_io"  (in Timer2 it is CLK_t2s - where I believe it is set to use the system clock (16mhz) as the input.

I'm just trying to fully understand all the possibilities - I do understand a 62.5 ns interrupt might be a tad quick (!!!) but then what SHOULD one expect with this setting?

What would it be used for?  Finally - what would be the settings for the shortest, practical interrupt be?

The completion date of a software project is 2 weeks from any given date.


I may have uncovered my error!  With further searches I've found that when there is no Prescale, the only interrupt that can happen when either an 8b (255 ticks) or a 16b (65535 ticks) OVERFLOWS.  Thus the shortest NON-PRESCALED interrupt would be with either of the 8B counters with a 15.938 uSecond period or pulse.  With the 16 bit Timer1 you would get 62.5 nano secs X 65535 (xFFFF  of the 16-bit timer) or 4.096 milliseconds.

Naturally by prescaling you get far more control.  Can anybody confirm this thinking?

=Alan R.
The completion date of a software project is 2 weeks from any given date.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131