Révision 720
Ajouté par Massamba FALL il y a presque 4 ans
SP4b1.c | ||
---|---|---|
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||
/***********************************************************************/
|
||
#include "sfr32c87.h"
|
||
char t;
|
||
char touche;
|
||
void main(void)
|
||
{
|
||
pd10= 0x0F;
|
||
pu31=1;
|
||
p10=0x00;
|
||
while (1){
|
||
t=p10;
|
||
p10= 0xFe;
|
||
t=p10;
|
||
if (t==0xDe){
|
||
touche ='2';
|
||
}
|
||
|
||
if (t==0xbe){
|
||
touche ='1';
|
||
}
|
||
if (t==0x7e){
|
||
touche ='3';
|
||
}
|
||
|
||
|
||
|
||
p10= 0xFd;
|
||
t=p10;
|
||
if (t==0xdd){
|
||
touche ='5';
|
||
}
|
||
if (t==0xbd){
|
||
touche ='4';
|
||
}
|
||
if (t==0x7d){
|
||
touche ='6';
|
||
}
|
||
|
||
|
||
|
||
p10= 0xFb;
|
||
t=p10;
|
||
if (t==0xdb){
|
||
touche ='8';
|
||
}
|
||
if (t==0xeb){
|
||
touche ='7';
|
||
}
|
||
if (t==0x7b){
|
||
touche ='9';
|
||
}
|
||
|
||
p10= 0xF7;
|
||
t=p10;
|
||
if (t==0xd7){
|
||
touche ='0';
|
||
}
|
||
if (t==0x77){
|
||
touche ='#';
|
||
}
|
||
if (t==0xe7){
|
||
touche ='*';
|
||
}
|
||
|
||
|
||
|
||
}
|
||
}
|
||
|
||
void main (void)
|
||
|
||
|
||
{
|
||
|
||
|
||
|
||
char c;
|
||
|
||
pd1=0xff;
|
||
|
||
c=0b10000000;
|
||
|
||
if(c&0b10000000)
|
||
|
||
p1_7=1;
|
||
|
||
else
|
||
p1_7=0;
|
||
|
||
if(c&0b10000000)
|
||
|
||
p1_6=1;
|
||
|
||
else
|
||
p1_6=0;
|
||
|
||
if(c&0b10000000)
|
||
|
||
p1_5=1;
|
||
|
||
else
|
||
p1_5=0;
|
||
if(c&0b10000000)
|
||
|
||
p1_4=1;
|
||
|
||
else
|
||
p1_4=0;
|
||
|
||
|
||
|
||
if(c&0b10000000)
|
||
|
||
p1_2=1;
|
||
|
||
else
|
||
p1_2=0;
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
|
Formats disponibles : Unified diff
TP b1 commité aujourd'hui car oubli de commit