|
-
May 26th, 2009, 02:46 AM
#1
Thread Starter
Junior Member
[need help] simulate PLC process
Hi,
I need help for my project.
I want to simulate a PLC process in VB.net which the process is running in a big loop.
What I try to make is calling 'Subroutines' and 'Functions' in a while loop after button 'Run' is pressed and stop after button 'Stop' is pressed.
in general, this is what I have done so far and it seems very heavy during the process. I guess that the Application.DoEvents() is the one that makes the program runs heavy.
HTML Code:
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
btnStart.Enabled = False
While btnStart.Enabled = False 'chkG_bUnitAuto.Checked
SubRoutines1()
Application.DoEvents()
SubRoutines2()
Application.DoEvents()
Functions1(nValue1)
Application.DoEvents()
Functions2(nValue2)
Application.DoEvents()
End While
End Sub
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
btnStart.Enabled = True
StopAll()
End Sub
Do you guys maybe know what can I do to make it simple or maybe some ideas?
-
May 26th, 2009, 08:12 AM
#2
Re: [need help] simulate PLC process
When you say "program runs heavy", do you mean that your program uses a lot of system resources (CPU time, memory...) when running?
Application.DoEvents does not make your program runs heavy. What makes it run heavy is Subroutine1, Subroutine2, Function1, Function2 and you need to show us the code in those methods before we can give any suggestions.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
Tags for this Thread
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
|