User's Manual

PMAC User Manual
Writing a PLC Program 245
To use a different uncompiled PLC of the same number as a compiled PLC, include it in the input file to
the compiler after the text for the compiled PLC. The compiler will pass it through to the output and it
will be reloaded each time. Otherwise, do a separate download of this PLC after each compile/download
cycle. All other commands are passed through the compiler to the output file unchanged.
The compiler will tells how many words of PMAC memory the compiled code will occupy; it will note
an error if the compiled code exceeds the maximum permitted 15360 words of PMAC memory. If using
a user-written servo in PMAC, ascertain that the compiled code does not exceed 14336 words.
Downloading the Compiled Code to PMAC
The single output file from the compiler can be downloaded to PMAC by any program or routine that can
send files to PMAC, such as the PMAC Executive program’s Download file to PMAC menu selection. In
the CNC Executive program, the download occurs automatically after the compiling.
The act of downloading any new compiled PLC programs deletes all of the existing compiled PLC
programs in the PMAC active memory automatically. No other commands need to be used to delete
these.
In PMACs with battery-backed memory, the compiled PLC programs are retained by the battery
automatically through power-down cycles until they are explicitly deleted by the DELETE PLCC
command, or by the downloading of a new set of compiled PLCs.
In PMACs with flash memory backup, the SAVE command must be used after downloading in order for
the compiled PLCs to be retained through a power-down or reset of the card. The SAVE command copies
the programs from active memory to the non-volatile flash memory. At power-up/reset, the contents of
the flash memory are copied into active memory.
Running the Compiled PLCs
I-variable I5 is the master control for both uncompiled and compiled PLCs. The PLC programs can be
individually enabled and disabled with the ENABLE PLC, ENABLE PLCC, DISABLE PLC, and
DISABLE PLCC commands. These can be given as on-line commands, or as buffered commands within
motion programs, uncompiled PLC programs, or compiled PLC programs. A PLC program can even
disable itself. Do not use the DISABLE PLCC command from within either PLC 0 or PLCC 0; they
cannot be guaranteed to work here.
It can be useful to think of the two bits of I5 as being like the master breakers for a house, and the
individual program enable/disable controls as being like light switches within the house. Both the master
breaker and the light switch must be in the ON setting for the light to work. The breakers and the light
switches are separately controllable.
When the compiled PLC programs are downloaded to PMAC, they are all individually enabled. They
will start running immediately if permitted by I5.
On power-up/reset, all existing PLC programs, compiled and uncompiled, are individually enabled. If I5
was saved to a value that permits a given PLC program to run, it will be ready to run on power-up. PLC
1 will be the first PLC to execute after power-up/reset (before even PLCC 1). Many people use this as
their reset PLC, executing once and disabling itself to prevent repeated execution. This PLC program can
be used to prevent other PLC programs from executing immediately on power up with DISABLE PLC
and DISABLE PLCC commands. In this way, power up can be done with only a choice of PLC
programs enabled.
Sending the <CONTROL-D> character is a quick way of disabling all PLC programs, compiled and
interpreted.