Révision 465
Ajouté par albest il y a presque 4 ans
SP4b1.c | ||
---|---|---|
void tpo_50ms(void);
|
||
|
||
unsigned char touche = 0;
|
||
unsigned char touche_ls = 0;
|
||
unsigned char touche_cs = 0;
|
||
char t;
|
||
|
||
void main(void){
|
||
/*init_keyboard();
|
||
|
||
while(1){
|
||
touche_ls = p10;
|
||
if ((p10 & 0xf0) != 0xf0){
|
||
tpo_50ms();
|
||
}
|
||
|
||
}*/
|
||
pd10 = 0x0F;
|
||
p10 = 0x0e;
|
||
t = p10;
|
||
p10 = 0x0d;
|
||
t = p10;
|
||
p10 = 0x0b;
|
||
t = p10;
|
||
p10 = 0x07;
|
||
t = p10;
|
||
|
||
pd10 = 0x0F;
|
||
pu31 = 1;
|
||
/*while(1){
|
||
p10 = 0;
|
||
while(1)
|
||
{
|
||
t = p10;
|
||
}*/
|
||
if(t !=0xf0)
|
||
{
|
||
p10 = 0xfe;
|
||
t = p10;
|
||
if (t==0xbe)
|
||
{
|
||
touche = '1';
|
||
}
|
||
if (t==0xde)
|
||
{
|
||
touche = '2';
|
||
}
|
||
if (t==0x7e)
|
||
{
|
||
touche = '3';
|
||
}
|
||
p10 = 0xfd;
|
||
t = p10;
|
||
if (t==0xbd)
|
||
{
|
||
touche = '4';
|
||
}
|
||
if (t==0xdd)
|
||
{
|
||
touche = '5';
|
||
}
|
||
if (t==0x7d)
|
||
{
|
||
touche = '6';
|
||
}
|
||
p10 = 0xfb;
|
||
t = p10;
|
||
if (t==0x7b)
|
||
{
|
||
touche = '9';
|
||
}
|
||
if (t==0xdb)
|
||
{
|
||
touche = '8';
|
||
}
|
||
if (t==0xeb)
|
||
{
|
||
touche = '7';
|
||
}
|
||
p10 = 0xf7;
|
||
t = p10;
|
||
if (t==0xd7)
|
||
{
|
||
touche = '0';
|
||
}
|
||
if (t==0x77)
|
||
{
|
||
touche = '#';
|
||
}
|
||
if (t==0xe7)
|
||
{
|
||
touche = '*';
|
||
}
|
||
p10 = 0xf;
|
||
t = p10;
|
||
if (t==0xbe)
|
||
{
|
||
touche = '1';
|
||
}
|
||
if (t==0xde)
|
||
{
|
||
touche = '2';
|
||
}
|
||
if (t==0x7e)
|
||
{
|
||
touche = '3';
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
void init_keyboard(void){
|
||
... | ... | |
ta0ic = 0x00;
|
||
while(ir_ta0ic != 1);
|
||
ta0s = 0;
|
||
}
|
||
}
|
Formats disponibles : Unified diff
Fin du code pour le clavier matricé