View Full Version : which avr has maximum number of i/o pins?

08-04-2008, 07:23 PM
i need to input large number of individual boolean yes/no. you may think of it as a public voting system in some game. number of such voting devices could be even upto 100. so i need to have one main master avr to which all voting device in hand of public respond to. so i need that mcu should have maximum number of i/o pins .any ideas for that? AT32UC3A1512 offers 69 i/o pins. any other one which offers more? also, i wld be greatful if you could tell me its approximate cost. thnx.

08-04-2008, 08:06 PM
hey, i forgot to tell u dat the above MCU is not in PDIP package. i wld prefer one in PDIP, and have maximum i/o pins

08-04-2008, 08:46 PM
@mk: To take a 100 inputs, you need no more then 20 i/o's. :)

The largest AVR device available in a PDIP package is the ATMEGA644P (clickie) (http://www.atmel.com/dyn/products/product_card.asp?part_id=3896), which has 32 i/o's.

Also, the AT32UC3A1512, is not an AVR device, it is AVR32, which i quite different from the AVR architecture.

Hope this helps,


Debu :)

08-04-2008, 11:37 PM
hi mk

your problem statement is not very clear..... what i get is you want to build a voting system like used in TV shows in which audience are given 5 to 10 sec to vote using their voting pads...... if this is your problem then debu is very right..... you do not need much i/o lines........

speed of humans is very less compared to even slowest uC...... lets say a person push the switch and then releases it... it takes approx 200ms...... in this time a uC running at 1MHz can execute 2lac instructions...... so even if you write a code that scan 1 user in 100 instruction cycle,you can support 2000 users on single i/o pin.....but yes it require a lot of MUX........ to reduce MUX you can use more i/o lines.

now if you have only 100 users, i would suggest to use any small avr, say atmega8...... use 8 i/o lines, 8 16X1 MUX, initiate a 4 bit counter and use it as selection line comman to all MUX......

another point to see is that if you use 100 i/o lines for 100 users, and suppose users are seated in a large room (which generally is the case) then you need 100 wires streached down from user to the avr..... if you use MUX you need only 8 long wires and other are short wires.......

hope you got my point.......

08-05-2008, 08:20 AM
yea... im getting ur point.... but i dont know much about mux, will need to study more about the..... thnx, for the wonderful idea of using mux, i think it should work well now. n yea, u got it right, i need to build a voting system nly as in game shows.


08-05-2008, 08:36 PM
@mk, ashish_agarwal123456: No need for any multiplexers. All you need is a matrix-type setup. so you need 2*(n^0.5) i/o's for 'n' inputs.

If you look carefully at this image:

http://img158.imageshack.us/img158/1852/39875803xm9.th.jpg (http://img158.imageshack.us/my.php?image=39875803xm9.jpg)

You will see, that by placing an input at each of the junctions, at the intersection of the matrix, by simply using 2*6 lines, you are able to get 36 inputs!!

Similarly, if you use 2*10 lines, you can get 100 inputs.

Hopte this helps.


Debu :)

08-05-2008, 10:40 PM
i think that's a crossbar pattern used in telephony..... but i can't get how it is working..... i mean to realize it we have to replace each node with some circuitry.... is it so???? something like a transistor or tri-state???

08-06-2008, 06:28 AM
@ashish_agarwal123456: Well, no extra circuitry is required, for digital inputs. It works in a very simple manner:
1) Just connect your input at each of the juctions.
2) Write code to monitor the columns, only the columns, of the matrix.
3) If an input high is detected at one of the columns, then quickly check all the rows.
4) Now, say in the 6x6 matix that is shown on top, column 4 is high, and row 3 is high. That means that input number 21 is high.

Its quite simple, really. This same method is also used in Matrix keyboards.


Debu :)

08-06-2008, 09:12 AM
hey, dats a really gr8 trick! very easy too, thanks a lot!!! it would be useful even in my future projects!, thnx!

08-06-2008, 11:11 AM

if we give input to any junction, then wont all the other junctoins also become high as they are all interconnected?

as you say, if we give input at junction number 21 (column 4, row 3), then in the figure you gave, PIND3 and PINC2 should go high. right? but to the PIND3, we would also be connecting C0, C1, C2, C3, C4, C5. ie all of them would go high similarly, al of the columns would also go high.

if we use diods between the junctions, directed such that dey are forward bias with respect to current flowing towards the PINs, the do you mean to say that we have to find out the top left corner of the square of HIGH junctions formed.

Or is there any other way that im not able to figure out at present, by which in the total matrix, just 1 row and 1 column would be HIGH.

08-06-2008, 11:29 AM
really cool trick man.......
but you know i am never out of questions...... i was wondering of the situation as shown......

http://img47.imageshack.us/img47/9799/crossbargr0.gif (http://imageshack.us)

08-07-2008, 10:19 AM
I think it could work this way.....

refering to the diagram in the previous post.........

if you configure port ABCDEFGH(column) as output and 12345678(row) as input
and make connection so that at each node when a user pushes a button then the particular row and column line get shorted

Then scanb in this way...

set coulmn A high and read in rows .Check which bits are set.Now set column B high.Again read in row.

Suppose D4 is pressed then when you activate line D ,the bit 4 of the row would be high....

shouldnt this work?

08-07-2008, 10:59 AM
ya that will work..... and that's what is known as TDM(time division multiplexing) and is done at ic level using MUX or tri state......

08-07-2008, 07:30 PM
@mk: No there is no problem, you will need to put a button at each juction which has the configuration,asin the image below. Think about it. :)

http://img150.imageshack.us/img150/4779/52407026wh7.th.png (http://img150.imageshack.us/my.php?image=52407026wh7.png)

@ashish_agarwal123456: Alas! Yes, this is a problem in the matrix configuration. Even if there are two inputs simultaneously, you will get false inputs.

And, No, You don't require extra circuitry at all.


Debu :)

08-07-2008, 08:42 PM
i think there is a little mistake here...... or may be i have misunderstood.....i think either the column or row should be made output port and the other as input port.... otherwise where the power will come from???

see this link.... it shows how matrix configuration works, how it can be implemented and how the above mentioned problem can be eleminated....


and if you are looking for more info on how modern keyboard works look at this:

08-07-2008, 09:26 PM
can v use the same matrix method to give output as well? what changes in the circuit would b necessary?

08-08-2008, 12:00 PM
yes, of cource....... just make both the avr ports as output..... make one column active at a time and give parallel data for that column from other port......

http://img376.imageshack.us/img376/2208/memorymappingol2.gif (http://imageshack.us)

also go through the memory mapping concept, its the same thing....... you can refer computer architecture by morris mano......