CNC Services Northwest

Centroid CNC control sales, service, training and support


PLC Programming Overview

PLC (Programmable Logic Controller) functions are built into the Centroid control hardware and software. In general, the PLC is responsible for all machine functions except for axis motion (servo control). For example, spindle control; coolant control; lube pump control; and automatic tool changer sequencing are all controlled by the PLC.

The architecture and capabilities of the PLC, and the corresponding PLC programming language, have varied with different generations of control hardware and software.

Systems built between 1993 and 2002, generally using CPU7 control boards and DOS-based CNC7 software, used a PLC program interpreter which ran on the CPU board.

Most systems built between 2002 and 2010, generally using CPU10 control boards and Linux-based CNC10 control software, used a two-part PLC program: one part was the same CPU-based interpreter as was used on earlier CNC7 systems; the second part was a PC-based interpreter with expanded capabilities, but limited access to some areas (notably internal status bits and Jog Panel LEDs).

Systems built since 2010 which use the MPU11 family hardware (MPU11 board, Oak board, or All-in-one DC unit) once again use a single PLC program, running on the CPU board. However, that PLC interpreter has all the features of the CNC10 PC-based interpreter, plus significantly more control over internal behavior (for example, response to Jog Panel keys and control of axis jogging).

The boundary between the "CNC7" architecture, with a single CPU-based program, and the "CNC10" architecture, with a CPU-based program plus a PC-based program, is not absolute. The PC-based PLC interpreter and two-program design was actually introduced with CNC7 version 8.00 for DOS. Any control using CNC7 software 8.00 or newer can optionally use the two-part PLC program, as can any control using Linux-based CNC10 control software on a CPU7, CPU9 or CPU10 board. Conversely, any of those later systems can be set up to use the CNC7-style, single CPU-based PLC program, regardless of which control software or CPU board they have.

For simplicity on these pages, I will refer to the earlier CPU-based PLC program as a "CNC7" PLC program, even if it may be running under CNC10 and may be running on a CPU10 board. I will refer to the two-part PC plus CPU architecture as a "CNC10" PLC program, even if it may be running under CNC7 v8.xx or with a CPU7 board.

MPU11 systems, on the other hand, always use the single-program MPU-based interpreter. I will refer to this architecture as "MPU11".

CNC7 CPU-based program architecture

The PLC compiler is named PLCCOMP (or plccomp on CNC10 Linux systems). The compiled program, used by the control, is CNC7.PLC on DOS CNC7 systems, or cnc10.plc on Linux CNC10 systems.

The program source consists of a list of definitions, giving intuitive names to the various input, output and memory bits; followed by a series of logic assignment statements, structured in an "output = logic expression" format.

The PLC interpreter operates only on single-bit locations: 80 inputs, 80 outputs, and 80 memory bits. Lower-numbered inputs and outputs are generally physical I/O on a PLC interface board. Higher-numbered inputs and outputs are variously internal flags and the buttons and LEDs on the Jog Panel. Memory bits are scratch space, and exist solely in the PLC interpreter (though the CNC7 or CNC10 software can view the memory bits, and in some circumstances use them to determine when to display messages).

Because the PLC interpreter cannot operate on numeric variables, it is usually not practical to support automatic tool changers and similar devices with just a CPU-based PLC program. There is no good way to count carousel positions, calculate rotation distance, etc..

Early controls which required automatic tool changer support did so with a third-party PLC, such as a Koyo DL205 using the OPTIC232 serial interface.

A typical fragment of PLC logic from a CNC7 CPU-based program might look like this:

SpindleRelay1       = ( SpindleRelay1 OR Spin_start )
                      AND / Spin_stop
                      AND Probe_not_detected

CNC10 dual program architecture

These systems use two PLC programs. One runs on the CPU board, using the same interpreter, same compiler and same language as the CNC7 system described above. The second runs on the PC, as a memory-resident background task.

In general, the CPU-based PLC program does those tasks which require direct access to internal flags and jog panel hardware: updating jog panel LEDs, flagging fault conditions, and implementing remote Cycle Start, Cycle Cancel and Feed Hold functions. The PC-based PLC program does the more recognizable tasks of managing input switches and output relays for most of the external machine accessories.

The compiler for the PC-based PLC program is XPLCCOMP on DOS systems, or xplccomp on Linux systems. The compiled program, used by the system, is PC.PLC (located in the C:\PLC directory) on DOS CNC7 systems, or pc.plc (located in the control software directory, /cncroot/c/cnc10 or /cncroot/c/cnc10t) on Linux CNC10 systems.

The PC-based PLC interpreter can access the same 80 inputs, outputs and memory bits as the CPU-based PLC program, though by convention it is prohibited from modifying inputs, internal flag outputs, Jog Panel LEDs, or memory bits MEM73 to MEM80.

In addition, the PC-based PLC interpreter can access additional single-bit locations (INP81 to INP256; OUT81 to OUT256; and MEM81 to MEM256), plus numeric "word" variables, timers, and positive differential (PD) bits.

The PC-based PLC interpreter also supports program stages, allowing blocks of PLC logic to be enabled and disabled as needed for logic flow.

The program source for the PC-based PLC interpreter begins with definitions like those in the CPU-based program source; followed by a series of logic statements, structured in a "IF logic expression THEN output/action" format.

A typical fragment of PLC logic from a CNC10 PC-based program might look like this:

IF (Spindle_enable | Spin_start) & ! Spin_stop &
   Probe_not_detected THEN (Spindle_enable)

MPU11 architecture

MPU11-family systems use a single PLC program, interpreted on the MPU11 control board (MPU11, All-in-one DC, or Oak board). The interpreter provides all the features of the CNC10 PC-based interpreter, plus much greater access to control system status, and much greater authority over the motion control and Jog Panel portions of the system.

The compiler is mpucomp. The compiled program file, used by the control system, is mpu.plc (located in the control software directory, c:\cncm or c:\cnct).

The program source begins with definitions like those in previous architectures; followed by a series of logic statements, structured in a "IF logic expression THEN output/action" format.

A typical fragment of PLC logic from an MPU11-based program might look like this:

IF (SpindleEnableOut || SpinStart_M ) && !SpinStop_M
  THEN (SpindleEnableOut)

MPU11 PLC programming applications and examples


CNC Services Northwest Home

Copyright © 2017 Marc Leonard
Last updated 14-Aug-2017 MBL