Best way to use waitpeq to check the status of a range of pins
gergtech
Posts: 7
Hello,
I'm obviously new....but I'm trying to pause the my program until pins ina[1] though ina[20] = 0 using waitpeq.
Ive tried to use the Propeller manual to figure this out, but I don't get the examples.
This is probably a Prop 101 question,
Thank you for the help
Greg Pfrommer
Atlanta Ga
I'm obviously new....but I'm trying to pause the my program until pins ina[1] though ina[20] = 0 using waitpeq.
Ive tried to use the Propeller manual to figure this out, but I don't get the examples.
This is probably a Prop 101 question,
Thank you for the help
Greg Pfrommer
Atlanta Ga
Comments
Yep, one line. If any pin is high (1) the expression will evaluate as true.
I so need to go back to school?
Welcome to the forum!
Jon's solution works and is easy to grasp, since it's able to use the ina[20..1] notation. However, you can use waitpeq, if you like, and it does save power consumption during the wait. Do it this way:
The first argument to waitpeq is the pin state you're waiting for; the second argument, a mask whose "one" bits identify which pins of ina you're checking. The third argument should always be zero, since there is no inb.
-Phil