This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

witing to port pins questions

I have a quick question:

Suppose I have the following code:

DDIR = 0;

Now, I have a code that does some task and according to some conditions, the following line might be executed:

Code:

PORT1 &= ~(0x01 << 4);

The 5th pin of PORT1 is already 0, or low, whatever, when I write 0 to this pin, which is already 0, what will happen? is it going to write 0 again, or just the code ignores it and keeps it 0? Should I test the pin status before I write an existing status, don't laugh at me, but really this question has been on my head for a long time.