volatile char StartFlag = 0;
volatile char StopFlag = 0;
char array[20];
int i;
#INT_RDA
void interrupt()
{
int8 rxchar;
rxchar=getc(); //now you have read the char
if (rxchar == 0X02) // check for start byte
{
StartFlag = TRUE;
i=0; //make sure we start at the beginning
}
else
{
if (StartFlag)
{
if (rxchar == 0X03)
{
array = '\0';
StopFlag = TRUE;
StartFlag = FALSE;
i = 0;
}
else
array[i++] = rxchar; // store received data into an array
}
}
}
volatile char StartFlag = 0;
volatile char StopFlag = 0;
char array[20];
int i;
#INT_RDA
void interrupt()
{
int8 rxchar;
rxchar=getc(); //now you have read the char
if (rxchar == 0X02) // check for start byte
{
StartFlag = TRUE;
i=0; //make sure we start at the beginning
}
else
{
if (StartFlag)
{
if (rxchar == 0X03)
{
array = '\0';
StopFlag = TRUE;
StartFlag = FALSE;
i = 0;
}
else
array[i++] = rxchar; // store received data into an array
}
}
}
Millet böyle yapmış bi bak