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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Andy Neil
03/03/05 07:40
Read: 2524 times

#88984 - Picky, picky, but no such thing!
Responding to: Michal Hupka's previous message
Michal Hupka said:
As Andy and Neil said on "classic" 8051 (or 8052) if you write the 1 to bit in register that match pin on microcontroller, it is setted as an input pin.

That was Andy & Neil; now here's Andy Neil!

Actually, there is nothing to set a standard 8051 pin as an input; all pins are always bidirectional.
However, if you write a '0' to a pin, it turns the open-drain driver ON and there is no way that anything external can ever force it to anything other than '0'
Therefore the input will just read '0' - irrespective of the external signal you might wish to read.

But If you write a '1' to a pin, it turns the open-drain driver OFF and so an external signal can take the pin either high or low - and the input can read the state of the external signal.

The is all explained in Chapter 3 of the "bible" for the 8051:

Chapter 3 - 80C51 Family Hardware Description:

Start reading at p2, "Port Structure and Operation" and pay particular attention to Figures 4 & 5

List of 17 messages in thread
on 8051 settings pins as input or output      Stewart Mathers      03/02/05 14:46      
   re: setting pins as input or output      Andy Peters      03/02/05 14:50      
   thanks      Stewart Mathers      03/02/05 14:56      
      Do you not      Neil Kurzman      03/02/05 15:47      
   It's depending on chip      Michal Hupka      03/03/05 07:14      
      depending on chip      Erik Malund      03/03/05 07:25      
         No reason for negative Karma point      Kai Klaas      03/03/05 08:25      
            fine      Steve M. Taylor      03/03/05 08:41      
            not first post, not first time asked      Erik Malund      03/03/05 08:56      
      Picky, picky, but no such thing!      Andy Neil      03/03/05 07:40      
         oh, I did just that      Erik Malund      03/03/05 07:56      
            Don't try this at home...      Andy Neil      03/03/05 08:02      
               Maybe it still works...      Kai Klaas      03/03/05 08:48      
                  Eh???      Andy Neil      03/03/05 09:23      
                     It's a joke, don't take it too literaly      Kai Klaas      03/03/05 10:06      
                        Sorry      Andy Neil      03/03/05 10:11      
                           My english is still so poor...      Kai Klaas      03/03/05 10:22      

Back to Subject List