Révision 568
Ajouté par lefraisse il y a presque 4 ans
SP4b1.c | ||
---|---|---|
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||
/***********************************************************************/
|
||
|
||
void main(void)
|
||
{
|
||
|
||
#include "sfr32c87.h"
|
||
void init_keyboard(void);
|
||
void tpo_50ms(void);
|
||
unsigned char touche = 0;
|
||
char t;
|
||
void main(void){
|
||
|
||
pd10=0xF0; //On fixe les sorties ? 1 et les entr?es ? 0
|
||
p10=0xFF;
|
||
pu30=1; //On met les entr?es ? 1 (pull-up)
|
||
t=p10;
|
||
p10=0x00;
|
||
while(1){
|
||
t=p10;
|
||
if(t!=0x0F){
|
||
p10=0xEF;
|
||
t=
|
||
if(p10!=0xEF){
|
||
p10=0xDF;
|
||
}
|
||
if(p10!=0xDF){
|
||
p10=0xBF;
|
||
}
|
||
if(p10!=0xBF){
|
||
p10=0x7F;
|
||
}
|
||
t=p10;
|
||
}
|
||
}
|
||
}
|
||
void init_keyboard(void){
|
||
pd10 = 0x0F;
|
||
p10=0;
|
||
pu31 = 1;
|
||
}
|
||
void tpo_50ms(void){
|
||
tcspr = 0x8A;
|
||
ta0mr = 0x82;
|
||
ta0 = 50000;
|
||
ta0s = 1;
|
||
ta0os = 1;
|
||
ta0ic = 0x00;
|
||
while(ir_ta0ic != 1);
|
||
ta0s = 0;
|
||
}
|
Formats disponibles : Unified diff
Début de correction programme