Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: Davek0974 on July 23, 2016, 08:08:28 AM
-
Hi all
I'm in the last stages of my Bridgeport conversion but i think something is backwards?
Todays task was hooking up the z axis at last - the final step. I have motion from my CSMIO/IP-A and have done a basic pid tuning on the servo drive.
Limits are working and homing does too.
What i need to know is :- Z++ is at the highest point and all cuts are taken in the negative direction so a 1mm depth of cut will be -1mm yes???
At present the DRO on this axis is backwards - it reads lower as the axis rises.
How do i reverse the Z axis on this setup???
-
Config, Homing and Limits, Reversed option.
Hood
-
Got it, thanks, all going the right way now ;)
Got limits, homing, home offset, safe-z all going now.
Tool-change - have put the original M6 macros back as i don't want to do auto-probing for the Z after a change.
Load some simple code with 2 tool changes in it, run code it says Press cycle start after etc as normal, NOW, at this point I presumed i could jog the bed away to gain room to get the tool in/out??
If i move the bed at all during the M6 as soon as i press cycle start i get the damned ePid fault and Mach goes into reset????
If i just press cycle start on the M6 it works fine.
Anyone have any ideas here - it clearly won't work if i cant jog to get the tool in. :)
-
Never done the Stop Spindle option with IP-A so not sure if it is that or Mach that is your issue.
One thing it may be with the stop spindle option is, the M6End is used with that option, so edit out all the crap in it and see if it helps.
Failing that you could possibly use the auto change option and have something like the following in the M6Start
Code "M5"
Code "G53 G0 Z-5"
While IsMoving()
Wend
Hood
-
Hmm, this is whats currently in M6end...
REM The default script here moves the tool back to m6start if any movement has occured during the tool change..
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
if(IsSafeZ() = 1) Then
SafeZ = GetSafeZ()
if SafeZ > z then StraightTraverse x, y,SafeZ, a, b, c
StraightFeed x, y, z , a, b, c
else
Code"G00 X" & x & "Y" & y
end if
Not clear what all that does, this is all thats in M6Start..
tool = GetSelectedTool()
SetCurrentTool( tool )
No position stuff ???
-
It is meant to put the axis back to where it was after a toolchange and jog I think, not sure if it ever worked correctly and often caused issues for people so I usually suggest you comment it all out or delete if you wish.
Hood
-
Well, still getting nowhere :)
I tried empty M6 macros and no you cant jog once in the M6 routine or it just ePid's out every time, if you do nothing and just press start it works fine.
I then tried cutting up the 2010 macros - removed all the probing stuff, also took out the clearance plane stuff as all i want is to go to Z0 or Z-2 move the Y axis to zero and await a tool change, then go back to where it was and carry on.
Pulled it all apart, saved it and now it goes into tool change but then mach goes into reset on Limit Switch Triggered message although there is no movement!
Will go back and play some more but what does everyone else do when wanting a manual tool change and has a CSMIO fitted?
-
Did you try like I suggested and use the Auto toolchange option and alter the M6start macro to do your move, stop spindle etc and wait for Start button?
Hood
-
Yes, it does not seem to like jogging in the loop?
I have sorted something out though - the reset issue was me being stupidly clever or cleverly stupid ;)
When i ripped the macro apart, i thought i would be smart and re-use the Clearance Plane DRO var as my Z tool change position :)
The mistake was that the clearance plane DRO had +2mm in it and it had to be -2mm to work - the limit switch hit error was Mach being smart i guess and hitting a fake limits switch as it couldn't move to Z2 as all Z moves are negative :)
A short video of 3-axis tests and manual tool change.
https://youtu.be/mJUxtS997MQ
-
The only time I used Stop/Wait for toolchanges was with the wee lathe and afraid I never jogged as I commanded a move to the toolchange position prior to the tool call, as you do normally with a lathe.
Hood
-
Maybe it really just does not like being jogged??
I've never tried it on the mini-mill, it goes to tool-change position in code.
Still, its doing something usable now, thats the main thing i guess :)
-
Wonder if using auto change option, doing the spindle stop and have the setcurrenttool() stuff in there and then lastly have a M0, would work.
You could then just start the spindle (normally it would be in code anyway at a toolchange) then press start.
You could also write in the macro that if the current tool is same as selected tool then to end the macro before you do the above stuff.
Hood
-
Hmm, will play with this when i get it all going fully, will have a better idea of whats needed then.
It does ignore the M6 if the current tool is the same as that requested.
-
Try putting nothing in the M6Start Macro. It will still pause if you have that option set in the General Config screen. Then see if you still get the error after jogging. If not, then there's definitely something in the macro that's doing it. Otherwise, it may be a bug in the software. I'm trying to remember if I have done any jogging in the M6 state as I have everything automated to go to a safe tool change location and then probe after acknowledging that is complete. Then press cycle start and the spindle moves back to it's original location and continues on with the program.
Let us know if that changes anything.
Stephen "Highspeed" Kruse
-
Thanks, will have a look.
I want the ability to use the tool length offset table for most stuff but also have manual height probing with a touch-plate for some tasks.
R8 tooling is quite long so the table needs to get out of the way to change it, thats the plan anyway ;)
-
Understand that, Dave. I like having it that way too. I've set up an M6Start macro that positions the spindle to a user defined location using the "Tool Change Location" DROs in the settings page and then prompts for the tool to be changed. It waits for the tool to be changed and acknowledged then asks for an auto tool zero (with OK or Cancel buttons) and if auto is selected it moves to the Z location specified as above (the tool change is done at SafeZ if defined or 0 if not) and begins the probe move. Cancel lets you do it manually. Then press "Cycle Start" to run the M6End macro which positions the tool at the location it was when the M6 command was triggered in the program and continues on.
My advice to use a "do nothing" M6 macro is for troubleshooting to determine if it's a macro problem or a bug in the program. I'll have another look at mine to see if jogging causes problems in the manual operation of the macro.
Stephen "Highspeed" Kruse
EDIT: Reading through this post again, I just noticed that you did try blank macros already. I'll have a go at it later today and see how it works out for me. What components are you using for your electronics? (Breakout board, motion controller, stepper drivers, etc.)
-
One additional question or two, are you using Mach 3 or 4 and what screen set are you using? I'm using Mach 3 and the original 1024 screen set modified to clean it up a bit and added a set of LEDs on the Run Program screen to monitor the probe signal.
Highspeed
-
High,
I'm using Mach3 with the 2010 screen, a CSMIO/IP-A controller and AC servo's for drive.
The whole tool-change thing gets a bit messy it seems, I want to use toolholders so i can use the tool length table and only zero once but some jobs would need a special tool maybe and that would need manually zeroing?
I have no real CNC experience here so learning all the way.
One suggestion has been to not use the table but output each tool as a separate file and do a manual zero touch at the beginning before running the code.
I also have speed control issues where i am using a VFD as well as the mechanical control on the mill to give me full range AND power/torque. I have the system tell me to set the speed at high or low and back-gear or not BUT it does this after the code runs and gets the S command - the thing is it just runs the code with the message on screen and thus i have no chance to change the settings. This really needs sorting out as it limits what can be done in a code sequence.
-
If you were to use a tool range for special tools that need manual zeroing, say tool 50 upwards, then you can test for that in your M6 script, and handle them differently.
As for the spindle speed, I think you're probably going to need to use some non-standard coding in your g-code files.
Does your current M6 S/speed change script have anything in it to activate a feedhold while the speed is being changed?
-
If you were to use a tool range for special tools that need manual zeroing, say tool 50 upwards, then you can test for that in your M6 script, and handle them differently.
That sounds interesting but will need to learn some more macro stuff i think.
As for the spindle speed, I think you're probably going to need to use some non-standard coding in your g-code files.
Does your current M6 script have anything in it to activate a feedhold while the speed is being changed?
Pretty certain there is no feed-hold stuff in the M6 macros at present, Ideally it would advise of the speed change before starting the spindle as it has to be stopped when going into or out of back-gear, but not when going from high speed to low speed where it must be running :)
-
You obviously quoted me before my sly edit. It's the S/Speedchange macro you need to edit, not the M6 for the spindle speed.
You'd need to check in what order the scripts get run, especially if both M3 and S are on the same line.
As long as they don't both get called simultaneously, you could essentially have identical code in both to test for the correct gear, so even if the M3 gets called before the speed change, the M3 macro will of already done the gear checking, so by the time the spindle speed macro is called, it just checks for the correct gear and then sets the VFD as required.
Then on just a speed change, the spindle speed macro will handle the gear change.
-
Yeah, i tried messing with the M3 way back but it does not read the speed correctly and does very odd things, cant recall exactly what happened now but its all in my main conversion thread, it didn't work anyway which is what lead me to the spindlespeed macro which worked better but I still have this issue where it says do this or that but does not give you a chance to actually do it :)
-
This is my current spindle speed.m1s code, so far it warns me to either change the mechanical speed dial (this must be done with spindle running) OR change back-gear (must be done with spindle off) and speed dial as well.
It needs to somehow tell Mach to not process G-code as well as stop the spindle at certain combinations of speed/pulley. I guess a manual spindle start is ok.
Can this be done, I'm beginning to think i should have just used the cash and fitted a servo spindle :(
rpm = GetRPM()
pulley = GetOEMDRO(56)
Select Case rpm
case 0 To 126
If pulley <> 1 then
Call SetOEMDRO(56,1)
if pulley = 2 then
MachMsg ("Change Speed Dial To 700rpm","Wrong Speed Range",0)
else
MachMsg ("Change Back-Gear To Low Range And 700rpm","Wrong Speed Range",0)
end if
End If
Case 127 To 366
If pulley <> 2 Then
Call SetOEMDRO(56,2)
if pulley = 1 then
MachMsg ("Change Speed Dial To 2200rpm","Wrong Speed Range",0)
else
MachMsg ("Change Back-Gear To Low Range And 2200rpm","Wrong Speed Range",0)
end if
End If
Case 367 To 1031
If pulley <> 3 Then
Call SetOEMDRO(56,3)
if pulley = 4 Then
MachMsg ("Change Speed Dial To 700rpm","Wrong Speed Range",0)
else
MachMsg ("Change Back-Gear To High Range And 700rpm","Wrong Speed Range",0)
end if
End If
Case 1032 To 3000
If pulley <> 4 Then
Call SetOEMDRO(56,4)
if pulley = 3 Then
MachMsg ("Change Speed Dial To 2200rpm","Wrong Speed Range",0)
else
MachMsg ("Change Back-Gear To High Range And 2200rpm","Wrong Speed Range",0)
end if
End If
Case 3001 To 99999
Call SetOEMDRO(56,4)
MachMsg ("Speed Limited By Machine, Check Code, Change Back-Gear To High Range And 2200rpm","Wrong Speed Range",0)
End Select
SetSpinSpeed( rpm )
-
The problem with your current code, is there is nothing to stop motion. It simply displays whatever message, then continues on it's way.
Within the If Else statements, you'll need to call a feedhold prior to displaying the message, so that motion is physically stopped. Once you get that working, you could then expand it to stop the spindle if needed, and then restart in whatever direction you need.
What I'd suggest before you try editing/adding to the code, is create a flow chart of the process, so that you know exactly what the process is, before you start coding anything. That way you're simply converting from flow chart to code, and not trying to figure out the process at the same time as trying to code it.
-
Ok, thanks
so it sounds like it will be possible to do what i want, what is the correct way to code a feed-hold in a macro?
Would it be just DoOEMButton (1001)
with maybe Code "M05" to stop the spindle ?
Flowchart sounds good, but i do have a pretty good idea of what is needed anyway, just unsure how to achieve it :)
-
I usually use msgbox"" for this so that you know what is going on and have to respond and then have the macro do a stop and exit, here is a snippet from the toolchange macro I just did for a friends lathe.
If AxisPosition = TurretAngle Then 'Check that the A Axis DRO is the same as the Turret Angle derived from Prox's
Message "Toolchange Complete" ' If it is then show message in ticker saying toolchange complete
Else
MsgBox"Toolchange Failed!! Programme stopped!!" 'If it is not then pop up message warning
DoOemButton(1003) 'Press Stop button
End If
Hood
-
That snippet was right at the end of the macro so it would exit anyway but if it was earlier then you would have to have an End before the End If so that it exits the macro right away.
Snippet from earlier in the same macro.
If XHomed = True or ZHomed = True Then 'Check to see if X and Z are NOT homed
MsgBox " Please home axes before tool call" 'Message to say not homed
DoOemButton(1003) 'Stop Code
End 'Exit macro
End If
-
Ok, my manual does not list the msgbox function, what is the difference between msgbox and machmsg ?? They both seem to display message boxes.
;)
-
Not a clue, never used MachMsg.
Hood
-
Hmm, ok, maybe need a newer macro manual. Msgbox is a visual basic style call.
Will have a play when i get the encoders wired properly.
-
OK, this works better in simulation on my laptop at least.
rpm = GetRPM() 'requested RPM
pulley = GetOEMDRO(56) 'current pulley
Select Case rpm
case 0 To 126
If pulley <> 1 then
DoOemButton (1001) 'feed-hold
Call SetOEMDRO(56,1) 'set the new pulley
if pulley = 2 then
Msgbox "Change Speed Dial To 700rpm"
else
Code "M05"
Msgbox "Change Back-Gear To Low Range And 700rpm"
end if
End If
Case 127 To 366
If pulley <> 2 Then
DoOemButton (1001) 'feed-hold
Call SetOEMDRO(56,2)
if pulley = 1 then
Msgbox "Change Speed Dial To 2200rpm"
else
Code "M05"
Msgbox "Change Back-Gear To Low Range And 2200rpm"
end if
End If
Case 367 To 1031
If pulley <> 3 Then
DoOemButton (1001) 'feed-hold
Call SetOEMDRO(56,3)
if pulley = 4 Then
Msgbox "Change Speed Dial To 700rpm"
else
Code "M05"
Msgbox "Change Back-Gear To High Range And 700rpm"
end if
End If
Case 1032 To 3000
If pulley <> 4 Then
DoOemButton (1001) 'feed-hold
Call SetOEMDRO(56,4)
if pulley = 3 Then
Msgbox "Change Speed Dial To 2200rpm"
else
Code "M05"
Msgbox "Change Back-Gear To High Range And 2200rpm"
end if
End If
Case 3001 To 99999
DoOemButton (1003) 'stop
Msgbox "Speed Requested Out Of Machine Range, Code Stopped"
End Select
SetSpinSpeed( rpm )
Now, is the msgbox function modal - does it suspend code until acknowledged as i would want to put an M03 after the message in some cases but this will only work if the message halts further code.
Also, something is upsetting the "Spindle Override" DRO for some reason - this makes a real mess of speeds as the code sets one speed but S/O changes it to something else !!
Any ideas of do i have to add a spindle override reset call as well??
-
Mach wont run the G Code whilst a macro is running (excepting the macropump) so with a message box Mach will sit there waiting for the OK to be clicked.
Hood
-
Ah, so i don't really need the feedhold lines?
How about the odd behaviour with the spindle override DRO ? Something is upsetting it, its in this macro and does it in both the 2010 set plus the std 1024 set.
-
Dont see anything in the macro for spindle override so not sure what is going on.
Do you have an override pot on your panel/pendant?
How have you got the plugin options set for spindle override?
Hood
-
Oh and that is correct, no need for feedhold it just wanting it to wait until you ok the message box.
Hood
-
Dont see anything in the macro for spindle override so not sure what is going on.
Do you have an override pot on your panel/pendant?
How have you got the plugin options set for spindle override?
Hood
At present this is on my laptop so no machine or controller at all, no pot etc.
Maybe that is the issue, will have to test it on the mill.
-
Oh and that is correct, no need for feedhold it just wanting it to wait until you ok the message box.
Hood
I guess I will need to add in a [ Code "M03" ] line wherever I stopped the spindle else it will zoom off after ok'ing the message without the spindle running ?
-
Yes, wouldn't do any favours to your cutters if you didn't :D
Hood
-
Ok, played with the code tonight - it's really not that bad, simple, clear instruction and does what it needs.
The only bug seems to be that it messes up the spindle speed override for some reason - this would really mess things up so i need to get it sorted.
No idea where to start on this one though
-
I am not sure why you get that problem as I don't see anything in the macro that could possibly do it. Could there be something in the M3 macro that is doing it or could you have a brain or macropump or something else looking at the I/O and messing with the Spindle Override?
Hood
-
Thats the odd part - there is nothing i can find that touches that DRO so it must be an internal thing linked to pulley numbers or something.
Is there an OEMbutton code for the spindle speed override button - maybe easier to just tack that on at the end??
-
DoOemButton(183)
I seem to recall however that years ago I had issues using that button in a macro on the Beaver mill and ended up writing to the DRO itself, so if there are problems you could try.
SetOemDRO(74,100)
If however you have a pot and have the IP-A set to control the override itself rather than allowing Mach to, then likely it will force it to 100% anyway.
Hood
-
yes i too tried button 183 and it was not happy.
I will have a pot on the CSMIO so maybe that will fix it as you say, writing to the DRO could be useful too if not.
Thanks
-
Sorted :)
With the help of a much admired friend ;) I now have it working properly.
You have to have two pulleys only,
1= 1 to 3000 rpm reversed
2 = 1 to 3000rpm normal
Using my modified macro attached to instruct which mechanical setting to use, there is now no funky spindle speed override display :)
-
Ignore the last post, it worked on the simulation but not in reality as the PWM was totally freaked out!
I have gone back to my code with the screwy SSO DRO stuff, i also fitted the SSO pot so the CSMIO had control - it certainly fixes the weird SSO behaviour BUT the range of the override pot is very limited and dependant on the pulley setting - very complex relationship between pulleys, wpm and SSO pot i think.
Still it all seems to play together now, pretty smoothly.