Why like to set a mask for Pio?

Mar 09, 2006 4 Replies

Hi All,



void PioSet ( uint16 mask, uint16 bits )


When the mask[i] is true, and the bits[i] will true, or the bits[i] will store the Pio[i]'s input value instead of my assignment value.



Why so complicated?



why not just:



Pioset ( uint16 bits);


BR /Boki.



First, I apologize if this ends up being posted twice. 14 hours without it even showing up on the news server I originally posted from gives me reason to believe that someone along that path found my wisdom so profound that they diverted it off the wire for their selfish benefit. ;-)

Now as to the OP's query, but from a different news server:

Because then all PIO bits would be affected, which is fine if the caller already knows how the PIO is currently set, but using a mask allows the caller to specify *which* bits to 'merge' in with the PIO setting and which bits to ignore.

Dan Henry

"mask" and "bits" allows you to set and clear bits with a single function (and a single call to that function). "mask" determines the affected bits and "bits" sets or clears only those bits.

With Pioset ( uint16 bits ) you would need a separate Pioclr ( uint16 bits ) function.

Alan Nishioka

I got it, thank you very much!

btw, if you have any post problem, maybe you can take a try on google group, no server is needed.

BR Boki.

Dan Henry wrote:

And on what, do you think, is google running?

Meindert

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required