Best Microcontroller Projects


[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Forum
Problem?-Solution
Projects Showcase
LCD-KEYS OnePort
PIC Introduction
PIC Programmer
Schematic Tool
PIC Projects
Tips & Techniques
PIC Tutorials
C Course
Digital Downloads
Store
My SECRET
Oscilloscopes
About Me
Search This Site
Freebies
Articles
Books
Resource Links
Site Map
Video du Jour
Rant/Rave
Privacy Policy
Contact
Terms of Use


Custom Search

Sign up for MicroZine:
''The'' Microcontroller Newsletter


:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Enter your first Name and primary email address in the form above:

And receive absolutely FREE a full project for:


"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be Removed
at any time.  

It will NOT be
available indefinitely SO

To avoid
disappointment get it:

Now



Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.


To get exclusive access Enter your first name Name and primary email address Now in the form above.:

But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates.

Scroll up to the form above and sign up NOW.  Don't forget it's FREE and if you don't like it you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.



Social Bookmarking
Click & Add:
add to BlinkBlink
add to Del.icio.usDel.icio.us
add to DiggDigg
add to FurlFurl
add to GoogleGoogle
add to SimpySimpy
add to SpurlSpurl
Bookmark at TechnoratiTechnorati
add to YahooY! MyWeb
Readers comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's

SUPERB and FANTASTIC."


- Ranish Pottath


"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan

bursach<at>gmail.com

Learn PIC C Now
Wondering how to program your next project using C and need a great start?


"Awesome site,
very, very easy and nice
to navigate!"


- Matt
matt_tr<at>
wolf359.cjb.net


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."


- Dave

de_scott<at>bellsouth.net

Learn Microcontrollers
"Interested in
Microcontrollers?"


Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.
Regards."


- Anon





Digital I/O Expansion

How to expand your interfaces using digital I/O using serial techniques.

You are probably here because you have a problem either - you have just run out of pins and need to add more functions to your microcontroller or the I/O you need is far more than the number of pins available on your microcontroller. 

The way to add more functions to a pin limited system is to use serial communication.  
As long as you have at least one pin available all is not lost.

There are several methods and each has different tradeoffs.  Here is a list of possible methods, in order of the number of pins needed (excluding ground), but not in any other particular order of importance.

Type Wires
RS232 1
Dallas 1 wire 1
Johnson counter 2
I2C 2
Serial to parallel 3
Parallel to serial 3
SPI 3-4

Digital I/O expansion: RS232

Perhaps the most unusual one is the RS232 serial comms method - for one way communication you only need one wire.  You won't need a level translator if you just communicate between two chips on the same board and because it will be over a short distance you can run it fast.

The best way to use it is with the built in UART in each microcontroller but you could use a software version if absolutely necessary.

You can find more information by clicking the following links for RS232 pinouts, usage and details.

Using the built in USART is easy and this method gives you a good communication system between two microcontrollers but you do need a microcontroller at the receiving side and so this is a more complex solution (You also have to decide on the command set and how that operates).

Digital I/O expansion: Dallas 1 wire

This is a proprietary communication system created by Dallas Semiconductor (part of Maxim www.maxim-ic.com).  Each device has a unique laser engraved address etched into it so that you can put multiple devices on the same wire network.  It uses a single bus master (your microcontroller) to control all slave devices and is powered by the driving signal (you can add circuitry to provide additional power at the device).

Typical devices you can use include:

DS2408 8 channel addressable switch; input and output & latch.
DS2413 A switch (turns on and off an open drain transistor 28V max).
DS2433 4kbit EEPROM
DS2450 Quad ADC converter
DS2423 Counter with 4kbit RAM
DS28E04-100 4kbit EEPROM and dual IO
DS2417 Real Time Clock
DS2890 Digital POT
DS18B20 Thermometer

Note this is not the full list - there are lots more devices!

Although you might think that the 1 wire system is for long distance control and measurement you can use it in a single board and you can use 100s of devices on the same wire network.

Digital I/O expansion: Johnson counter

One chip I like to use for very simple I/O expansion is the 74HC4017 original the CMOS version but also available in HC etc.  It is a Johnson counter that sequentially turns on one of 10 outputs.  All you need to drive it is two controls reset and clock.  It does not have a lot of output current drive so you may need transistors to provide more current.

Its is a useful chip for multiplexing seven segment displays.

Digital I/O expansion: Serial to parallel/parallel to serial chips

You can use the discrete chips 74HC595 (serial in and 8 bit parallel out) and 75HC165 (8 bit parallel in and serial out).  All you need for each type is 3 controls:latch (to get or set stable data), reset and clock.  

The advantage of these two devices over simple shift registers e.g. 4094 is that the latch control signal loads data from the internal shift register to the outputs.

This separates the output signals (595) from the shift register so you can setup all the serial data, clocking it into the device without changing the outputs.  When you are ready you latch the data through to the output using the latch control signal.

This ensures that the data never changes until you are ready for it to change and a similar operation happens for the parallel to serial device.

Note: You can easily cascade these devices to provide more I/O using the same set of controls.

Digital I/O expansion: I2C

This is one of the more flexible ways of interfacing using only two pins and the most important point is that it gives data transmission in both directions to/from slave devices. The SPI protocol does this in a more limited way.  

You can add devices onto the bus limited by the addressing scheme ~120 devices and the capacitance that each device adds to the total capacitance.  Addresses are fixed for manufacturers and device family and some have extra pins to set the lower address range e.g. for extra serial EEPROMS of the same type.

For more information on I2C click here.

PCF8574 8-bit I/O port (cheap version JLC1562).
MAX1036 Quad ADC converter 8bit.
PCF8591  Quad ADC and 1 DAC 8bit.
MAX5548  DAC 8bit.
DS1672 32-Bit Binary Counter RTC.
DS1803 Dual Digital POT (256 position).
DS1307 Real Time Clock.
DS1624 Digital thermometer and memory.

Note: There are many more I2C devices!

Digital I/O expansion: SPI

This is the Serial Peripheral Interface using 4 wires (3 if data is only sent in one direction). It is basically a shift register based protocol - (because of this it can run fast).  For more information on SPI click here.

MAX7317 10-bit I/O expander (26MHz!).
MAX1062 Quad ADC converter 14bit.
MAX5590 DAC 8 channel 10bit
AD8402 Dual Digital POT 256 position.
DS1390 Real Time Clock.
MAX6627 12 bit temperature sensor.

Note: There are many more SPI devices!

I/O port expansion : Summary and a look at speed issues

The SPI interface is the fastest (>10MHz) but uses the most pins while an I2C interface is medium speed (100kHz-400kHz) and RS232 is the slowest.   RS232 uses two pins for communication in both directions but if you need only transmit data to a peripheral then you can use one pin.

Digital I/O expander : speed

Interface PINS required Can create in software Speed
SPI 3-4 (and ground) Yes (slower) >10MHz
I2C 2 (and ground) Yes (slower) 100kHz/
400kHz
RS232 1 (and ground) (for simplex). Yes (slower) 50kHz

Jump from digital I/O
to Best Microcontroller Projects Home page


Don't forget to Sign Up for your

Microcontroller Newsletter

With "Essential tips and techniques",

..."New Site Info" and more...

Including a free project :

How to drive an LCD and 12key keypad using "Only One 8 Bit Port" with no interface logic!...

(Works for any microcontroller)

This costs you : Nothing...
Just fill out the form below and you'll get full C source code and project schematic and description.



:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Google
 
  Best Microcontroller projects.





<-- --> <-- -->