How to increase the I/O pins in a microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by devmania, Aug 25, 2010.

  1. devmania

    Thread Starter New Member

    Aug 22, 2010
    Hi everyone,

    Can any one tell me how to increase the i/o pins in a microcontroller?
    What should i interface with At89c51 microcontroller ?


    Jul 13, 2010
    there are two option to increase the I/O pins virtually..
    (1) use 8255
    (2) develop a program in such a way that any of one port will enables the buffer(External) of other by using this you can form Maximum 256 8-bit I/O ports from only 2 ports..
    but one thing keep in mind that number of ports u going to form will need same number of buffers..

  3. sage.radachowsky


    May 11, 2010
    Shift registers do wonders for increasing digital I/O pins. A serial-in, parallel-out shift register with latching will let you use 3 uC pins to control any number of digital outputs.
  4. Papabravo


    Feb 24, 2006
    Tri-state multiplexers like 74HC257 will greatly expand the number of input pins you can sense. I once did a board with 10 of them.


    Jul 13, 2010
    @ sage.radachowsky

    plz explain me how ?
    if possible give ckt diagram..
  6. wannaBinventor

    Active Member

    Apr 8, 2010
    Pull up some datasheets for some 3 state octal buffers and I'm sure you will see some example circuits.

    Basically you have 8 pins that make up a data bus. From there, you connect lines from each data bus to another set of inputs or outputs. Then you may need only one or two more IO lines to enable/turn off that particular data buffer.

    So, picture a uC with 15 I/O pins. You attach the databus (long lines connections that all the buffers wire to) to 8 of the pins, and then use the 7 other pins for bus selection (assuming the octal buffer only needed a high or low signal to an enable pin to turn data transfers on and off). These 7 buffers control 8 other IO lines each. So: with 15 pins you can control 7*8 = 56 data I/O lines using this method.

    A uC with 20 IO pins could control 12*8 = 96 pins.
  7. davebee

    Well-Known Member

    Oct 22, 2008
    It matters what the extra pins are for.

    Expansion pins will be slower than native IO pins. Sometimes that matters and sometimes it does not; it depends on the project.

    The 8255 can be difficult to work with. For one thing, if you change the direction parameters on any port, it sets all output ports to logic zero.

    Shift registers aren't quite as fast as the 8255 but might be easier to work with. But you might need an additional latch chip if you want to avoid glitches on output pins during shifting.

    Most expansion circuits will work on just about any microcontroller, as long as you watch voltage levels, such as between 3.3 and 5 volts.

    It's hard to offer a circuit diagram without more information on what the project's needs are - speed, number of pins, input or output or both, whether temporary output glitches would be a problem.
  8. retched

    AAC Fanatic!

    Dec 5, 2009
    Using a shift register that has latching as an option will make your life that much easier.

    If you find you need it, it's good to have. Adding another IC to "latch" the outputs would add to cost and complexity.

    And I would like to agree that it would be quite difficult to offer a schematic or diagram without knowing the specifics of your needs.
  9. GetDeviceInfo

    AAC Fanatic!

    Jun 7, 2009
    you haven't told use how many I/O your considering. If your going to add a device, consider other functionality. MAX3420 for instance has two general purpose 8 bit ports, with interrupt capabilities, and of course a USB host/device engine.

    A second 8051 micro in a slave configuration could add tons of versitility.
  10. sage.radachowsky


    May 11, 2010
    Take a look at the bottom circuit on this page.


    Jul 13, 2010
    Got ur idea..thanks..
    Don't u think this ckt is not of serial in/parallel out ,but it's of serial in/diffrential parallel out..

    (actuly serial in/parallel out is not possible in any case)
  12. sage.radachowsky


    May 11, 2010
    I don't understand what you mean....

    I'm talking about digital signals that have a low and high value.
    The shift register allows you to fill up a series of latches in a serial way, and then all those latched values appear on output pins in parallel.

    You can daisy-chain them together, as well, so you can have 8, 16, 24, 32... outputs all from the same 3 control pins of the microcontroller.

    I've used this method a lot and it's very useful. It can also help on PCB layout because if the output pins are far from the microcontroller, then you only have to route 3 lines to the shift registers, and then those create the 8 or 16 ... pins at their outputs.

    But usually, I tend to use a microcontroller with enough pins for the job.


    Jul 13, 2010
    Let the boudrate(rate of data) be X in serial comm,when u convert it to parallel(of 8 bit) the rate of data would be X/8.

    so that u can not spell it as serial in/parallel out,but u need to say serial in/diff parallel out.

    this's just for undersanding not relate to post(question) ..
  14. sage.radachowsky


    May 11, 2010
    Yes, it is true that the speed of the parallel output will be much slower than the speed of the serial input. This technique is not used for the highest-speed outputs. It is very useful, though, for things like strings of LEDs or strings of other kinds of actuators.

    If you run at 1 MHz, like I often do with a microcontroller, then it will take about 17 or 18 cycles to push all the data into a shift register. Or maybe if you use a "for()" loop then it will take about 50 cycles... because of the loop overhead and math, etc.

    Still, this is 50 uS, which is very fast for many things like LED control.