Do you a sine, square, or triangle shaped pulse?
The incoming is my sine wave........I am sorry about providing info about the incoming signal.....its not 5Vpp......but in the order of few10s of milli volts around 2.5v dc.
You may need to use the comparator with Hysteresis enabled and with debouncing as well. However you can also have th signal thru filters to remove the noise.
My only design (so far) with the comparator was quite good, but I had a 4V p-p square wave coming in. To get the best results I ran it into one of the dedicated op amp inputs, and buffered the signal with the fastest op amp setting. Then it ran it through the comparator, with the good Vref (not the power supply split resistor). It was rock solid, but my wave was sub 10KHz.. Actually, now I recall I have another design that operates on a 1 v p-p sinve wave and the above approach worked just fine.
If the signal is a few mV it might be worth it to amplify your signal? The opamp offset is 2 mV, and comparator hysteresis is on the order of 10 mV. PGA's are built in (though watch the 3db cutoff), or use external resitor and an opamp.
I am really bad at calculating things, so generally I go for the build and test approach, I think that may be why I like PSoC, since its really just like a breadboard, but all inside one IC..
Depends on the nosie level as well. You might consider a simple
RC LP filter in the input signal path to take out fast L and C transients that
might exceed hysterisis levels used. Another way of doing this is
to use an OpAmp as a comparator, and set its power level low, hence
its slew rate and BW will act as a LP filter to transients.
Just some options.
One additional comment. An OpAmp has a compensation cap in it, thats
what is key in limiting full power BW (vs small signal BW). Thinking another
way, it acts like a LP filter to large transients, as well as its small siganl BW
effects. A comparator has typically no compensation cap in it.
My signals are 40k signals. Since the hysteresis is of 10mv, i think i can sustain with the noise corrupting my signals......
PGA can act as a good low pass filter...as gain increases the cutoff comes down....But the falloff is 20db per decade so the harmonics of my 40k can easily creep in even though not having high gain......