Projet

Général

Profil

548 mukis
/***********************************************************************/
/* */
/* 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. */
/***********************************************************************/
561 mukis
#include "sfr32c87.h"
548 mukis
561 mukis
char t;
608 mukis
char touche;
561 mukis
548 mukis
void main(void)
{
561 mukis
pd10 = 0xF0; //F:sortie, 0:Entree
p10 = 0xFF;
pu30 = 1;
t = p10;
p10 = 0x00;
548 mukis
561 mukis
while (1)
{
t = p10;
if (t != 0x0F) //une touche est apuyee
{
595 mukis
p10=0xEF; // colonne de droite a 0
561 mukis
t=p10;
710 mukis
if (t == 0xEB) //la touche 7 est apuyee
561 mukis
{
608 mukis
touche='7';
}
710 mukis
if (t == 0xE7) //la touche * est apuyee
608 mukis
{
touche='*';
}

p10=0x7F; // colonne du milieu a 0
710 mukis
t=p10;
if (t == 0x7E) //la touche 3 est apuyee
608 mukis
{
595 mukis
touche='3';
561 mukis
}
710 mukis
if (t == 0x7D) //la touche 6 est apuyee
595 mukis
{
touche='6';
}
710 mukis
if (t == 0x7B) //la touche 9 est apuyee
595 mukis
{
touche='9';
}
710 mukis
if (t == 0x77) //la touche # est apuyee
595 mukis
{
touche='#';
}

p10=0xDF; // colonne du milieu a 0
710 mukis
t=p10;
if (t == 0xDE) //la touche 2 est apuyee
595 mukis
{
touche='2';
}
710 mukis
if (t == 0xDD) //la touche 5 est apuyee
595 mukis
{
touche='5';
}
710 mukis
if (t == 0xDB) //la touche 8 est apuyee
595 mukis
{
touche='8';
}
710 mukis
if (t == 0xD7) //la touche 0 est apuyee
595 mukis
{
touche='0';
}

p10=0xBF; // colonne de gauche a 0
710 mukis
t=p10;
if (t == 0xBE) //la touche 1 est apuyee
595 mukis
{
touche='1';
}
710 mukis
if (t == 0xBD) //une touche 4 est apuyee
595 mukis
{
touche='4';
}
561 mukis
}
}
548 mukis
}