Projet

Général

Profil

« Précédent | Suivant » 

Révision 695

Ajouté par megoutteno il y a presque 4 ans

Programmation du clavier finit

Voir les différences:

SP4b1.c
#include "sfr32c87.h"
char t;
char t_clavier;
void main(void)
{
pd10=0xF0;
p10=0xFF;
pu30=1;
t=p10;
p10=0x00;
while(1)
{
t=p10;
if(t!=0x0F)
if(t!=0x0F) // si une touche est appuy?
{
p10=0xEF;
p10=0xEF; // test de la touche * et 7
t=p10;
}
if(t==0xEF)
{
if(t==0xE7)
{
t_clavier='*';
}
if(t==0xEB)
{
t_clavier='7';
}
}
if(t==0xDF)
{
}if(t==0xBF)
{
p10=0xDF; // test de la touche 2, 5, 8, 0
t=p10;
if(t==0xDE)
{
t_clavier='2';
}
if(t==0xDD)
{
t_clavier='5';
}
if(t==0xDB)
{
t_clavier='8';
}
if(t==0xD7)
{
t_clavier='0';
}
p10=0x7F; // test de la touche 3, 6, 9, #
t=p10;
if(t==0x7E)
{
t_clavier='3';
}
if(t==0x7D)
{
t_clavier='6';
}
if(t==0x7B)
{
t_clavier='9';
}
if(t==0x77)
{
t_clavier='#';
}
p10=0xBF; // test de la touche 1, 4
t=p10;
if(t==0xBE)
{
t_clavier='1';
}
if(t==0xBD)
{
t_clavier='4';
}
}
if(t==0x7F)
{
}
}
}

Formats disponibles : Unified diff