Hello Guest it is March 28, 2024, 10:25:37 AM

Author Topic: Need help with Macro A-axis.  (Read 3137 times)

0 Members and 1 Guest are viewing this topic.

Need help with Macro A-axis.
« on: March 04, 2011, 08:38:27 AM »
I am wrestling with the VB language to make a macro for turning a stepper on the A-axis.
Complete newbie to Visual Basic.

There is an optical sensor on the tool changer axis, one pulse per revolution.
I want first to home the tools to this optical pulse.

This is what I have;

'M6start.own 
'Input is an optical sensor for homing the ATC. 
'Get OEMLED ATC-Home. Check if ATC opto is lit.
'One pulse as a home reference generated by Emco5cnc ATC.   

While GetOEMLED(821) = False    
Call Rotate_1
Wend 

Private Sub Rotate_1()
Code "G91"
Code "G00 A259" 
GetOEMLED(821) 
Code "G00 A-10"
Code "G90" 

End Sub 

any ideas please.

Jos

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Need help with Macro A-axis.
« Reply #1 on: March 07, 2011, 08:06:58 AM »
ah, ok....... 

I am ASSUMING..... that you want to "Home" the A ONCE per user session? It would be best to use Machs Native homing routines.
in which case you don't need any macro, just pipe your home switch to mach3.

on the other hand, if your doing this for each time you call the "A" axis before going to find the tool, you can again use a Hybrid version of the Homing routine.
Note you will need to bring in the homing input inside of Ports and Pins and set it's port and pin number to be your A axis home.

'M6Start.m1s

DoOEMButton(1025)   'This will Re-Ref (or Ref), you A axis only.
Code "G1 A-10 F6"      'If you need to move some distance, after your homing to "line up" your first slot, then put in then change this amount to what you need.
While IsMoving()         'Old school wait till it finishes moving.
Wend
DoOEMButton(1011)   'If you want to "Zero" your A axis at the main tool slot, so that from this point on, you can have your the rest of your ATC code move to
                                'tool slots based on Tool Slot 1, being your A=0 degrees.

'The rest of your ATC code for moving to new positions here.

'scott



fun times
Re: Need help with Macro A-axis.
« Reply #2 on: March 07, 2011, 10:40:10 AM »
Thanks Scott,

I will give it a try.

What I wanted to do is first of all Home the A-axis (ATC optical pulse)
 then on call from the G-code , M6 T0404 for instance, select the tool called for.

I run into different problems;

A-axis is Angular > set
Rot 360 rollover > set
A Home input 13 low active.

After homing I want to turn the A-axis 60 degrees ( 6 tool positions)

The ATC turns alright but sometimes CW and sometimes CCW.
Sometimes 60 degrees but mostly turns a few times around.

Even the VB script editor plays up, stepping through a macro if OK, running it gives some errors even to the point that the system hangs up.

It is hard to get control,

thanks,

Jos

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Need help with Macro A-axis.
« Reply #3 on: March 09, 2011, 08:40:40 AM »
Here look at this Rotary ATC example code I posted a while back, it can help you get started...

http://www.machsupport.com/forum/index.php/topic,4191.0.html

scott
fun times