Hi,
I am writing embedded controller code by using c language, i am declaring two 8 bit buffers of size,
Code:
uint8_t buff[255];
uint8_t temp_buffer[30] = {0};
uint16_t temp_ptr = 0;
void Check_FE_recreate_frame(void)
{
uint16_t temp_ctr = 0;
uint16_t kdx = 0;
temp_buffer[temp_ptr] = buff[0];
temp_ptr++;
for (kdx = 1; kdx <= 20; kdx++)
{
if ((buff[kdx] == 0xFF) && (buff[kdx + 1] == 0xFE))
{
temp_buffer[temp_ptr] = 0xFF;
temp_ptr++;
temp_ctr++;
kdx++;
}
else
{
temp_buffer[temp_ptr] = buff[kdx];
temp_ptr++;
}
}
len = Rx_ptr - temp_ctr;
}
int main()
{
while(1){
function call();
}
the function is running in while 1 loop, once the data is receiving in to buffer and copying into temp_buffer , for second time it is receiving data but not overwriting in to temp_buffer???
Please help me to solve this?