Shop OBEX P1 Docs P2 Docs Learn Events
HIGH and LOW commands — Parallax Forums

HIGH and LOW commands

ArchiverArchiver Posts: 46,084
edited 2002-07-26 18:08 in General Discussion
I like to know if there is any advantage of using
OUT/DIR commands over High and Low commands.

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-07-26 16:54
    Ali,

    The main advantage is that you can set a group of pins at the
    same time with the OUT and DIR commands. HIGH and LOW set only
    one pin.

    DLC

    --- In basicstamps@y..., Ali <kambms@y...> wrote:
    >
    > I like to know if there is any advantage of using
    > OUT/DIR commands over High and Low commands.
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Everything you'll ever need on one web page
    > from News and Sport to Email and Music Charts
    > http://uk.my.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2002-07-26 17:09
    I use basic stamp to control the motors....this i do by setting pin
    1 and 2 high..
    High 1 or High 2

    the alternative is to...define pin 1 and 2 as output pins
    Dir1=1
    and then use out1=1 to set it high...
    does this make the execution faster?


    --- In basicstamps@y..., "dennis_lm_clark" <dlc@v...> wrote:
    > Ali,
    >
    > The main advantage is that you can set a group of pins at the
    > same time with the OUT and DIR commands. HIGH and LOW set only
    > one pin.
    >
    > DLC
    >
    > --- In basicstamps@y..., Ali <kambms@y...> wrote:
    > >
    > > I like to know if there is any advantage of using
    > > OUT/DIR commands over High and Low commands.
    > >
    > > __________________________________________________
    > > Do You Yahoo!?
    > > Everything you'll ever need on one web page
    > > from News and Sport to Email and Music Charts
    > > http://uk.my.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2002-07-26 18:08
    Any "advantage" depends on your application requirements.

    With HIGH and LOW, you actually do two things at once (set the DIRS bit and the
    OUTS bit for the pin), but you can only affect one pin at a time.

    By using DIRS and OUTS directly, you can affect multiple pins at the same time.
    So, with just two lines of code, you could set the directions and the output
    states of all 16 I/O pins.

    The only "disadvantage" to using DIRS and OUTS is for the new programmer who may
    not understand that a "1" bit in DIRS makes the pin an output, and that a "1"
    bit in OUTS makes the pin high. With HIGH and LOW there is no ambiguity.

    -- Jon Williams
    -- Applications Engineer, Parallax


    In a message dated Fri, 26 Jul 2002 15:54:12 +0100 (BST), kambms@y...
    writes:

    > I like to know if there is any advantage of using
    > OUT/DIR commands over High and Low commands.
Sign In or Register to comment.