Hello guys. I'm new in programming and I have a problem with a 3x4 keypad. I have found a code on the internet for a 4x4 keypad and I have aplyed this code a little bit modified to my project but I can't read a column. It looks like only two if conditions are read. The values are showed on a glcd.Please help me
The columns are connected to PC1, PC2, PC3 and the rows are connected to PC4,PC5,PC6,PC7. I'm using atmega 32. A guy told me that I should put a longer delay because the response of AVR inputs is delayed by one cycle but i don't now where do i should put the delay, because in my code I don't have any delay.
The columns are connected to PC1, PC2, PC3 and the rows are connected to PC4,PC5,PC6,PC7. I'm using atmega 32. A guy told me that I should put a longer delay because the response of AVR inputs is delayed by one cycle but i don't now where do i should put the delay, because in my code I don't have any delay.
Rich (BB code):
DDRC= 0b11110000;
PORTC=0b00001111;
while(1)
{
PORTC = 0b11101111;
if (!bit_is_set(PINC, 1))
{ glcdSetAddress(3,LINE6);
glcdPutStr("1");}
if (!bit_is_set(PINC, 3))
{ glcdSetAddress(3,LINE6);
glcdPutStr("2");}
if (!bit_is_set(PINC, 2))
{ glcdSetAddress(3,LINE6);
glcdPutStr("3");}
PORTC = 0b11011111;
if (!bit_is_set(PINC, 1))
{ glcdSetAddress(3,LINE6);
glcdPutStr("4");}
if (!bit_is_set(PINC, 3))
{ glcdSetAddress(3,LINE6);
glcdPutStr("5");}
if (!bit_is_set(PINC, 2))
{ glcdSetAddress(3,LINE6);
glcdPutStr("6");}
PORTC = 0b10111111;
if (!bit_is_set(PINC, 1))
{ glcdSetAddress(3,LINE6);
glcdPutStr("7");}
if (!bit_is_set(PINC, 3))
{ glcdSetAddress(3,LINE6);
glcdPutStr("8");}
if (!bit_is_set(PINC, 2))
{ glcdSetAddress(3,LINE6);
glcdPutStr("9");}
PORTC = 0b01111111;
if (!bit_is_set(PINC, 1))
{ glcdSetAddress(3,LINE6);
glcdPutStr("0");}
if (!bit_is_set(PINC, 3))
{ glcdSetAddress(3,LINE6);
glcdPutStr(")");}
if (!bit_is_set(PINC, 2))
{ glcdSetAddress(3,LINE6);
glcdPutStr("(");}