user883: I built a simple clock using a 4 digits 7 segments LCD display. I display one digit at a time, switching on and off very quicky and cycling through digits.
Everything is ok, but I used 8 + 4 = 12 arduino pins. I need 2 more pins for other features and I don't want to use 0 and 1 as I need onboard programming features of Arduino Mini.
I used I2C for RTC clock, I could add some interface here (like a PCF8574) and get some pins from here. But I'd like a different (and more educational, for me) approach.
Is there an IC that sends an HIGH output on one of four output pins driven by 2 input pins? I need this:
IN     OUT
P0 P1  D0 D1 D2 D3
0  0   1  0  0  0
0  1   0  1  0  0
1  0   0  0  1  0
1  1   0  0  0  1

This way I can connect OUT to digit selection and spare 2 pins.
Thanks for your hints.

user42: A 2-to-4 line decoder should do what you need. I've used a 74HC139 with Arduino before, which contains two decoders in a 16-pin DIP.
There are lots of other options though. In the past, I've used an 8 bit serial-to-parallel shift register (74HC595) to control a 7 segment display. It effectively lets you control 8 (or more) outputs using only 3 pins on your microcontroller. You have to be careful of power requirements though. Most shift registers aren't able to drive such a display directly, but I was able to incorporate transistors quite easily to get around that.

user59: An I2C IO expander might be your best bet.  If your existing I2C device uses a different address, you may be able to put both devices on the same I2C bus.  You would then use 0 additional pins compared to your current design.

user304: I know it's not what you asked, but you're using a lot of pins, why not try streamlining them and go to an I2C backpack? This one from adafruit includes a single 4x7 segment display.
given your comment, another option would be an I2C/SPI 7 Segment driver. (datasheet). 
new edit: Actually, when I posted the above 7 segment driver, this is the one I was thinking of. I don't know why I didn't find this the first time.
max7219/7221 datasheet and digikey source:

user349: Are you using your analog pins?  Did you know they can be used as digital pins?

The analog pins can be used identically to the digital pins, using the aliases A0 (for analog input 0), A1, etc. For example, the code would look like this to set analog pin 0 to an output, and to set it HIGH:
pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);


This is your best bet if you aren't using all your analog pins.

883: <p>I built a simple clock using a 4 digits 7 segments LCD display. I display one digit at a time, switching on and off very quicky and cycling through digits.</p>

<p>Everything is ok, but I used 8 + 4 = 12 arduino pins. I need 2 more pins for other features and I don't want to use 0 and 1 as I need onboard programming features of Arduino Mini.</p>

<p>I used I2C for RTC clock, I could add some interface here (like a PCF8574) and get some pins from here. But I'd like a different (and more educational, for me) approach.</p>

<p>Is there an IC that sends an HIGH output on one of four output pins driven by 2 input pins? I need this:</p>

<pre><code>IN     OUT
P0 P1  D0 D1 D2 D3
0  0   1  0  0  0
0  1   0  1  0  0
1  0   0  0  1  0
1  1   0  0  0  1
</code></pre>

<p>This way I can connect OUT to digit selection and spare 2 pins.</p>

<p>Thanks for your hints.</p>
 42: <p>A 2-to-4 line decoder should do what you need. I've used a <a href="http://www.fairchildsemi.com/ds/74/74VHC139.pdf" rel="nofollow">74HC139</a> with Arduino before, which contains two decoders in a 16-pin DIP.</p>

<p>There are lots of other options though. In the past, I've used an 8 bit serial-to-parallel shift register (<a href="https://www.sparkfun.com/datasheets/IC/SN74HC595.pdf" rel="nofollow">74HC595</a>) to control a 7 segment display. It effectively lets you control 8 (or more) outputs using only 3 pins on your microcontroller. You have to be careful of power requirements though. Most shift registers aren't able to drive such a display directly, but I was able to incorporate transistors quite easily to get around that.</p>
 59: <p>An <a href="http://www.digikey.com/product-detail/en/MCP23017-E/SP/MCP23017-E/SP-ND/894272" rel="nofollow" title="I2C">I2C IO expander</a> might be your best bet.  If your existing I2C device uses a different address, you may be able to put both devices on the same I2C bus.  You would then use 0 additional pins compared to your current design.</p>
 304: <p>I know it's not what you asked, but you're using a lot of pins, why not try streamlining them and go to an I2C backpack? <a href="http://www.adafruit.com/products/879" rel="nofollow">This one from adafruit</a> includes a single 4x7 segment display.</p>

<p>given your comment, another option would be an <a href="http://uk.farnell.com/nxp/saa1064-n2/ic-led-driver-4dgt-i2c-24dip/dp/1627002" rel="nofollow">I2C/SPI 7 Segment driver</a>. (<a href="http://www.fortito.mx/wp-content/uploads/technical/SAA1064.pdf" rel="nofollow">datasheet</a>). </p>

<p>new edit: Actually, when I posted the above 7 segment driver, this is the one I was thinking of. I don't know why I didn't find this the first time.</p>

<p><a href="http://www.maximintegrated.com/datasheet/index.mvp/id/1339" rel="nofollow">max7219/7221 datasheet</a> and <a href="http://www.digikey.com.au/product-search/en?vendor=0&amp;keywords=max7219+%7C+max7221" rel="nofollow">digikey source</a>:</p>
 349: <p>Are you using your analog pins?  Did you know <a href="http://arduino.cc/en/Tutorial/AnalogInputPins" rel="nofollow noreferrer">they can be used as digital pins</a>?</p>
<blockquote>
<p>The analog pins can be used identically to the digital pins, using the aliases A0 (for analog input 0), A1, etc. For example, the code would look like this to set analog pin 0 to an output, and to set it HIGH:</p>
<pre><code>pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);
</code></pre>
</blockquote>
<p>This is your best bet if you aren't using all your analog pins.</p>
