Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Keypad & ATmega16

Status
Not open for further replies.

k1_zav

Junior Member level 2
Junior Member level 2
Joined
Mar 13, 2005
Messages
23
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,460
atmega16 keypad

Hi there.
I have a problem.
I want to interface an Atmega 16 to a keypad that has 12 keys.
I use external interrupt for recognition of columns.
Assum I want to work with the third column. When I press '3' I got 3.
but when I press '6' or '9' I got many 6 or 9.

Do you know what's the problem.
By the way I use Codevision AVR as C compiler and this is interrupt service routine:


#define row1 PORTB.4
#define row2 PORTB.5
#define row3 PORTB.6
#define row4 PORTB.7

bit row_recognition;
unsigned char temp;


"// External Interrupt 0 service routine
interrupt [EXT_INT0] void ext_int0_isr(void)
{
// Column 3

#asm("cli")


row1=0;
row2=1;
row3=1;
row4=1;
delay_ms(1);

row_recognition=PIND.2;

if (!row_recognition)
{
temp='3';
lcd_putchar(temp);
temp=0;

}
else
{
row1=1;
row2=0;
row3=1;
row4=1;

delay_ms(1);
row_recognition=PIND.2;

if (!row_recognition)
{
temp='6';

lcd_putchar(temp);
temp=0;

}
else
{
row1=1;
row2=1;
row3=0;
row4=1;

delay_ms(1);
row_recognition=PIND.2;
if(!row_recognition)
{
temp='9';
lcd_putchar(temp);
temp=0;
}
else //if (row_recognition)
{
temp='#';
lcd_putchar(temp);
temp=0;
};
};
};




delay_ms(5);
row1=0;
row2=0;
row3=0;
row4=0;

lcd_putchar('X');


#asm("sei")
}"

So, Does anybody know what's the problem?
Thanks.
 

keypad atmega

I got it.
Its because of interrupt flag.:D
 

atmega keypad

Hello k1_zav
Iam working also with keypad and atmega16.can you paste your working source code,so I can see how you solved the problem

regards
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top