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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/06/06 15:51
Modified:
  06/06/06 15:53

Read: times


 
Msg Score: +2
 +2 Good Answer/Helpful
#117878 - many get confused by this
Responding to: ???'s previous message
My purpose is to use Port2 as output port only. I use Port3 for input-only by writing #FFh to it in the beginning of my program. After that, I will only read from that port. But Port2, which I want use only for output only, wont it suddenly become for-input-only if I happen to write a HIGH to any of its pins, (which I will)?

The below refer to 'standard' '51 ports only The OP is using a derivative with standard ports. Some newer derivatives have configurable ports and for such this only applu when in the quasi-bidirectional mode.

There is no such thing as "input mode". "input only", "output mode" and "output only"

ANY port pin is ALWAYS OUTPUT.
If you write a '1' to it it will output a '1' but in that state it is "input capable".

So, if a port pin OUTPUT a '1' it may be externally be pulled down (which is input) but it still OUTPUT a '1' which just happens to be pulled down externally so you read a '0'. SO, if there is nothing connected that can pull the signal down, you have a signal at the '1' level. Go back to the "wired OR" example and visualize this.
Now, if a port output a '0', you can not affect it externally without popping the chip.

we had a similar discussion a while ago, http://www.8052.com/forum/read.phtml?id=108366

Erik

List of 18 messages in thread
TopicAuthorDate
Help Understanding AT89C51 Datasheet            01/01/70 00:00      
   logic gain and other            01/01/70 00:00      
      Should I study more?            01/01/70 00:00      
         do you have any hardware knowledge            01/01/70 00:00      
            No hardware knowledge            01/01/70 00:00      
               what purpose?            01/01/70 00:00      
                  Purpose            01/01/70 00:00      
                     many get confused by this            01/01/70 00:00      
                        Got it !            01/01/70 00:00      
   per-pin, per-port, and whole-chip limits            01/01/70 00:00      
      strictly speaking...            01/01/70 00:00      
         Slight oversimplification            01/01/70 00:00      
            it used to be DC, now it is AC            01/01/70 00:00      
      "per pin"            01/01/70 00:00      
   Good post!            01/01/70 00:00      
      Excellent Community            01/01/70 00:00      
   have you read "the bible"            01/01/70 00:00      
      Yes, I have started            01/01/70 00:00      

Back to Subject List