Shop OBEX P1 Docs P2 Docs Learn Events
Inputs/Outputs — Parallax Forums

Inputs/Outputs

ArchiverArchiver Posts: 46,084
edited 2002-05-13 18:06 in General Discussion
Hi,
I am just wondering how you can control which are inputs/oupts with the BASIC
command "INPUT" or "OUTPUT"
But I don't want to write:
Input 1
input 2
Input 3 Etc
Can it be done like "Inputs 1-3" or "Input 1 TO 3" or something simmilar?
Thanks
Ben



BEN (TEAM DBR)
http://www.geocities.com/temdbr



Do You Yahoo!?
Get personalised at My Yahoo!.

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-05-13 17:47
    Outs=%0000000010000000 ' Define starting levels for P15-P0
    Dirs=%0000000010110010 ' Define which of P15-P0 are in-0 or out-1

    NOTE: The leftmost digit is for pin15, rightmost is for pin0
    The above 2 lines define P15-P8 as inputs, P7 is an output and starts
    high,P6=input,P5-P4 are outputs starting with logic low, P3-P2 are inputs,
    P1 is an output starting logic low, and P0 is an input.

    KF4HAZ - Lonnie

    From: "BENS ANTS" <bensrobot@
    > Hi,
    > I am just wondering how you can control which are inputs/oupts with the
    BASIC command "INPUT" or "OUTPUT"
    > But I don't want to write:
    > Input 1
    > input 2
    > Input 3 Etc
    > Can it be done like "Inputs 1-3" or "Input 1 TO 3" or something simmilar?
    > Thanks
    > Ben
    >
    >
    >
    > BEN (TEAM DBR)
    > http://www.geocities.com/temdbr
  • ArchiverArchiver Posts: 46,084
    edited 2002-05-13 17:57
    Try DIRS=%0000000000000011

    Where 0 is an input and 1 is an output.
    You can also use DIRH (P8-15), DIRL (P0-7), DIRA, DIRB, DIRC, and DIRD
    (four bits each starting at 0 and counting up).

    Al Williams
    AWC
    * NEW: Experiment with Programmable Logic
    http://www.al-williams.com/awce/pbx84.htm



    >
    Original Message
    > From: BENS ANTS [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=6yP89vFgkLvYglDEMPhRcZn7hPl7wyGVsMTFtIpdQ1AVcaWVPOB-utK7ZN3nqlsNk4IDkuoKU0_ZAL8Kn2Fe]bensrobot@y...[/url
    > Sent: Monday, May 13, 2002 11:12 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Inputs/Outputs
    >
    >
    >
    > Hi,
    > I am just wondering how you can control which are
    > inputs/oupts with the BASIC command "INPUT" or "OUTPUT" But I
    > don't want to write: Input 1
    > input 2
    > Input 3 Etc
    > Can it be done like "Inputs 1-3" or "Input 1 TO 3" or
    > something simmilar? Thanks Ben
    >
    >
    >
    > BEN (TEAM DBR)
    > http://www.geocities.com/temdbr
    >
    >
    >
    >
    > Do You Yahoo!?
    > Get personalised at My Yahoo!.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2002-05-13 18:06
    Use the predefined names identified in the manual or create an alias to
    them:

    The predefined name DIRS represents the direction state of the 16 bit
    word for the I/O pins (0-15) in a BS2, DIRL identifies the first bytes
    (8 bits, 0-7) and DIRA identifies the first nibble (0-3).

    So to make pins 0-3 input just do INPUT DIRA. To set all 16 pins as
    input do INPUT DIRS.


    If you preferred your own meaningful labels do:

    MYBITS VAR DIRA ' creates alias to pins defined by DIRA
    INPUT MYBITS ' sets first nibble, pins 0-3, as input

    I think this does what you want.

    BENS ANTS wrote:
    >
    > Hi,
    > I am just wondering how you can control which are inputs/oupts with the BASIC
    command "INPUT" or "OUTPUT"
    > But I don't want to write:
    > Input 1
    > input 2
    > Input 3 Etc
    > Can it be done like "Inputs 1-3" or "Input 1 TO 3" or something simmilar?
    > Thanks
    > Ben
    >
    > BEN (TEAM DBR)
    > http://www.geocities.com/temdbr
    >
    >
    > Do You Yahoo!?
    > Get personalised at My Yahoo!.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.