Révision 822
Ajouté par dgmbadinga il y a presque 4 ans
branch/MBADINGA/sp4c12/Sp4c12/uart0.h | ||
---|---|---|
void uart0_init(void);
|
||
void uart0_tx(char c);
|
||
void uart0_rx(void);
|
||
char uart0_rx(void);
|
branch/MBADINGA/sp4c12/Sp4c12/SessionM32C_E8a_SYSTEM.ini | ||
---|---|---|
EMUSEL=0
|
||
MCU_GROUP=M32C__87 Group
|
||
[POWER_SUPPLY]
|
||
VOLTAGE_5_0=0
|
||
VOLTAGE_5_0=1
|
||
VOLTAGE_3_3=0
|
||
[FW_LOCATE]
|
||
FWADDRESS=fff0
|
||
... | ... | |
PROCESSOR_MODE=0
|
||
[COMMUNI]
|
||
COMSPEED=8
|
||
COMSPEED PROGRAM FLASH=8
|
||
COMSPEED DATA FLASH=8
|
||
[Driver Configuration]
|
||
Renesas Communications=USB interface,0,
|
||
[Target]
|
branch/MBADINGA/sp4c12/Sp4c12/uart0.c | ||
---|---|---|
#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;
|
||
crd_u0c0=1;
|
||
crs_u0c0=0;
|
||
nch_u0c0=0;
|
||
ckpol_u0c0=0;
|
||
uform_u0c0=0;
|
||
txept_u0c0=0;
|
||
|
||
u0brg=255;
|
||
|
||
te_u0c1=0;
|
||
re_u0c1=0;
|
||
ti_u0c1=1;
|
||
ri_u0c1=0;
|
||
u0rrm_u0c1=0;
|
||
u0lch_u0c1=0;
|
||
|
||
//bit 7=0
|
||
u0c1=u0c1 & 0x7f;
|
||
|
||
pd6_0=0;
|
||
pd6_1=0;
|
||
pd6_2=0;
|
||
pd6_3=1;
|
||
|
||
ps0_0=0;
|
||
ps0_1=0;
|
||
ps0_2=0;
|
||
ps0_3=1;
|
||
psl0_0=0;
|
||
|
||
}
|
||
|
||
void uart0_tx(char c)
|
||
{
|
||
ti_u0c1=0;
|
||
while(ri_u0c1!=1);
|
||
u0tb=c;
|
||
|
||
}
|
||
|
||
char uart0_rx(void)
|
||
{
|
||
psl0_0=1;
|
||
while(ri_u0c1!=1);
|
||
return u0rb;
|
||
|
||
|
||
}
|
branch/MBADINGA/sp4c12/Sp4c12/Sp4c12.c | ||
---|---|---|
#include "uart0.h"
|
||
|
||
|
||
void uart0_init(void){
|
||
|
||
Pd6=0x00;
|
||
Pd6_2=1;
|
||
u0smr=0;
|
||
u0smr2=0;
|
||
u0smr3=0;
|
||
u0smr4=0;
|
||
u0c0=0;
|
||
u0c1=0;
|
||
|
||
|
||
}
|
||
|
||
void uart0_tx(char c){
|
||
|
||
|
||
}
|
||
|
||
|
||
char uart0_rx(void){
|
||
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
char c='A';
|
||
int i;
|
||
uart0_init();
|
||
uart0_tx(c);
|
||
|
||
}
|
Formats disponibles : Unified diff
tsp4_c12