Shop OBEX P1 Docs P2 Docs Learn Events
hysteresis between two rctime inputs. — Parallax Forums

hysteresis between two rctime inputs.

yurightyuright Posts: 13
edited 2011-06-06 17:12 in General Discussion
I am brand new to Basic Stamp. I am working with a BS2 and am trying to duplicate an analog device I built recently. It uses two pots, a command and a feedback which input to a comparator. It controls two outputs which both go high when inputs are equal. If the inputs are not equal one or the other output will be low etc. I have tried to write a program that will do this. It seems to work except for the last block where I want both outputs the same when inputs are equal. I am using rctime for the inputs. Due to the small variations in the rctime values the outputs flipflop How can I write in the necessary hysteresis to allow both outputs to be the same over a range of input values.

I did take the time to look for an answer in previous posts but was unable to find anything that applied to what I am trying to do. Again I am new to programming language and probably wouldn't have recognized an answer to my question if it were in front of me. I will attach a screenshot of the file. Thanks

Comments

  • yurightyuright Posts: 13
    edited 2011-06-06 15:08
    Turns out it was in front of my face. This code seems to do what I want. Any additional ideas on a better way to do this would be welcomed, thanks again..



    IF comtime > feedtime -60 AND comtime < feedtime +60 THEN

    HIGH fwd
    HIGH rvrs

    ENDIF
  • ercoerco Posts: 20,260
    edited 2011-06-06 17:12
    Way to bail yourself out, yuright! You didn't give us much time to help you, kudos for testing and solving your own problem while you waited. This is a friendly forum, come back anytime you need help or have something to share.
Sign In or Register to comment.