Projet

Général

Profil

/***********************************************************************/
/* */
/* FILE :sp4c1.c */
/* DATE :Thu, Jun 03, 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 uart0_init(void);
void uart0_tx(char c);
char uart0_rx(void);

void main(void)
{
uart0_init();
while(1){
uart0_tx('b');
}
}


void uart0_init(void){
pd6_1=0;
ps6_2=0;
ps0_3=1;
ps0_2=0;
ps0_2=0;
//registre u0mr
smd0_u0mr=1;//mode horloge synchrone
smd1_u0mr=0;//mode UART 8-bits
smd2_u0mr=1;//mode UART 8-bits
ckdir_u0mr=0;//configuration horloge interne
stps_u0mr=0;//configuration pour 2 bits de stops
pry_u0mr=0;// selection du bit de parite
prye_u0mr=0;//activation du bit de parite
iopol_u0mr=0;//polarite non-inversee
u0smr=0x00;
u0smr2=0x00;
u0smr3=0x00;
u0smr4=0x00;
//registre u0c0
clk0_u0c0=1;/*configuration pour f8 */
clk0_u0c0=0;
crs_u0c0=1;//activation du clear to send (CTS)
crd_u0c0=1;//
nch_u0c0=0;//Selection Port de sortie : CMOS
ckpol_u0c0=0;//
uform_u0c0=0;//selection du LSB en premier
//baud rate
u0brg=0x20;//Initialisation du registre U0BRG a 32 bits
//registre u0c1
te_u0c1=0;//desactvation de la transmition d'operation
re_u0c1=0;//desactvation de la reception d'operation
u0lch_u0c1=0;
u0rrm_u0c1=0;
sclkstpb_u0c1=0;
u0c1=0x05;
}

void uart0_tx(char c){
crd_u0c0=1;
crs_u0c0=0;
te_u0c1=1;
u0tb=c;
te_u0c1=0;
}
(13-13/13)