Note that there are some explanatory texts on larger screens.

plurals
  1. POAVR Analog Comparator + Internal Pullup?
    text
    copied!<p>I have what I hope is a simple question pertaining to the Atmel AVR microcontrollers. So I want to use the ATTiny85's Analog Comparator to determine if a signal is above or below a threshold. This signal is normally "floating" and <strong>pulled toward ground</strong> when "active" (i.e. it's an active low - open collector signal). If I enable the pullup on the input pin (which is also the comparator input) by doing:</p> <pre><code>DDRB = 0x00; // DDRB.1 = 0 = input PORTB = 0xFF; // PORTB.1 = 1 = internal pullup enabled </code></pre> <p>If i use the analog comparator and select PORTB.1 as AIN1 will the internal pullup be applied to my input signal? I'm hoping someone has personal experience to verify this behavior. Hope this question isn't too 'hardware-oriented' for stack-overflow. Thanks!</p> <p><strong>EDIT</strong> In response to some of the comments below to the effect of "why not treat it digitially", it's because my "signal" is generated by a sensor (namely an optical IR sensor). I can't be assured that it will pull down "hard enough" to be interpretted as a zero digitally, so I'm going to use the internal 2.56V reference as my switching threshold. I'm just trying to pick up the "IR event," so this seemed the simplest way to me.</p> <p>Also, by using the analog comparator, I can detect the event "asynchronously" using an ISR. Granted some of the pins can invoke an interrupt on a digital edge, but the one don't want to rely on the response to dip below V_IL.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload