New topic: Serial port questions
<http://forums.realsoftware.com/viewtopic.php?t=38744> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message tseyfarth Post subject: Serial port questionsPosted: Sat Apr 23, 2011 7:58 pm Joined: Sat Dec 04, 2010 9:14 pm Posts: 223 Hello all. When using the DataAvailable serial event, I am testing first to see if a complete packet has been received. My question is, if a complete packet has NOT been received, is it best to exit the event handling code, or continue within the event handler testing on each loop to see if all data is available? Code:Do If me.BytesAvailable >=5 then MsgCount = 0 MsgLength = 0 Result = MsgCounter() end if If me.BytesAvailable >= MsgLength then buf = me.ReadAll if MsgCount >0 then Result = ActOnStatus.Initialize(PollData(RemoteNoPolling).Address,buf)'," ",PollData(RemoteNoPolling).Address,False,False) End if End if loop until me.BytesAvailable <=0 Top timhare Post subject: Re: Serial port questionsPosted: Sun Apr 24, 2011 1:16 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 9726 Location: Portland, OR USA Exit the event. Do not loop waiting for more data. You will get another DataAvailable event when the rest of it arrives. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
