Author Topic: Input and output config question  (Read 1738 times)

0 Members and 1 Guest are viewing this topic.

Offline Spekkio

  • Regular Contributor
  • *
  • Posts: 94
  • Country: se
Input and output config question
« on: December 07, 2011, 11:16:35 am »
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?
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7446
  • Country: nz
Re: Input and output config question
« Reply #1 on: December 07, 2011, 11:53:48 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 ?
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)

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?
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.


« Last Edit: December 07, 2011, 12:21:35 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf