Shop OBEX P1 Docs P2 Docs Learn Events
multipul outputs — Parallax Forums

multipul outputs

MR SPARKYMR SPARKY Posts: 23
edited 2008-09-17 04:29 in BASIC Stamp
I have written many programs and every one i had send a high or low signal to multipul pins. my question is simple, can I tell two different pins to go low or high in one line. For example: I want pins 1,5,9, and 13 to go low. The way i have been doing it is with 4 lines of code. is there any way to consolidate it. I have attached an example of the way I am doing it now. If someone could tell if this is consolidatable. If so where can I find the information on how to do it. I have been looking for a while and have no clue what im looking for or where to find it.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I light up·everyones life!!!!!

Comments

  • NR1XNR1X Posts: 111
    edited 2008-09-16 09:43
    check out the output registers and direction registers.. look in stamp manual under "outs" and "dirs"
  • MR SPARKYMR SPARKY Posts: 23
    edited 2008-09-16 10:53
    I see the bits. out then the number of the bit. but I am not sure how to seperate them in the line. I did not see anything in that secctio to show seperation. I not really understanding it to well. can some one please shed some light on the situation.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I light up·everyones life!!!!!
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-09-16 11:46
    Sparky -

    You don't separate them, you use them in groups of 4, 8 or 16 pins as required. It's merely a matter of logically assigning consecutive physical pin ports when you do your wiring. Once you've done it, you'll never turn back.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON
  • NR1XNR1X Posts: 111
    edited 2008-09-16 19:15
    outs =% 1101110111011101 would make pins 1,5, 9 and 13 low all others would be high
    outl =%11011001 would make pins 1,2,and 5 low all others high
    outh does the same, but addresses pins 8 through 15
    if you wanted to address 4 consecutive pins you would use :
    outa for pins 0 through 3
    outb for pins 4,5,6,7
    outc = 8,9,10,11
    outd = 12,13,14,15
  • MR SPARKYMR SPARKY Posts: 23
    edited 2008-09-17 02:19
    kb1nrb that was what I had figured but i cant get it to work. i am not sure if I am writng the code incorrectly or not. I tryed it but the leds did not light.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I light up·everyones life!!!!!
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-17 03:15
    Make sure you have the corresponding DIRS / DIRL / DIRH / DIRA / DIRB / DIRC / DIRD bits set to all one bits to make the I/O pins outputs.

    In any event, we can't help you figure out what's wrong without a posted copy of your source program. If it's short, use the [noparse][[/noparse] code ] [noparse][[/noparse] /code ] brackets to include it in your message (without the extra spaces). If it's long, attach it to your message using the Attachment Manager.
  • MR SPARKYMR SPARKY Posts: 23
    edited 2008-09-17 04:29
    I figured it out. I did not put the dir bit set in. thanks for all the help. this will save some trees.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I light up·everyones life!!!!!
Sign In or Register to comment.