CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Adding lots of I/O to a PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jharkins
Guest







Adding lots of I/O to a PIC
PostPosted: Sat Jan 04, 2003 6:12 pm     Reply with quote

My hardware needs a lot of switch inputs. Nothing fast, response on the order to 50 ms or more should be fine. The switches won't change very often either, maybe once a minute.

Philips has an I/O expander that connects to an I2C bus and adds 16 bits. I need about 40 bits total. Anyone know of a way to add about 40 bits to a PIC without using 3 I/O expander chips, or resorting to a largish FPGA? The I2C bus is ideal as I'm already using all the pins on an 18f452 for other stuff.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10420
Lance Lascari
Guest







Re: Adding lots of I/O to a PIC
PostPosted: Sat Jan 04, 2003 6:28 pm     Reply with quote

I tend to like to use shift register based designs for slow-i/o, often with manual (software) spi type interfaces. 74hc165 might be worth looking at. You can chain as many of these as you want together, poll them at whatever rate makes sense.

-Lance


:=My hardware needs a lot of switch inputs. Nothing fast, response on the order to 50 ms or more should be fine. The switches won't change very often either, maybe once a minute.
:=
:=Philips has an I/O expander that connects to an I2C bus and adds 16 bits. I need about 40 bits total. Anyone know of a way to add about 40 bits to a PIC without using 3 I/O expander chips, or resorting to a largish FPGA? The I2C bus is ideal as I'm already using all the pins on an 18f452 for other stuff.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10421
Charlie U
Guest







Re: Adding lots of I/O to a PIC
PostPosted: Sun Jan 05, 2003 9:41 am     Reply with quote

:=My hardware needs a lot of switch inputs. Nothing fast, response on the order to 50 ms or more should be fine. The switches won't change very often either, maybe once a minute.
:=
:=Philips has an I/O expander that connects to an I2C bus and adds 16 bits. I need about 40 bits total. Anyone know of a way to add about 40 bits to a PIC without using 3 I/O expander chips, or resorting to a largish FPGA? The I2C bus is ideal as I'm already using all the pins on an 18f452 for other stuff.

Have you considered a scanned array of switches? Configure the switches in an array that has 5 columns and 8 rows, for example. The switches are at the cross points of the array and when closed, connect a column to a row. The basic concept is to drive one of the columns and read the rows, then drive the next column and read the rows, etc. To implement this scheme, you might try an additional small PIC that can operate as an I2C slave and just let it scan the switches. You could use the weak pull ups on the PIC to pull the inputs high and then have the column outputs idle high and drive low to scan. If you will ever have multiple switches closed at one time, you might consider current limiting series resistors, or just switch the idle outputs to inputs.

Melabs has a schematic of one of the proto boards on their website. They have a scanned array of 16 switches on a port. See the link below.

Give this a thought and let us know what you come up with.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10427
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

Re: Adding lots of I/O to a PIC
PostPosted: Sun Jan 05, 2003 9:18 pm     Reply with quote

Use the 74165 for the inputs and 74595 for the outputs

Regards
Mark

:=I tend to like to use shift register based designs for slow-i/o, often with manual (software) spi type interfaces. 74hc165 might be worth looking at. You can chain as many of these as you want together, poll them at whatever rate makes sense.
:=
:=-Lance
:=
:=
:=:=My hardware needs a lot of switch inputs. Nothing fast, response on the order to 50 ms or more should be fine. The switches won't change very often either, maybe once a minute.
:=:=
:=:=Philips has an I/O expander that connects to an I2C bus and adds 16 bits. I need about 40 bits total. Anyone know of a way to add about 40 bits to a PIC without using 3 I/O expander chips, or resorting to a largish FPGA? The I2C bus is ideal as I'm already using all the pins on an 18f452 for other stuff.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10443
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

port expansion
PostPosted: Mon Jan 06, 2003 9:07 pm     Reply with quote

An 82C55 will expand an 8 bit port by 3
___________________________
This message was ported from CCS's old forum
Original Post ID: 10489
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Adding lots of I/O to a PIC
PostPosted: Tue Jan 07, 2003 1:06 pm     Reply with quote

:=Use the 74165 for the inputs and 74595 for the outputs
:=
---------------------------------------------------------

CCS has example files for doing this:

EX_EXPIO.C
74165.C
74595.C
___________________________
This message was ported from CCS's old forum
Original Post ID: 10513
John Yaron
Guest







Re: Adding lots of I/O to a PIC
PostPosted: Tue Jan 07, 2003 1:11 pm     Reply with quote

:=My hardware needs a lot of switch inputs. Nothing fast, response on the order to 50 ms or more should be fine. The switches won't change very often either, maybe once a minute.
:=
:=Philips has an I/O expander that connects to an I2C bus and adds 16 bits. I need about 40 bits total. Anyone know of a way to add about 40 bits to a PIC without using 3 I/O expander chips, or resorting to a largish FPGA? The I2C bus is ideal as I'm already using all the pins on an 18f452 for other stuff.



Resistor array and analog input
___________________________
This message was ported from CCS's old forum
Original Post ID: 10514
Steve H
Guest







New Microchip Product
PostPosted: Wed Jan 08, 2003 9:10 am     Reply with quote

Microchip is sampling a new I2C I/O Expander: MPC23016.

I found it on their website by searching for I/O Expander.

Steve H.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10537
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group