When you first run a UCL program it is advised to run the task in DEBUG mode. To do this, follow these
steps. First, we will assume that the UCL.TXT file has been created already. At the terminal type:
DEBUG UCL
Followed by:
START UCL
If there are errors in the program, the interpreter will be unable to make sense of the program and will
raise a message via debug indicating in what line the error is and what the error may be concerning. Here is an
example of a compile failure as seen via debug:
\SYSTEM\> DEBUG UCL
SET UCL DEBUG ON
\SYSTEM\> START UCL
UCL task stopped....
UCL task is now running....
\SYSTEM\> File contains I_USER_INT1=I_USER_IT1+1;
Processing Equation 1 ...
Error (readEquation function) - register name I_USER_IT1
not recognised.The UCL task will now exit.
\SYSTEM\>
Here you can see that the register name has been entered into the file incorrectly. I_USER_IT1 should
be called I_USER_INT1. Of course, this is a very simple example of a compile error. As UCL files get
increasingly more complicated there can be one or many compile errors that take time to identify and correct. A
good principle to adopt is to regularly compile each new line of your program to ensure it is compiling as you
progress, rather than wait until you have one big file that has had no prior testing.
A successful compilation will result in the compilation being listed. After this debug repeatedly prints out
the output from each function (line) of the UCL file.
\SYSTEM\> File contains I_USER_INT1=I_USER_INT1+1;
Processing Equation 1 ...
Resolve brackets.Setting priorities...
List contains:
REG NUM 612.00 PRIO -2147483639,
PRIO 2147483617,
REG NUM 612.00 PRIO -2147483639,
SYMBOL + PRIO 2147483623,
INTEGER 1.00 PRIO -2147483639,
Equation 1 OK.
########################################################
######
Reg 612 INTEGER = 1
########################################################
######
This last line will repeat indefinitely until either debug is turned off or the UCL task is terminated. In
practise it is normal to run debug until you are happy that all is being calculated correctly before turning debug
off. You can quickly turn UCL debug (and all other debug) off if required by simply typing the following at the
command line:
DEBUG
If at any point you wish to stop your UCL program, simply type the following at the command line:
STOP UCL
A UCL program can only be halted, by obtaining the UCL processes ID and then performing an ID stop.
11.5 What makes up a UCL program?
A program is a text file, stored on the SD card, that contains one or more UCL statements. A statement
comprises of a target register, an equal’s sign, then an expression, and the statement is ended with a semicolon,
E.g.
<register_name> = <expression>;
An expression can be as simple as a single integer value, or as complex as a nested set of equations.