I am trying to parse a packet which contains merit values returned from multiple sensors over the RS232 port. A typical packet looks something like this:
1P=515
1M=877
1S=412
1C=871
2F=777
$
Now, the problem is that as many as 2000 of these packets could be returned from the sensors every minute. I have installed a COM callback function with the event LWRS_RXFLAG set to '$'. In the COM callback, it reads until it encounters the termination byte '$', parses the buffer, and returns. At high rates of speed, I am getting stack overflow errors when running the program. When I take a look at my executable in task manager, over time the memory usage of the execuatable slowly grows and grows. My ques
tion is this, are multiple calls to the COM callback function being made at the same time? Or is it called in succession, i.e. looking at the beginning of the input queue, every time there is a $ the function is called one time, and then returns. There is a lot going on in my callback function, I am plotting a histogram and a strip chart, and sometimes writing to a file. I simply cannot parse the data quickly enough, but that's fine as long as there aren't multiple threads being created with multiple calls to the function at the same time.
Thanks.