What's new
What's new

Fanuc Write Variables from PC

bradyc

Plastic
Joined
Jun 23, 2022
Hi,

I am looking for a way to write values to Fanuc variables (i.e. local variable #1) on a Fanuc 21i or 31i controller from my PC. Currently, I am connected via the serial RS 232 port but I can invest in additional hardware or controller add-ons if necessary.
 

angelw

Diamond
Joined
Sep 10, 2010
Location
Victoria Australia
Hi,

I am looking for a way to write values to Fanuc variables (i.e. local variable #1) on a Fanuc 21i or 31i controller from my PC. Currently, I am connected via the serial RS 232 port but I can invest in additional hardware or controller add-ons if necessary.
Are you wanting to do this while a program is running on the machine? If so, its not going to happen without modification to the PMC. If you're going to be setting the Variables whilst the machine is not operating another program, it can be done simply by creating a program with the code for whatever Variables you want to set in the form of:

#1 = 11111
#2 = 22222
etc.
However, as these are local Variables, if you terminated the PC Program with M30, this will Reset the Local Variables back to Empty (Null). You could call the program you want to run for your part manufacture, as a Subprogram that is called by a Subprogram Call Block sent from the PC, but if the Variables being set are to be used in the Subprogram, you would have to use Common Variables, or pass the Local Variable values via a Macro Call Block (G65).

A better explanation of your goal is required.

Regards,

Bill





sending a program to the control via DNC with the control mode set to Auto/Memory
 

bradyc

Plastic
Joined
Jun 23, 2022
Hi Bill,

The goal is to be able to write the value of a global variable or offset to be used in programs. We want to write this value directly from the PC, without needing to run a program to set it, while the machine is idle.

Is there a function or method to input a value to any sort of variable or offset value directly from a PC?

ex I have a program making a cut, but this cut needs to go 5mm further than set in the program.
I can set a variable to 5 directly from my PC and the program will access this value and cut 5mm further. (Lets say the program included the variable in the original run where I was 5mm short, but it was set to 0mm)

Afterward this 5mm could change to 2mm and all I need to do is send a line from my PC to the PMC saying change this value to 2mm and then I can run the program again and it uses the 2mm offset instead of 5mm. All without needing to load and run another program just to change this offset value from 5mm to 2mm.
 

dandrummerman21

Stainless
Joined
Feb 5, 2008
Location
MI, USA
Any reason you want to send from pc instead of just putting the variable in to the control itself?

I'm unsure whether the example you gave is all you want, or if there are several variables per part.
 

angelw

Diamond
Joined
Sep 10, 2010
Location
Victoria Australia
Hi Bill,

The goal is to be able to write the value of a global variable or offset to be used in programs. We want to write this value directly from the PC, without needing to run a program to set it, while the machine is idle.

Is there a function or method to input a value to any sort of variable or offset value directly from a PC?

ex I have a program making a cut, but this cut needs to go 5mm further than set in the program.
I can set a variable to 5 directly from my PC and the program will access this value and cut 5mm further. (Lets say the program included the variable in the original run where I was 5mm short, but it was set to 0mm)

Afterward this 5mm could change to 2mm and all I need to do is send a line from my PC to the PMC saying change this value to 2mm and then I can run the program again and it uses the 2mm offset instead of 5mm. All without needing to load and run another program just to change this offset value from 5mm to 2mm.
The only way, with the PMC as is, would be to have your Part Program run as a Subprogram called by a Program from your PC that is being fed as a DNC program. When appropriate to make the change to Variable, the Subprogram would return to the Calling Program (the PC DNC Program), where there would be a User Macro Statement and then a Call of the Subprogram again. The logic would be all in the arrangement of the DNC Program and the Subprogram that will be your Part Program.

Regards,

Bill
 








 
Top