04-10-2011 07:53 PM
It is very slow because you only parse one block per second. Typically systems like this would use parallel loops. One loop would acquire the signals coming in from the external device. The second loop would parse the string. The parsing loop would run quite fast as long as the string has more than 4 characters. When it has fewer than 4 it waits for more data from the other loop.
Depending on how you get the raw data, you may be able to use a single loop with a delay which depends on the amount of data in the string. Use a case structure to only read data from the external device when it is available. It is hard to be more specific without knowing more about your system.
Lynn
04-10-2011 09:56 PM
At the moment I have 1 loop for reading from the serial port and this is where I am parsing the string and inserting it into the queue. Another loop that reads from the queue and separates that data depending on the header. and a third loop that only analyzes the separated data. I'm sure I can figure this out so if I don't I will be back. What you told me is a very good starting point
04-11-2011 09:02 AM
Here is my solution to that problem. Seems to work quite well and much faster than one element every scan.