root/branch/FRAISSE/sp4b1/SP4b1/SP4b1.c @ 711
551 | lefraisse | /***********************************************************************/
|
|
/* */
|
|||
/* FILE :SP4b1.c */
|
|||
/* DATE :Wed, May 26, 2021 */
|
|||
/* DESCRIPTION :main program file. */
|
|||
/* CPU GROUP :87B */
|
|||
/* */
|
|||
/* This file is generated by Renesas Project Generator (Ver.4.18). */
|
|||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
|||
/***********************************************************************/
|
|||
568 | lefraisse | #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;
|
|||
711 | lefraisse | t=p10;
|
|
if(p10==0xE7){
|
|||
touche='*';
|
|||
568 | lefraisse | }
|
|
711 | lefraisse | if(p10==0xEB){
|
|
touche='7';
|
|||
568 | lefraisse | }
|
|
711 | lefraisse | ||
p10=0xDF;
|
|||
t=p10;
|
|||
if(p10==0xDD){
|
|||
touche='5';
|
|||
568 | lefraisse | }
|
|
711 | lefraisse | if(p10==0xD7){
|
|
touche='0';
|
|||
}
|
|||
if(p10==0xDB){
|
|||
touche='8';
|
|||
}
|
|||
if (p10==0xDE){
|
|||
touche='2';
|
|||
}
|
|||
p10=0x7F;
|
|||
568 | lefraisse | t=p10;
|
|
711 | lefraisse | if(p10==0x7D){
|
|
touche='6';
|
|||
}
|
|||
if(p10==0x77){
|
|||
touche='#';
|
|||
}
|
|||
if(p10==0x7B){
|
|||
touche='9';
|
|||
}
|
|||
if (p10==0x7E){
|
|||
touche='3';
|
|||
}
|
|||
p10=0xBF;
|
|||
t=p10;
|
|||
if(p10==0xBD){
|
|||
touche='4';
|
|||
}
|
|||
if (p10==0xBE){
|
|||
touche='1';
|
|||
}
|
|||
568 | lefraisse | }
|
|
}
|
|||
551 | lefraisse | }
|
|
568 | lefraisse | 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;
|
|||
}
|