Frequency counter

I want to use pin change interrupt pins on attiny85 to count the pulse frequency. I want to count upto 100 Khz with accuracy of 1Hz. I want to use software delays for gate time.

I could have used counters to count pulse frequency but T0 pin of attiny85 is also SCL pin, and I want to send frequency through I2C to Raspberry pi.

So, I have to use external interrupts to do counting with software delays.
Has anyone did this. Is it possible. Please give lead on this.

You realize that you'll need a crystal to get the frequency accurate enough - all timekeeping is based off of the system clock, but it's only spec'ed to +/- 10% IIRC. Even tuned, it's only within 1-2%.

2 pins for XTal and 2 pins for I2C means you only have one pin left - is this enough? If not, you can switch to an attiny84 (and use timer1 to count the pulses)

Ya, I did that, I used timer1 to count gate time but still error around 60Khz is Around 5Hz and its varying in range of 5Hz. I want accuracy upto 1Hz for all frequency. And I want to use two pins extra, so I cannot external clock.
Please help.....
Or suggest another avr microcontroller with atmost 10 pins.

Tiny 84 is probably the best choice in the AVR line. if you absolutely need two more pins. If your need can be satisfied by an analog input, you can use about half-range of the Reset pin of the Tiny 85, and keep the reset function.

ChrisTenone:
Tiny 84 is probably the best choice in the AVR line.

Tiny841 is generally better than 84 for about the same price, but he doesn't need any of the features (it's tighter internal oscillator spec still isn't nearly good enough, your application doesn't sound like you'd have any use for the serial ports, nor the extra 16-bit timer or fancy ADC modes)

Actually, I just realized, you cant just use a cheapo basic crystal to get 1hz out of 100,000 - that's 10 ppm, about as good as you can get! Most crystals aren't that good....