Révision 700
Ajouté par modia3 il y a plus de 4 ans
| SP4b1.c | ||
|---|---|---|
|
void init_keyboard(void);
|
||
|
char t;
|
||
|
char touche;
|
||
|
|
||
|
void main(void)
|
||
|
{
|
||
|
pd10=0xF0;
|
||
| ... | ... | |
|
pu30=1;
|
||
|
p10=0x00;
|
||
|
t=p10;
|
||
|
while(1){
|
||
|
p10=0x0F;
|
||
|
t=p10;
|
||
|
if(t!=0x0F)
|
||
|
{
|
||
|
p10=0xEF;
|
||
|
t=p10;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
while(1)
|
||
|
{
|
||
|
t=p10;
|
||
|
|
||
|
if(t!=0x0F) // si une touche est appuy?
|
||
|
{
|
||
|
p10=0xEF; // test de la touche * et 7
|
||
|
t=p10;
|
||
|
if(t==0xEB)
|
||
|
{
|
||
|
touche='7';
|
||
|
}
|
||
|
if(t==0xE7)
|
||
|
{
|
||
|
touche='*';
|
||
|
}
|
||
|
p10=0x7F;
|
||
|
t=p10;
|
||
|
if(t==0x7E)
|
||
|
{
|
||
|
touche='3';
|
||
|
}
|
||
|
if(t==0x7D)
|
||
|
{
|
||
|
touche='6';
|
||
|
}
|
||
|
if(t==0x7B)
|
||
|
{
|
||
|
touche='9';
|
||
|
}
|
||
|
if(t==0x77)
|
||
|
{
|
||
|
touche='#';
|
||
|
}
|
||
|
p10=0xDF;
|
||
|
t=p10;
|
||
|
if(t==0xDE)
|
||
|
{
|
||
|
touche='2';
|
||
|
}
|
||
|
if(t==0xDD)
|
||
|
{
|
||
|
touche='5';
|
||
|
}
|
||
|
if(t==0xDB)
|
||
|
{
|
||
|
touche='8';
|
||
|
}
|
||
|
if(t==0xD7)
|
||
|
{
|
||
|
touche='0';
|
||
|
}
|
||
|
p10=0xBF;
|
||
|
t=p10;
|
||
|
|
||
|
if(t==0xBE)
|
||
|
{
|
||
|
touche='1';
|
||
|
}
|
||
|
if(t==0xBD)
|
||
|
{
|
||
|
touche='4';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
Formats disponibles : Unified diff
Fin du tp b1(touches clavier)