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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/21/06 17:23
Read: times


 
#112724 - Ports
Responding to: ???'s previous message
You really need to take a closer look at the way ports operate on the 89C52. In a nutshell, when writing a 1 to the pin you are effectively turning off the output driver, thus allowing an internal or external pullup resistor (or device) to pull the pin to Vcc. If you now read that pin you will read logic 1. You have your sensor connected to the pin and is outputting a logic one. Again, read the pin and will read logic 1. (or +5 as you put it). Now your sensor outputs a 0. Since your port pin is now a high input impedance your sensor has no trouble pulling the pin to ground potential (or very close to it). Read the pin again and you will read logic 0.
In summary: write a 1 to the pin and depending on which port, the pin is effectively open or connected to Vcc through a high resistance. In this state an external device can easily pull the pin to ground, or leave it at Vcc. When you write a 0 to that pin that pin is forced to ground. any attempt to pull it up to Vcc will result in excessive current, possibly damaging the port and/or the external device.

Hal

List of 14 messages in thread
TopicAuthorDate
About I/O 89C52            01/01/70 00:00      
   what about reading this thread            01/01/70 00:00      
   hmm ?            01/01/70 00:00      
   So, read it.            01/01/70 00:00      
      but            01/01/70 00:00      
         yes            01/01/70 00:00      
         reread the "bible"            01/01/70 00:00      
            so            01/01/70 00:00      
               bfore reading a 1 read the bible            01/01/70 00:00      
               Ports            01/01/70 00:00      
                  pullup + loading capacitance            01/01/70 00:00      
         No            01/01/70 00:00      
   so that's true ?            01/01/70 00:00      
      no else if            01/01/70 00:00      

Back to Subject List