Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: manmeran on May 29, 2010, 06:41:31 AM

Title: start from line #
Post 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.
Title: Re: start from line #
Post by: manmeran on May 29, 2010, 07:07:36 AM
sorry for my mistake.
correct line1 :
C = GetOEMled (11)
If C  THEN
Title: Re: start from line #
Post by: BR549 on May 30, 2010, 11:46:19 AM
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.

Title: Re: start from line #
Post by: manmeran on May 31, 2010, 02:57:56 AM
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.

Quote
OK I see a BIG safety concern
I use this code when cutting does not do well and we need to be done again

Quote
It is a bad idea to have statements(DoButton(0)) that control machine movement from the macropump
have You a better suggestion?
Title: Re: start from line #
Post by: BR549 on May 31, 2010, 01:12:44 PM
Sorry sport but what you are trying to do is dangerous. You are on your own for this one.

Title: Re: start from line #
Post by: manmeran on May 31, 2010, 01:14:43 PM
dangerous  
why?

What is important for this forum:
Quote
when i trigger "INPUT#1" ,dont trigger M115.
Title: Re: start from line #
Post by: BR549 on May 31, 2010, 01:19:09 PM
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.

Title: Re: start from line #
Post by: manmeran on May 31, 2010, 01:26:40 PM
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
Title: Re: start from line #
Post by: manmeran on May 31, 2010, 01:31:44 PM
Quote
in fact C & D sense "M03" .have You a better suggestion ?
are you have ?

AND
Quote
when i trigger "INPUT#1" ,dont trigger M115.

Title: Re: start from line #
Post by: BR549 on May 31, 2010, 01:49:26 PM
NO "I " don't
Title: Re: start from line #
Post by: stirling on June 02, 2010, 04:21:06 AM
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.
Title: Re: start from line #
Post by: manmeran on June 02, 2010, 04:27:40 AM
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?
Title: Re: start from line #
Post by: stirling on June 02, 2010, 04:33:43 AM
As far as I know ,1300 ms is for my macro(M115) ,not macropump.
What is calling your M115?
Title: Re: start from line #
Post by: manmeran on June 02, 2010, 04:35:19 AM
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?
Title: Re: start from line #
Post by: stirling on June 02, 2010, 05:18:06 AM
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.

Title: Re: start from line #
Post by: manmeran on June 02, 2010, 05:26:50 AM
Quote
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
Title: Re: start from line #
Post by: stirling on June 02, 2010, 05:38:47 AM
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
Title: Re: start from line #
Post by: manmeran on June 02, 2010, 05:46:44 AM
is it possible guide me more ?
Title: Re: start from line #
Post by: stirling on June 02, 2010, 06:20:59 AM
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.
Title: Re: start from line #
Post by: manmeran on June 02, 2010, 11:09:34 AM
why nobody can not help me ?
This problem is so big?
Title: Re: start from line #
Post by: BR549 on June 02, 2010, 07:16:33 PM
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
Title: Re: start from line #
Post by: stirling on June 03, 2010, 03:36:42 AM
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
Title: Re: start from line #
Post by: BR549 on June 03, 2010, 08:55:04 PM
:-) 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.
Title: Re: start from line #
Post by: BR549 on June 03, 2010, 11:18:23 PM
Amir look in the MACH Macro Programmers Manual, Page 57. That will tell you what you need to know.

Title: Re: start from line #
Post by: manmeran on June 04, 2010, 01:56:20 AM
thx Terry
Title: Re: start from line #
Post by: manmeran on June 05, 2010, 06:54:05 AM
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.
Title: Re: start from line #
Post by: BR549 on June 05, 2010, 02:13:09 PM
IT works just fine here. there is nothing wrong with the process just the application.
Title: Re: start from line #
Post by: manmeran on June 05, 2010, 02:57:24 PM
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
Title: Re: start from line #
Post by: BR549 on June 05, 2010, 04:46:04 PM
I don't know.

 I do not work on code that may endanger the operator or machine
Title: Re: start from line #
Post by: manmeran on June 06, 2010, 01:37:31 AM
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
Title: Re: start from line #
Post by: BR549 on June 06, 2010, 11:25:20 AM
You are going to be waiting for a long time.
Title: Re: start from line #
Post by: manmeran on June 06, 2010, 02:59:00 PM
i solve my problem mmmmmmmmmmmr terry.





""Do not let what you cannot do interfere with what you can do ""
Title: Re: start from line #
Post by: BR549 on June 06, 2010, 03:42:20 PM
I am happy for you.
Title: need help! three function on one button
Post by: kkquek on November 02, 2010, 10:32:28 PM
dear sir ,
how to make a button to "run,pause,continue" on one button(same button)
because my extend keypad only hace 10 button