Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/13/05 16:22
Modified:
  04/13/05 16:25

Read: times


 
#91511 - Input/Output
Responding to: ???'s previous message
Hi Karthik,

I think I can help with your confusion. The i/o port, which is to say each pin of the port, is an open collector circuit. Most of the ports have internal pullup resistors, but one will probably require that you provide external pullup resistors (I don't remember which, check your data sheet).

If you write a 1 to the port you are setting the voltage hi above a pullup resistor. If whatever is connected to the pin externally also sets the voltage hi, then the voltage across the pullup resistor is zero, no current flows and the pin is hi. On the other hand, if something external sets the pin to zero volts then there is voltage across the pullup resistor. The current flows appropriately and the pin is at zero volts. On the other hand, if you write a zero to a pin (to the top of the pullup resistor) and something external writes a 1 to the same pin, then the voltage across the pullup resistor is reversed, current tries to flow the wrong way round and the strongest supply wins. Well, maybe your ยต-controller won't actually fry (How dangerous would that be, to have a device that was damaged by every data bus conflict? Can you imagine trying to manage the setup and hold time requirements?), but you will certainly get indeterminate results when you try to read the pin's value.

This is why the datasheets tell you to write a 1 to a pin if you plan to read it as input. It's the only way you'll know what the external device has set it to. (I'm assuming that you aren't trying to read a tri-state device in its floating state.)

I hope this helps. Good luck,

Joe

List of 13 messages in thread
TopicAuthorDate
ports input to ouput            01/01/70 00:00      
   Fundamental questions            01/01/70 00:00      
   Not relevant            01/01/70 00:00      
   Input/Output            01/01/70 00:00      
      Top of pullup??            01/01/70 00:00      
         Yes, the top.            01/01/70 00:00      
            now you even confused me            01/01/70 00:00      
               A good representation of 8051 I/Os here            01/01/70 00:00      
            What do you think, Karthik?            01/01/70 00:00      
            Always an input, no matter how you treat            01/01/70 00:00      
               I concede            01/01/70 00:00      
            Pull down            01/01/70 00:00      
   I am clear now thanks to everybody            01/01/70 00:00      

Back to Subject List