Another keybord question :)
Posted: Sun Aug 26, 2007 4:40 am
My ISR and interupts work fine , but I have a problem in the keybord driver .
when I want to detect that a key is released it dosn't work , this is my code :
the problem here is that the sequence in blod it's not accesd , when a key is released? If some one knows why ,please help.
when I want to detect that a key is released it dosn't work , this is my code :
Code: Select all
char charTable[]={..........All the keybord keys......}
char ShiftcharTable[]={..... All the keybord keys +shift.....}
char printable[]={.... ALL the non printable keys.......}
void KbHandler(void)
{
char key;
unsigned char cmd;
char ascii;
key =inportb(0x60);//read the pressed key
if(key<sizeof(charTable))//if down
{
//if shift
if((key==LSHIFT)|| (key==RSHIFT)) up=1;
else
{ if(up)ascii=ShiftcharTable[key];
else ascii=charTable[key];
//On verifie que c'est un caractere imprimable
int i=1,j;
for(j=0;j<sizeof(non_printable);j++)
if(ascii==non_printable[j]){
i=0;
break;
};
if(i)
{
add(ascii); //On la met dans le buffer
}
}
}
[b]else
{
if(key>=0x80)
{
if((key==(RSHIFT+0x80))||(key==(LSHIFT+0x80))) up=0;
}
}[/b]
cmd=inportb(0x61);
outportb(0x61,cmd | 0x80); //disable the keybord
outportb(0x61,cmd); //
outportb(0xA0,0x20);//EOI to the slave
outportb(0x20,0x20);//EOI to the master
};