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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/07/03 09:08
Read: times


 
#52240 - RE: sample codes
Responding to: ???'s previous message
There is no such thing as separate input or output modes in the 8051. You can read from a port or write to a port without having to set a mode. If you write to a port that value will be output on the port pins. If you read from a port, you will read what logic value is on the port pins at that moment.
The I/O pin circuit is open-collector based. If you write a 1 to it, the pin will be weakly pulled up to +5V, if you write 0 to it, the pin will be strongly pulled (short circuited) to ground. So if you write a 0 to it, the pin is unusable for input (you will always read 0 if you read it, and you will burn up external logic trying to drive a 1 into this pin which is a very hard 0). To use a pin for input you must write a 1 to it (once is enough) to make it relatively 'weak' so that external logic can influence the level on the pin.
So with writing a 1 you actually are writing a 1 to the pin, and the 'side effect' is that the pin gets usable as input.

I'm curious what manual you mean if you say you have read the manual?
Read the official '8051 bible' for detailed information. You can find it under Links/Interesting sites.

List of 11 messages in thread
TopicAuthorDate
sample codes            01/01/70 00:00      
   RE: sample codes            01/01/70 00:00      
      RE: sample codes            01/01/70 00:00      
         RE: sample codes            01/01/70 00:00      
            RE: sample codes            01/01/70 00:00      
      RE: sample codes            01/01/70 00:00      
         RE: sample codes            01/01/70 00:00      
            RE: sample codes            01/01/70 00:00      
               RE: sample codes            01/01/70 00:00      
               RE: sample codes            01/01/70 00:00      
   RE: sample codes            01/01/70 00:00      

Back to Subject List