Delta Tau GEO BRICK LV User Manual

Page of 440
 
Turbo PMAC User Manual 
372
 
Writing and Executing PLC Programs
 
Opening the Buffer 
For each PLC program, the next step is to open the buffer for entry with the OPEN PLC n statement, 
where n is the buffer number.  Next, if there is anything currently in the buffer that should not be kept, it 
should be emptied with the CLEAR statement (PLC buffers may not be edited on the Turbo PMAC itself; 
they must be cleared and re-entered).  If the buffer is not cleared, new statements will be added onto the 
end of the buffer.   
Downloading the Program 
Typically in program development, the editing will be done in a host-based text editor, and the old buffer 
is cleared every time the new version is downloaded to the card.  When finished, close the buffer with the 
CLOSE command.  Opening a PLC program buffer automatically disables that program.  After it is 
closed, it remains disabled, but it can be re-enabled again with the ENABLE PLC n command, where n 
is the buffer number (0–31).  I5 must also be set properly for a PLC program to operate. 
Note:   
Because all PLC programs in Turbo PMAC’s memory are enabled at power-
on/reset it is good practice to have I5 saved as 0 in Turbo PMAC’s memory when 
developing PLC programs.  This will allow resetting Turbo PMAC with no PLCs 
running (an enabled PLC only runs if I5 is set properly) and recovering more easily 
from a PLC programming error. 
The general form for this technique is: 
CLOSE 
DELETE GATHER 
OPEN PLC n 
CLEAR 
{PLC statements} 
CLOSE 
ENABLE PLC n 
Closing the Buffer 
At the closing, Turbo PMAC checks to make sure all IF branches and WHILE loops have been terminated 
properly.  If not, it reports an error, and the buffer is inoperable.  Then correct the PLC program in the 
host and re-enter it (clearing the erroneous block in the process, of course).  This process is repeated for 
all of the PLC buffers being used. 
Erasing the Program 
To erase an uncompiled PLC program, open the buffer, clear the contents, and then close the buffer again.  
This can be done with three commands on one line, as in: 
OPEN PLC 5 CLEAR CLOSE 
Example 
A quick example of a PLC block entry is shown below: 
OPEN PLC 2 
CLEAR 
IF (M11=1) 
 I130=10000 
ELSE  
 I130=8000 
ENDIF 
CLOSE 
ENABLE PLC 2