Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 28, 2012, 01:09:24 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
General Mach Discussion
Lathe Turret Macro
Pages:
1
2
3
»
Go Down
« previous
next »
Author
Topic: Lathe Turret Macro (Read 807 times)
0 Members and 1 Guest are viewing this topic.
GytarrMann19
Active Member
Offline
Posts: 65
Lathe Turret Macro
«
on:
August 18, 2011, 09:29:00 PM »
Hello all,
This is the Macro I shamelessly stole from Hood in another post. It works, but only in one direction. I.E., I can index from position 1 to position 2, etc., but If i try to go from 1 to 8, I get a message saying "limit switch triggered." If I go into the homing config menu and reverse the direction, it works in the new direction, but not in the previous. I hope that makes sense. The machine is a mid 80s CHNC with 8 position turret. I removed the original air motor and replaced with a stepper running as the A axis. The stepper indexes ok, and the macro raises and lowers the turret correctly. Jut won't let me go in both directions. Additionally, I have a switch to sense turret up/down position. I'd like to add something to the code to ensure the stepper doesn't run until Mach knows the turret is up for sure. Any ideas?
Next issue: I have a home switch for the turret. How do I get Mach to home it from the basic lathe screen. Can I add a "home turret" button in with the home x and z buttons?
I really appreciate the help from the forum. This is my first experience with Mach. I currently have my X and Z axes moving nicely with servos and Granite drives, the spindle runs via VFD and AC induction motor, and the coolant pump, air collet closer and part chute are working nicely as well. All via SmoothStepper and C23 BOB. The turret is my last big challenge.
Thanks,
Kevin
Here is the Macro I'm using:
If GetSelectedTool() = GetCurrentTool() Then
End
End If
Code "G53 G0 Z-1"
While IsMoving()
Wend
If GetSelectedTool = 1 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A0"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 2 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A45"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 3 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A90"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 4 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A135"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 5 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A180"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 6 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A225"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 7 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A270"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 8 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A315"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
Logged
Hood
Active Member
Offline
Posts: 17,366
Carnoustie, Scotland
Re: Lathe Turret Macro
«
Reply #1 on:
August 19, 2011, 01:48:59 AM »
Sounds like you either are sharing the same pin number of the turrets home switch with the limits or that you have set the home switch for A to also be a limit for A.
Regarding the Homing, if you open the screen in Screen4 (or other screen editor programme) you could change the Home All button to a VB button. Save the screenset with a different name (so it wont get overwritten if you upgrade) then from View menu in Mach load the renamed screen. Then when in Mach operator menu then Edit VB Buttons, Home All should be flashing, click on it and put this in
DoButton( 24 )
DoButton( 22 )
DoButton( 25 )
That will home Z then X then A, if you want a different order then just switch them around.
What input are you using to monitor the Up/Down of the turret?
Hood
Logged
GytarrMann19
Active Member
Offline
Posts: 65
Re: Lathe Turret Macro
«
Reply #2 on:
August 19, 2011, 12:34:17 PM »
Neither of the conditions you mention with home switches is true, and today it seems to be working fine. I would like however for the turret to always rotate in the same direction, on account of the backlash in the gear train. I tried applying backlash compensation to the A axis but it doesn't appear to do anything. I'm going to try playing with the screen editor this afternoon. I'm sure I'll have questions. For turret up/down, I'm using input 1, active when the turret is up.
Thanks again!
Kevin
Logged
GytarrMann19
Active Member
Offline
Posts: 65
Re: Lathe Turret Macro
«
Reply #3 on:
August 19, 2011, 04:19:59 PM »
So I got my hands on Mach3Screen, and used it to add the homing capabilities. One trouble- i need to be able to raise the turret when homing it. How do I accomplish this?
Kevin
Logged
Hood
Active Member
Offline
Posts: 17,366
Carnoustie, Scotland
Re: Lathe Turret Macro
«
Reply #4 on:
August 19, 2011, 04:50:07 PM »
Ok to rotate only one way you should have the option on general config called "Ang short rot on G0" disabled.
To raise the turret whilst homing you would need to add some VB to the homing button you made, I presume you have DoButton(25) in it at the moment?
You would need to have something like
ActivateSignal(OutPut7)
DoButton(24)
DeActivateSignal(OutPut7)
For your toolchange to wait on the input this may work
If GetSelectedTool = 1 Then
Do
ActivateSignal(OutPut7)
If IsActive(Input1) Then Exit Do
Loop
Code "G53 G0 A0"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
You will need to alter the rest of the tool calls to similar to the one above.
Hood
Logged
Hood
Active Member
Offline
Posts: 17,366
Carnoustie, Scotland
Re: Lathe Turret Macro
«
Reply #5 on:
August 19, 2011, 07:31:10 PM »
Just tested the VB out and it seems to work fine but would grab a lot of CPU if the turret didnt lift for some reason so put a sleep 10 in (like example below) and that should sort things.
If GetSelectedTool = 1 Then
Do
ActivateSignal(OutPut7)
If IsActive(Input1) Then Exit Do
Sleep 10
Loop
Code "G53 G0 A0"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
Logged
GytarrMann19
Active Member
Offline
Posts: 65
Re: Lathe Turret Macro
«
Reply #6 on:
August 20, 2011, 04:33:36 PM »
"Ang short rot on G0" is disabled, but the turret still rotates both ways. On the VB code for homing, what can I add to make the script wait for the DoButton(25) to complete before the turret lowers? I have it set up now with just a sleep, but it would be neater if it waited for the code rather than just an arbitrary length of time. Again, thanks for the help. This is turning out to be a lot easier than I thought it would.
Kevin
Logged
Hood
Active Member
Offline
Posts: 17,366
Carnoustie, Scotland
Re: Lathe Turret Macro
«
Reply #7 on:
August 20, 2011, 04:37:52 PM »
I thought that would have stopped rotation both ways as I was thinking to go the opposite way you would need a negative move, however it may be because the macro is using G53. Will have to test out later.
While IsMoving()
Wend
After the DoButton should make it wait.
Hood
Logged
Hood
Active Member
Offline
Posts: 17,366
Carnoustie, Scotland
Re: Lathe Turret Macro
«
Reply #8 on:
August 20, 2011, 07:25:04 PM »
Just tried here and the A will only move one way with a positive value commanded. Only thing I can think of is you possibly dont have the A set as a rotational axis. If thats not it can you attach your xml and I will have a look and see if I can find the issue.
Hood
Logged
GytarrMann19
Active Member
Offline
Posts: 65
Re: Lathe Turret Macro
«
Reply #9 on:
December 16, 2011, 04:19:35 PM »
Well this is a late reply! The shop got so busy over the summer I haven't had a chance to touch this machine till now. The turret is reassembled, homes correctly, and indexes correctly over and over in one direction. Again, it does not work right at all in the other direction due to the backlash issue. The A axis is set as rotational, and "Ang short rot on G0" is unchecked.
Does the backlash compensation feature not work? Or just not with this application?
Thanks again,
Kevin
Logged
Pages:
1
2
3
»
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...