Shop OBEX P1 Docs P2 Docs Learn Events
LED winks once every ~3 seconds. What's happening? — Parallax Forums

LED winks once every ~3 seconds. What's happening?

AzironaZackAzironaZack Posts: 2
edited 2009-02-20 20:38 in BASIC Stamp
Hey all,
Since getting my BASIC Stamp Discovery Kit in the mail I've been playing with it daily. It's great fun to build simple circuits and control them with the BS2.

My BS2 and Board of Education (USB) is confusing me currently though. I've worked through the "What's a Microcontroller" text chapter on LEDs and was playing around with simple LED stuff when I noticed this odd behavior.

DETAILS:

Circuit Configuration: The LED circuit shown on page 215 of the BASIC Stamp command reference text. This is the configuration shown for the demo program for the "HIGH" command. Pin0 ----> LED ----> 470 Ohm resistor ----> Vss

PBasic Code:
' {$STAMP BS2}
' {$PBASIC 2.5}
HIGH 0

Behavior:
When I download that code into the BS2 and run it; the LED emits light for about 3 seconds then rapidly cycles from off to on, then remains on for another ~3 seconds. This behavior repeats indefinitely. The LED appears to wink/blink once about every 3 seconds.

Using a cheap digital voltmeter I'm able to see that whenever the LED blinks off the voltage between pin 0 and Vss drops. Since the voltmeter digital readout only updates 2-3 times per second I can't tell exactly how far the voltage is dropping at that time.

NOTES:
1) The behavior occurs regardless of which pin I route the LED to (and configure the program for, of course).
2) The behavior does NOT occur if I simply run the LED from Vdd to the resister to Vss (ie omit the BS2 entirely by replacing the connection to pin 0 in the circuit with Vdd). In this case the LED stays lit, as expected.
3) The behavior occurs whether or not the BOE is hooked up to my computer.
4) The behavior occurs whether or not I power the BOE with a new 9v battery or with the 12v (1A) regulated ac/dc adapter that I'm currently using.
5) If I run the following code, I do not see the blink:
DO
HIGH 0
PAUSE 5000
LOW 0
PAUSE 5000
LOOP


Is this behavior something I should expect the BS2 to be doing? What is causing this?

I have tried searching the general web and these forums for answers but I haven't had any luck. There's just too many simple LED blinking demonstrations out there! Since I can't come up with a way to search for this behavior explicitly that excludes all these demos I haven't been able to find any descriptions or discussions of the behavior that I'm seeing.

Thanks a million!

Zack

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-02-20 20:34
    Zack,

    The following is from the Help File (and BASIC Stamp Manual). In your case, no END statement mean the END is implied. With the DO...LOOP system the program never ends and the BASIC Stamp never goes into low-power mode. I hope this helps. Take care.
    Explanation
    END puts the BASIC Stamp into its inactive, low-power mode. In this mode the Stamp's current draw (excluding loads driven by the I/O pins) is reduced to the amount shown above. END keeps the BASIC Stamp inactive until the reset line is activated, the power is cycled off and back on or the PC downloads another program.
    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.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • AzironaZackAzironaZack Posts: 2
    edited 2009-02-20 20:38
    Chris,
    Thank you very much for your response and the reference. This is, clearly, expected behavior then.

    Thanks again for the very helpful and prompt response.

    Zack
Sign In or Register to comment.