Delta Tau GEO BRICK LV User Manual

Page of 440
Turbo PMAC User Manual 
Writing and Executing PLC Programs
 
375
 
Note: 
M5187 is the Coordinate System In-Position bit as defined in the suggested M-
variable list. 
Precise Timing 
Since PLCs 1 to 31 are the lowest computation priority on Turbo PMAC, the cycle time cannot be 
precisely determined.  To hold up an action for a fairly precise amount of time, a WHILE loop can be 
used, but instead of incrementing a variable, use an on-board timer.   
Each coordinate system on Turbo PMAC has two user countdown timers: Isx11 and Isx12 (I5111 and 
I5112 for Coordinate System 1).  These timers are active for Coordinate Systems 1 through (I68+1).  
They are 24-bit signed registers (range: -8,388,608 to +8,388,607) that count down once each servo cycle.  
Typically, write a value to it representing the time to wait, expressed in servo cycles (multiply 
milliseconds by 8,388,608/I10), then wait for it to reach zero.  Example code is: 
I5111=500*8388608/I10 
; Set timer to 500 msec 
WHILE (I5111>0) 
; Loop until counts to zero 
ENDWHILE 
; Exit PLC program here when true 
If more timers are needed, use memory address X:$0.  This 24-bit register counts up once per servo cycle.  
Store a starting value for this, then each scan subtract the starting value from the current value and 
compare the difference to the amount of time to wait.  By subtracting into another 24-bit register, possible 
rollover of X:$0 is handled gracefully. 
Define the following M-variables with on-line commands: 
M0->X:$0,24 
; Servo counter register 
M85->X:$0010F0,24 
; Free 24-bit register 
M86->X:$0010F1,24 
; Free 24-bit register 
Then write as part of the PLC program: 
M85=M0 
; Start of timer 
M86=M0-M85 
; Time elapsed so far 
WHILE (M86<P86) 
; Less than specified time? 
  M86=M0-M85 
; Time elapsed so far 
ENDWHILE 
; Exit PLC program here when true 
Compiled PLC Programs 
It is possible to compile Turbo PMAC PLC programs for faster execution.  The faster execution of the 
compiled PLCs comes from two factors: first, from the elimination of interpretation time, and second, 
from the capability of the compiled PLC programs to execute integer arithmetic.  Floating-point 
operations in compiled PLC programs run two to three times faster than in interpreted PLC programs; 
integer (including Boolean) operations run 20 to 30 times faster in compiled form. 
Turbo PMAC does not perform the compilation of the PLC programs itself.  The compilation is done in a 
PC; the resulting machine code is then downloaded to Turbo PMAC.   
Turbo PMAC can store and execute up to 32 compiled PLC programs as well as 32 interpreted 
(uncompiled) PLC programs for a total of 64 PLC programs.  15K (15,360) 24-bit words of Turbo PMAC 
memory are reserved for compiled PLCs; or 14K (14,336) words if there is a user-written servo as well.  
No other task may use this memory, and compiled PLCs may not use any other memory.   
Note:  
The size of the compiled code mentioned here refers to the space that the actual 
compiled code will occupy in Turbo PMAC’s memory.  It does not refer to the size 
of the compiler’s output file on the PC’s disk drive.