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 25, 2012, 06:39:00 AM
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
Door Safety Macro Problems
Pages:
1
Go Down
« previous
next »
Author
Topic: Door Safety Macro Problems (Read 952 times)
0 Members and 1 Guest are viewing this topic.
babinda01
Active Member
Offline
Posts: 27
Door Safety Macro Problems
«
on:
August 18, 2009, 06:08:02 PM »
Hi
I am having a few issues with my macropump, and am hoping someone can help.
This macro works in a fasion, it does what I want but I get random errors occuring, like Cypress enable error, and sometimes I get a divide by zero error and sometime my system freezes (not sure if this one is related). Sometimes the system will run for hours with no problems and other times I will only get a few minutes out of the beast
Basically what I am wanting to do is if my safety door is open I need to stop and close the current program and send a message back to a C# application - AKSYSTECH.ABORT, and then when the door is closed again re-enable the system and prompt to reload the last program.
I hope you can get the idea of what I am trying to do.
Regards
Andrew
Copy of macropump.m1s
(1.52 KB - downloaded 46 times.)
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Door Safety Macro Problems
«
Reply #1 on:
August 19, 2009, 07:34:57 PM »
'/////////////////// unless your going to use an Exit dont use a sub in macropump
'Sub Main()
Dim DoorOpen
Dim DoorSafetyCycle
Dim t
If IsActive(Input1) Then
setuserled(1113,1)
DoorOpen = 1
setuserled(1114,0)
'///////////////////////////////////////////////////////////////////////////
If isloading() = 0 Then
'change to: If isloading() Then
'////////////////////////////////////////////////////////////////////
If getled(4) = 1 Then
' This has to be: GetOEMLED(4)
DoOEMButton(1003)'Stops Program May need to change this to 1001 - Pause
End If
DoOEMButton(169)'Closes Current Program
End If
deactivatesignal(output1)
deactivatesignal(output2)
deactivatesignal(output3)
deactivatesignal(output4)
Message ("Door Open - PROGRAM ABORTED!!!")
End If
If Not IsActive(input1) Then
If getuserled(1113) = 1 Then
setuserled(1114,0)
DoorSafetyCycle = 1
setuserled(1114,1)
Message ("Re-Select Required Job")
Message ("AKSYSTech.Abort")
For t = 1 To 3
SetTimer( 1 )
'///////////////////////////////////////
While GetTimer(1) < .05 ' You CANNOT use While loops in the macro pump it will crash mach
Wend
'Change this to an if statement or somthing..
Next t
Message ("")
setuserled(1113,0)
End If
End If
'//////////////////////////////////////////////////////////////
If IsLoading()= 1 Then
' Change to: If IsLoading() Then
If getuserled(1114) = 0 Then
'/////////////////////////////////////////////////////////////////
While IsLoading()= 1 ' You CANNOT use While loops in the macro pump it will crash mach
Wend
'Change this to an if statement or somthing..
Message ("AKSYSTech.Abort")
Message ("Door Safety Cycle Not Completed!!!")
DoOEMButton(1003)'Stops Program
DoOEMButton (169)'Closes Current Program
End If
End If
If getoemled(164) Then
setuserled(1114,0)
End If
If getoemled(165) Then
setuserled(1114,0)
End If
If GetOEMLed(800) Then
setuserled(1111,0)
setuserled(1112,0)
setuserled(1113,0)
setuserled(1114,0)
End If
'/////////////////// unless your going to use an Exit dont use a sub in macropump
'
End Sub
Main
'scott
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/
vmax549
Guest
Re: Door Safety Macro Problems
«
Reply #2 on:
August 19, 2009, 08:29:51 PM »
Would it be easier to use the door safety input for mach? Prevents the program from running with it ajar.
Just a thought, (;-) TP
Logged
babinda01
Active Member
Offline
Posts: 27
Re: Door Safety Macro Problems
«
Reply #3 on:
August 20, 2009, 12:05:41 AM »
Hi Scott,
Thanks for your reply. The while loops I have in there may be my problem. I will change it and see how I go then.
Regards
Andrew
Logged
babinda01
Active Member
Offline
Posts: 27
Re: Door Safety Macro Problems
«
Reply #4 on:
August 20, 2009, 12:34:17 AM »
Hi Scott,
Just nother question ....... Can I use a sleep(500) in the macropump? Or doesn't it like sleep commands either.
Regards
Andrew
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Door Safety Macro Problems
«
Reply #5 on:
August 20, 2009, 12:43:47 AM »
Dont run a sleep, since the macro pump is a Scanning program runs in a continous loop at machs update loop.......
instead if you need to do a pause, or set a timed event, dont run a: code"G4 P#" since you would have to run a "While IsMoving()" Wend after that.
a better approach in the macro pump would be to set a VB Timer then be watching for that value to be exceeded in an if statement to execute the code you where waiting on the time out for.
scott
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/
melee
Guest
Re: Door Safety Macro Problems
«
Reply #6 on:
August 23, 2009, 07:35:56 AM »
Hi
I'm with VMax549, ordinarily a safety door would be wired with all the other interlocks to EStop. Simple and effective.
I suspect there is something else going on with your set up outside of Mach and you are trying to automate the whole thing.
If one had to design something that would degrade system performance and potentially cause unlimited problems, it would be the macro pump, continually polling something or other.
Insert a while() loop with a conditional exit which might not even be reached, into something that is called several times a second and crash, bang, wallop.
If you can change your programming methodology to avoid the use of the macro pump, you will have a much faster and more stable system.
If you don't want to just link the door to Estop, one possibility is to have a user defined macro which is called at the start of every program, which in turn checks the state of whatever pin you have linked your door to.
If active it halts and sends the relevant message.
I assume your safety door is not going to open on its own accord during the cycle, you just want to check that it is shut before starting, so you don't need to check thousands upon thousands of times, just once at the beginning.
Just some thoughts
regards
Melee
Logged
babinda01
Active Member
Offline
Posts: 27
Re: Door Safety Macro Problems
«
Reply #7 on:
August 23, 2009, 04:53:42 PM »
Hi Melee,
Thanks for your input. The machine I am having trouble with is a special purpose machine, and my customer had problems with the operators bypassing the safety input (originally I just had it wired to the safety input as suggested). So the decission was made to make the system look for both a door open and a door close before it would allow a program to be run. In doing this I decided it would be best to remove the program from Mach3 once a door opened and again if the operator tried to run the program without completeing the complete door cycle.
Your suggestion of putting the brainwork into a macro that I call at the start of my program is excellent, and I thank you for the suggestion. I will try this thismorning and see how I go.
Thanks again
Andrew
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...