root/branch/CLAUD/sp4b1/SP4b1/SP4b1.c @ 697
543 | anclaud | /***********************************************************************/
|
|
/* */
|
|||
/* 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. */
|
|||
/***********************************************************************/
|
|||
563 | anclaud | #include "sfr32c87.h"
|
|
/*
|
|||
void init_keyboard(void);
|
|||
void tpo_50ms(void);
|
|||
unsigned char touche = 0;
|
|||
543 | anclaud | void main(void)
|
|
563 | anclaud | {
|
|
init_keyboard();
|
|||
while(1)
|
|||
{
|
|||
if ( (p10 & 0xf0)!= 0xf0 )
|
|||
{
|
|||
touche = p10;
|
|||
tpo_50ms();
|
|||
}
|
|||
}
|
|||
}
|
|||
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;
|
|||
}
|
|||
*/
|
|||
697 | anclaud | ||
563 | anclaud | void main (void)
|
|
543 | anclaud | {
|
|
697 | anclaud | char t;
|
|
char touche = 0;
|
|||
pd10 = 0x0F;
|
|||
p10 = 0;
|
|||
pu31=1;
|
|||
563 | anclaud | t = p10;
|
|
while(1)
|
|||
{
|
|||
697 | anclaud | p10=0x0F;
|
|
563 | anclaud | t=p10;
|
|
697 | anclaud | if(t!=0xf0)
|
|
563 | anclaud | {
|
|
697 | anclaud | p10=0xf7;
|
|
563 | anclaud | t=p10;
|
|
697 | anclaud | if (t==0xe7)
|
|
563 | anclaud | {
|
|
touche = '*';
|
|||
}
|
|||
697 | anclaud | if (t==0xd7)
|
|
563 | anclaud | {
|
|
touche = '0';
|
|||
}
|
|||
697 | anclaud | if (t==0x77)
|
|
563 | anclaud | {
|
|
touche = '#';
|
|||
}
|
|||
697 | anclaud | p10=0xfb;
|
|
t=p10;
|
|||
if (t==0xeb)
|
|||
{
|
|||
touche = '7';
|
|||
}
|
|||
if (t==0xdb)
|
|||
{
|
|||
touche = '8';
|
|||
}
|
|||
if (t==0x7b)
|
|||
{
|
|||
touche = '9';
|
|||
}
|
|||
p10=0xfd;
|
|||
t=p10;
|
|||
if (t==0xbd)
|
|||
{
|
|||
touche = '4';
|
|||
}
|
|||
if (t==0xdd)
|
|||
{
|
|||
touche = '5';
|
|||
}
|
|||
if (t==0x7d)
|
|||
{
|
|||
touche = '6';
|
|||
}
|
|||
p10=0xfe;
|
|||
t=p10;
|
|||
if (t==0xbe)
|
|||
{
|
|||
touche = '1';
|
|||
}
|
|||
if (t==0xde)
|
|||
{
|
|||
touche = '2';
|
|||
}
|
|||
if (t==0x7e)
|
|||
{
|
|||
touche = '3';
|
|||
}
|
|||
563 | anclaud | }
|
|
}
|
|||
}
|