Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 28, 2012, 12:47:49 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
VB and the development of wizards
Help with optimising button script
Pages:
1
Go Down
« previous
next »
Author
Topic: Help with optimising button script (Read 1029 times)
0 Members and 2 Guests are viewing this topic.
muecker
Active Member
Offline
Posts: 8
Help with optimising button script
«
on:
March 26, 2007, 01:35:33 PM »
I have two buttons that operators use, one for homing and one for setting a height controlled by external PLC. When either of these buttons are pressed, the CPU usage max's out at 100%. Usually it works fine, but occasionally after using them, they report machine crashes. Below are the two scripts. Is there a way to optimise these, or if not are these scripts really the culprit?
Here they are:
Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Dim LevelSet As Boolean
dim ctr1 as Long
Dim TS as single
Dim TE as single
Dim TT as single
Dim Checked as Boolean
Checked = false
ctr1 = -100000
Ready = 0
SystemReady = GetUserLED(1020) and not GetUserLED(1024) and not IsActive(input1) and not IsActive(input4) and IsOutputActive(output10)
If SystemReady then
Ready = MsgBox ("Machine Must be Idle, Press Okay to Continue",305,"Solder Height Check")
If Ready = 1 Then 'move to solder check position
Zheight = GetOEMDRO(1051)
XPos = GetOEMDRO(1052)
YPos = GetOEMDRO(1053)
code "g55"
Do While IsMoving()
loop
code "g1 z0 f20"
Do While IsMoving()
loop
code "g0 x" & XPos
Do While IsMoving()
loop
code "g0 y" & YPos
Do While IsMoving()
loop
code "g1 f20"
Do While IsMoving()
loop
code "g1 z" & Zheight
Do While IsMoving()
loop
ActivateSignal(Output9)
Do Until ctr = 100000
ctr = ctr + 1
Loop
DeActivateSignal(Output9)
TS = Timer
Do Until IsActive(Input3)
TE = Timer
TT = TE -TS
If TT > 60 then
Checked = true
Exit Do
Else
End If
Loop
code "g55"
code "g1 z0 f20"
code "g0 x0 y0"
Else
End If
If Checked = true then
MsgBox("Level Check Failed")
Else
End If
Else
MsgBox("System not Ready")
End If
And the other:
Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Dim Zhomed As Boolean
Dim Yhomed As Boolean
Dim Xhomed As Boolean
DoOEMButton( 1024 )
While IsMoving()
Wend
Zhomed = GetOEMLED(809)
If Zhomed = true then
DoOEMButton(1003)
Else
DoOEMButton( 135)
End If
DoOEMButton( 1023 )
While IsMoving()
Wend
Yhomed = GetOEMLED(809)
If Yhomed = true then
DoOEMButton(1003)
Else
DoOEMButton( 134)
End If
DoOEMButton( 1022 )
While IsMoving()
Wend
Xhomed = GetOEMLED(809)
If Xhomed = true then
DoOEMButton(1003)
Else
DoOEMButton( 133)
End If
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Help with optimising button script
«
Reply #1 on:
March 26, 2007, 09:05:38 PM »
Change these things and see if it makes a difference:
Put parentheses around your NOT objects:
example;
SystemReady = GetUserLED(1020) and not(GetUserLED(1024)) and not(IsActive(input1)) and not(IsActive(input4)) and IsOutputActive(output10)
If SystemReady then
Why do you put BOTH Do loops AND while Ismoving() statements suspect lag is here:
example;
If Ready = 1 Then 'move to solder check position
Zheight = GetOEMDRO(1051)
XPos = GetOEMDRO(1052)
YPos = GetOEMDRO(1053)
code "g55"
While IsMoving()
Wend
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
muecker
Active Member
Offline
Posts: 8
Re: Help with optimising button script
«
Reply #2 on:
March 27, 2007, 06:21:47 AM »
I didnt notice that i put those do loops in there. I'll try changing it.
Thanks
Logged
Pages:
1
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...