|
-
Apr 26th, 2012, 12:49 AM
#11
Thread Starter
New Member
Re: calculation becoming slow-delay accumulation
 Originally Posted by Doogle
That seems like a lot of code for a simple transfer of data
Code:
i = 1
cdraw = 0
While cdraw <= clines
cdraw = cdraw + 1
mscomm1.output = "s"
mscomm1.output Mid$(newline, i, 18)
i = i + 18
'waits till process is complete
Do Until recv = "c"
DoEvents
DoEvents
Loop
Wend
does the same job.
Using DoEvents will slow up the whole process - you ought to be triggering the sending of the data through the OnComm event - if for any reason the other end doesn't send a "c" then you go into an infinite loop.
k..i can simplify the code..thanx for advice..but my main problem still exists..the pgm is interfaced with an external microcontroller..when i debugged the delay area ,i found that the data sending section works fine,the delay comes in the next part.ie after 'c' is recieved ,it takes a bit higher time to start the next working of loop..as u told the problem could be with doevents..how can i write the program do events..my aim is just to wait until 'c' is recieved..the recieved character is recieved in 'recv' variable in oncomm event..when i tried without doevents,the program hangs.wat can i do now?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|