Use of PINS in 8-bit binary
ChcKsss
Posts: 10
Hey I just got a board of education so I'm not very professional with it yet.
I would like to set all pins in one to a certain binary status for example pins=%0001000.
And later I would like to do binary operators like pins=pins & pins=%00000011.
Until now I just defined the pins like:
Pone PIN 0
Ptwo PIN 1 ..... and so on
but the source code is getting huge if I would write then Pone=Pone & Ptwo=Ptwo... Plus it is not working that way.
So my question is: How can I handle pins in binary. Since this would make things a lot easier.
Thank you in advance for your help
Cindy
I would like to set all pins in one to a certain binary status for example pins=%0001000.
And later I would like to do binary operators like pins=pins & pins=%00000011.
Until now I just defined the pins like:
Pone PIN 0
Ptwo PIN 1 ..... and so on
but the source code is getting huge if I would write then Pone=Pone & Ptwo=Ptwo... Plus it is not working that way.
So my question is: How can I handle pins in binary. Since this would make things a lot easier.
Thank you in advance for your help
Cindy
Comments
·· You can set all 8 pins at the same time if they're in the same port group, for example, P0-P7 or P8 through P15.· Just use OUTL or OUTH depending on which group you're on and you can set them with OUTL = value/variable.· Remember, the outputs won't actually be connected if the DIRL register isn't set for these pins to be outputs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thank you so much! This helped a lot
But still it doesn't like the line: OUTS = OUTS & OUTS = %00010000
It gives me the error message : "Expecting binary operator ')' "
How would you write the line?
Cindy
·· You are sort of double-assigning OUTS in that statement.· A literal version of your command would be:
OUTS = OUTS &·%00010000
Of course, the binary byte above could also be a variable.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com