Révision 810
Ajouté par ahkurklu il y a presque 4 ans
branch/KURKLU/sp4c12/sp4c12/sp4c12/uart0.h | ||
---|---|---|
/* This file is generated by Renesas Project Generator (Ver.4.18). */
|
||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||
/***********************************************************************/
|
||
|
||
void uart0_init(void);
|
||
void uart0_tc(char c);
|
||
void uart0_rx(void);
|
branch/KURKLU/sp4c12/sp4c12/sp4c12/SessionM32C_E8a_SYSTEM.ini | ||
---|---|---|
PROCESSOR_MODE=0
|
||
[COMMUNI]
|
||
COMSPEED=8
|
||
COMSPEED PROGRAM FLASH=8
|
||
COMSPEED DATA FLASH=8
|
||
[Driver Configuration]
|
||
Renesas Communications=USB interface,0,
|
||
[Target]
|
branch/KURKLU/sp4c12/sp4c12/sp4c12/uart0.c | ||
---|---|---|
/* This file is generated by Renesas Project Generator (Ver.4.18). */
|
||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||
/***********************************************************************/
|
||
#include "uart0.h"
|
||
#include "sfr32c87.h"
|
||
void uart0_init(void){
|
||
|
||
|
||
|
||
|
||
smd0_u0mr = 1;
|
||
smd1_u0mr = 0;
|
||
smd2_u0mr = 1;
|
||
ckdir_u0mr = 0;
|
||
stps_u0mr = 0;
|
||
prye_u0mr = 0;
|
||
iopol_u0mr = 0;
|
||
|
||
u0smr = 0x00;
|
||
u0smr2 = 0x00;
|
||
u0smr3 = 0x00;
|
||
u0smr4 = 0x00;
|
||
|
||
clk0_u0c0 = 0;
|
||
clk1_u0c0 = 0;
|
||
ckpol_u0c0 =0;
|
||
|
||
u0brg = 0xFF;
|
||
|
||
te_u0c1 = 0;
|
||
re_u0c1 = 0;
|
||
u0rrm_u0c1 = 0;
|
||
|
||
//ilvl0_s0tic =;
|
||
//ilvl1_s0tic =;
|
||
//ilvl2_s0tic =;
|
||
ir_s0tic = 0;
|
||
|
||
//ilvl0_s0ric =;
|
||
//ilvl1_s0ric =;
|
||
//ilvl2_s0ric =;
|
||
ir_s0ric = 0;
|
||
|
||
te_u0c1 = 1;
|
||
re_u0c1 = 1;
|
||
}
|
||
|
||
void uart0_tx(char c){
|
||
|
||
te_u0c1 = 1;
|
||
ti_u0c1 = 0;
|
||
crd_u0c0 = 0;
|
||
if(crs_u0c0 == 0){
|
||
pd6_0 = 0;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
branch/KURKLU/sp4c12/sp4c12/sp4c12/sp4c12.c | ||
---|---|---|
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||
/***********************************************************************/
|
||
#include"sfr32c87.h"
|
||
#include"uart0.h"
|
||
#include <stdlib.h>
|
||
|
||
|
||
void uart0_tx(char c){
|
||
te_u0c1 = 1;
|
||
ti_u0c1 = 0;
|
||
|
||
while(ti_u0c1 == 1){
|
||
u0tb = c;
|
||
}
|
||
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
pd6 = 0xff;
|
||
|
||
char c = 'u';
|
||
|
||
smd0_u0mr = 1;
|
||
//U0MR
|
||
smd0_u0mr = 1; //Uart en mode 8bit
|
||
smd1_u0mr = 0;
|
||
smd2_u0mr = 1;
|
||
ckdir_u0mr = 0;
|
||
stps_u0mr = 0;
|
||
prye_u0mr = 0;
|
||
iopol_u0mr = 0;
|
||
smd2_u0mr = 1;
|
||
ckdir_u0mr = 0; //horloge interne
|
||
stps_u0mr = 0; //1 bit de stop
|
||
pry_u0mr = 0; //parit? impair
|
||
prye_u0mr = 0; //parit? d?sactiv?
|
||
iopol_u0mr = 0; // TX RX non inv?rs?
|
||
|
||
//U0SMR
|
||
u0smr = 0x00;
|
||
u0smr2 = 0x00;
|
||
u0smr3 = 0x00;
|
||
u0smr4 = 0x00;
|
||
|
||
clk0_u0c0 = 0;
|
||
clk1_u0c0 = 0;
|
||
ckpol_u0c0 = 0;
|
||
//U0BRG
|
||
u0brg = 0x20; // baud rate
|
||
|
||
u0brg = 0xFF;
|
||
//U0C0
|
||
clk0_u0c0 =1; // selection f8
|
||
clk1_u0c0 =0;
|
||
crs_u0c0 =0;
|
||
txept_u0c0 =0;
|
||
crd_u0c0 =1;
|
||
nch_u0c0 =0;
|
||
ckpol_u0c0 =0;
|
||
uform_u0c0 =0;
|
||
|
||
te_u0c1 = 0;
|
||
re_u0c1 = 0;
|
||
u0rrm_u0c1 = 0;
|
||
//U0C1
|
||
te_u0c1 = 1;
|
||
ti_u0c1 = 0;
|
||
re_u0c1 = 1;
|
||
ri_u0c1 = 0;
|
||
u0irs_u0c1 = 0;
|
||
u0rrm_u0c1 = 0;
|
||
u0lch_u0c1 = 0;
|
||
sclkstpb_u0c1 = 0;
|
||
u0ere_u0c1 = 0;
|
||
|
||
//ilvl0_s0tic =;
|
||
//ilvl1_s0tic =;
|
||
//ilvl2_s0tic =;
|
||
ir_s0tic = 0;
|
||
pd6_0 = 0;
|
||
pd6_1 = 0;
|
||
pd6_2 = 0;
|
||
pd6_3 = 1;
|
||
|
||
//ilvl0_s0ric =;
|
||
//ilvl1_s0ric =;
|
||
//ilvl2_s0ric =;
|
||
ir_s0ric = 0;
|
||
|
||
te_u0c1 = 1;
|
||
re_u0c1 = 1;
|
||
ps0_0 = 0;
|
||
ps0_1 = 0;
|
||
ps0_2 = 0;
|
||
ps0_3 = 1;
|
||
|
||
|
||
|
||
te_u0c1 = 1;
|
||
ti_u0c1 = 0;
|
||
crd_u0c0 = 0;
|
||
u0tb = 'a';
|
||
if(crs_u0c0 == 0){
|
||
p6_0 = 0;
|
||
|
||
}
|
||
|
||
|
||
uart0_tx(c);
|
||
}
|
Formats disponibles : Unified diff
Modification de l'initialisation et ajout fonction uart0_tx