Shop OBEX P1 Docs P2 Docs Learn Events
Schmitt-Trigger hysteresis question — Parallax Forums

Schmitt-Trigger hysteresis question

Beau SchwabeBeau Schwabe Posts: 6,568
edited 2005-03-27 06:06 in General Discussion
I have a project that depends greatly on the hysteresis level of a schmitt trigger.

The data sheet for a 74HC14 schmitt trigger has a hysteresis level between 2.8V and 1.75V when powered by a 5V supply.

On page 91 in the SXKeyMan2_0.pdf manual the hysteresis level is indicated between 4.25V (85%) and .75V (15%)
if powered by a 5V supply.

I really don't want to stick a 74HC14 out on the side just to get the levels that I need for the schmitt trigger. Does
anyone have an alternative idea? Setting the input to just CMOS without schmitt trigger enabled almost works.
Using two pins with one set to CMOS and the other set to TTL might work with a little software overhead, but I need
all the CPU I can get at this particular event.

Too bad you can't set a VrefHigh and VrefLow on the internal schmitt triggers to set your own hysteresis level.
with a 3.3V supply I could control the upper end to 2.8V (85%) but the lower end now becomes a problem.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III

National Semiconductor Corporation
Latest Company News
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-25 17:30
    Gunther has a progammable hysterisis application in his book, but it is at home. As I remember it requires an additional pin and there is a resistor ladder that sets what the hysterisis is (logic level of second pin sets which level of hysterisis the input pin is skewed towards), while this requires an additional pin, I think it would require less software overhead than the CMOS/TTL solution, but Im not sure. I was contemplating the possibility of using the analog comparator, and reading the input to the pin as well, but I don't know if this would work (it too would require another pin for Vref). But I think running at 3.3V and using the analog comparator for the lower level might get you what you need.
  • pjvpjv Posts: 1,903
    edited 2005-03-25 17:31
    Hi Beau;

    There are some simple clever tricks you can use in certain cases, but before I lead you down that proverbial garden path, let me ascertain from you whether it is the hysteresis function you need, or just a selectable, or for that matter an run-time adjustable trigger level?

    If hysteresis is required, then there still are several approaches. Can you afford to dedicate two inputs to determine the input level? One for a selectable high trip point, and one for a selectable low trip point, combined internally with software?

    That leads to the question of how fast you need this to operate, or perhaps better asked, what is the minimum high and minimum low level durations?

    Also, if the input speed are high, can you afford to run the processor fast?

    I just might have a very simple and neat answer for you.

    Cheers,

    Peter (pjv)
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-25 17:48
    Peter is much more knowlegable in this than I am, so I'll bow to his expertise.
  • BeanBean Posts: 8,129
    edited 2005-03-25 18:02
    Can you use the built-in comparitor to trigger at the levels you want ?
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video Display Module" Available Now.

    www.sxvm.com

    "A problem well defined, is a problem·half solved."
    ·
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2005-03-25 18:11
    Peter,

    I am trying to fine tune the trigger input circuit to a SX-Light pen (my contest design entry). The "cone" or sensing region
    if you will of the phototransistor, picks up multiple Horizontal Sync pulses effectively producing a 60/70Hz signal with a 31kHz
    carrier depending on the CRT monitor and screen mode selected. Typically this cone is about 20 Horizontal Sync Pulses wide.
    Since the outer regions of the cone have less amplitude than the center regions it complicates things a little more. Currently I
    have a design that discriminates this signal pretty good using a 74HC14 at a final stage to the SX and is very stable when tilting
    the Light Pen up or down which has been a problem in the past, but I would like to rid myself of the 74HC14. With the hysteresis
    levels of the SX, I have stability issues due to fringing effects caused by the outermost Horizontal Sync Pulses under the sensing
    cone. The SX is currently running at 50MHz and for optimal vertical resolution, I absolutely need all of the CPU cycles that I can
    get. Horizontal resolution is not a problem at all.


    Bean,

    Since you might know a little more about my design entry than some of the others, I'm not sure that the comparator would work
    quite like I would need it to for this application. I could be wrong.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    Latest Company News
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • pjvpjv Posts: 1,903
    edited 2005-03-25 18:49
    Hi Beau;

    Let me offer you a technique I have successfully used in the past.

    On the pin you want to use as your input, create a DAC by connecting a 10K resistor to a 0.01 uF grounded capacitor. Then also connect your opto input signal to the same input pin through a 4K7 resistor. These values may need to change a bunch but you can determine that after you get the concept running.

    Periodically, (say every one or ten milliseconds, depending on the component values) in the ISR (and you need to run that ISR relatively fast and deterministically, say every 10 uSec), switch this input pin to an output, and run the standard "roll-over" D/A converter software to that pin for a number (perhaps 10) of ISR cycles to "refresh" the analog value on the capacitor, and then switch the pin back to an input.

    This has the effect of creating a voltage divider from your opto input through the 4K7 resistor, to a settable DAC value through the 10K resistor, with your input pin being the ratio of the resistors and voltages.

    While the pin is an output during the ISR "DAC refresh" cycles, the pin's low output impedance will obviously swamp any effect the opto signal has during this period because it is connected through a 4K7 resistor, and no valid input can be taken during this time.

    You will need to experiment with the component values, and timings as what I have suggested here are just starting points.

    I have used this technique to do multi-input AtoD conversions, as well as set bias points for optical inputs etc. and it has worked very well, but it is a little complicated in software. One nince thing is that it consumes no extra pins.

    If you need to have true hysteresis, you can cause the software to alter the DAC value, up some once a high transition is detected, and down some when a low transition is detected. Remember, in your calculations that the SX switches very reliably at half of Vcc.

    If your speed is such that the DAC cannot conveniently be changed quickly enough for hysteresis operation, then you could dedicate an identical arrangement on another pin, and do the logic work in software.

    Have fun, and more help is available if you want it.

    Cheers,

    Peter (pjv)

    Post Edited (pjv) : 3/25/2005 6:52:58 PM GMT
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2005-03-25 23:37
    Thanks Peter ,

    Since the SX design contest results are now out, and I have been making improvements on my design, I will try to post more data over the weekend....

    This project is just for fun anyway so Mikayla (my daughter) could "draw" on the computer I have set up for her at the house.

    The idea was inspired, because I know how she likes to draw soo much on Mommy's Palm computer (...and losing the stylus ....and switching to crayon)smilewinkgrin.gif
    ... So I just took a chance at entering this project into the contest.


    BTW) WD-40 and a paper towel removes crayon from almost anything. ...even cloth (WD-40 removes from cloth easily with soap and water) yeah.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    Latest Company News
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2005-03-27 05:24
    Here are a few scope shots of the Light Pen signal...


    Note:
    With all of the scope views, The top (CH1) is the PenTrigger as well as the scope trigger,
    and the Bottom is the VSync borrowed off of the CRT connector at the back of the PC.
    On the CRT Monitor plug Pin 13 is the Hsync, Pin 14 is the Vsync, and Pin 10 is GND.


    LPTrig.gif is the Light Pen Trigger schematic

    PenTrigger.jpg is the raw signal just before the 74HC14

    PenTriggerSchmitt1.jpg is the raw signal output from the schematic

    LMR.jpg is a composite of 3 screen positions with the Light Pen.
    Notice the "phase shift" between VSync and PenTrigger.
    The signal position is relative to the upper left corner of PenTrigger.jpg

    FMT.jpg is another composite of 3 screen shots with the Light Pen in a fixed
    position (1) moving up and down (2) and lastly there is a threshold
    comparison between a SX and a 74HC14 (image copy of #2)

    Still after looking at these images....Threshold comparison specifically,
    I'm not sure exactly why the insertion of the 74HC14 increases the vertical
    stability dramatically. And YES I am taking into account the inversion in
    software.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    Latest Company News
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
    895 x 563 - 12K
    466 x 361 - 45K
    493 x 385 - 48K
    1457 x 453 - 113K
    1485 x 461 - 139K
  • KenMKenM Posts: 657
    edited 2005-03-27 05:55
    Beau,

    That looks like a Tektronics TDS210 scope?·
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2005-03-27 05:57
    TDS220 100MHz 1GS/s

    Why?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    Latest Company News
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • KenMKenM Posts: 657
    edited 2005-03-27 06:01
    The scope screen shots looked the same as my scope...a TDS210 60MHz, 1GS/s
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2005-03-27 06:06
    Ahhh..... I wish I had the data card for mine, so I could just download the data into my PC rather than taking
    a silly out of focus picture. I never can get the close-ups in focus with our digital camera, and when I do
    manage to get a decent close-up I can never reproduce the same setup for the next time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    Latest Company News
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
Sign In or Register to comment.