Shop OBEX P1 Docs P2 Docs Learn Events
Strange Relay Pulsing — Parallax Forums

Strange Relay Pulsing

ArchiverArchiver Posts: 46,084
edited 2001-04-03 18:18 in General Discussion
Martin-

When you allow your Stamp program to "fall off the edge of the world"
by running out of instructions to execute, it enters the END mode.
See the manual for the gory details of END, but the main thing here
is your Stamp pins all become inputs (not driven) briefly every ~2.3
seconds. In your second program, waiting forever for the "ATTN:" to
arrive prevents this condition.

The usual approach to prevent this problem is to end your program
with an endless loop:

loop:
GOTO loop

or with a STOP statement. Your final program will probably always
have a next thing to be done so this problem solves itself normally.


Regards,

Steve

On 2 Apr 01 at 23:53, martin@i... wrote:

> Can anyone explain why the following code causes a relay to pulse
> off about every 2 seconds instead of staying on...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-04-03 00:04
    output 0
    is NOT a COMMAND!
    what this is?
    ACJacques

    martin@i... wrote:
    >
    > Can anyone explain why the following code causes a relay to pulse off
    > about every 2 seconds instead of staying on...
    >
    > output 0
    > out0 = 1
    >
    > ...but with this code no pulsing effect...
    >
    > output 0
    > out0 = 1
    > SERIN 16, 16780, [noparse][[/noparse]WAIT("ATTN:")]
    >
    > ...the relay saying on as it should.
    >
    > It's as if the first one is looping which is stopped by the WAIT in
    > the SERIN command.
    >
    > The relay is controled by a transistor relay driver circut, but I
    > don't see how this is a hardware issue.
    >
    > Thanks,
    > Martin
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-04-03 00:53
    Can anyone explain why the following code causes a relay to pulse off
    about every 2 seconds instead of staying on...

    output 0
    out0 = 1

    ...but with this code no pulsing effect...

    output 0
    out0 = 1
    SERIN 16, 16780, [noparse][[/noparse]WAIT("ATTN:")]

    ...the relay saying on as it should.

    It's as if the first one is looping which is stopped by the WAIT in
    the SERIN command.

    The relay is controled by a transistor relay driver circut, but I
    don't see how this is a hardware issue.

    Thanks,
    Martin
  • ArchiverArchiver Posts: 46,084
    edited 2001-04-03 02:56
    [font=arial,helvetica]In a message dated 4/2/01 6:55:42 PM Central Daylight Time,
    martin@infinitefunctions.com writes:


    Can anyone explain why the following code causes a relay to pulse off
    about every 2 seconds instead of staying on...

    output 0
    out0 = 1

    ...but with this code no pulsing effect...

    output 0
    out0 = 1
    SERIN 16, 16780, [noparse][[/noparse]WAIT("ATTN:")]

    ...the relay saying on as it should.

    It's as if the first one is looping which is stopped by the WAIT in
    the SERIN command.

    The relay is controled by a transistor relay driver circut, but I
    don't see how this is a hardware issue.



    Consult the manual regarding END and the 18ms "wink" that occurs every 2.3
    seconds (also happens during SLEEP). ·Your second listing fixes the problem
    by waiting in an infinite loop (the SERIN) -- the Stamp program never "ends"
    and doesn't go into low-power mode.

    You can fix your first listing by adding STOP at the end.

    [/font]
  • ArchiverArchiver Posts: 46,084
    edited 2001-04-03 03:45
    [font=arial,helvetica]In a message dated 4/2/01 9:14:23 PM Central Daylight Time,
    acjacques@infolink.com.br writes:


    output 0
    is NOT a COMMAND!
    what this is?



    Yes, it is -- for the BS2 family. ·This is the same as Dir0 = 1.

    [/font]
  • ArchiverArchiver Posts: 46,084
    edited 2001-04-03 18:18
    Thanks for the help guys.

    My completed program doesn't run into this problem and now I know why.

    Just wanted to make sure this is a 'feature' and not a bug. [noparse]:)[/noparse]

    Martin
Sign In or Register to comment.