Is There an ANDN Spin equivalent?
Duane Degn
Posts: 10,588
I want to make sure a single bit is set low within a mask. It's easy in PASM with "andn", but I can't think of a quick way of doing it in Spin.
I can think of several ways to do this in Spin but they are all messy and long.
I don't need to know if the bit is there, I just want to make sure it's not once the operation is done.
Do any of you have a good technique for setting a bit to zero in Spin?
I can think of several ways to do this in Spin but they are all messy and long.
I don't need to know if the bit is there, I just want to make sure it's not once the operation is done.
Do any of you have a good technique for setting a bit to zero in Spin?
Comments
Here's code that works as long as the bit in "enableMask" is set in "activeMask":
"activeMask" is read from a PASM driver to set pin states.
For this example lets assume enableMask equals one while activeMask can either be two or three. If activeMask equals three the above code works but if it equals two then it doesn't.
CouldWould you show me how to use a "& !" mask? I'm still not thinking of a simple way to use them.
Edit: A light just went on in my head. If you wait a bit, I'll give it a try.
Mike, Didn't you see the "wait a bit" part?
Here's what I came up with:
I see that Mike's is shorter.
Thank you both.