Thanks all for the reply. Some suggestion are very good
I find the possible reason:
The while loop in the function GetComString() might be interrupted by hardware COM. Now I put the while loop inside the loop(), instead of using a function returning a string, when the interrupt happened, it will continue the while loop since it is in loop(). What I need to do is the break of while loop does not necessary means a complete new line has been read in, I need check if it read in a newline token and flag it.
The function GetComString() always return a string, even it is interrupted by other interruption. That causes the string been broken into small pieces. Now I do not need any delay.
Thanks