Projet

Général

Profil

/***********************************************************************/
/* */
/* FILE :SP4b2.c */
/* DATE :Tue, May 25, 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"

#define RS p1_0
#define RW p1_1
#define E p1_2
#define BF p0_7

void tempo(void)
{
int i;
for (i=0 ; i<1000 ;i++)
asm("nop");
}

void init_ports_aff(void)
{
pd0 = 0xff;
p0 = 0x00;
pd1= 0xff;
p1=0x00;
}



void busy(void)
{
pd0=0x00;//entr?e
RS=0;
RW=1;
E=1;
while(BF!=0);
E=0;
pd0=0xff;//sortie
}

void affiche_caractere(unsigned char caractere)
{
RS=1;
RW=0;
p0=caractere;
E=1;
tempo();
E=0;
tempo();
busy();
}

void affiche_commande(unsigned char commande)
{

RS=0;
RW=0;
p0=commande;
E=1;
tempo();
E=0;
tempo();
busy();
}

(2-2/8)