## Input pin voltage threshold and hysteris statement.

28 posts / 0 new
Author
Message

I want to say the following about Input pin voltage threshold and hysteris:

Quote:
Looking at the ATmega328 data sheet we see that for the I/O pin to read 1 when the Vcc is 5 volts the input voltage level should be about 2.6 volts. For the pin to indicate 0 with a Vcc of 5 volts then the input voltage should be less than about 2.1 volts. So at 5 volts we have a hysteresis of about 0.5 volts. At 3.3 volts these values would be about 1.6 volts for a 1, about 1.25 for a 0, with about 0.35 volts hysteresis. Why do I keep saying "˜about'? That is so you won't memorize these figures and think you know how to generate a 1 or 0 on an input pin. Ask yourself: when have you ever gotten exactly 5 or 3.3 volts for Vcc? What if you are using batteries and you've got 3.2 volts one day and 2.7 a month later? What I'm saying is that you need to consider these thresholds and hysteresis values as ballpark for your application and make sure you've got some extra voltage if you want to be sure you've got a 1 and that you take it down lower than the indicated low to assure that you are getting a 0. So to be safe lets say that for a 5 volt system you should assure an input of greater than 3 volts to get a 1 and less than 2 volts to assure a 0. If you are on a battery then try to estimate the minimum voltage you are likely to have that will keep the system running, lets say 1.8 volts so for that you'd want greater than 1 volt for a 1 and less than 0.5 for a 0. When in doubt, refer to the pin threshold and hysteresis charts in the datasheet.
Am I going to get yelled at? Well of course, but is this substantially correct?

Smiley

Well, regarding AVRs and perhaps other CMOS devices maybe, you are right.

I really had to read the datasheet if AVR inputs really have hysteresis. They do, so you are absolutely correct.

Not all chips or microcontrollers say anything about hysteresis, they might or might not have hysteresis. They could just have a band of uncertainty whether it is a 0 or 1 or whether such halfway voltage will eventually burn the input CMOS buffer when both the P-fet and N-fet conducts power supply current to ground. The limits are just there to say that everything over this is 1 and everything under this is 0.

But not all chips utilize CMOS voltage levels. Some have TTL compatible levels, where everything over 2.0V on input is considered high and everything under 0.8V on input is considered low. So definitely here your statement that everything over 3V is high and everything under 2V is low (in a 5V system) is then invalid if another chip uses TTL compatible levels. What makes these TTL levels popular is that the same threshold levels are used in 5V and 3.3V systems, so they do not scale (at least much) with supply voltage.

So this means a microcontroller with 3.3V supply voltage can drive an input of a TTL compatible chip, no matter if that chip uses 3.3V or 5V as supply voltage. But a 3.3V micro can only drive CMOS compatible input that uses 3.3V supply. And 5V micro can drive either type input if it has 5V supply, and sometimes the inputs are 5V tolerant even at 3.3V supply.

Quote:

for the I/O pin to read 1 when the Vcc is 5 volts the input voltage level should be about 2.6 volts. For the pin to indicate 0 with a Vcc of 5 volts then the input voltage should be less than about 2.1 volts.

Where do your 2.6V and 2.1V come from? I though '1' was above 0.7*Vcc and '0' was below 0.3*Vcc? For 5V that would be 3.5V and 1.5V

Cliff

It says right so in the AVR datasheet, in IO pin electrical specification curves (don't have it open now).

You are too fixed on normal 74HC and other CMOS chip specifications which do say 70% and 30%, which have the threshold around 50%.

I guess I was miseld by entries such as this (m164... data):

```Table 25-10.        2-wire Serial Bus Requirements

Symbol        Parameter                                                             Condition                          Min                  Max            Units

VIL           Input Low-voltage                                                                                        -0.5               0.3VCC

VIH           Input High-voltage                                                                                     0.7VCC              VCC + 0.5 ```

True, but those voltages come from the I2C specification, that is the worst case limits every device on bus must work with.

The AVR clearly has much better specification, as at 5V vilmax is 0.42*Vcc=2.1V and vihmin is 0.52*Vcc=2.6V.

This reminds me that it can cause timing problems with slowly rising signals like on I2C. One device might see logic 1 earlier than another device, so extra waiting time may be needed that all devices see logic high long enough. But that is why the voltages on bus are specified, so that all the devices with different thresholds within the specification can work on the same bus.

Quote:
the input voltage level should be about 2.6 volts.

Typo? should be above ...

JC

Last Edited: Thu. Jul 28, 2011 - 02:42 PM

Once again it appears that the "easy" questions aren't always so easy to answer...

(Note that I'm not here to provide enlightenment, just here to toss in a comment or two.)

The 0.3*Vcc and 0.7*Vcc aren't just in the I2C spec. In the Mega168 data sheet, Electrical Characteristics, Section 28.2 DC Characteristics, at 5 V the values are:

Input High Voltage: > 0.6 * Vcc
Input Low Voltage: < 0.3 * Vcc

(for general I/O pins, excludes Reset\ and Xtal pins)

The 0.6 * Vcc surprised me, for I have quoted 0.7 * Vcc previously on the forum when this topic was discussed.

I guess Smiley has to decide if he is writing this for N&Vs, or for a chip design class. Different audiences, and different levels of understanding.

JC

Quote:

I though '1' was above 0.7*Vcc and '0' was below 0.3*Vcc?

And in all the posts above, there is the implied "guaranteed". (Smiley did toss in "assure" at some point.)

In practice I haven't seen it come up much. It might be a concern as Smiley mentioned on a battery system with varying supply voltage, and an input signal that doesn't get close to 0V. Say 1V. Now if the battery supply drops that 1V now may be a level at which a low reading is not guaranteed.

In practice I don't think I've ever run into that as a problem. But I have only a handful of battery apps.

Quote:
Notes: 1. "Max" means the highest value where the pin is guaranteed to be read as low
2. "Min" means the lowest value where the pin is guaranteed to be read as high

Oh, yeah--there was an app of mine where I did indeed do some experimenting with logic high/low thresholds. Short result (on a Mega88P) is that there is hysteresis but it was narrow. (And when playing with voltages from time to time one >>could<< get into the "conducting both ways" and the current draw went up.) The reason for the experiment was to determine if pin-change could be used to detect changing levels in a pulse stream or whether the analog comparator must be used. The "trigger" level was about half Vcc anyway and the incoming signal swung close to the rails--no practical difference either way except pin-change/logic-level doesn't require the compare voltage to be set up saving a pin and components, and also allows more flexibility in choice of input pin(s).

Lee

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.

Quote:

The 0.6 * Vcc surprised me, for I have quoted 0.7 * Vcc previously on the forum when this topic was discussed.

LOL--must have been discussing AT90Sxxxx
Quote:
VIH Input High Voltage Except (XTAL, RESET)0.7 VCC

where .3/.7 was typical.

But also take a peek at the omnibus Mega164PA family datasheet. .2/.7 for low supply voltage range and .3/.6 for higher supply voltages. Now, do you really think that is a 0.2V difference in the logic-low (or -high) "trip" point when the supply voltage changes from 2.39V to 2.41V? :twisted:

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.

I think the discussion also came up a time or two in discussing driving 5 V LCDs with 3 V powered micros.

The issue was whether or not a micro outputting a 3 V High would be high enough to be a valid high on a 5 V powered LCD input.

(Short answer to that question was that the minimum High from the micro may not be adequate to reliably trigger the LCD, easy solution: get a 3 V LCD!)

I'll certainly defer to Jepael's knowledge on the various chip's internal architechures, but with a totem-pole or open collector output the lows ought to be within a diode drop or two of ground, and not an issue for low level detection on 3 and 5 V logic systems.

JC

Smiley,

You are "substantially" correct.

However, I should point out that the "tradition" (going back into the early days of IC logic circa 1960's) is that these voltage-vs-threshold curves for input high and low logic levels illustrate the associated guaranteed min and max voltages, not the average voltage levels as you imply by using the word "about".

I'll explain.... Take a batch of a million 74xx04's (a standard logic inverter, from a specific family ). You will find that the voltage at which a high logic level (i.e. a "1") is recognized by each IC in the batch will vary because of processing differences. Some will produce the "1" with an input as low as 2.0 volts, while others need, say, 2.4 volts to produce that "1". The published curve will use the 2.4 volt figure because if you apply that voltage to the input of any of those million samples you will be guaranteed to get a "1". The value is sometimes referred to as the "guaranteed minimum high input level". The implication is that you can apply any voltage GREATER than 2.4 volts to the input and get the desired Logic 1, guaranteed.

In the "tradition" the curve is NOT to be interpretted as an AVERAGE value of the Logic 1 threshold voltage. The "big clue", if you will, is that there is never a tolerance specified for these curves. The curves will cover a certain range of supply voltage, and there will usually be a family of curves given to cover the IC's specified temperature range. But the implication is still the same - the curve shows the minimum voltage value which can be applied to ANY gate in the population of a gazillion units and you will always be guaranteed to get a Logic 1.

The Logic Low Input Threshold Curves are to be interpretted just the opposite. That is, the curves illustrate the "guaranteed maximum low input level". So long as your applied input voltage is BELOW the curve value for a given supply voltage & chip temperature, it will produce a Logic 0 in any of the gazillion 74xx04's in the supply chain. Go a tad higher on that input, and you will find that a certain number of the gates in the population will not produce that Logic 0.

This is the case for "normal", non-hysterysis logic inputs. For a thorough treatment of how the above description applies to logic inputs with hysteresis, look up a data sheet for a 74xx14 (hex Schmidtt trigger). The same idea of guaranteed high & low levels is there, but the hysterysis level also has its own guaranteed min & max voltage ranges. It gets pretty complicated, but it makes sense if you take the time to study it.

Now, having studied the 74xx14 data sheet, look at the Atmel328 data sheet and you will realize that Atmel is NOT providing a complete specification for the 328's inputs which include hysterysis.

Therefore, to maintain my sanity when referring to these AtMega input specs, I assume they follow the "tradition" for normal (non-hysterysis) logic input curves and design accordingly! If I have a design where I really find myself splitting voltage hairs regarding a logic input level on an Atmel processor,and it's a high-rel, high-volume application, I'll buffer that signal with a device whose input specs I can trace back to an unambiguous and complete specification. E.g. a 74xx14 or a comparator of some sort.

Quote:

Now, having studied the 74xx14 data sheet, look at the Atmel328 data sheet and you will realize that Atmel is NOT providing a complete specification for the 328's inputs which include hysterysis.

??? At least the PA datasheet has "Figure 30-27. ATmega48A: I/O Pin Input Hysteresis vs. VCC" with a few temperature lines. What else is missing? Mega164PA family as well.

8271Dâ€“AVRâ€“05/11
8272Aâ€“AVRâ€“01/10

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.

theusch,

In the interest of brevity I'll just present these questions:

A. How should I interpret Figure 30-27 (Input Hysteresis) in your referenced AtMega48 data sheet? It shows the input hysteresis as exactly 0.5 volts with a supply voltage of 5.0 VDC and a temperature of 25 degC. Does that mean each and every AtMega48 in the supply chain will have 0.5 volts of input hysteresis under these stated conditions? Not likely. ICs are made of silicon not tool steel, they have lots of variations and tolerances. As such, does Figure 30-27 have any stated tolerances? Does it say the curve depicts the minimum amount hysteresis you will find in the AtMega48 population ofr the maximum amount? See what I mean? Go back to the 74HC14 data sheet(e.g.) and see how they treat the situation.

B. Similarly in Figure 30-25 (Input Threshold Voltage for a Logic 1) should I interpet the curve to mean that every single AtMega48 in its population will have exactly the same 2.6 volt high-going threshold? Again, not likely for the same reasons stated in A above. Again see the various 74xx14 data sheets for the correct way to describe inputs with hysteresis on real-world logic devices.

To restate the obvious and well-know:
Atmel data sheets have a lot of shortcomings.

Quote:

To restate the obvious and well-know:
Atmel data sheets have a lot of shortcomings.

I don't know if I'd go that far.

Quote:

In the interest of brevity I'll just present these questions:

In the interest of brevity I'll only pose one more question: Can you give me an example of an AVR (or other microcontroller) design where more extensive hysteresis information than the guaranteed Vih and Vil levels are needed, and why?

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.

theusch,

One example would be where you have a sinewave input that you want to convert it to a square wave using the alleged Schmidt-trigger inputs. The sinewave amplitude & offset have a certain variability over time and various other cicuit conditions. In my design analysis I want to ensure that the sinewave will always reach the high-going trip level for the input in all AtMega48s (across the population) and will likewise always dip below the low-going threshold. Perhaps also to ensure the resulting square wave has an acceptable range of duty cycles.

How would I do that if the data sheet is not giving me the possible min-max range for both thresholds?

To give only a single value for a schmidt-trigger's Vih or Vil without a tolerance or range for each is bogus.

Most processors don't have schmidtt-trigger inputs, they have either (so-called) CMOS inputs (where Vih & Vil are more-or-less proportional to supply voltage) or TTL-compatible input (where Vih & Vil are more-or-less fixed voltage values & independent of supply voltage). In these cases the traditional Vih & Vil curves (such as the AtMega48 curves) are perfectly adequate.

Once you add hysteresis to the inputs, you introduce a number of other variables that need to be spelled out to the user so he can match his signals correctly to the inputs. Again, the 74xx14 data sheets provide examples of how to present this information thoroughly and unambiguously.

OK,OK....
Atmel data sheets have SOME shortcomings.

I love the AVR products, it's the data sheets that need more attention.

Quote:

One example would be where you have a sinewave input that you want to convert it to a square wave using the alleged Schmidt-trigger inputs. The sinewave amplitude & offset have a certain variability over time and various other cicuit conditions. In my design analysis I want to ensure that the sinewave will always reach the high-going trip level for the input in all AtMega48s (across the population) and will likewise always dip below the low-going threshold. Perhaps also to ensure the resulting square wave has an acceptable range of duty cycles.

How would I do that if the data sheet is not giving me the possible min-max range for both thresholds?

I disagree, I guess. You know that it will fire going up at no more than VIH, and fire going down at no more than VIL. You wouldn't use logic-level for distortion between high and low, anyway--no matter how much info you have been given. Thus this is contrived. But with a given sample of the Mega48 running under relatively constant conditions I'd expect the trip points to be consistent from one cycle to the next to the next ...

If you really want distortion then you'd use the analog comparator into your ICP. Right?

Now, I'm just the lowly software guy with scores of production AVR apps under my belt. We are indeed small potatoes but maybe about 100kAVRs in various apps go into the field each year. Each app is small, but if the AVR was running into borderline digital input "trip" conditions and our (primarily industrial apps) have flaky stuff happening, then A) we'd be hearing about it and B) if it is that dire a situation then we'd probably be out of business, since as I mentioned I've only even looked into it on one app out of probably 100.

I guess we just design conservatively and make sure our lows are less than 0.2Vcc etc. And we don't run fast and don't push the envelope.

I don't buy your example as real, I guess. The topic in general is certainly something to be aware of and respect and honor. To me, though, further work than just checking the VIH/VIL numbers in a normal AVR app is hand-wringing.

Lee

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.

The specification/datasheet of a product is an important document, a written agreement between the seller/manufacturer and a customer.
Every ambiguity in the specification should be treated as a smoking shield, a promise, it is selling something not guaranteed or not characterised. Such lack if information is a marketing tool which manufacturers use against their customers and competition hoping you interpret the data in their favour.

And it does not matter if you need it for your design or not - as Chuck remarked, that hysteresis parameter is given away.

No RSTDISBL, no fun!

I'll still say that exact specification of input hysteresis on digital inputs is much ado about nothing. As the VIL/VIH numbers are e.g .3/.6 or .2/.7 on the modern AVR models. A wide range of no-man's-land, between 1/3 and 1/2 of Vcc. OK, it is No Man's Land--don't go there. There be dragons beyond those ropes. Stay out of the minefield. It makes no difference if the mines are real close to the ropes, or further into the roped-off area.

There--did I mix enough metaphors in that statement? :twisted: Tell me where it matters writing code for an AVR app. Tell me where I should be looking at the schematic to be concerned. My RTC connections? SD card connections? Incoming signals from Schmitt-trigger input signal conditioning? Keypad buttons? DIP-switch signals? RS485 converter signals? FTDI chip?

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.

Hmm it does seem weird that in the DC specs the limits are said in percentage of supply voltage, and the curves say the limits more accurately.

I would have to interpret this so that if a signal is not about to change, it has to be within those DC Vihmin/Vilmax limits. But when a signal changes from high to low or low to high, the logic transition happens based on the limits and hysteresis in the curves.

So this might mean that it is not okay to for example feed 50% of VCC to a digital pin and expect it to work. Well, except if you have to do that if it happens to be an analog pin as well and you use the ADC to read it.

Quote:

Well, except if you have to do that if it happens to be an analog pin as well and you use the ADC to read it.

Thus, for power saving if the signal happens to stay in that area, the modern AVR generations (beginning with the P? or earlier? I cannot remember) have given us the DIDR register(s).

I did a number of apps with AT90S8535 and AT90S4433 and ATmega8 with ADC channels such as thermistors would be in that middle area indefinitely, and no DIDR. I never measured for increased current consumptions but the controller units just kept going and going and going like the Energizer bunny--no dire consequences as far as I know.

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.

Smiley -

One error: NO input hysteresis. The logic state is simply undefined between those limits. There is some (non-zero width) switching window somewhere between those two limits. When you reach that window from the low side, the output will start to change, and will be fully changed when you reach the high side of the window. When you approach the window from the high side, the same thing happens, in the opposite order. No hysteresis.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

ka7ehk wrote:

One error: NO input hysteresis.

If so, then why there is a curve in AVR datasheets that tell the hysteresis voltage of input pin?

OK, of course we don't know if that is real hysteresis or do they just say it is hysteresis even though it is just the range of undefined area between high and low thresholds. It is never said anywhere that AVR input pins would have Schmitt triggers.

Jepael wrote:
If so, then why there is a curve in AVR datasheets that tell the hysteresis voltage of input pin?

Brutte wrote:
Such lack if information is a marketing tool which manufacturers use against their customers and competition hoping you interpret the data in their favour.

No RSTDISBL, no fun!

Quote:

It is never said anywhere that AVR input pins would have Schmitt triggers.

Mega88PArevD:
Quote:
14.2.5 Digital Input Enable and Sleep Modes
As shown in Figure 14-2, the digital input signal can be clamped to ground at the input of the
Schmitt Trigger. ...

Mega164PArevA:
Quote:
13.2.5 Digital Input Enable and Sleep Modes
As shown in Figure 13-2, the digital input signal can be clamped to ground at the input of the
schmitt-trigger.

Mega8revL:
Quote:
Digital Input Enable and Sleep Modes
As shown in Figure 22, the digital input signal can be clamped to ground at the input of
the Schmitt-trigger. ...

AT90S8535, November 2000:
Quote:
During Power-down Mode, the Schmitt trigger of the digital input is disconnected. This allows analog signals that are close to VCC/2 to be present during power-down without causing excessive power consumption.

If you don't like to read, then it is in the picture in the later datasheets. :twisted: (Just teasing you on the last; the diagrams are often general but the symbol >>is<< there and corresponds with the text quoted.)

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.

Quote:

One error: NO input hysteresis.

Jim--so what about the graph in the datasheet? Chuck is trying to convince me that it isn't totally characterized. I won't disagree; my retorts have been that it doesn't matter to normal people. But I think it is indeed there, both from reading the datasheets and the little experiment that I mentioned earlier.

Lee

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.

The confusion can come from different interpretation of the "specification"(aka electrical characteristics) and "typical characteristics" words.

The former is guaranteed by the manufacturer for all devices within testing conditions. The latter is given away - it is not guaranteed to be as indicated when you test the chip you bought. If it is not - there is no way to verify it.

Example(tn2313 rev. I):
a)runs 10MHz at 2,7V. At full temperature range. That behavior is guaranteed.
b)IO pin driver sources 21mA at Vcc=5V. That is not guaranteed and it may happen voltage sags at 20.0001mA down to the GND with some chip - they didn't test it, they do not guarantee it. However you can clearly see at Typical Characteristics chapter the IO can sink/source more than 20mA.

Hysteresis is only characterized in a Typical Characteristics chapter, so it is given away IMHO. It can be 0V wide on some devices and pins and there is nothing you can do about it - their product still meets the specification.

No RSTDISBL, no fun!

I appreciate all the great feedback. I decided to go wordy and came up with:

Quote:
Logic Input/Output Voltage Levels
Looking at the ATmega328 data sheet section 29.8.9 Pin Threshold and Hysteresis, we see that for the I/O pin to read 1 when the Vcc is 5 volts the input voltage level should be above about 2.6 volts. For the pin to indicate 0 with a Vcc of 5 volts then the input voltage should be below about 2.1 volts. So at 5 volts we have a hysteresis of about 0.5 volts. At 3.3 volts these values would be above about 1.6 volts for a 1, below about 1.25 for a 0, with about 0.35 volts hysteresis. Why do I keep saying â€˜aboutâ€™? That is so you wonâ€™t memorize these figures and think you know how to generate a 1 or 0 on an input pin. Ask yourself: when have you ever gotten exactly 5 or 3.3 volts for Vcc? What if you are using batteries and youâ€™ve got 3.2 volts one day and 2.7 a month later? What Iâ€™m saying is that you need to consider these thresholds and hysteresis values as ballpark for your application and make sure youâ€™ve got some extra voltage if you want to be sure youâ€™ve got a 1 and that you take it down lower than the indicated low to assure that you are getting a 0.

The Arduino website [http://arduino.cc/en/Reference/C... states that for a digital input high you need to provide greater than 3 volts and for a digial input low you need to provide less than 2 volts and while this is certainly true for the standard 5 volt Arduino, it isnâ€™t true for those Arduinos that use lower voltages such as the 3.3 volt models. For these the 3V high will work but for the low you really need to provide less than 1V. You might think that this would be simple but look no further than the thread I started on AVRFreaks to see that it isnâ€™t: http://tinyurl.com/3r6aoyu

If you look at the datasheet section 28.2 DC Characteristics you get some absolute maximum and minimum electrical parameters to work with. The datasheet table 28-1 shows the maximum input low:
For Vcc = 1.8V â€“ 2.4V maximum input low is 0.2*Vcc
For Vcc = 2.4 â€“ 5.5V maximum input low is 0.3*Vcc
Minimum input high:
For Vcc = 1.8V â€“ 2.4V minimum input high is 0.7*Vcc
For Vcc = 2.4 â€“ 5.5V minimum input high is 0.6*Vcc

From which we can calculate:
For 1.8 volts, the maximum input low is 0.2*1.8V= 0.65V
For 1.8 volts, the minimum input high is 0.7*1.8V= 1.26V
For 5.5 volts, the maximum input low is 0.3*5V= 1.65V
For 5.5 volts, the minimum input high is 0.6*5V= 3.3V

Okay this is getting to be too much so letâ€™s promulgate a rule of thumb that applies in all cases: take 0.2*Vcc for low and 0.7*Vcc for high. If this is too restrictive and you want to make the reasonable assumption that your 5 volt system wonâ€™t fall below 2.4 volts then you can use a narrower range of 0.3Vcc and 0.6Vcc which for 5 volts gives you above 0.6*5 = 3V for a high and below 0.3*5 = 1.5V for a low.

What about digital output? Well that is a bit clearer but with the complication that it depends on the current it has to provide to the output circuit.

Output low for 5V at -20ma is 0.9V or less
Output low for 3V at -10ma is 0.6V or less
Output high for 5V at -20ma is 4.2V or more
Output high for 3V at -10ma is 2.3 or more

We can see that these digital output high and low values will work with the digital input pins, but if you are using them to drive something other than an AVR compatible digital input, then you might have to take a look at the datasheet.

Hysteresis?
In our case this refers to the concept that we must have above a certain voltage to generate a 1 and below a different lower voltage to generate a 0. For a 5 volt AVR we considered any voltage above 3 volts to be 1, high, or true and any voltage below 2 volts to be 0, low, or false - but what about voltages between 2 and 3? If a voltage falls below 2, then the pin indicates low even if the pin immediately rises to 2.1 or 2.9999â€¦, it has to go all the way to 3 to change the pin to high, then if it drops below 3 the pin continues to indicate high until it falls below 2 volts when it changes to low. This is called hysteresis and is a great feature because it allows us to measure signals with some noise on them. Imagine a signal that is slowly dropping from 3 to 2 but has a bit of +- 0.2 volts high frequency chaos jumping around, if the pin state changes from high to low and low to high at exactly 2 volts then youâ€™d see the pin toggling like crazy going off and on due to the noise while the real signal (the average of all that noise) we are interested in takes its own good time falling below our threshold plus the noise level. We might read a thousand transitions while the signal voltage falls the extra 0.2 volts noise needed to get completely below the transition threshold.

Maybe it is too much, but I guess for this issue a bit of over explaining makes sense.

Smiley