Can the active g code program be changed via the PLC?

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

footpetaljones
Posts: 10
Joined: Sun Jan 07, 2018 8:53 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Can the active g code program be changed via the PLC?

Post by footpetaljones »

I have a Tree 325 with a Dynapath 20 control in need of a retrofit I am feeding with a Fanuc robot. The robot is jumpered into the cycle start and cycle end signals. I have a macro set up to look at the status of a few inputs to determine which program to run, but it is very limited. I am wondering if there is a system variable or some other way for Acorn's PLC to change the running program.
slodat
Posts: 793
Joined: Thu Apr 12, 2018 11:16 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Can the active g code program be changed via the PLC?

Post by slodat »

I did a retrofit on a Tree 425. I know this doesn't answer your question, but I thought I'd point you to it. Sold the old control on ebay.
martyscncgarage
Posts: 9914
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: Can the active g code program be changed via the PLC?

Post by martyscncgarage »

footpetaljones wrote: Sat May 09, 2020 11:03 am I have a Tree 325 with a Dynapath 20 control in need of a retrofit I am feeding with a Fanuc robot. The robot is jumpered into the cycle start and cycle end signals. I have a macro set up to look at the status of a few inputs to determine which program to run, but it is very limited. I am wondering if there is a system variable or some other way for Acorn's PLC to change the running program.
I assume:
Robot loads the part, pulls clear, G code resumes.
Machine stops, signals Robot to unload and load part
G code resumes

Trying to understand your question.
Please explain exactly how a typical cycle runs. Post the G code. How the Robot interacts with the machine...

Marty
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ
cncsnw
Posts: 3868
Joined: Wed Mar 24, 2010 5:48 pm

Re: Can the active g code program be changed via the PLC?

Post by cncsnw »

While the PLC program cannot directly change the loaded program, there is an "end run" available. It would only be practical if you had a short list of pre-determined CNC job file names to choose from.

1) The PLC program can trigger execution of a Windows batch file, by setting PLC system variable SV_SYS_COMMAND to a non-zero value. For example, the PLC program setting SV_SYS_COMMAND = 5 will cause CNC12 to launch c:\cncm\plc_system_command_5.bat
2) An external program can trigger CNC12 to change the currently-loaded CNC job file by writing a new file name into a text file named "c:\cncm\loadjob.txt". CNC12 will act on that request the next time it is sitting idle at the main screen.
3) Therefore you could have a series of batch files which copy different CNC file names into "loadjob.txt", and trigger execution of those batch files via PLC logic.
martyscncgarage
Posts: 9914
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: Can the active g code program be changed via the PLC?

Post by martyscncgarage »

Marc (CNCSNW) is the guy to hire or consult with for those special scenarios. He has extensive experience with the Centroid control and PLC programming. If it can be done, he can make it happen.

Marty
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ
footpetaljones
Posts: 10
Joined: Sun Jan 07, 2018 8:53 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Can the active g code program be changed via the PLC?

Post by footpetaljones »

martyscncgarage wrote: Sat May 09, 2020 2:31 pm I assume:
Robot loads the part, pulls clear, G code resumes.
Machine stops, signals Robot to unload and load part
G code resumes

Trying to understand your question.
Please explain exactly how a typical cycle runs. Post the G code. How the Robot interacts with the machine...

Marty
I'm not at the shop right now to grab the program, but you have the basic gist of the system. To start operation, the robot is started and waits for a service request from the machine. The main program of the machine first sets an output (robot service request) and waits for an input (robot service complete), the robot loads the machine and based on how I set the robot variable 3 robot outputs are set that the machine reads. The inputs are read into a macro variable, i decode the binary, and based on the result the program jumps to certain portions of the program (ex, if #1 = 3, GOTO 3). Each section of the program that is jumped to is a complete program for that operation and ends in a "GOTO 1" with "1" being the first line of the program. From there the cycle repeats.

The emergency stop, service request, service complete, and 3 macro inputs are the only communication the robot and machine have.
footpetaljones
Posts: 10
Joined: Sun Jan 07, 2018 8:53 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Can the active g code program be changed via the PLC?

Post by footpetaljones »

cncsnw wrote: Sat May 09, 2020 3:40 pm While the PLC program cannot directly change the loaded program, there is an "end run" available. It would only be practical if you had a short list of pre-determined CNC job file names to choose from.

1) The PLC program can trigger execution of a Windows batch file, by setting PLC system variable SV_SYS_COMMAND to a non-zero value. For example, the PLC program setting SV_SYS_COMMAND = 5 will cause CNC12 to launch c:\cncm\plc_system_command_5.bat
2) An external program can trigger CNC12 to change the currently-loaded CNC job file by writing a new file name into a text file named "c:\cncm\loadjob.txt". CNC12 will act on that request the next time it is sitting idle at the main screen.
3) Therefore you could have a series of batch files which copy different CNC file names into "loadjob.txt", and trigger execution of those batch files via PLC logic.
This sounds like it would suit my workflow well enough. I generally like naming programs "Onnnn" Fanuc style rather than having some wordy description of what it is. Is there any limit on the number of .bat files, or could I preload "O0001.bat" through "O9999.bat" without issue?

The ideal system I'd like to set up would be to have a pallet system similar to a lot of high end 5 axis machines where each pallet can be assigned a program and a priority in a scheduler and the machine will check if another pallet is scheduled, and if so load according to priority. That's way above my paygrade though, and I'm not sure how such a system would operate. Would the robot be the master, the machine, or everything runs through an external program handling the schedule.

Marc, if this sounds like it'd be something within your wheelhouse I'm definitely interested in talking more to flesh out the idea of how something like this could be put together. Would it be best for you to keep the conversation going here, or through another means?
cncsnw
Posts: 3868
Joined: Wed Mar 24, 2010 5:48 pm

Re: Can the active g code program be changed via the PLC?

Post by cncsnw »

So, if you wanted, you could write it to work exactly the way you describe in the old system as well: you would always have the same CNC job file loaded (though you might change the content of the part-specific blocks within it); and you could write CNC code to calculate the jump target based on the three inputs.

The way you phrased the original question, and the solution I suggested for that, will only work if you allow the CNC job to come to an end (perhaps immediately after calling the robot to swap parts). After a brief interval with nothing running, CNC12 would notice the presence of the loadjob.txt file, and change the current job. Then, next time Cycle Start was detected after that, the new job would run.

If you are looking for continuous looping, then the second method you described (one program with jumps to multiple targets) would probably work more smoothly and reliably. If you did not want to have all the geometry of all your parts embedded in one huge program, you could have the target of the variable jumps be M98 subprogram calls. Then the actual part codes could be in separate numbered or named subprograms.
cncsnw
Posts: 3868
Joined: Wed Mar 24, 2010 5:48 pm

Re: Can the active g code program be changed via the PLC?

Post by cncsnw »

footpetaljones wrote:This sounds like it would suit my workflow well enough. I generally like naming programs "Onnnn" Fanuc style rather than having some wordy description of what it is. Is there any limit on the number of .bat files, or could I preload "O0001.bat" through "O9999.bat" without issue?
You may be confusing the Windows system batch files (e.g. "plc_system_command_5.bat") with CNC program files.

In the first scenario I suggested (using PLC logic to make CNC12 choose a different CNC job to run next time Cycle Start is pressed), the batch files triggered by the PLC would be required to be named "plc_system_command_n.bat", where n is the number you are going to call it with in the PLC ladder. That has nothing whatsoever to do with CNC codes or CNC program numbers.

The content of the plc_system_command_n.bat files would be Windows/DOS style commands, such as ECHO or COPY.

Separate from all that, Centroid gives you a way to number CNC program files, such that they will be recognized in M98 and G65 calls. If you put some useful CNC code in a file named "O0001.cnc", then any other program that run "M98 P1" will call that file and run the CNC codes in it.

So, if you wanted to use the second method, which you described a couple posts back, then you could optionally write code something like this:

Code: Select all

N1
  M61  ; <-- custom macro to activate the robot to load a new part, and identify its part number (0-7) on inputs 14-16
  #100 = [#50014 + 2*#50015 + 4*#50016]
  M98 P#100   ; <-- call subprogram #0 - #7, in file O0000.cnc - O0007.cnc
GOTO 1
footpetaljones
Posts: 10
Joined: Sun Jan 07, 2018 8:53 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Can the active g code program be changed via the PLC?

Post by footpetaljones »

cncsnw wrote: Sat May 09, 2020 9:22 pm The way you phrased the original question, and the solution I suggested for that, will only work if you allow the CNC job to come to an end (perhaps immediately after calling the robot to swap parts). After a brief interval with nothing running, CNC12 would notice the presence of the loadjob.txt file, and change the current job. Then, next time Cycle Start was detected after that, the new job would run.
This is more in line with what I am envisioning. Having one master program with every part mashed into it is only the way I set it up because it is the only way I could set it up on the Delta 20 control. Each "subprogram" in the master program is hand written to compress the code as much as possible with limited memory, and then hand stitched together. This is not a workflow I like at all, and is completely inflexible for more complicated programs than the spot/drill/tap that my current system is doing. I have many more jobs I run without the robot and DNC to the machine after posting from Fusion360 that do not work with the current system. I would like to go from posting program "O2000" from HSMworks, load "O2000" onto the control, assign "O2000" to pallet 7, set pallet 7's priority, and whenever that priority becomes highest the pallet is loaded into the machine and program "O2000" run.
Post Reply