If this is not the right forum for this question, then please point me in the right direction.
I'm brand new to Visual Basic 2008 (just started with it 5-6 weeks ago) and I'm pretty stuck. I've managed to learn enough to develop a small program that reads the ASCII "sentences" from my GPS receiver by polling the port. I've also managed to parse the sentences into usable data, and feel pretty sure that I can manage to do what I want to with the data. However, polling the port takes too much time. The sentences that the GPS sends take about 1.4 seconds to arrive in the computers UART buffer, leaving 0.6 seconds to do what I want with everything, which is most probably not enough time.
What I'd like to do is let the Serial port's input buffer fill to a predetermined level (about 600 bytes), and then have the ComPort's "ReceivedBytesThreshold" method trigger, causing a subroutine to read the entire contents of the input buffer all at once. I'm hoping that will give me about 1.9 seconds to do what I want with the data.
In order to test that theory I wrote a little routine that determines the amount of time it will actually take to read everything at once. However, when I go to update a text box on the form with the "start" and "end" times I get a threading runtime error.
The best I can gather for what I've managed to read is that when the "ReceivedBytesThreshold" method is triggered it creates a new thread, which limits me from modifying anything in the original thread from data in the new thread. However, there is something called Invoke and BeginInvoke that may let me get the job done, but I have no idea what I am doing so I cannot get it to work.
Can anyone here help me with this problem? I will be happy to share the code, but I thought I would wait and see if anyone was willing to lend me a hand first.
Thanks in advance,
Jonathan
I'm brand new to Visual Basic 2008 (just started with it 5-6 weeks ago) and I'm pretty stuck. I've managed to learn enough to develop a small program that reads the ASCII "sentences" from my GPS receiver by polling the port. I've also managed to parse the sentences into usable data, and feel pretty sure that I can manage to do what I want to with the data. However, polling the port takes too much time. The sentences that the GPS sends take about 1.4 seconds to arrive in the computers UART buffer, leaving 0.6 seconds to do what I want with everything, which is most probably not enough time.
What I'd like to do is let the Serial port's input buffer fill to a predetermined level (about 600 bytes), and then have the ComPort's "ReceivedBytesThreshold" method trigger, causing a subroutine to read the entire contents of the input buffer all at once. I'm hoping that will give me about 1.9 seconds to do what I want with the data.
In order to test that theory I wrote a little routine that determines the amount of time it will actually take to read everything at once. However, when I go to update a text box on the form with the "start" and "end" times I get a threading runtime error.
The best I can gather for what I've managed to read is that when the "ReceivedBytesThreshold" method is triggered it creates a new thread, which limits me from modifying anything in the original thread from data in the new thread. However, there is something called Invoke and BeginInvoke that may let me get the job done, but I have no idea what I am doing so I cannot get it to work.
Can anyone here help me with this problem? I will be happy to share the code, but I thought I would wait and see if anyone was willing to lend me a hand first.
Thanks in advance,
Jonathan