Here is a diagram from the spec describing the circuit configuration for each I/O pin.
According to the spec, all ports have individually selectable pull-up resistors with a supply-voltage invariant resistance of 20K-50K ohm. In addition, all ports have protection diodes to both VCC and GND.
The pull up resistor can be enabled by software with the following code:
"Consequently a pin that is configured to have pullup resistors turned on when the pin is an INPUT, will have the pin configured as HIGH if the pin is then swtiched to an OUTPUT with pinMode(). This works in the other direction as well, and an output pin that is left in a HIGH state will have the pullup resistors set if switched to an input with pinMode()"
According to the spec, all ports have individually selectable pull-up resistors with a supply-voltage invariant resistance of 20K-50K ohm. In addition, all ports have protection diodes to both VCC and GND.
The pull up resistor can be enabled by software with the following code:
pinMode(pin, INPUT); // set pin to input
digitalWrite(pin, HIGH); // turn on pullup resistors
This means when the pin is configured as input:
- No need for external pull up/down resistors
- Value of pin when nothing is connected is "pulled-up": HIGH (1)
"Consequently a pin that is configured to have pullup resistors turned on when the pin is an INPUT, will have the pin configured as HIGH if the pin is then swtiched to an OUTPUT with pinMode(). This works in the other direction as well, and an output pin that is left in a HIGH state will have the pullup resistors set if switched to an input with pinMode()"
"The analog pins also have pullup resistors, which work identically to pullup resistors on the digital pins. They are enabled by issuing a command such a:"
digitalWrite(14, HIGH); // set pullup on analog pin 0
No comments:
Post a Comment