Révision 881
Ajouté par magraffin il y a environ 4 ans
uart0.c | ||
---|---|---|
#include "uart0.h"
|
||
|
||
char tram[80];
|
||
char c,c1,c2,t1,t2,check=0,t3,t4;
|
||
int i=0,debut=0,fin_tram=0,validation=0;
|
||
char c,c1,c2,t1,t2,check=0,t3,t4,carac_tram=0;
|
||
int i=0,debut=0,fin_tram,validation=0;
|
||
|
||
void main(void)
|
||
{
|
||
|
||
uart0_init();
|
||
pd1_0=1;
|
||
pd1_1=1;
|
||
|
||
/*
|
||
while (1)
|
||
... | ... | |
*/
|
||
while (1)
|
||
{
|
||
fin_tram=rectram();
|
||
carac_tram=rectram(tram);
|
||
}
|
||
}
|
||
|
||
void uart0_init(void)
|
||
{
|
||
|
||
... | ... | |
return (res);
|
||
}
|
||
|
||
int rectram(char * Buffer){
|
||
int rectram(char *buffer){
|
||
fin_tram=0;
|
||
validation=0;
|
||
do{
|
||
c=uart0_rx();
|
||
if (c=='\n' || c=='\r'){
|
||
return 1;
|
||
fin_tram=1;
|
||
}
|
||
if (c=='*'){
|
||
/*p1_1=1;
|
||
while (i!=10000){i++;}
|
||
p1_1=0;*/
|
||
//*(buffer+i)
|
||
c1=uart0_rx();
|
||
c2=uart0_rx();
|
||
debut=0;
|
||
i=0;
|
||
i+=3;
|
||
t1=(check&0xf0)>>4;//decode_int(c1);decode_int(c1);
|
||
t2=check&0x0f;//decode_int(c2);decode_int(c2);
|
||
t3=decode_int(c1);
|
||
... | ... | |
}
|
||
if (debut==1){
|
||
i++;
|
||
tram[i]=c;
|
||
*(Buffer+i)=c;
|
||
*(buffer+i)=c;
|
||
check=check^c;
|
||
}
|
||
if (c=='$'){
|
||
/*p1_0=1;
|
||
while (i!=10000){i++;}
|
||
p1_0=0;*/
|
||
i=0;
|
||
debut=1;
|
||
fin_tram=0;
|
||
tram[0]=c;
|
||
*buffer=c;
|
||
}
|
||
}
|
||
while (fin_tram==0);
|
||
return i+1;
|
||
}
|
Formats disponibles : Unified diff
rectram fonctionne et construction de irectram