Révision 830
Ajouté par megoutteno il y a environ 4 ans
branch/Gouttenoire/sp4c12/SP4c12/SP4c12/SP4c12.c | ||
---|---|---|
/***********************************************************************/
|
||
#include "sfr32c87.h"
|
||
|
||
|
||
void uart0_init(void) ;
|
||
void uart0_tx(char c) ;
|
||
char uart0_rx(void) ;
|
||
void irectrame(char c);
|
||
@@ -20,10 +20,20 @@
|
||
|
||
void main(void)
|
||
{
|
||
uart0_init();
|
||
int i=0,j=0;
|
||
char seq[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||
|
||
uart0_init();
|
||
while(1)
|
||
{
|
||
uart0_tx('a');
|
||
for (i=0;i<26;i++)
|
||
{
|
||
uart0_tx(seq[i]);
|
||
for(j=0;j<10000;j++)
|
||
{
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
... | ... | |
|
||
}
|
||
void uart0_tx(char c)
|
||
{
|
||
{
|
||
te_u0c1=1;
|
||
crs_u0c0=0;
|
||
crd_u0c0= 1;
|
||
... | ... | |
}
|
||
char uart0_rx(void)
|
||
{
|
||
char c;
|
||
while(ri_u0c1);
|
||
c= u0rb;
|
||
}
|
||
/*void irectrame(char c)
|
||
{
|
||
char etat,synchro,reception,checksum,validation,trame,trame_ok;
|
||
c= u0rb;
|
||
if(c == '$' && etat == synchro)
|
||
{
|
||
etat=reception;
|
||
}
|
||
if(c !='*' && etat == reception)
|
||
{
|
||
etat=checksum;
|
||
}
|
||
if(c && etat == checksum)
|
||
{
|
||
etat=validation;
|
||
}
|
||
if(c == trame && etat == validation)
|
||
{
|
||
c=uart0_rx();
|
||
}
|
||
else
|
||
{
|
||
etat=synchro;
|
||
}
|
||
trame_ok=1;
|
||
|
||
}
|
||
|
||
}
|
||
*/
|
Formats disponibles : Unified diff
fonction uart0_tx finie(affichage des lettres de l'alphabet sur le terminale)