Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: riporeno on January 07, 2015, 05:24:12 AM
-
hello everyone
I'm looking for a macro to do the 'homing as in professional machines. (with encoder)
I'll explain ...
the axis moves then when he hears the micro mechanical (input 1) reverses direction until it finds the zero mark on the encoder (imput2)
has anyone ever used this system?
thank you
-
hi riporeno,
as fas i know the CS-Lab controler is the only one witch
can reference on a zero mark of the encoder.
http://www.cs-lab.eu/en/artykul-47-Precise_homing_on_INDEX.html
regards Thomas
-
ok thanks Thomas
I look if I can be helpful
regards
-
Use the standard RefHome feature to find the switch then use a MACRO to inch the drive in the direction of the index mark Use a Do While LOOP to inch the drive untill it sees the index signal.
While Index SIGNAL <> 1
Code"G91"
Code"X.001"
Loop
End
-
hello
This could be interesting.
how do I set it?
I should do the zero standard then call this macro?
I understand that he goes up to the signal received in the input 1?
when it arrives on zero writes dro?
sorry but I have never done anything like this.
if you help me thank you.
-
Hi,
Use the standard RefHome feature to find the switch then use a MACRO to inch the drive in the direction of the index mark Use a Do While LOOP to inch the drive untill it sees the index signal.
While Index SIGNAL <> 1
Code"G91"
Code"X.001"
Loop
End
and you think this macro is fast enough to see a zero mark of a resolver ?
Thomas
-
Within the resolution of the Move value, yes.
(;- TP
-
this would be the procedure that I would do.
move the axis on microswith.
as soon as I see the signal (input1) change the direction and when I find the encoder signal (input2) stops and makes the zero reference
I just understand the procedure for an axis ..then I arrange for others.
thank you
-
hello
I have done the macro to do home with encoder.
Now I should add that I disable instruction limits axes xyz
someone can help me and tell me what the function necessary?
I will not disable the input but the function (axis limits)
thank you
-
hello,
have a look for oembutton(150).
Thomas
-
Why would you want to disable the Limits ?? When Homing Mach3 runs to the Limit / Home switch, trips, stops, then Backs up/off until the switch reopens and then stops.
Then the addition encoder code would move the axis further "AWAY" from the switch which does NOT interfere with the limit function. IF you disabled the limits AND you had an encoder failure it would run away and SLAM hard into the HARD STOPS and could damage the Machine AND you.
Just a thought, (;-) TP
-
hi
oembutton the function (150) does not exclude the limits.
is used to enable the axes to move them after they stopped on the limit.
thanks anyway,
regards
-
"BR549"
hi
I made a macro of home that works this way:
the limit signal axis is traded on the input of Mach3 as reference
with which the machine must reverse the movement until coming out from it and try the zero encoder.
at this point reactivated limits.
I solved the problem by using a relay 'which exchanges the signal only at home,
then returns to its normal state of axis limits.
hello
thank you
-
Mach3 already does that internally when you call the RefHome (G28.1) IF you are using combined switch functions then MACH3 KNOWs how to deal with them. On Homing it deactivates the limit function then reactivates it AFTER the homing Has completed.
Why reinvent the wheel ??
Just a thought, (;-) TP
-
Mach3 off limits if the zero is carried home
on the same input with the same signal
in my case I have to manage two signals because I have an encoder with zero mark that will give me the precision.
this procedure
reach the first sign of the limit that will reverse the movement of the axis.
until coming back will be released from this signal
2) at this point goes up when they hear the signal encoder.
If I used only the encoder signal would not have the reference limit (limit axis)
then the zero signal encoder would be made at the first turn of the screw at any point of the stroke.
I do not know if I explained.
hi
-
Hi,
ok than let's try an other road:
Message ("ref. Z-axis")
DoOemButton(1024) 'Ref Z
Sleep(500)
While GetOemLed(809) = true 'wait normal reference to be finished
Sleep(200)
Wend
Message ("ref. Z-axis to index mark")
'here you can do your reference onto the index signal
Regards Thomas
-
Hi TPS:
"as fas i know the CS-Lab controler is the only one witch
can reference on a zero mark of the encoder."
The dspmc controller by Vital Systems does the machine reference using the Z channel of encoder.
John
-
hello
I solved this way.
the axis moves at high speed until you find the first signal of the limit switch
when found reverses slowing the feed
Now launch the home and tries zero encoder.
works fine.
pulse time 2 ms
mach sees it and I'm doing the tests using a simple interface card with parallel pc.
Sub Main ()
'Dichiaro le variabili per i contatori dei cicli "For...Next"
Dim z,y,x
'Dichiaro le due velocità di spostamento
FeedVeloce = 1000 'Speed approaching ... research first switch.
FeedHoming = 20 'Search speed switches Home
'Imposed on the parameter of the speed of Homing for X, Y, Z
SetParam ("ZRefPer", FeedHoming)
SetParam ("YRefPer", FeedHoming)
SetParam ("XRefPer", FeedHoming)
'Call the subprogram for the Home Z
GoTo HomeZ
HomeZ:
'Z I lift fast for a distance definitely superior to its stroke
Code "G0 Z999999 F" & FeedVeloce
'Start of cycle for the search of the first switch
For z = 1 To 600
'If the first switch is activated ...
If IsActive(INPUT1) Then
'Without approaching fast, wait half a second and I start homing
DoOEMButton(1003)
Sleep 500
DoButton(24)
'I look forward to concluding the homing of Z and call the subroutine for the homing of Y ...
While IsMoving()
Wend
GoTo HomeY
'... Or, if the first switch is off, repeat the cycle "For ... Next"
Else
Sleep 100
End If
Next z
'ripeto per gli assi Y e X
HomeY:
Code "G0 Y-999999 F" & FeedVeloce
For y = 1 To 600
If IsActive(INPUT2) Then
DoOEMButton(1003)
Sleep 500
DoButton(23)
While IsMoving()
Wend
GoTo HomeX
Else
Sleep 500
End If
Next y
HomeX:
Code "G0 X-999999 F" & FeedVeloce
For x = 1 To 600
If IsActive(INPUT3) Then
DoOEMButton(1003)
Sleep 500
DoButton(22)
While IsMoving()
Wend
GoTo Fine
Else
Sleep 100
End If
Next x
Fine:
Code "(Homing eseguito)"
End Sub
-
Hi riporeno,
here my proposal:
Sub Main ()
'Dichiaro le due velocità di spostamento
FeedHoming = 20 'Search speed switches Home
'Imposed on the parameter of the speed of Homing for X, Y, Z
SetParam ("ZRefPer", FeedHoming)
SetParam ("YRefPer", FeedHoming)
SetParam ("XRefPer", FeedHoming)
'Call the subprogram for the Home Z
'Z I lift fast for a distance definitely superior to its stroke
Code "G0 Z999999" 'TPS G0 does allways full speed no feedrate needed
While IsMoving() 'wait for input during move
If IsActive(INPUT1) Then
'Without approaching fast, wait half a second and I start homing
DoOEMButton(1003)
Sleep 500
DoButton(24)
While GetOemLed(809) = true 'TPS wait for Z-Ref finished had a lot trouble using IsMoving()
Sleep(200)
Wend
Wend
'ripeto per gli assi Y e X
Code "G0 Y-999999" 'TPS G0 does allways full speed no feedrate needed
While IsMoving() 'wait for input during move
If IsActive(INPUT2) Then
DoOEMButton(1003)
Sleep 500
DoButton(23)
While GetOemLed(808) = true 'TPS wait for Z-Ref finished had a lot trouble using IsMoving()
Sleep(200)
Wend
Wend
Code "G0 X-999999" 'TPS G0 does allways full speed no feedrate needed
While IsMoving() 'wait for input during move
If IsActive(INPUT3) Then
DoOEMButton(1003)
Sleep 500
DoButton(22)
While GetOemLed(807) = true 'TPS wait for Z-Ref finished had a lot trouble using IsMoving()
Sleep(200)
Wend
Wend
Code "(Homing eseguito)"
End Sub
without GOTO's and some remarks.
Regards Thomas
PS: code is not tested
here http://www.machsupport.com/forum/index.php/topic,27912.0.html
you can read about my homing problems.
-
thank you very much for your cooperation
I'm doing tests these days
how can I disable
the signal of the axis limits with the macro language.?
also you can change the feed value set maximum motor tuning in?
(with macro language)
thank you
regards
-
Hi riporeno
how can I disable
the signal of the axis limits with the macro language.?
not sure why you want to do this, because if limit's and
reference switch are configured for the the same pin,
it's doing reference first.
regarding to your macro, why dont you do a refernce with
high speed (on normal switch), the do a other one with
1/10 of the origin speed ?
also you can change the feed value set maximum motor tuning in?
(with macro language)
just use G1 F*********instead of G0.
Thomas
-
hi TPS
hello
the first fast movement is done in g code faster until the arrival on the micro
then executes the homing to minimum speed (1% of max speed) ..but is still too high.
as you say it would be good.
G1F move ... until it finds the second reference.
How do I say to stop the signal (Home) and then reset the axis and make green LED reset occurred?
All this without calling DoButton (23). 22 etc. etc.
sorry but I can not fill in the macro.
what I wrote is the set of some macro joined together.
would be great.
thank you
greetings
-
Hi reporemo,
is your home switch and your index wired to seperate inputs ?
just an idea:
wire both signals via a relay to the same input
relay off -> normal home switch
relay on -> index
-then do a reference with higher speed to normal switch
-switch relay
-lower reference speed
-do an other reference with slow speed to index
Thomas
-
hi TPS
sorry but I do not understand what you mean
I have two different input
before zeroing I enable a relay that signal out of limits.
arrival on the micro that indicates the first input.
I go back up to find zero index encoder. on the second input.
thank you
regads
-
Having got to the home position how are the machine coordinates zeroed?
I found dooembutton(105) but that does them all. How can one zero X and Y leaving Z unchanged?
-
Hi,
Having got to the home position how are the machine coordinates zeroed?
I found dooembutton(105) but that does them all. How can one zero X and Y leaving Z unchanged?
DoButton( 8 ) -> Zero X
DoButton(9) -> Zero Y
DoButton(10) -> Zero Z
DoButton(22) -> Ref. X
DoButton(23) -> Ref. Y
DoButton(24) -> Ref. Z
Regards Thomas
-
Hi riporeno,
hi TPS
sorry but I do not understand what you mean
I have two different input
before zeroing I enable a relay that signal out of limits.
arrival on the micro that indicates the first input.
I go back up to find zero index encoder. on the second input.
thank you
regads
i mean to wire both signals ,home switch and index signal, via
a relay to one input, witch is the reference input. then you
can use in both times the reference function, and not reacting
to an input in the macro.
VB macros are only updated 1/10s so it is very hard to see this index
signal. homing function is updated in a higher priority.
Thomas
-
hi Thomas ..
ok I understand.
however, as I said above with home I can see the index of zero encoder.
Use a simple photocoupler.
The percentage of feed in the parameters is set 1%
my max speed is 5000 mm / m 'so it would be 50mm / m'.
I intend to bring the feed to 10000mm / m '.
in this case the feed would be 100mm / m 'then too high.
why was wondering if it was possible to set the speed with a macro.
If you say you have a Vb macro slow reading of the signal I'll try to find a hardware solution that manages the signal input ..in order to prolong the time of the signal.
thanks for your cooperation
-
Hi riporeno,
why was wondering if it was possible to set the speed with a macro.
Get/SetParam()
"VelocitiesX" = X MaxVel from motor tuning page (SetParam as units/second. Mach will multiply X60 for display in motor tuning as units/minute.)
"VelocitiesY"= Y MaxVel from motor tuning page (SetParam as units/second. Mach will multiply X60 for display in motor tuning as units/minute.)
"VelocitiesZ" = Z MaxVel from motor tuning page (SetParam as units/second. Mach will multiply X60 for display in motor tuning as units/minute.)
is that what you are looking for ?
Thomas
-
hi thomas
perfect .. that's what I was looking for.
now I'm off to work.
Tomorrow when I try to write this code in the macro.
then I'll let you know if I can.
thanks again for the help.
regards
moreno
-
h iTthomas
I tried to enter the values it says syntax error
you can give me an example how to insert the number? example 166 ...
Get/SetParam()
"VelocitiesX" = X MaxVel from motor tuning page
thanks regards
-
Hi,
for Example
Sub main()
SetParam("VelocitiesX",66.66) 'Value in units/sec
msgbox GetParam("VelocitiesX")
End Sub
Thomas
-
hi Thomas
everything works perfectly.
I thank you very much for helping me.
congratulations, you are very smart.
Now I write all the code for the three axes.
regards
moreno
-
hi
I implemented the macro cycle reset.
It works very well.
I put a relay 'which disables the signal of the limits and diverts the signal on another input so that when you open the swith, the axis back and look for the zero index.
To avoid putting the relay could compile a command to disable the limits?
then I enable them to macro
in this way would avoid using an output.
thank you
regards
moreno
https://www.youtube.com/watch?v=J_UZcuZjX68