[FIXED]ATMEGA168 - TMR/CTR1 Clock prescaler - not 128 :(

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Having done a fantastic piece of design work for measuring an input pulse frequency using the Input Capture Pin, written some code and tested it in Studio4 - I find that CLCKio/128 is not a valid value for the clock select for TMR/CTR1 :(

/256 doesn't give the resolution I require and /64 overflows the timer at the lower input frequencies.

What's the EASIEST way round this?
TIA
Martin

Last Edited: Mon. Feb 8, 2010 - 08:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

/64 and count the overflows in a variable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you can accept it, you can double the system-clock-prescaler.

/Martin.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

/64 and counting the overflows. Sorted ;)

Wish Atmel hadn't left out /128 though - seems no logic to it

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Which other pre-scale value would you drop to put in 128?

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Wish Atmel hadn't left out /128 though - seems no logic to it

What about /2 and /4 and /16 and /32 and /512? Is /128 somehow more logical than those numbers?

Note that Tiny15/26/261 family, and Tiny25 family,have "14-bit prescalers" and a 4-bit prescaler selection. Those are, however, on 8-bit timers.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.