Electronics > Microcontrollers
Input and output config question
(1/1)
Spekkio:
I wonder, how does an MCU work internally when configuring a pin as input/output.
From what I understand, when an I/O is configured as input it has a high resistance, and if configured as output it has low resistance.
I have connected a SN65HVD231 Transceiver Rs pin to a I/O on a MCU, looking in the datasheet for the transceiver, you can read that the Rs pin controls the slope-control, putting a 100k resistor to ground from Rs pin will result in 2V/us slew rate, 10k sets it to 15V/us slew rate.
If I connect a I/O to the Rs pin, and configure the I/O as an Input, would it be the same as connecting a large resistor to ground ?
What happens when you configure the I/O as an output and set it to low-level, would it be the same as connecting the Rs pin directly to ground, and directly to Vcc when high-level?
Psi:
--- Quote from: Spekkio on December 07, 2011, 11:16:35 am ---If I connect a I/O to the Rs pin, and configure the I/O as an Input, would it be the same as connecting a large resistor to ground ?
--- End quote ---
Hard to say, if its set as an input it shouldn't be drawing any current at all, but it probably will a tiny bit.
AVR datasheet says 1uA input leakage so @ 5v that's 5Meg Ohms, but it could be to high or low.
Ya can't use this for anything, for all intensive purposes the input resistance is infinite.
Unless you have a pin pullup enabled, then it will pull to vcc through the internal pullup (around ~50k)
--- Quote from: Spekkio on December 07, 2011, 11:16:35 am ---What happens when you configure the I/O as an output and set it to low-level, would it be the same as connecting the Rs pin directly to ground, and directly to Vcc when high-level?
--- End quote ---
Correct.
There will be a slight on-resistance in the micro's internal driver fets than means it wont be able to pull too exactly vcc or gnd, but it will get very close.
Here's how the i/o pins works for AVRs.
Navigation
[0] Message Index
Go to full version