Révision 750
Ajouté par albest il y a presque 4 ans
branch/best/sp4c12/SP4b1/SP4b1/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]
|
||
M32C E8a SYSTEM=Renesas Communications
|
||
[USER_DATA]
|
||
RESET=fe0000
|
branch/best/sp4c12/SP4b1/SP4b1/SP4b1.c | ||
---|---|---|
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||
/***********************************************************************/
|
||
#include "sfr32c87.h"
|
||
|
||
void uart0_init(void); // Initialisation du port s?rie
|
||
void uart0_tx(char c); //Envoie d'un caract?re
|
||
char uart0_rx(void); //Fonction d'attente et lecture d'un caract?re
|
||
int rectrame(char * Buffer);
|
||
|
||
void main(void)
|
||
{
|
||
|
||
int i = 0;
|
||
uart0_init();
|
||
while (1){
|
||
uart0_tx( uart0_rx()+1 );
|
||
|
||
|
||
}
|
||
}
|
||
|
||
void uart0_init(void){
|
||
u0mr = 0x05;
|
||
u0brg = 32;
|
||
u0c0 = 0x11;
|
||
u0c1 = 0x05;
|
||
pd6 = 0x08;
|
||
psl0 = 0x00;
|
||
ps0 = 0x08;
|
||
}
|
||
|
||
void uart0_tx(char c){
|
||
while (ti_u0c1 != 1);
|
||
u0tb = c;
|
||
}
|
||
|
||
char uart0_rx(void){
|
||
while (ri_u0c1 != 1);
|
||
return u0rb;
|
||
}
|
||
|
||
int rectrame(char * Buffer){
|
||
int i = 0;
|
||
while (uart0_rx() != 0x0D && uart0_rx() != 0x0A){
|
||
|
||
}
|
||
}
|
Formats disponibles : Unified diff
Mise en place des fonctions init, rx et tx