how are you?. I'm having some trouble analizing streamed data. Recently I made a program that analizes streamed data and works for the first message of the stream as you can see in the following post
Problem with structire packing
when I noticed that program will work only for the first message for the way the buffer is being filler I changed the focus of the processing to move the compare variable to the position of the last byte arrived and then compare backwards since I need to check first the suffix of the message to determine where the prefix is, after that then decide what to do (this last part is not done yet).
The problem that I have here is that as I'm inside the analize_stream function I want to use the pointer to the reception buffer I declared to compare instead the original reception buffer name, so when I try to use the pointer then the first element appears perfectly but the final three appears as zero as you can see in the following image
and the code is this
uint8_t analize_string(uint32_t * incomming)
{
static uint8_t incCounter = 0;
static uint8_t arreglo[Long_Rec] = {0};
arreglo[incCounter] = incomming[incCounter];
if((incomming[incCounter] == 0xff)
&& (incomming[incCounter - 1] == 0xff)
&& (incomming[incCounter - 2] == 0xff))
{
incCounter = 0;
}
if(interface.aHMI)
{
////// screen_handler();
interface.aHMI = false;
}
receive_data((char *) &U2rxBuffer[incCounter], (uint16_t) sizeof(uint8_t));
return incCounter;
}
as you can see in the image the incomming pointer is correctly directed since it has the correct data to analize (0xffffff86) but when I did the comparison with the "if" then it didn't worked so I added the operation to mirror the incomming pointer (U2rxBuffer actually) in the array "arreglo", then arreglo is showing the second, third and fourth element equal to zero but when I do the same operation but mirroring directly U2rxBuffer into arreglo it shows the content of arreglo as should be as you can see in the following image:
the only thing that I changed to the code was "incomming" for "U2rxBuffer", so, why if incomming is correctly directed then it doesn't assign the data for addresses beyond initial address?.
This program righ now what does is to call analize_string every time a new byte arrives and exits until a new one arrives.
NOTE: Seeing again my previous post I noted that yesterday I was this problem too but I didn't noted.
Please help.