|
/***********************************************************************/
|
|
/* */
|
|
/* FILE :SP4b1.c */
|
|
/* DATE :Tue, May 18, 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. */
|
|
/***********************************************************************/
|
|
|
|
#include "sfr32c87.h"
|
|
|
|
void init_keyboard(void);
|
|
void tpo_50ms(void) ;
|
|
|
|
unsigned char touche_c = 0;
|
|
unsigned char touche_appuyee;
|
|
|
|
void main(void){
|
|
init_keyboard();
|
|
while(1){
|
|
if ( (p10 & 0xf0)!= 0xf0 ){ //les colonnes sont en entr?es
|
|
touche_c = p10 ;
|
|
tpo_50ms() ; // une temporisation entre en oeuvre pour ?viter les ph?nom?nes de rebond
|
|
|
|
p10 = 0x0e;
|
|
if ( (p10 & 0xff)== 0xbe ){ //diff?rents tests
|
|
touche_appuyee = '1';
|
|
}
|
|
if ( (p10 & 0xff)== 0xde ){
|
|
touche_appuyee = '2';
|
|
}
|
|
if ( (p10 & 0xff)== 0x7e ){
|
|
touche_appuyee = '3';
|
|
}
|
|
|
|
p10 = 0x0d;
|
|
if ( (p10 & 0xff)== 0xbd ){
|
|
touche_appuyee = '4';
|
|
}
|
|
if ( (p10 & 0xff)== 0xdd ){
|
|
touche_appuyee = '5';
|
|
}
|
|
if ( (p10 & 0xff)== 0x7d ){
|
|
touche_appuyee = '6';
|
|
}
|
|
|
|
p10 = 0x0b;
|
|
if ( (p10 & 0xff)== 0xeb ){
|
|
touche_appuyee = '7';
|
|
}
|
|
if ( (p10 & 0xff)== 0xdb ){
|
|
touche_appuyee = '8';
|
|
}
|
|
if ( (p10 & 0xff)== 0x7b ){
|
|
touche_appuyee = '9';
|
|
}
|
|
|
|
p10 = 0x07;
|
|
if ( (p10 & 0xff)== 0xe7 ){
|
|
touche_appuyee = '*';
|
|
}
|
|
if ( (p10 & 0xff)== 0xd7 ){
|
|
touche_appuyee = '0';
|
|
}
|
|
if ( (p10 & 0xff)== 0x77 ){
|
|
touche_appuyee = '#';
|
|
}
|
|
}
|
|
init_keyboard();
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|