+ Reply to Thread
Results 1 to 4 of 4

Thread: Selecting I/O on the 8051

  1. #1
    AceOfHearts Newbie
    Join Date
    Apr 2007
    Posts
    185

    Selecting I/O on the 8051

    Hi there,

    I am a little confused concerning how to select input and output on the 8051.

    OK, upon reset, all the ports are input port. Right? And when the first 0 is written to the port, it becomes an output port....

    Why is it that when I send a logic (be it 1 or 0) it outputs it, without me writing this iniitial 0 to configure it as an output port?

    Suppose it is now an output port, and I now want to make it an input port so I need to send 1 to the port. But how does it know that I want to make it an input port, because it could just output it as a normal output logic?

    Confused. Please help...
    Last edited by AceOfHearts; 29th August 2007 at 10:18 PM.


  2. #2
    Brevor Newbie
    Join Date
    Feb 2007
    Location
    Valparaiso,Indiana USA
    Posts
    144

    OK, upon reset, all the ports are input port. Right? And when the first 0 is written to the port, it becomes an output port....
    No the ports do not get configured as input or output. They are bi-directional all the time. To use the port as an input write a 1 to it, whatever is providing the input (sensor, switch ect.) must pull the port pin low or let it float high to input the data.

  3. #3
    Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent
    Join Date
    Mar 2006
    Location
    Michigan, USA (GMT-5)
    Posts
    2,892

    The resolution of your problem involves the definition of the 8051 I/O port. It is a quasi-bi-directional output. The output stage of each pin on ports 1, 2, 3 has a strong n-channel pull down transistor and a very weak p-channel pull up tranistor. An 8051 output can sink several milliamperes of current in the zero state. The same output can source only 50 micramperes or so in the high state. Check the individual datasheets for the exact numbers. When the output data latch has a one written to it and it sources 50 microamperes, any external output can pull the weak p-channel transistor low without much trouble at all. This is radically different from the I/O ports on almost every other processor in the universe. Why was it done this way? In a word -- cost. In the early 1970's when the predecessor of the 8051 was designed the folks at Intel hit upon this technique to avoid having to use up valuable silicon real estate for a data direction register; it was an elegant solution at the time. With a little bit of care you can make the difference between the 8051 output stage and the alternative a complete don't care. A common base switch works really well in this application.

  4. #4
    mcs51mc Newbie
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    338

    Hope this Word document will remove all confusion ... ...
    Attached Files

+ Reply to Thread

Similar Threads

  1. hyperterminal communication w/ 8051
    By spyghost in forum 8051/8951
    Replies: 8
    Latest: 22nd May 2008, 11:54 AM
  2. 8051 ISP Programming
    By newby32 in forum 8051/8951
    Replies: 2
    Latest: 13th June 2007, 05:31 PM
  3. 8051 Microcontroller (Urgent Help)
    By UAE_Engineer in forum 8051/8951
    Replies: 5
    Latest: 22nd March 2007, 12:13 PM
  4. Could I get away with this? (8051 + AM29F010B)
    By mstechca in forum 8051/8951
    Replies: 0
    Latest: 9th March 2006, 03:05 AM
  5. interfacing 16*16 matrix display with 8051
    By pmphilip in forum 8051/8951
    Replies: 0
    Latest: 1st February 2005, 04:47 AM

Tags for this Thread