Setting Multiple Pin States
David Kissick
Posts: 15
Hey group!
This should be an easy question. I need to be able to set several pins on a BS2 from Low to High at the same time. Is there code that will do this or do I have to change them individually? for the curious, this is to control transistors driving LEDs in order to create a light show. Thanks for the help.
David
This should be an easy question. I need to be able to set several pins on a BS2 from Low to High at the same time. Is there code that will do this or do I have to change them individually? for the curious, this is to control transistors driving LEDs in order to create a light show. Thanks for the help.
David
Comments
Specific groups of pins can be addressed as one entity, as follows. See the PBASIC Stamp Manual or the PBASIC Editor Help File for more information.
OUTS = All 16 outputs, pins 0-15
OUTL = Pins 0-7·· OUTH = Pins 8-15
OUTA = Pins 0-3·· OUTB = Pins 4-7·· OUTC = Pins 8-11·· OUTD = Pins 12-15
INS, INH, INL, INA, INB, INC, IND operate in the same manner for inputs.
Regards,
Bruce Bates
OUTL = %00000111
DIRL = %11111111
Of course, you only need to set DIRL once, and your program can use those pins as outputs as required. If you download our StampWorks book you see that we have a little lightshow project included -- it might give you some ideas for your project.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
That's exactly what I needed.
David