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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/10/07 15:34
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#130578 - Port 0 is open drain
Responding to: ???'s previous message
Hi Hazman,

Port 0 is different from the other ports of an 8051 in that it is open drain. This is why you need pull up resistors on the pins of port 0.

Bipolar transistors have three terminals; emitter, base and collector. MOS FET transistors have source, gate and drain terminals. Either can be configured as an open collector or open drain circuit. Now the pin circuitry of the 8051 port 0 is slightly more complex than I am about to describe, but this should still be sufficient for you to understand the function of those pull up resistors.

Think of a normally biased NPN transistor (common base configuration if my memory serves). When the base current is below the turn-on threshold, the transistor is in cutoff and V_ce is approximately = to V_cc. If the emitter is tied to 0 V, then the voltage measured at the collector is approximately V_cc. If the base current is then turned on sufficiently to drive the transistor into saturation, V_ce drops to nearly 0 V, putting the collector at approximately the same voltage as the emitter (0 V). This is how normal TTL logic works. The output is taken from the collector, the input is applied to the base, and the only two operating points used are cutoff and saturation.

But in the case of an open collector configuration (or an open drain configuration) V_cc is not tied to the collector (or drain). It is instead left "open" or unconnected (hence the name). Thus, when no current is applied to the base (gate), and the transistor is in cutoff, the collector (drain) is just floating at some indeterminate voltage. It is in a high impedance (Hi-Z) state.

If you measure the voltage level of an open collector/drain pin while in the Hi-Z state you will measure indeterminate voltage. It may read a high voltage on a sufficiently hi impedance meter, but it will not source any current. Thus, if you're trying to drive anything with it, the voltage will be pulled down quickly and it won't work.

By attaching a pull up resistor to the pin you are essentially providing the V_cc connection to the collector, and more importantly you are providing the current source for whatever you want to drive.

Now, with the pull up resistor in place, consider the transistor as being in cutoff. No current flows through the transistor, therefore no current flows through the pull up resistor. And if no current flows through the resistor, no voltage is dropped across it. Thus, if V_cc is applied to one end of the resistor, V_cc is present at the other end (the transistor collector) as well. The output is now held at a definite voltage level, namely V_cc.

Similarly, if the transistor is turned on and driven to saturation, maximum current flows and almost all of V_cc is dropped across the pull up resistor. Thus, the voltage present at the collector of the transistor is approximately 0 volts.

Again, while the circuitry of the 8051 port 0 is a bit more comples than this, this is still basically how open collector/drain circuits work. Hopefully this helps you understand it a bit better.

By the way, this is also why sometimes you will see the datasheet of a ยต-controller say that writing a 0 to a port pin is turning it on, and writing a 1 is turning it off. This has confused more than a couple of newcomers to the subject, because we tend to associate turning something on with producing the output voltage (V_cc) and turning it off as taking the voltage away (0 V). But, as you have just seen, it works backwards from the way we intuitively think.

Hope this helps.
Joe


List of 62 messages in thread
TopicAuthorDate
how can i use port 0 as output            01/01/70 00:00      
   read            01/01/70 00:00      
      not quite understand            01/01/70 00:00      
         READ            01/01/70 00:00      
            i'm blur            01/01/70 00:00      
               it is a \'1\', but not a \'high\'            01/01/70 00:00      
         Port 0 is open drain            01/01/70 00:00      
            connection between u-c with pull up?            01/01/70 00:00      
               Basics            01/01/70 00:00      
                  typo            01/01/70 00:00      
                     Doh!            01/01/70 00:00      
               The answer is...            01/01/70 00:00      
                  Sinking and Sourcing            01/01/70 00:00      
                     Correct!            01/01/70 00:00      
                  sending data using port 0?            01/01/70 00:00      
                     Yes            01/01/70 00:00      
                        LED display driver            01/01/70 00:00      
                           Port1 is better than port0 for this            01/01/70 00:00      
                              is it right like this?            01/01/70 00:00      
                                 NO            01/01/70 00:00      
                                 Where is the TB62726 in your circuit??            01/01/70 00:00      
                                    stiil stuck with port0            01/01/70 00:00      
                                       help me plz            01/01/70 00:00      
                                          drop the cute stuff            01/01/70 00:00      
                                    connections right or not?            01/01/70 00:00      
                                       Hallelujah!!            01/01/70 00:00      
                                          I already did            01/01/70 00:00      
                                          sorry            01/01/70 00:00      
                                       No            01/01/70 00:00      
                                 Looks like a point of confusion            01/01/70 00:00      
                                    It is not Right            01/01/70 00:00      
                                    Looks like total confusion!            01/01/70 00:00      
                                       looks like?            01/01/70 00:00      
                                    confused..            01/01/70 00:00      
                                       That is Right            01/01/70 00:00      
                                       the schematic is fine, BUT            01/01/70 00:00      
                                       You have damaged the micro!!            01/01/70 00:00      
                                    my assumption right now            01/01/70 00:00      
                                       basics            01/01/70 00:00      
                                          Deja Vu            01/01/70 00:00      
                                          Wyh not?            01/01/70 00:00      
                                             the difference is            01/01/70 00:00      
                                       See my recent post.            01/01/70 00:00      
                                          why not ?            01/01/70 00:00      
                                          No, you're wrong ...            01/01/70 00:00      
   Don't remove your earlier schematics!!            01/01/70 00:00      
      RightO            01/01/70 00:00      
         a good way to burn the port pin (and the LED)            01/01/70 00:00      
            Sorry Datasheet is different for what I am saying            01/01/70 00:00      
               NO, nada, niente, never, nie, non,, aldrig            01/01/70 00:00      
               Hair-raising...            01/01/70 00:00      
               Completely Incorrect!            01/01/70 00:00      
                  In practice..            01/01/70 00:00      
                     Please read specs properly            01/01/70 00:00      
                        What has survived your "tests" must be correct?            01/01/70 00:00      
      diagram attached            01/01/70 00:00      
         Connections are not correct!            01/01/70 00:00      
   Modifications            01/01/70 00:00      
      PWM without using 8051-Timer            01/01/70 00:00      
         New Topic; New Thread            01/01/70 00:00      
         Yes, but...            01/01/70 00:00      
         the usual question            01/01/70 00:00      

Back to Subject List