After working my way through the port manipulation article more carefully, I think that I have implemented a clock, but am getting some strange results.
Via my code below, I want to simultaneously set pins 12 and 11 HIGH, delay 10 microseconds (100kHZ), and then set pins 12 and 11 LOW.
After each "set" operation, I am using pins 3 and 2 to read the value of PORTB using PIND, and printing the resulting number to serial.
Given the ports of PIND I connected the jumpers to, I would expect PIND to read the following binary numbers during each iteration:
B00000000
B00001100
which would be printed as
0 and 12 via Serial.println(), respectively.
However, examining my serial output stream, I instead get alternating 15s and 7s, where the 15 is sometimes replaced by a 13.
This would suggest that PIND is reading the following binary numbers:
7 = B00000111;
15 = B00001111;
13 = B00001101;
These results are strange to me, because this suggests that the value of pin 2 is never changing, since it is constantly 1...
The two most far-right 1s and 0s of PIND are RX & TX from the documentation. Given this, I can understand why I would not get 0 and 12, as these would be set to 0 and 1 for send/receive. However, I do not understand why Rx would ever be set to 1 as this is input... since I am not sending code, I would not expect it to ever receive anything. Conversely, I do not understand why Tx would ever be 0, as it should always be sending..?
I imagine I am still doing something incorrectly. Am I interpreting the binary wrong? Could someone please point me in the right direction?

For your reference, my code is:
/* Arduino Port Manipulation to Generate Clock
*/
void setup()
{
Serial.begin(115200); //Set serial baud rate
}
void loop()
{
PORTB = B00011000; //Set Port B pins 11,12 HIGH, others LOW
Serial.println(PIND); //Read all Port D pins (0-7) simultaneously and print
delayMicroseconds(10); //Delay for 10 microseconds for timing
PORTB = B00000000; //Set all Port B pins LOW
Serial.println(PIND); //Read all Port D pins (0-7) simultaneously and print
}
EDIT: Alternatively, is there a way to simply read from 2 pins instead of all of PIND, but do so simultaneously? This would eliminate the ambiguity with what Px and TX may be doing. Still doesn't explain why pin 2 is always 1, though.
Thank you again for your help!
arduinoRobo