Révision 643
Ajouté par jcguifodjo il y a presque 4 ans
branch/GUIFO/sp4b1/SP4b1LCD/SP4b1LCD/SP4b1LCD.c | ||
---|---|---|
lcd_8b(c);
|
||
}
|
||
|
||
|
||
char t;
|
||
char touche;
|
||
void main(void){
|
||
char c;
|
||
|
||
lcd_init ();
|
||
pd10= 0x0F;
|
||
char decode_touche(char t){
|
||
char t;
|
||
char touche;
|
||
pd10= 0x0F;
|
||
pu31=1;
|
||
p10=0x00;
|
||
t=pd10;
|
||
|
||
|
||
while(1){
|
||
|
||
t=p10;
|
||
p10= 0xFe;
|
||
t=p10;
|
||
tpo_ms(400);
|
||
|
||
if (t==0xde){
|
||
touche ='2';
|
||
}
|
||
tpo_ms(400);
|
||
|
||
if (t==0xbe){
|
||
touche ='1';
|
||
}
|
||
tpo_ms(400);
|
||
|
||
|
||
if (t==0x7e){
|
||
touche ='3';
|
||
}
|
||
tpo_ms(400);
|
||
p10= 0xFd;
|
||
|
||
p10= 0xFd;
|
||
t=p10;
|
||
if (t==0xdd){
|
||
touche ='5';
|
||
}
|
||
tpo_ms(400);
|
||
|
||
if (t==0xbd){
|
||
touche ='4';
|
||
}
|
||
tpo_ms(400);
|
||
|
||
|
||
if (t==0x7d){
|
||
touche ='6';
|
||
}
|
||
tpo_ms(400);
|
||
|
||
p10= 0xFb;
|
||
t=p10;
|
||
if (t==0xdb){
|
||
touche ='8';
|
||
}
|
||
tpo_ms(500);
|
||
|
||
|
||
if (t==0xeb){
|
||
touche ='7';
|
||
}
|
||
tpo_ms(500);
|
||
|
||
if (t==0x7b){
|
||
touche ='9';
|
||
}
|
||
tpo_ms(5);
|
||
|
||
p10= 0xF7;
|
||
t=p10;
|
||
|
||
if (t==0xd7){
|
||
touche ='0';
|
||
}
|
||
tpo_ms(5);
|
||
|
||
if (t==0x77){
|
||
touche ='#';
|
||
}
|
||
tpo_ms(5);
|
||
|
||
if (t==0xe7){
|
||
touche ='*';
|
||
}
|
||
tpo_ms(5);
|
||
lcd_car (touche);
|
||
|
||
}
|
||
|
||
return touche;
|
||
|
||
}
|
||
|
||
|
||
void main(void){
|
||
char t;
|
||
t=p10;
|
||
|
||
lcd_init ();
|
||
|
||
|
||
|
||
while(1){
|
||
/*if(p10!=0xf0){
|
||
p10=0x00;*/
|
||
lcd_car ('A');
|
||
|
||
/*while(p10!=0xf0){
|
||
p10=0x00;
|
||
}*/
|
||
}
|
||
//}
|
||
}
|
||
|
||
|
branch/GUIFO/sp4a12/main.c | ||
---|---|---|
float latitude;
|
||
float longitude;
|
||
} Position ;
|
||
|
||
//Comparaison des trames pour savoir si la trame est du bon type
|
||
int trame_cmp(char* trame,char* type)
|
||
{
|
||
... | ... | |
void test_decode_nombre(void){
|
||
|
||
if (decode_nombre("632",2)!=63){
|
||
printf ("Erreur Test unitaire basique decode nombre.\n");
|
||
printf ("Erreur Test unitaire basique decode nombre1.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("400",2)!=40){
|
||
printf ("Erreur Test unitaire basique decode nombre.\n");
|
||
printf ("Erreur Test unitaire basique decode nombre2.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("1204",3)!=120){
|
||
printf ("Erreur Test unitaire basique decode nombre.\n");
|
||
printf ("Erreur Test unitaire basique decode nombre3.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("10",1)!=1){
|
||
printf ("Erreur Test unitaire basique decode nombre.\n");
|
||
printf ("Erreur Test unitaire basique decode nombre4.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("7865",3)!=786){
|
||
printf ("Erreur Test unitaire basique decode nombre.\n");
|
||
printf ("Erreur Test unitaire basique decode nombre5.\n");
|
||
exit(-1);
|
||
}
|
||
|
Formats disponibles : Unified diff
Decodage de caractère sur lcd