Pages: 1 2 [3]   Go Down
Author Topic: Analog Comparator falling edge setup  (Read 3174 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am concerned that the atmega328p datasheet provides (as far as I can tell) no data on the speed of the analog comparator, so there is no telling whether it is fast enough for this application.
I was concerned about that as well, but I'll try and report back.

As far as the circuit itself is concerned, I understand how it works and will use a similar setup. I know there are other ways with less hardware but this project is not intended for sale or anything, mainly just to use Atmega328 features I haven't used before(like the comparator) and understand how they work. And to have a working ESR-meter in the end smiley-wink

@dhenry
I'd be interested in the code and schematic as well, but I'll implement it the other way.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When you are done, come back and we can compare notes then.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When you are done, come back and we can compare notes then.

You know the schematic, and the code is pretty easy
Code:
ISR(TIMER2_COMPA_vect){                        // every 500µs
  bitWrite(PORTD, 3, 0);                          // Disable discharge
  bitWrite(PORTD, measurementRange, 0); // Pulse
  delayMicroseconds(7);                           // The pulse width should be around 8µs
  bitWrite(PORTD, measurementRange, 1); // Stops the pulse
  bitWrite(PORTD, 3, 1);                         // Enable discharge
}

ISR(ANALOG_COMP_vect){ // Comparator interrupt
  compareCounter++;
}

In the lowest range, every pulse is 10mΩ. In the middle range 100mΩ and 1Ω in the high range.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What about your code and setup?
« Last Edit: December 14, 2012, 10:09:18 am by daywalkerdha » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In the lowest range, every pulse is 10mΩ. In the middle range 100mΩ and 1Ω in the high range.

Great. Please let us know how that's working out for you.

Logged

Pages: 1 2 [3]   Go Up
Jump to: