Shop OBEX P1 Docs P2 Docs Learn Events
Multiple pins — Parallax Forums

Multiple pins

StarManStarMan Posts: 306
edited 2007-05-02 22:36 in BASIC Stamp
Is there a way (like a HIGH or LOW command) to output two or more pins at once?· I tried to search the subject but found nothing.

Thanks,

Chris I.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-30 20:26
    You can directly access groups of 4 or 8 pins using names like OUTL/OUTH and the nibble equivalents. Look at the section of the PBasic manual that talks about memory for the BS2. It lists all of these special names (and suffixes) and gives examples of their use.
  • StarManStarMan Posts: 306
    edited 2007-05-01 01:38
    Thanks Mike.· I read the similar section in the Pbasic editor help file but the manual is clearer.· I get it now.
  • StarManStarMan Posts: 306
    edited 2007-05-02 22:02
    Hmmm,· Well, I thought I understood but I guess not.· My understanding is that if I use OUTD = 1, pins 12 thru 15 will output high.· But only pin 12 goes high.

    I tried this little piece of test code with LEDs on pins 12 thru 15.· The HIGH commands work, OUTD does not.· Only pin 12 goes high with OUTD.

    '
    [noparse][[/noparse] Initialization ]
    DIRS = %1111000000000000



    '
    [noparse][[/noparse] Program Code ]

    Main:
    HIGH 12
    PAUSE 1000
    LOW 12
    PAUSE 1000
    HIGH 13
    PAUSE 1000
    LOW 13
    PAUSE 1000
    HIGH 14
    PAUSE 1000
    LOW 14
    PAUSE 1000
    HIGH 15
    PAUSE 1000
    LOW 15
    PAUSE 1000

    OUTD = 1
    PAUSE 1000
    OUTD = 0
    PAUSE 1000

    GOTO Main

    It has to be something simple.· Any Guidance?

    Thanks,

    Chris I.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-02 22:19
    When you write "OUTD = 1", you're really writing "OUTD = %0001" which sets the pins the way you're seeing. If you want to set all of them high, you have to write "OUTD = %1111" or "OUTD = $F" or "OUTD = 15"
  • StarManStarMan Posts: 306
    edited 2007-05-02 22:36
    Ha!· More simple than I thought.

    Thanks Mike.
Sign In or Register to comment.