Delta Tau GEO BRICK LV User Manual

Page of 440
Turbo PMAC User Manual 
Writing and Executing PLC Programs
 
371
 
WRITING AND EXECUTING PLC PROGRAMS 
What are PLC Programs? 
Turbo PMAC has 64 PLC programs that operate asynchronously and with rapid repetition – 32 compiled 
PLC programs and 32 interpreted (uncompiled) PLC programs.  They are called PLC programs because 
they perform many of the same functions as hardware programmable logic controllers.  PLC programs 
have most of the same logical constructs as the motion programs, but no move-type statements.   
Most compiled PLC programs are similar, if not identical, to uncompiled PLC programs.  In fact, before a 
PLC program is compiled, it should be tested and debugged as an uncompiled PLC.  The differences 
between the two types of PLC programs are in the area of buffer control, L-variables, some command 
syntax, and the use of the compiler.  Because of their similarities, much of the section about uncompiled 
PLC programs also applies to compiled PLC programs.  The information specifically concerning 
compiled PLC programs is contained in the Compiled PLC Programs section. 
When To Use 
PLC programs are designed for calculations and actions that are asynchronous to the motion.  If the 
calculation action you want is synchronous to the programmed motion (e.g. at the boundary of a 
programmed move), use a motion program instead to create the action.  Even if the action is to repeat for 
each programmed move, it is best done in a motion program, probably in a subroutine. 
Common Uses 
PLC programs are particularly useful for monitoring analog and digital inputs, setting outputs, sending 
messages, monitoring motion parameters, issuing commands as if from a host, changing gains, and 
starting and stopping moves.  By their complete access to Turbo PMAC variables and I/O and their 
asynchronous nature, they become powerful adjuncts to the motion control programs. 
64 PLC Programs 
WARNING:  
A PLC 0 that is too large can cause unpredictable behavior and can even trip Turbo 
PMAC’s Watchdog Timer by “starving” background tasks of time to execute. 
PLC programs are numbered 0 through 31 for both the compiled and uncompiled PLCs.  This means that 
you can have both a compiled PLC n and an uncompiled PLC n stored in Turbo PMAC.  PLC program 0 
is a special fast program that operates at the end of the servo-interrupt cycle with a frequency specified by 
variable I8 (every I8+1 servo cycles).  This program is meant for a few time-critical tasks, and it should 
be kept small, because its rapid repetition can steal time from other tasks. 
PLC programs 1 through 31 operate continually in background as time allows, effectively in an infinite 
loop.  They are interrupted by the higher-priority tasks of motor phasing, servo-loop closure, move 
planning, and PLC 0. 
Entering a PLC Program 
The PLC program statements are entered as buffered command lines into Turbo PMAC.  In preparation, it 
is a good idea to make sure no other buffers have been left open, by issuing a CLOSE command.  It is also 
good practice to make sure that memory has not been tied up in data gathering or program trace buffers, 
by issuing a DELETE GATHER command.