Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: manmeran on May 29, 2010, 06:41:31 AM
-
i want sense M3(when Spindle turn on) and save "Line number" to var 604.
and show number line to userDRO 1200.
if i trigger input#1 then code execute from it line.
1140 is OEMled for input#1
i write this VB code in addition about VB i am very Beginner :) :
macropump.m1s
If DOSPINCW()
then
SetVar(604,GetDro(16))
SetUserDro(1200,Getvar(604))
END if
A = GetOEMled (1140)
B = GetUserDRO (1140)
If A And (B = 0) Then
SetDro(16,Getvar(604))
Sleep(100)
DoButton(0)
SetUserDRO(1140,1)
End If
If Not A And (B > 0) Then
SetUserDRO(1140,0)
End If
plese guide for Troubleshooting.
-
sorry for my mistake.
correct line1 :
C = GetOEMled (11)
If C THEN
-
OK I see a BIG safety concern. The macropump updates 10 times per sec SO it is really a continuos loop.
It is a bad idea to have statements(DoButton(0)) that control machine movement from the macropump AS it could cause the machine to move without being under the Direct control of the operator. It could injure or kill the operator.
-
i write this code and work well:
macropump.m1s
C = GetOEMled (813) ' Dwell LED
D = GetOEMled (11) ' Spindle ON LED
If C And D Then
SetVar(604,GetDro(16))
SetUserDro(1200,Getvar(604))
End If
'in fact C & D sense "M03" .have You a better suggestion ?
'A = GetOEMled (1140) / is Inactive because dont work well
'B = GetUserDRO (1140)
'If A And (B = 0) Then
'Code "M115"
'SetUserDRO(1140,1)
'End If
'If Not A And (B > 0) Then
'SetUserDRO(1140,0)
'End If
and
m115.m1s
DoButton(1) 'Feedhold
While IsMoving 'Wait for movement to stop
Sleep(100)
Wend
DoButton(3) 'Set Stop
Sleep(1000)
SetDro(16,(Getvar(604)+1))
Sleep(100)
DoOEMButton(156)
Sleep(100)
DoButton(0)
END
my problem is when i trigger "INPUT#1" ,dont trigger M115.
please help me.
OK I see a BIG safety concern
I use this code when cutting does not do well and we need to be done again
It is a bad idea to have statements(DoButton(0)) that control machine movement from the macropump
have You a better suggestion?
-
Sorry sport but what you are trying to do is dangerous. You are on your own for this one.
-
dangerous
why?
What is important for this forum:
when i trigger "INPUT#1" ,dont trigger M115.
-
Because the operator DOES NOT have primary control of the start of movement of the machine. It could move anytime the conditions exist whether you wanted it to move or not. THAT IS DANGEROUS.
-
no.
you dont understand my mean.
in cutting with OXY/fuel Sometimes Because to being dirty sheets ,cutting surface is not well done. The user can then once again previous path from starting point to begin Counter
does not Any interference in the main process
-
in fact C & D sense "M03" .have You a better suggestion ?
are you have ?
AND
when i trigger "INPUT#1" ,dont trigger M115.
-
NO "I " don't
-
manmardam - apart from anything else, you appear to be ignoring the fact that the macropump runs CONTINUALLY every 10th of a second. i.e. every 100ms.
Never mind the rest of your code, add up the time just for your delays (1300ms). What do you reckon that means?
EDIT: After re-reading up on the macropump I think I'm wrong here. According to Art's video, the macropump re-runs 1/10th of a second after it finishes the previous run - not every 1/10th of a second. Actually he say's a 1/5th of a second but I think that's changed.
-
As far as I know ,1300 ms is for my macro(M115) ,not macropump.
is it important that there is macropump what code to run?
-
As far as I know ,1300 ms is for my macro(M115) ,not macropump.
What is calling your M115?
-
yes, i call m115 with macropump.
I think you mean is:
Process inside macropump with the code located in(M115) ,should not be more than 100 ms
SO What is the solution?
-
yes, i call m115 with macropump.
I think you mean is:
Process inside macropump with the code located in(M115) ,should not be more than 100 ms
Well personally I'd make sure that any macropump finished WELL inside 100ms to be safe, but you get the idea. Remeber this is just one issue, there are others.
EDIT: See my edit above in post #10
SO What is the solution?
Don't use the macropump for this - it's not appropriate. If I understand your requirement, all you want to do is be able to run from the line where the latest M3 was and you want to be able to do that from an external button - correct?
Off the top of my head.
1) Modify M3 to record it's line number in a dro.
2) Add a screen button FOR THE OPERATOR that runs from that line. Mach has the facillity for "run from here" all taken care of, preparatory moves - the whole shabang - use that functionality.
3) To operate from the external button - use a trigger.
-
you want to do is be able to run from the line where the latest M3 was and you want to be able to do that from an external button - correct?
exactly.
i not problem with my macro, it work well.
but my problem is External button.when code dont run and axis is Immobile,i can trigger macro with external button. but when i press "Cycle start" and code run ,Does not do anything right. i dont trigger macro with external button.
I hope you understand my problem
please see my screen
Amir
-
I don't think you understand what I mean by trigger. You're attempting to create your own via the macropump by polling. There is no need to do this. Mach provides purpose built triggers for things like this. Read up on them in the manual.
Cheers
Ian
-
is it possible guide me more ?
-
LOL - You're having me on right? I've given you what I think may be a possible approach. I'm not going to code it all up for you - it's your baby not mine.
Cheers
Ian
EDIT: By all means come back with specific questions but at the moment I can't think what else to say to help.
-
why nobody can not help me ?
This problem is so big?
-
IAN, Run from here does not work with plasma or jet cutting WITH a Top of material routine. The G28.1 or G31 throws a monkey wrench into the mix.
Also you must restart and stop the torch at each cut point.
I gave Amir a solution that we use here ,(Stop and restart as an auto function ran by screen buttons or hotkeys) actually gave him 2 solutions but they don't seems to work on his end for some reason.
http://www.machsupport.com/forum/index.php/topic,14927.50.html
-
Hi Terry - I must have missed that thread - I didn't know the history behind this - nor that "Run from here" had issues - personally I've never used it - all my jobs run from start to finish no problem (yeah right ;D). Like I said it was "off the top of my head". I was really just trying to point out that the macropump wasn't the way to go for this one and why - which from your posts here I think you agree with!
At this point I'm a bit stumped because nothing that is suggested seems to cut the mustard for whatever reason. C'est la vie.
Cheers
Ian
-
:-) LOL HIYA Ian, we spend a LOT of time with new code proofing it to run correctly , but with plasma you never know when the torch will cough or sneeze and put the fire OUT. Then you have to stop and verify the torch and restart where you left off.
That was why we developed the stop/restart routine a time saver.
-
Amir look in the MACH Macro Programmers Manual, Page 57. That will tell you what you need to know.
-
thx Terry
-
Amir look in the MACH Macro Programmers Manual, Page 57. That will tell you what you need to know.
i think you mean is : If IsActive(INPUT1) Then
code" M..."
End If
i test it,no change Compared to previous test .
result is same
i think When the code runs not possible Execute macro with External Button.
-
IT works just fine here. there is nothing wrong with the process just the application.
-
Let me for finishing this issue to the review it once again:
macropump :
C = GetOEMled (813)
D = GetOEMled (11)
If C And D Then
SetVar(604,GetDro(16))
SetUserDro(1200,Getvar(604))
End If
If IsActive(INPUT1) Then
Code"M650"
End If
M650 :
DoButton(1) 'Feedhold
While IsMoving 'Wait for movement to stop
Sleep(100)
Wend
DoButton(3) 'Set Stop
Sleep(100)
SetDro(16,Getvar(604))
Sleep(100)
DoOEMButton(156)
Sleep(100)
DoButton(0)
Code"(You are now back to beginning contour )"
END
and setup input#1 Active low.
Only works in situations that are immobile axes.
Is this code on your PC to work properly?
Amir
-
I don't know.
I do not work on code that may endanger the operator or machine
-
You always pay the issue that this code is dangerous.
I explained that this code isnt dangerous, but You do not ignore.
I wanted to help you, ,why can not to the Trigger macro during the move axes(when i press cycle start) ?
After about 20 posts have not yet replied.
This one is special for me.
Thx Terry and another.
i am wait.
Amir
-
You are going to be waiting for a long time.
-
i solve my problem mmmmmmmmmmmr terry.
""Do not let what you cannot do interfere with what you can do ""
-
I am happy for you.
-
dear sir ,
how to make a button to "run,pause,continue" on one button(same button)
because my extend keypad only hace 10 button