Geeks With Blogs
Joaquin Jares Just another geek's blog

There are several ways to chain demux IC’s to get more outputs than the ones that a single IC can get you. In these posts I’ll explore the ones I could find and use successfully. The first one has to do with the differences of inverting and non-inverting IC’s. In this video, I have 2 iC’s driving 16 LEDs. With this configuration I could drive as much as 64 LEDs with these 2 IC’s. I simply didn’t have the patience to connect them all:

16 LEDs with 2 IC’s

In my previous post I mentioned that the 74HC138 should be connected to the LED via their cathode, meaning that the IC is effectively working as ground for the LED. That’s because the 138 is an inverting 3-to-8 demux. The 74HC238, on the other hand, is not inverting so when you connect it to the LED, the LED is connected to the IC via its anode. The IC is providing power to the LED, which is connected to ground normally.

We can use this characteristic of the ICs to connect 64 LEDs using one of each. Think of it as a table, where you have 8 by 8 LEDs. The “rows” are connected to the 138 and the “columns” are connected to the 238. Only when the 138 is coding a LOW and the 238 is coding a HIGH, the LED will light. Here’s a schematic for the 16 LEDs I connected:

16LEDSPOT

The 138 has its first two output pins connected to 8 LEDs each, and the 238 has its output pins connected to 2 LEDs each. For 64 LEDs, you should connect the 8 output pins in each IC to 8 LEDs. Notice that since I’m only using one input in the 138, I have connected the other inputs to ground. This effectively codes a LOW for all those inputs. The enablers are hard wired to activate the IC’s.

In this schema I also have a potentiometer. It looks like this:

16 LEDs, using a potentiometer

The potentiometer is connected to A0. I also connected AREF to the power line in the breadboard, so it will have the same amount of current as the potentiometer (without the resistance, that is). You must connect the AREF to your maximum when using an analog pin. The rest of the schema, I think, speaks for itself.

So what does the code look like? The encoder is exactly the same as the one I’ve been using for the last couple of posts, but this time initialized with 4 digital pins. Again, if you want 64 LEDs you’ll have to initialize it with 6 digital pins:

Encoder =

new Demuxer(Pins.GPIO_PIN_D0, Pins.GPIO_PIN_D1, Pins.GPIO_PIN_D2, Pins.GPIO_PIN_D3);

I also have the potentiometer coded as an AnalogInput:

Potentiometer =

new AnalogInput(Pins.GPIO_PIN_A0);

The AnalogInput must be initialized with the range to work correctly. I have it initialized like this:

Potentiometer.SetRange(0, 15);

So my breadboard class now looks like this:

1 public class BaseBoard 2 { 3 public Demuxer Encoder { get; private set; } 4 public AnalogInput Potentiometer { get; private set; } 5 6 public BaseBoard() 7 { 8 Encoder = new Demuxer(Pins.GPIO_PIN_D0, Pins.GPIO_PIN_D1, Pins.GPIO_PIN_D2, Pins.GPIO_PIN_D3); 9 Potentiometer = new AnalogInput(Pins.GPIO_PIN_A0); 10 11 Potentiometer.SetRange(0, 15); 12 } 13 }

And the main program looks like this:

1 public static void Main() 2 { 3 board = new BaseBoard(); 4 5 while(true) 6 { 7 board.Encoder.Encode(board.Potentiometer.Read()); 8 Thread.Sleep(100); 9 } 10 }

Simple, isn’t it?

There’s a huge disadvantage in chaining the IC’s this way: you must provide power and ground. That is, if you wanted to create a shield that provides 64 outputs (or 1024, using all the digital pins in the Netduino) you simply can’t use this technique. There are other ways to do it that I’ll explore in the next few posts. On the other hand, this technique is really simple to wire, uses only 2 ICs (so it’s cheap) and works great.

Posted on Sunday, November 14, 2010 9:23 AM | Back to top


Comments on this post: DEMUX Chaining

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Joaquin Jares | Powered by: GeeksWithBlogs.net