Shop OBEX P1 Docs P2 Docs Learn Events
Reset and SLEEP — Parallax Forums

Reset and SLEEP

Bill ChennaultBill Chennault Posts: 1,198
edited 2008-03-07 19:34 in BASIC Stamp
All--

If I drive the RES pin low then let it float on a Stamp, will that awaken it from SLEEP? My plan is to keep Ugly Buster's BS2p40 master awake and to put all the slave BS2s to sleep until the master needs them.

Thanks!

--Bill

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-06 16:37
    It won't "awaken" it. It'll reset the Stamp and the program will start over from the beginning. There's no way to force a SLEEP to stop early. What you want to do is to use a short NAP statement to put the slave into low power mode for a short period of time, perhaps 50ms. Every 50ms, the slave will come out of SLEEP/NAP, test a communications line from the master to see if it's active. If not, it goes back to SLEEP/NAP again. That way, the slaves spend over 99% of their time in low power mode, yet can function very quickly. Make sure to use pull ups or pull downs on all output pins of the slaves because they'll periodically change to input mode (read the manual) during SLEEP/NAP.

    If it's ok to start the slaves over from the beginning, you could certainly use a reset to terminate the SLEEP. It's just that you'd lose the contents of any variables. You could store any status information in the EEPROM using WRITE statements before the slave goes to SLEEP.

    Post Edited (Mike Green) : 3/6/2008 4:46:52 PM GMT
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2008-03-06 17:20
    Mike--

    Thanks for the help. In my CURRENT experiments, a reset would work fine. Later, NAP will be necessary as you described.

    The only slave pins used as outputs (in this configuration) are the ones (one per slave)·used to control HB-25s. Should they be tied to Vss or Vdd via a 4.7k resistor? Plus, I do not know when a line should be pulled up or down. If you have time, would you please explain it for me?

    Thanks!

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-06 17:30
    The HB-25 is designed to substitute for a servo motor which uses pulses that idle at logic low (ground). You want a pull down in that case (Vss) so, when the Stamp is "playing dead" during a NAP or SLEEP, the output line looks idle.
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2008-03-06 19:39
    Mike--

    Is the logic to pull a line high or low based on the idea that you do not want to "activate" the connected circuit during idle periods? And, is the sole reason we do not want a line (in many cases) left floating because such a line MIGHT assume a high or low status?

    Or, is there an encyclopedia's worth of material and years of experience necessary to understand this technique?

    As always . . . thanks.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-06 23:41
    Bill,
    Basically, when a line is left floating because it's in input mode (or just not connected), it's literally floating in a sea of static charges and induced currents from nearby conductors and other magnetic and electric field sources. If the voltage of the line is above the circuit's threshold, it's treated as a logic one. If it's below the threshold, it's treated as a logic zero. If it's right around the threshold, who knows what value it will have, but the input circuitry will "leak" a relatively high amount of current ... enough to shorten battery life if you're running off batteries.

    Try an experiment some time. Connect a Stamp or Propeller pin to a piece of insulated wire sticking up in the air and let the pin be in input mode. Write a program to sense the value of that I/O pin and turn on an LED if the pin is a logic high. Then bring your hand near the wire or rub some fur (wool cloth) on some rubber nearby and see what happens.
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2008-03-06 23:51
    Mike--

    What a neat idea for a fun·little·experiment!

    Thank you, as well, for the explanation.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2008-03-07 17:46
    Another experiment is to let that one pin float, and turn the neighboring pin alternately high and low:

    INPUT 1   ' there is no connection from p0 to p1
    DO
      TOGGLE 0   ' you can attach an R and LED to this pin if you want
      DEBUG BIN1 IN1
      PAUSE 100
    LOOP
    



    You will see that in1 follows the 010101... pattern output by p0 exactly, even though there is no connection between them. The connection is simply the parasitic capacitance between the pins and wiring.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2008-03-07 19:34
    Tracy--

    I will never know much about electronics, but I now know more.

    Thanks!

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
Sign In or Register to comment.