Hello Guest it is May 22, 2019, 09:28:25 PM

Author Topic: zero an axis before every move  (Read 2516 times)

0 Members and 1 Guest are viewing this topic.

Offline ASC

*
  •  59 59
    • View Profile
    • Automation Systems
zero an axis before every move
« on: August 01, 2010, 03:47:51 PM »
Hey guys, I'm working on a rather unique 5 axis dispensing machine and am still quite new to Mach and VB, so I'm having a difficult time with what is probably a simple problem.  I have a dispenser controlled by my C-axis that is moved in and out of the work area via a linear actuator.  This actuator is moved into place with the M-command M802 (switching output 1).  My goal is to have the C axis reset to zero every time the actuator is activated.  This is to simplify the g-code when programming the dispenser;  Rather than accumulating a larger and larger value each time a small amount of fluid is dispensed, we want to start from zero each time.  Can anyone help me with a VB script or any other approach to make my C axis zero each time I activate M802?

My M802 script currently looks like this:

ActivateSignal(output1)
code("G4 P1")

I just need some help on what lines to add to set the C axis to zero!
Mr. Creosote

Offline BR549

*
  •  6,865 6,865
    • View Profile
Re: zero an axis before every move
« Reply #1 on: August 01, 2010, 03:53:33 PM »
try

Dobutton(13)

Offline ASC

*
  •  59 59
    • View Profile
    • Automation Systems
Re: zero an axis before every move
« Reply #2 on: August 01, 2010, 04:02:18 PM »
And away she goes!  That did it perfectly, thank you! 
Mr. Creosote

Offline Mc2

*
  •  31 31
    • View Profile
Re: zero an axis before every move
« Reply #3 on: August 01, 2010, 05:41:59 PM »
try

Dobutton(13)
Hey guys, I'm working on a rather unique 5 axis dispensing machine and am still quite new to Mach and VB, so I'm having a difficult time with what is probably a simple problem.  I have a dispenser controlled by my C-axis that is moved in and out of the work area via a linear actuator.  This actuator is moved into place with the M-command M802 (switching output 1).  My goal is to have the C axis reset to zero every time the actuator is activated.  This is to simplify the g-code when programming the dispenser;  Rather than accumulating a larger and larger value each time a small amount of fluid is dispensed, we want to start from zero each time.  Can anyone help me with a VB script or any other approach to make my C axis zero each time I activate M802?

My M802 script currently looks like this:

ActivateSignal(output1)
code("G4 P1")

I just need some help on what lines to add to set the C axis to zero!

I would rather keep it simple. You will want to move the C axis incramental. So the g-code would look something like:

G91
C .01 f1.
G90

This way, you could move the actualtor back to the start when you are done. No need to reset zero. The C axis will move the set amount each time not a known postion each time.

Jim.

Offline ASC

*
  •  59 59
    • View Profile
    • Automation Systems
Re: zero an axis before every move
« Reply #4 on: August 02, 2010, 11:56:44 AM »
That would work but I need to have all the other axes moving in absolute coordinates at the same time I'm dispensing.  I'd be worried that the inremental change would cause an absolute headache.
Mr. Creosote

Offline Mc2

*
  •  31 31
    • View Profile
Re: zero an axis before every move
« Reply #5 on: August 02, 2010, 03:01:23 PM »
Oh, I understand. You will want the C axis moving simultaniously with other axis. In this case then I would use a macro varible. I would have to do some testing but it would go something like:

(At start of program)
#500=0.0

(anywhere in program where you wanted the feed move)
#500=[#500+.05]
G1 X1.0 Y1.0 C#500 F1

Anyways, glad you found your answers.
Jim.