Pages: [1]   Go Down
Author Topic: Need help with no prescale timer settings  (Read 1105 times)
0 Members and 1 Guest are viewing this topic.
Lindenwold, NJ USA
Offline Offline
Jr. Member
**
Karma: 2
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?    smiley-confuse

=Alan R.
Logged

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

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Show your code and perhaps someone can suggest ways to improve it.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Lindenwold, NJ USA
Offline Offline
Jr. Member
**
Karma: 2
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

=A.
Logged

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

Lindenwold, NJ USA
Offline Offline
Jr. Member
**
Karma: 2
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

Pages: [1]   Go Up
Jump to: