J
Joerg
- Jan 1, 1970
- 0
Jan said:On a sunny day (Tue, 26 Jan 2010 15:35:03 -0800) it happened Joerg
[...]
With a good micro controller you do not. As I showed the MSP430 specs
the hysteresis properly so you can rely on it. You can probably also
rely on it with the dsPIC but they failed to spec it. All one (mostly)
needs in such cases is the minimum hysteresis. The maximum doesn't
matter if you guarantee to get under 0.2*VDD and above 0.8*VDD.
Easy to say "oh just throw in an extra Schmitt up front". But in
consumer goods every penny gets turned around and around.
No no, I dunno how much you know about micros, but a few points I want to mention here:
1) When an input changes, its is sampled by the micro at some edge of its *own* clock.
Not if it's an interrupt
That means if you have a lousy signal, say a lot of RF noise on a rising edge, like this:
.
.
.
.
. .
.. . ------------- slice level
. ..
.
- ----
|| |
|| | ------- micro internal Schmitt output
|| |
- --
I want this
----
|
|
|
-------
-------
|
| micro clock
______
^
|
data is sampled here, and a '1' is read.
So the input is sampled either low or high, if it sampled low because its sampled just in the low part of the RF,
then it will sample high on the next micro clock, just a one clock delay.
I think, the reason, possibly the ONLY reason, for the Schmitt trigger in that input, is to avoid 'metastability'.
Now metastability is a whole an other subject, and whole threads have been written on it in comp.arch.fpga, look it up.
But it basically is related to the gates operating in their linear range, and the Schmitt trigger really prevents that,
Mostly the problem is sluggish inputs or stray noise from nearby
thunderstorms. A lightning-induced spectrum concentrates in the hundreds
of kHz range and that can produce a lot of grief in a uC. Some of the
stuff I deal with is also deployed in the "Tornado Alley", Carribean
etc. If you know engineers from the Dutch Antilles they can probably
tell you about that.
Now on the subject of noise, I have learned that interfacing microns in an industrial environment requires
*always* special precautions.
I use opto couplers myself always, simply because that
1) gets rid of ground loops.
2) allows for a wide range of input voltages, say you get something from a 24 V system, or 48 V, or even 230 V.
3) you can likely use the micros internal pullups at the input.
4) Very high frequency RF does not make it through an optocoupler.
5) no capacitive coupling to speak of either.
etc etc.
So, be smart, and use those.
It ain't so easy in price-sensitive gear (consumer and so on) where
every penny counts. If you can make it happen with a buck less than the
other guy your client wins