One more thing. I want to store received data in one variable, and later compare it to the value of other variable. I added some code but I don't think it's correct.. The tricky thing is that I'm receiving data from my bluetooth module(WT12). I have an aplication for my phone where I enter the code and it goes to the module to my micro. I want that code to be sent through UART and to put into some variable. And I don't know if there won't be any useless data transfered in the same time.
while(1) // infinite endless loop
{
static tU32 rxCharCnt = 0; // variable typecasted as 32 bit unsigned static variable rxcharcnt is
variable name. Initialised to zero
tU8 rxChar; // RXCHAR IS UNSIGNED 8 BIT char
char[] tempTable=new char[8];
int i=0;
char[] code=new char[8];
code[]={1,2,3,4,5,6,7,8};
//check if any character has been received
if (uart0GetChar(&rxChar) == TRUE) {
tempTable=rxChar;
i=i+1;
}
// value in UART0 register & with rxchar, if the result is true i.e. some
//data is received
if(tempTable[]==code[]
{
uart0SendString("It's ok"); // sending string from uart0.
}
}
return 0;
}