Shop OBEX P1 Docs P2 Docs Learn Events
Why does SEROUT (......) has to be followed by INPUT? — Parallax Forums

Why does SEROUT (......) has to be followed by INPUT?

John BurrowJohn Burrow Posts: 27
edited 2011-01-03 13:53 in BASIC Stamp
I have 3 Stamps all using the same connection to send output to a shared serial device - 19K2i, 8, None, 1

The first Stamp to transmit always gets it's message through. But subsequent messages from other Stamps do not go through.

I found that placing an INPUT statement, for the SEROUT pin, immediately after every SEROUT statement appears to 'free up' the line so other Stamps can use it.

Can anyone explain what the INPUT statement is accomplishing?

John Burrow
San Diego

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-03 13:24
    Each I/O pin can be in either input mode or output mode. The INPUT statement specifically forces the I/O pin into input mode. Many statements implicitly set the mode of the specified I/O pin and SEROUT is no exception. It forces the specified I/O pin into output mode and leaves it there until the mode is changed by some subsequent statement (like INPUT).
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-03 13:29
    As an alternative, you could also use open-drain mode for your SEROUT and pull the collective pins up to Vdd with a 4.7K resistor. (Even with fully-driven outputs, the pullup is a nice thing to have, since it forces the line to a "mark" condition in the absence of any other pin assertions.)

    -Phil
  • John BurrowJohn Burrow Posts: 27
    edited 2011-01-03 13:35
    Thanks to you both.

    If I add a 4.7K pull up, could I remove the INPUT statements?

    John
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-03 13:53
    You can remove the INPUT statement only if you change your SEROUT mode to "open".

    -Phil
Sign In or Register to comment.