Shop OBEX P1 Docs P2 Docs Learn Events
Outputs pulsing and I don't know why. — Parallax Forums

Outputs pulsing and I don't know why.

DKattDKatt Posts: 2
edited 2008-02-22 01:26 in BASIC Stamp
Hello everyone,

I just bought my very first BS2-IC and I seem to be having an issue with it. Perhaps someone can help me?

I've got it plugged into a breadboard with a clean and stable 12V supply.· There is one LED connected to P0 (pin 5). All other I/O are unconnected. My problem is after setting P0 to HIGH, the output does go high, but for some unknown reason it turns off for 20ms every 2.4 seconds (off meaning not low or high, but floating). I've tried various other I/O pins and the same happens on them. The last program I loaded has only this:

HIGH 0
END

I imagine that the output should stay on constantly. Is there something I haven't done or doing wrong? Has anyone else experienced this? Do I have a defective BS2?

Any help would be greatly appreciated. Thanks.

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2008-02-21 13:24
    DKatt,

    Please check that your 12 v is going into the Vin connection of the stamp. If you put 12v into Vdd, you by-pass the on-board regulator and will damage the Stamp. Also check that the 12 volts really is somewhere close to 12 volts.

    Secondly, do you have a current limiting resistor in series with the LED?

    Finally, the following is from the Stamp Help file:

    "Just as with the SLEEP command, pins will retain their input or output settings after the BASIC Stamp is deactivated by END. For example, if the BASIC Stamp is powering an LED when END executes, the LED will stay lit after END, but every 2.3 seconds, there will be a visible wink of the LED as the output pin switches to the input direction for 18 ms."

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-02-21 13:45
    DKatt -

    If the following appears to put the program into an infinite loop, indeed it does, but it also will stop the blinking you are experiencing.

    Again:

    HIGH 0

    GOTO Again

    END

    - - - - - -
    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Genius is one percent inspiration and ninety-nine percent perspiration."

    Thomas Alva Edison
  • RDL2004RDL2004 Posts: 2,554
    edited 2008-02-21 14:02
    This is from the Basic Stamp FAQ.



    Why do the BASIC Stamp’s output pins toggle briefly when I use the SLEEP, NAP or END
    commands or allow my program to end naturally?
    Inside the BASIC Stamp’s interpreter chip is a watchdog timer whose main purpose is to reset the interpreter chip
    if, for some reason, it should stop functioning properly. The SLEEP and NAP commands also utilize the watchdog
    timer to periodically (every 2.3 seconds to be exact) “wake-up” the BASIC Stamp from its low-power mode.
    Upon reset, the I/O pins are set to inputs for approximately 18 mS before returning to their previous directions and
    states. If you have an output pin set to a logical 1 state (+5V) and you use the SLEEP command, every 2.3
    seconds during sleep mode that I/O pin will switch to an input for 18 mS causing a momentary signal loss. This
    “power glitch” is easily viewable with an LED and a 470 ohm resister tied to an I/O pin and switched on just before
    entering sleep mode. In many cases this problem can be remedied by tying a pull-up or pull-down resistor to the
    I/O pin in question to provide a constant source of power should the I/O pin change directions. Allowing a
    PBASIC program to end naturally, or using the END command, will exhibit the same “power glitch” behavior
    because the interpreter chip enters a low-power state. The BASIC Stamp II, IIe and IIsx includes the STOP
    command which acts just like END, except the output pins remain driven.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Rick
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-02-21 17:37
    +1 Rick. Fix by using "stop" instead of "end".
  • DKattDKatt Posts: 2
    edited 2008-02-22 01:26
    Hello All,

    I got home from work and found your excellent explanations regarding the "problem" I _was_ having. I now understand this particular feature of the BS2. I think I'm going to like the Basic Stamp community.

    Thanks very much for your help and support!

    DKatt
Sign In or Register to comment.