Shop OBEX P1 Docs P2 Docs Learn Events
COMPARE Function on BS2Px — Parallax Forums

COMPARE Function on BS2Px

edited 2006-06-12 21:46 in BASIC Stamp
Good morning!

I am wondering how the COMPARE function compares vaoltages. Does it have (3) states? ( A higher than B, B higher than A and A=B) More importantly (because the Stamp is a digital device), can the Stamp only compare voltages that are 0 or 5 volts? Or can I, say, have the voltages be 2.7V and 4.2V and compare them (without the Stamp going wonky because of being in a digitally indeterminant state).

I have a circuit that looks at a sensor reading (voltage) and compares it to a set point (manually controlled; the other voltage). The comparator circuit is fairly robust, but I am interested in having the mu-C be the comparator so that we can change things as needed.

Thanks for any help!

Smokey

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Freeing smoke from wire and IC captivity since 1972

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-12 14:28
    Smokey,

    ·· The comparator is analog and can handle analog voltages within the input range of the I/O pins.· The best source of technical data on this function would be the SX datasheet located at the following link.· Take care.

    http://www.parallax.com/dl/docs/prod/datast/SX48BD-Data-v1.1.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-06-12 17:50
    Also be sure to read the section on COMPARE in the Stamp manual. It works exactly like your external comparator. It only works on Stamp pins p1 (-) and p2(+) with p0 optionally as the output, which is independent of the program clock and responds immediately to changes at the input. The COMPARE mode,result returns a value of 1 in result if the voltage at pin p2 is greater than the voltage at pin p1.

    Like any comparator, it has two states at the output, either p1>p2 or p1<p2, and if p1=p2 or close to it, you will see noise in the output and in the result variable. Just as with any comparator, you can add a bit of positive feedback to create hysteresis.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • edited 2006-06-12 21:46
    Thank you guys very much! It looks like I will not be able to use it for this project (as I have need for all the i/o I can get and so am using the 2p40), but I will keep the 2px processor in mind for future work! Of course, the propellor chip is equally fascinating...

    Until the next time I free smoke from their bonds... I appreciate the help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Freeing smoke from wire and IC captivity since 1972
Sign In or Register to comment.