PBasic question from a newbie
dholl17207
Posts: 5
I am just getting familiar with PBasic and was wondering if there was a way to turn on multiple outputs with one command. For instance when I use HIGH 14 etc. it would be nice be able to say HIGH 14, 15, 11 etc. Is this possible? any help would be appreciated. Thanks.
Comments
If the direction registers for a group of pins are set to output you can set multiple pins using OUTS (for all 16 pins), OUTL/OUTH (for 8 pins, P0-P7/P8-P15), OUTA/OUTB/OUTC/OUTD (for 4 pins) or OUTx (where x is a pin number, for one pin at a time). Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
HIGH 0
HIGH 2
HIGH 3
HIGH 5
HIGH 6
Is there a way to simplify this code block to:
HIGH 0,2,3,5,6 (or something similar) on one line
Thanks.
OUTL = %10101010
Or you could use a variable…
OUTL = ioByte
…where ioByte is the pattern you want to output.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
OUTL = $3C, or
OUTL = %00110111
would do what you want.
Also, you could do:
OutBits VAR BYTE
MyVal CON %00110111
OutBits = MyVal
OutL = OutBits
And you could also create an 'alias' to OutL with:
MyPort VAR OutL
MyPort = %00110111