You Are Here: Home » AVR ATmega Projects » Decoding 4 buttons with two I/O’s on AVR using ATtiny12 microcontroller

Decoding 4 buttons with two I/O’s on AVR using ATtiny12 microcontroller




Just the solution for AVR applications in which I/O is tight, such as the ATtiny12. This should work well on other kids of controllers that have independently controlled I/O direction registers, such as PIC and 6805 controllers.

buttons

This is a solution was devised for those I/O limited 8 pin controllers like the AT90S2323 (though I tested it on an AT90S1200A).

In principle, the circuit senses three states of the pushbuttons: Open (no button down), Pulled Up, and Pulled Down. The process is this: Pin A (PORTB bit 4)driven high through a resistor and the other end of the resistor is looked, at Pin B (PORTB bit 4) to see if it is being pulled high, low, or not being driven up a button at all. Then Pin B is driven and the other end of the resistor (Pin A) is looked at.

In the circuit, a 39k resistor is placed across the two I/O pins to allow each pin to drive the other through the resistor. The two pair of buttons connected identically, except that one pair of buttons is connected to pin A (PORTB bit 3) and the other pair of buttons is connected Pin B (PORTB bit 4). In each pair, one button is connected to VCC through a 10k resistor and the other button connects to ground through a 10k resistor.

 

For more detail: Decoding 4 buttons with two I/O’s on AVR using ATtiny12 microcontroller

Leave a Comment

You must be logged in to post a comment.

Read previous post:
EEPROM Driver for AVR with RAM using ATtiny15 microcontroller

Download the test program with driver:  i2cm030710F.asmI had been putting off writing a driver for some 24LC64 and 24LC256 EEPROMS...

Close
Scroll to top