Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to reduce the number of I/O Pins?

Status
Not open for further replies.

Victory1981

Newbie level 6
Joined
May 21, 2003
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
177
Hello, everyone.
I'm a newbie on microcontroller and meet with a problem.
I'm using AVR Mega16 which has 32 I/O Pins, I often fell it's not enough at all!
4*4 Matrix Keyboard : 8 pins
16*2 LCD: 11 pins
T0/T1,INT0/INT1 left for further used... 4 pins

Now, left only 9 I/O pins....
If I want to use a RAM....It's not enough at all!
Can someone tell me how to reduce the number of I/O pins I used?
Say, a IC can tranlate 4*4 Matrix Keyboard signal to binary number(which can reduce 4 I/O pins).

Is 8255 good? Or address registers(such as 74XXX) are better?
Or any new ideas about reducing the number of I/O pins?
 

hi .. it depends on your apps ... try latches ...e.g 74hc573

regards

cancel
 

Victory1981 said:
Hello, everyone.
I'm a newbie on microcontroller and meet with a problem.
I'm using AVR Mega16 which has 32 I/O Pins, I often fell it's not enough at all!
4*4 Matrix Keyboard : 8 pins
16*2 LCD: 11 pins
T0/T1,INT0/INT1 left for further used... 4 pins

Now, left only 9 I/O pins....
If I want to use a RAM....It's not enough at all!
Can someone tell me how to reduce the number of I/O pins I used?
Say, a IC can tranlate 4*4 Matrix Keyboard signal to binary number(which can reduce 4 I/O pins).

Is 8255 good? Or address registers(such as 74XXX) are better?
8255 if good but u can think about serial mode and do paralel
Or any new ideas about reducing the number of I/O pins?
 

With a little bit of software and 4(5) diodes you could control max. 12 keys with 4 io pins (or max. 20 keys with 5 io pins).

Also if you operate the LCD in 4 bit mode you need only 7(6) io pins (6 io pins if you tie the WR pin of the LCD to GND but in this case you can not read back anything from the LCD).

best regards
 

try to use MUX...
 

Victory1981 said:
Hello, everyone.
I'm a newbie on microcontroller and meet with a problem.
I'm using AVR Mega16 which has 32 I/O Pins, I often fell it's not enough at all!
4*4 Matrix Keyboard : 8 pins
16*2 LCD: 11 pins
T0/T1,INT0/INT1 left for further used... 4 pins

Now, left only 9 I/O pins....
If I want to use a RAM....It's not enough at all!
Can someone tell me how to reduce the number of I/O pins I used?
Say, a IC can tranlate 4*4 Matrix Keyboard signal to binary number(which can reduce 4 I/O pins).

Is 8255 good? Or address registers(such as 74XXX) are better?
Or any new ideas about reducing the number of I/O pins?

you can run it all from 8 pins of an a/d using resistance level on the circuit
forinstance the keypad can use four resistors on each row columb all connected to just two wires

simple effectivly using the a/d on the chip as a voltage comparitor

this is how old style two wire remote controls on a vcr worked {3v29 - 37 jvc}

for data i/o why not use a chip expander in the form of another micro

1 or 2 wires in shift in shift out gives 16 i/o's

so you can cut down the number of wires

appart from the mux bus design
this is a good alternative
 

hello

you can use philips I2C I/O expander ICs or use a serial to parallel converter shift registers.

you can also use devices with serial port interfaces (I2c,SPI),there are many peripherals with I2C interfaces from philips ,TI,Dallas ,....

In new designs because the serial speed is enough and satisfactory ,serial devices is better!
 

You can share the keypad and Lcd using same pins. But the I2C suggestion is better. You can use PCF8574s 8 Bit I/O devices. You only then need to use 2 pins on the cpu (data/clock) for up to 16x 8bit chips (8x pcf8574 8x pcf8574A). "A" suffix is different address group. Most high level languages have support for these. I always use 4 bit lcd anyway, make board layout easier.
 

To reduce the number of pins required for charater LCD's you should use the LCD in 4-bit mode rather than 8-bit mode.
Look at the bottom of this page: www.mysunrise.ch/users/pfleury/avr-lcd44780.html
Often it is not nessasary to read from the LCD's RAM and then you can connect the LCD's R/W pin to GND instead of connecting it to the AVR. Then you only have to use 6 pins (D4-D7, Enable and R/S) for your LCD instead of 11. Remeber to connect the LCD's unused D0-D3 to GND.
 

I think the simple way is to expand the IO pins. you could use 74138.
 

When should I use I2C?

I know I2C is very hot now.
But I don't quite understand that.
What's the benefit of I2C? Just reduce I/O pins?
What's the disadvantage?
If I need high speed AD sampling(say, >500KSPS),
can I2C transfer the data to microcontroller quickly enough?

I'm a newbie on microcontroller... want your help.
Thanks in advance.
 

HI

You have still a lot of good answers for your problem .....

But I suggest to download some stuff from Avrfreaks :

DN045 "Using shift register to increase number of IO pins"
DN044 "Using trinary coding to reduce pin wastage"
DN047 "The pin adder"

**broken link removed**

Regards
 

Re: When should I use I2C?

Victory1981 said:
I know I2C is very hot now.
But I don't quite understand that.
What's the benefit of I2C? Just reduce I/O pins?
What's the disadvantage?
If I need high speed AD sampling(say, >500KSPS),
can I2C transfer the data to microcontroller quickly enough?

I'm a newbie on microcontroller... want your help.
Thanks in advance.

The I2C bus was inveted by Philips.
I2C bus is used in for example televisions to control all the IC's at the chassis. Big IC manufactures like Philips, SGS-Thomson (ST) and others (mostly european companies) makes a lot of special IC's that can only be interfaced through IC2 interface.
One I2C advantage is, as you say to reduce the I/O pins, but another and just as imporant advantage is that it makes routing and wireing througout the chassis a lot easier, because you can connect all the IC's to the same two-wire bus.
Another similar bus is Micro-wire, I think this bus is more common by Japanese IC companies.
If you need higher speed you could use the three wire SPI bus instead of I2C. As I recall you can use this bus at higher speeds, be aware that there are different I2C bus speed specifications, some IC's can be used a 100 kHz, some at 400 kHz and some at 3400 kHz bus speed.
Here's all the info you need about I2C: www.semiconductors.philips.com/buses/i2c/
 

The 8255 will reduce number of pins dependent how many these chips you are going to use . If for chip select you will use
decoder which for 4 GPIO can give you
16 chip connection and 2 bits for read and 2 GPIO for 8255's read/write signals (and may be few for its other control circuit ), so you can have 4+2+8 + control pins , with number of extended ports is up to 24*16 = 384 .
Also with ATMEGA16 you can not (as far as I know) use external RAM , ATMEGA128 implements that .
 

Hi,
if you must connect external parallel access RAMs to your uC, the best way is to use 74xx373 (this permit to you to share 8 data bit and 8 address bit using only 8 I/O port of uC) and use a 74xx139 for decoding the RAM banks. I’ve used this method to connect 8kx8 (4 chips SRAM and NVRAM) to PIC uC. Pay attention because there are time critical situations if you use high speed quartz (study the datasheets of the components).

You can use serial access RAMs, instead. The protocol is I2C. But I never used them yet.
 

the 74C922 and 74C923 are 20 key keyboard encoder with debounce, 2 key rollover and tri-state output, but are pretty pricey
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top