Go Down

Topic: Note about pin 13 and digital input (Read 345 times) previous topic - next topic

abend

May 07, 2007, 05:24 am Last Edit: May 07, 2007, 05:24 am by abend Reason: 1
Hi all,

I just spent two hours figuring out what was causing me trouble, and am posting here so that I can hopefully save someone else some time.

I'm trying to read a 9 bits (8 bit data byte, plus one "data good" signal) in parallel into my Arduino. I am using three digital inputs, (11, 12, and 13) and the analog inputs. My reason for using the analog inputs is to save the digital outputs to drive a pair of shift registers (4 pins each, 1 shared, so 9 total).

When reading the input byte, I noticed that I didn't always get the correct value. At first, I assumed an error in the algorithm that generates the number, but when that checked out, I started getting suspicious of the part that sends the 9 bits to the Arduino. I had it send values that would have a lot of the data bits set, such as 255 (11111111 in binary). It appeared that no matter what I sent, the second bit from the MSB was always 0. I checked which pin that was, and noticed that it was pin 13, the pin with the LED on it.

Looking at the schmatic, I noticed that the LED is between the pin and ground. At 5V, LEDs don't present a lot of resistance. I effectively had a 0 ohm pulldown resistor on the input, keeping it at ground no matter what signal I applied to it. Interestingly, on the NG Rev C boards, the LED is not installed. I have my suspicions that this is because it makes the pin hard to use as an input.

My plan now is to take the LED off so I can use the pin. I'll leave the SMD resistors next to it in place, so that I can still use an LED between 13 and ground for debugging.

Hope this saves someone's evening,
Abend


http://www.arduino.cc/en/uploads/Main/arduino_NG_schematic.png


Go Up