Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/01/03 15:28
Read: times


 
#42716 - key buffer required pls hlp
i want to fill a char array with the chars pressed from a keypad, the array has four elements, i want to fill the array then string compare the array to a hard coded 4 char word, the problem im having is working out how to pass the chars typed from the interrupt into a function then passing the four chars (one at a time) to the array?

interrupt code is here in c (keil)
void keyisr(void) interrupt 0 using 1
{

byte data row, col, rowtemp, coltemp; //variables for keypad software driver
byte data temptimerhigh, temptimerlow;
static byte data timerflag=0;//retain variable value after leaving this function
byte data colcount=0;
byte data maxtimeout=0xFF;

EX0=0; // disable external interrupt

if (TR1) //if timer1 run control bit is set do
{
TR1=0; //clear timer1 run bit
temptimerhigh=TH1;//copy timer1 high byte to temptimerhigh
temptimerlow=TL1;//copy timer1 low byte to temptimerhigh
timerflag=1;
}

do
{
row=portc & 0xF0; //portc logically ANDED with 11110000B, assign value to row
delay(5);
rowtemp=portc & 0xF0;//portc logically ANDED with 11110000B, assign value to rowtemp
}

while(row!=rowtemp);

//legal values "E0,D0,B0,70"

if ((row==0xE0)||(row==0xD0)||(row==0xB0)||(row==0x70))
{
switch(row)
{
case 0x70: row=0;
break;
case 0xB0: row=1;
break;
case 0xD0: row=2;
break;
case 0xE0: row=3;
break;
}

//legal2 Walking the zero's 0xFE,0xFD,0xFB;

portc = 0xFE;
coltemp= portc & 0xF0;
if(coltemp==rowtemp)
{
col = 0;
colcount++;
}

portc = 0xFD;
coltemp= portc & 0xF0;
if(coltemp==rowtemp)
{
col = 1;
colcount++;
}

portc = 0xFB;
coltemp= portc & 0xF0;
if(coltemp==rowtemp)
{
col = 2;
colcount++;
}

if (colcount==0x01)
{
HERE IS WHERE THE KEY PRESS IS STORED
-----------> key = keypad[row][col];
lcd_write_cmd(0xC0);
WRITE TO LCD--->lcd_write_disp(key);

}
}

portc = 0xF0;
while(portc != 0xF0);
delay(5);



if (timerflag)
{
timerflag=0;
TH1 = temptimerhigh;
TL1 = temptimerlow;
TR1 = 1;
}
IE0 = 0;//Interrupt 0 edge flag
//IE0 has highest priority
EX0 = 1;//enable external interrupt 0
}


List of 5 messages in thread
TopicAuthorDate
key buffer required pls hlp            01/01/70 00:00      
   RE: key buffer required pls hlp            01/01/70 00:00      
      RE: key buffer required pls hlp            01/01/70 00:00      
         RE: key buffer required pls hlp            01/01/70 00:00      
   RE: key buffer required pls hlp            01/01/70 00:00      

Back to Subject List