pc I/O interface card

Status
Not open for further replies.

raus

New Member
Hi,

I`m trying to build a card to interface with the pc. I have found several tutorials explaining how to connect a PIC with the computer by different methods, that part is partially solved.

The problem: i have to control 3 groups of 20 pushbuttons and 1 group of 30 LEDS. I planned to interface with the pc using a PIC16F877A with 40 pis, so i have 33 IO pins. I dont know how to connect the pushbuttons and the leds...

-Is there any IC that allows me to expand the I/O ports?
-I thought that i can use a PIC to control each group (3 pics for the buttons, 1 pic for the leds, and 1 pic to interface with the pc). Can I connect 4 PICs to the one that drives the interface with the pc by I2C protocol? If so, could anyone post the scheme, please?

Thx in advance
 
I suggest you try looking up 'multiplexing', you only need 16 pins (8x8 = 64 keys) to read 64 keys. Likewise you can multiplex the outputs as well, 12 pins (5x7 = 35 LED's).

Check my tutorials for some examples.

There's a more complex scheme called 'charlieplexing', and if you look at these forums it's mentioned a lot.
 
Thx for answering,

So you say I can connect the leds as if they were a matrix of pushbuttons? That would be great. The problem is that maybe i need to expand the circuit later with mre IOs, so i need to know if I can connect more PICs by I2C in case i run out of pins in the original circuit
 

You 'could', but I2C isn't a very good choice, it's easier to use a simple serial connection - and it only requires one I/O pin instead of two.
 
for expandibility of output, I'd go with the 74HC595 shift reg. You'll only need 3 I/O pins for any number of outputs since you can daisy-chain them. 8 outputs per chip. They are cheap ($.50 or less) and it's very easy to implement. You could drive them with SPI hardware on the 877, if you want, but bit bang works quite well.

I've also seen a 3 to 8 decoder used to row select a switch matrix so 11 pins can drive an 8x8 array. you could even use the 595 SR to do it.

so 14 pins could drive all your buttons and LEDs.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…