I want to check which tool is in the spindle.
I know parameter N0128 is the tool in spindle.
how do I reference that in a macro?
I want to check which tool is in the spindle.
I know parameter N0128 is the tool in spindle.
how do I reference that in a macro?
what cnc type ?
Fanuc 0m-a
Hi,
changing the pmc to reflect the value is not a practical option in this case , so tracking with macro variables in the toolchange program seems to be the only possibility.
cheers
my tool change macro is hidden/stored in eprom. I can't change or view it.
I have read, G10 L50 can write to the parameters, but the program's I have seen only ever write not read the parameter.
so there is no way of reading the parameter directly?
Hi,
1. G10 is a write-only instruction.
2. there is 1 method to have cnc/pmc data avaliable inside a cnc program, and that is via macro variables.
there are 2 basic type of variable's; system variable's and user variables avaliable.
a. some system variable's:
i.e.(#4001 - #4120), #4120 = last t-code instruction. these are read-only and as they represent modal info.
because they are not visible, to know their value you need to copy them to visible varaibles, i.e. #100=#4120.
b. user variables: (#1> #999)
user assigned in the program or on the screen.
in special cases for custom applications, these # can be written to from the pmc, when the pmc/cnc parameters values is needed for decision making.
this modification is not very practical in this old systems, due to avaliability of old software for editing.(eeprom needs to be copied> modified>burned)
3. i would suggest to use #4120 as this is avaliable, test by compair to prm 128 status to see if the status changed together.
have fun.
#4120 is the easiest way to do that, but doesn't represent the tool in spindle, but as it was mentioned, the last T word called. If you have an umbrella type ATC, #4120 should represent tool in spindle, but with a swing arm random type tool changer, next tool is called before tool change, so #4120 won't represent tool in spindle. Parameter 10.4 enable/disable 9000's program, where macro is usually stored. Look at parameter 230 to 239, if one of them is set to 6, it means that you have a tool change macro that can be edited. Not all machine tool have a tool change macro, sometime all the tool change is done by the pmc. In that case, editing is much more complex. You can read any parameter in macro, but this involve ladder editing, witch is not a simple process. If you find that you have a tool change macro, probably that the tool in the spindle is passed to this macro via #1032(this variable allow the pmc to send a 16 bit signal to macro). Keep us informed
Sam
thanks for the further explanation. I'll give that a try.
thanks for the assistance.
thanks for the info. I thought #4120 may work like that. luckily I can't call the next tool so it will be the tool in spindle.
I'll have another look for a tool-change program. I have unlocked the 9000's before but I couldn't find anything. I don't have parameters 230 to 239 so it would suggest the tool change is in the pmc.
cheers
As already mentioned, using System Variable #4120 is not reliable, particularly if the Tool Change mechanism is via a Tool Change Arm and not an Umbrella type. If the machine uses a Tool Change Macro, you can modify the Macro to store the tool number changed into the spindle in a non-volatile variable (=>500). Determine a non-volatile variable not being used by any other Macro Program and add the following block in the Tool Change Macro program after the code that actually executes the Tool Change. For the example, #530 has been determined as not being used by any other Macro Program.
#530=#4120
By including the above code, the last tool moved into the spindle will be recorded in non-volatile variable #530, and will be retained in that variable even when power is removed from the control. If you then need to get the spindle tool number, you can do so by reading the value stored in variable #530, or whichever variable is used in the Tool Change Macro. The only time this system will get out of kilter is if a Manual Tool Change is executed, but will be put back into synch when the next tool change under MDI or Program Command is made.
If no Tool Change Macro exists, you can create your own for the purpose of storing the spindle tool number.
Regards,
Bill
I tried a simple macro.
G65 H01 P#500 Q#4120 and got alarm 115: A value not defined as a variable number is designated.
I thought it may be because I hadn't performed a tool change from powering on. I did a midi tool change via tool change button. but it still had no effect.
I didn't realize the Macro Version of your control was Macro A. Check via the Macro Variable Page that Variable #500 exists; its should. There are no Local Variables in the Macro A system, but the two types of Common Variables should exist. Try the same command using #100 to see if you get the same error. System Variable #4120 is one that should exist with your control.
What code for your machine actually launches a tool change, "T" or "M". Machines that have an umbrella type Tool Changer often just use a "T" code and don't use M06. Find out which address launches the Tool Change, and after resolving the issue with the alarm 115, you can create a User Macro program that is called by the same code as launches the Tool Change. Inside this Macro program you record the Tool Number and execute the code again that launches the Tool Change. Lets say that M06 executes the Tool change. You would register the numeral 6 in one of the parameter numbers 0240 to 0242, to call program numbers O9001 to O9003 respectively. If the Tool Change is launched with a "T" code, you would set bit 5 of parameter 0040 to 1, and create your Macro Program in O9000. If the program is called by a "T" code, and you create the program in program O9000 after setting bit 0040.5, you can get the Tool Number from Macro Variable #149 as follows:
G65 H01 P#500 Q#149
Macro Variable #149 will only be set to the Tool Number if bit 0040.5 is set, and after a "T" code is executed
The above instruction is based on the Tool Change being completed by the PMC program.
Regards,
Bill
thanks for the info.
my machine uses Txx and M06 for the tool change.
the variables #500 and #100 exist but it doesn't like the #4120 or #149.
I have set P10.4=0 and I can't see any O9xxx programs in the program directory screen.
I set P40.5=1 and the machine still performs a tool change but the macro G65 H01 P#110 Q#149 still gives a 115 error.
I don't have parameters 240-242. my 200 parameters stop @ 219. which sucks because I have read your advice in other threads about calling macros from M codes and it seems my machine doesn't have this feature enabled. it is strange because while I don't have the parameter to set the M code for rigid tapping my machine likes M29.
It looks like I'll just have to work round this tool in spindle issue. all I wanted to do was at the start of my programs check if the tool was in the spindle and if it was, ignore the tool change command. my tool change program isn't smart enough for this and if I call a tool change it is performed even if the tool is in the spindle.
I have a tool change macro I found on a forum. I'm not sure if this is a copy from a machine or just written for one. I have copied it below for reference. it is a O9xxx program but since I don't have parameters 240-242 it isn't much use. I have tried all the #4000'd parameters listed but they all error out with 115.
Fanuc tape drill tool change.
:9001
G80G40
G65H81P25Q#1013R1
G65H81P25Q#1008R1
G65H01P#132Q#4014
G65H01P#131Q#4003
G65H01P#130Q#4006
M66G91G30Z0
G65H12P#1132Q#1132R4096
G65H11P#1132Q#1132R1024
G04P100
G65H12P#148Q#1032R255
G04P100
G65H12P#1132Q#1132R4096
G65H11P#1132Q#1132R2048
G04P100
G65H12P#531Q#1032R255
G04P100
G65H12P#1132Q#1132R4096
G65H01P#1115Q1
G04P100
G65H12P#149Q#1032R255
G65H81P20Q#531R#149
G65H81P1Q#148R#149
G04P100
M42
N1G65H81P5Q#1011R1
G65H80P1
N5G65H86P10Q#531R18
G#132
G#131
G#130
G65H99P1
N10G65H83P15Q#531R0
G#131
G#130
G65H99P2
N15G65H01P#1112Q1
G65H11P#1132R256
G04P100
G65H01P#1113Q1
G91G30Z0M19
M52
M12
G04P500
G28Z0
G65H01P#1114Q1
M41
G30Z0
M11
M53
G65H01P#1109Q1
G04P100
G65H12P#1132Q#1132R4096
N20G65H01P#530Q#531
G#132
G#131
G#130
N25M67
M99
%