User's Manual

PMAC User Manual
Writing a PLC Program 243
A read operation from a less-than-24-bit (1- to 20-bit) signed L-variable takes from six to eight DSP
instruction cycles and from five to seven program memory locations. A read operation from a less-than-
24-bit (1- to 20-bit) unsigned L-variable takes from 7 to 9 DSP instruction cycles and from six to eight
program memory locations.
A write operation to a less-than-24-bit (1- to 20-bit) signed or unsigned L-variable takes 12 to 14
instruction cycles and 10 to 12 program memory locations.
The &, ^, |, +, -, * operators take one or two DSP instruction cycles.
The divide ( / ) operator takes nominally 82 DSP instruction cycles.
The modulo ( % ) operator takes nominally 76 DSP instruction cycles.
Integrating PLC Files
Before using the standalone compiler (PLCC.EXE), all of the PLC programs that are to be compiled must
be combined into one file. The CNC Executive program, and the new general PMAC Executive program
V3.x, can use multiple files if the main file references all of the other files to be used with #include
commands.
The standalone compiler will only operate on one file, assuming that it contains all of the PLC programs
to be compiled. It is acceptable to leave PLC programs that will not be compiled, and other commands, in
the file. The compiler will simply pass these through unchanged.
The standalone compiler cannot work with the #define macros and #include files that the PMAC
Executive program editor and download routines use. The substitutions into true PMAC code must be
performed before the compiler starts. The program PREPROC.EXE can be used to perform these
substitutions and integrate multiple files into a single file.
The preprocessor program PREPROC.EXE, or the compiler program PLCC.EXE can be obtained from
Delta Tau’s bulletin board system.
To execute the pre-processor program that performs the #define macro substitutions and integrates the
#include files, type PREPROC -F{filename} at the DOS prompt, where {filename} is the full
name of the main file, including the extension. This program creates an output file with the same name as
the input file, but with a .SRC output file. It also creates a .MAP file of the same name that contains the
cross-references between macro names and PMAC code.
Link Address File
In the same subdirectory that contains the cross-compiler, there must be a file called LISTLINK.TXT,
that the compiler will reference as it runs.. This file must contain the ASCII text returned by PMAC in
response to a LIST LINK command. This text contains the PMAC addresses of key subroutines to
which the cross-compiler must link the compiled PLC code. It is specific to a particular version of
PMAC firmware.
Any change in PMAC firmware, even a sub-version change for a bug fix (e.g. from V1.15A to V1.15B)
requires a new LISTLINK.TXT file, re-compilation of the PLCs, and re-downloading of the compiled
code.
Executing the Compiler
The standalone compiler is executed by typing PLCC -F{filename} at the DOS prompt, where
{filename} is the full name of the input file, including the extension. The compiler will then execute
either until successful completion, or until it finds an error.
In the PMAC Executive programs, the compiler is integrated into the download routine as long as the
Compile on Download option has been activated.