Shop OBEX P1 Docs P2 Docs Learn Events
potentiometer with propeller? — Parallax Forums

potentiometer with propeller?

vicosvicos Posts: 4
edited 2008-02-15 05:36 in Propeller 1
Hello,

I would like to know how to read a potentiometer position with propeller chip, any links or code?


Thanks

Vicos

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-15 05:15
    There are several examples. Look in the Downloads area for the Propeller for Application Note #1 (AN001) and look for a discussion of analog to digital conversion. Look at the examples that come with the Propeller Tool for digitizing the microphone input on the Propeller Demo Board. Download the Basic Functions Library from the Propeller Object Exchange which has an RCTIME-like function. Also look at the Propeller Education Kit lab on the counters which also discusses an RCTIME-like functionality. The first two suggestions would allow you to measure the pot position through measuring the voltage output from the pot. The RCTIME-like functionality would require a capacitor and allow you to measure the discharge time of an RC circuit using the pot.
  • potatoheadpotatohead Posts: 10,261
    edited 2008-02-15 05:36
    http://forums.parallax.com/forums/default.aspx?f=25&m=245567

    There is a nice, simple circuit here (fig 134.1)

    http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol7/col/NV134.pdf
    The PDF said...

    At this point we get into the mechanics of the RC measurement. The first step is to clear the
    work variable, rc_temp, and then make pin an output at the desired state; this will charge (1)
    or discharge (0) the RC circuit. Using a 220-ohm series resistor and a 0.1 uF cap, the time
    required for charge/discharge is 110 uS; we'll go ahead and use 500 uS to account for
    component variations or a larger series resistor. Once the capacitor is charged we make the
    pin an input, copy the system counter (cnt) value into rc_temp, and then wait for the pin state
    to change (this happens at ½ vdd).

    From the linked PDF, right below the circuit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
Sign In or Register to comment.