PLC Manual
PLC Manual
PLC Manual
OPERATOR'S MANUAL
Version 1.0
October, 1994
1 SYSTEM INTRODUCTION
Normal-Open Contact 11
Timer Normal-Open Contact 11
Counter Normal-Open Contact 11
Normal-Close Contact 11
Timer Normal-Close Contact 11
Counter Normal-Close Contact 12
Normal-Positive Relay Output 12
Normal-Negative Relay Output 12
Positively Trig. Relay Output 13
Negatively Trig. Relay Output 13
Arithmetic Addition 14
Arithmetic Subtraction 15
Arithmetic Multiplication 16
Arithmetic Division 17
Data MOVE 18
Compare 19
Logic AND 20
Logic OR 21
Logic XOR 22
i
Timer 23
Up Counter 24
Down Counter 25
Ring Up Counter 26
Ring Down Counter 27
Counter Setting 29
Ladder END 28
ii
HUST PLC Editor
1 SYSTEM INTRODUCTION
Ladder diagram, ladder, and PLC are all referring to the same thing -- PLC. A
standard PLC is an integral part of HUST CNC products but it can be edited to suit
the specific functional requirement of each individual machine. "PLC Editor" is an
optional PC software that HUST provides you to accomplish the PLC editing. This
manual describes the use of HUST's "PLC Editor".
HUST's PLC Editor provides the following functions which are shown at the
bottom of the first screen when you activate the PLC Editor.
The signals flowing between the CNC and the machine tool are processed by the
PLC. The PLC bits (I/O/C/S/A-bit) that are used in all HUST PLC systems are
described below. The meanings and the applications of the PLC bits are discussed
in all HUST CNC Connecting Manuals. In addition to the PLC bits, HUST's PLC
Editor also provides Timer, Counter, and Register for additional control.
I-bit : Input signal from external I/O unit (machine tool) to PLC.
O-bit : Output signal from PLC to I/O unit for driving external devices.
C-bit : Command signal from PLC to the CNC controller.
S-bit : Status signal from the CNC controller to PLC.
A-bit : Auxiliary internal bit for I/O/C/S-bit processing in PLC.
1
HUST PLC Editor
I000~I007 of HUST I-0 and I-3 series CNC or I018 of HUST 10/11-series CNC are
designated as input signals of G31 SKIP function. If you use SKIP function is your
program, be careful in handling of these I-bits. Otherwise, all the PLC bits in the
table are available for customer's use.
(2)
(3) Replace
(4)
(5) F1 EDIT F2 F3 COMP F4 F5 PRINT F6 F7 F8 F9 F0 END
Fig 1-1 Screen Display When Activating PLC Editor
2
HUST PLC Editor
♦ System requirements:
When you enter the execution file "plc1.exe" (or plc2.exe), a screen as shown in Fig
1-1 will be displayed. The three operations that you can do with HUST's PLC
Editor are shown at the bottom of the screen in the function-key area. "F3 COMP"
and "F5 PRINT" operations are normally used only after the entire ladder file
editing (F1 EDIT) have been finished.
1. F1 EDIT (Edit module) -- To edit a new ladder file or revise an existing file.
2. F3 COMP (Compile mod.) -- To produce a "*****.tsk" file for EPROM
writing.
3. F5 PRINT (Print module) -- To produce a ladder text file for printing.
4. F0 END -- To quit PLC Editor operation.
3
HUST PLC Editor
Once you have done one of the above, the operation you keyed in will be displayed
in the Command Line area (4), and the Function-key area (5) with a message in area
(3) will display the next step you should do. When you finish all the steps required,
press ENTER key and the data in the Command Line area (4) will be entered into
the Main area (2). If you made an error while editing, an error message would be
displayed in the Message area (3) when you press ENTER key. Both input methods
can be used inter-changeably.
The complete steps to bring an existing ladder file onto screen for editing are as
follows. Throughout this book, the information inside the bracket "<xxxxx>" are
the data that require user's input.
<filename> for EDIT, COMP, or PRINT is the file that has "LAD" extension such
as "xxxxx.LAD". When you key in the filename for EDIT, COMP, or PRINT, the
"LAD" extension can be omitted. Once you press ENTER key, the ladder diagram
as shown in Fig 2-1 will be displayed in the Main area (2) for an existing file.
( )
S001 C001
( )
(2) A110 A103 C001 A013
A013 A094
If it's a new file, a screen as in Fig2-2 will be displayed. Once a ladder file as in
Fig2-1 or Fig2-2 is displayed, the file is ready for editing. The next step you should
do is displayed at the Function-key area (5) and the Message area (3). We'll discuss
these functions in detail later.
4
HUST PLC Editor
(2)
=== END OF FILE ===
The special keys on the keyboard that are to be used during PLC editing will be
discussed below:
♦ "Esc" Key : Toggle between the Command mode and the Ladder mode
During PLC ladder editing, there are two windows existed for operation. They
can be toggled back and forth with "Esc" key. As to which window being active
is displayed at the top left-hand corner in the Header area (1) by <Esc>:Ladder
or <Esc>:Command. The best way to distinguish which window being active is
to check the two cursors on the screen. One is a big square cursor in the ladder
Main area (2) and the other is a line cursor in the Command Line area (4).
5
HUST PLC Editor
←,→ : Move the cursor left or right at the ladder Main area (2).
↑,↓ : Move the cursor up or down at the ladder Main area.
PgUp,PgDn : Scroll screen one page up or down at the ladder Main area.
Ctrl Home : Move cursor to the top of file.
Ctrl End : Move cursor to the end of file.
Once you have entered into EDIT mode for a ladder file, the Function-key area (5)
displays the function keys as follows:
We call this as "Element Edit" or "Component Edit", which will let you choose the
component for the ladder diagram. If you press F0-NEXT key, the Area (5) function
keys will scroll to the next page, called "Ladder Edit", which has the following
function keys for ladder editing.
If you press F0-NEXT key again, you'll go back to the "Element Edit" page.
6
HUST PLC Editor
♦ Insert -- Insert one line below the square cursor in ladder Main area (2).
♦ Delete
To delete a line, move square cursor to the line and press ALT-L to mark the
line, then press ALT-D (or delete). To delete multiple lines, use ALT-L to mark
the first line, move cursor to the last line and press ALT-L again, then press
ALT-D.
<number> represents the bit address number, 0~127. For finding O/C/S/A-bit
location, you simply replace F2 I_BIT in the steps by F3 O_BIT, F4 C_BIT, F5
S_BIT, or F6 A_BIT.
7
HUST PLC Editor
♦ Merge -- Merge the selected ladder file to the end of the current file.
"END" without filename will save the ladder in the current default file.
"END" with a filename will save the ladder with the filename as indicated.
Both file saves will do open/short circuit check. If you do not intent to save the
file, use the following steps. The original file will remain intact.
The ladder components are divided into normal components and functional
components. These components will be discussed in Chapter 3. F8 and F9
function-keys on the Function-key area (5) are for ladder subroutine control.
When pressing F1 CONT. key, the Function-key area (5) turns to next page. The
horizontal and the vertical connecting line are in F7 and F8, respectively.
8
HUST PLC Editor
♦ F8 LABEL
<name> is the subroutine name which has a max. of 6 characters, starting with a
capital letter of A~Z. Character #2~#6 can be letters or numbers. LABEL
command occupies one line of space and it will erase everything on the cursored
line. The max. number of LABEL (subroutine) allowed in a program is 128. Use
F5 RETN or F2 RTS for the last line of the subroutine.
♦ F9 JUMP
This key is for branching to another subroutine. When pressing this key, the next
line displays F1 ]JMP[ and F2 ]JSR[.
F1 ]JMP[
<name> is the subroutine name. When you use this command to branch into the
specified subroutine, the program will execute this subroutine till the end but the
program will not return to the original calling point.
F2 ]JSR[
<name> is the subroutine name. When you use this command to branch into the
specified subroutine, the program will execute this subroutine till the end and
the program will return to the original calling point.
Note that the ]JMP[ and ]JSR[ command should be preceded with a decision
statement (true or false) such as:
9
HUST PLC Editor
<filename> is the ladder filename to be compiled. (no extension required) You use
this command to compile ladder file only if you decide to produce a xxxxx.tsk file
for EPROM writing. When compiling a file, the module will do the following
things:
When compiling a ladder, the result will produce three (3) files as follows:
10
HUST PLC Editor
When editing the ladder components, both function-key and direct input methods
can be used as discussed in Chap 2. All the letters and symbols in the Function-key
area (5) are available from the keyboard. For simplicity, we will show the input
steps by function-key method only. If you use the direct input method, the data you
type in from the keyboard should be exactly the same as that in the Function-key,
including the period ".". In the explanation below, the data inside the bracket <> are
to be typed in from the keyboard.
11
HUST PLC Editor
Example:
( )
I001 O005
When the input I001 is ON, the output O005 is also ON.
When the input I001 is OFF, the output O005 is also OFF.
ON
Input Signal I001 OFF
ON
Output Signal O005 OFF
♦ Normal-negative Relay Output: Input --( / ) Output
Example:
( )
I001
When the input I001 is ON, the output O005 is OFF. O005
When the input I001 is OFF, the output O005 is ON.
ON
Input Signal I001 OFF
Output Signal O005 ON OFF
12
HUST PLC Editor
<ADDR> is the bit address, 0~127. When the input signal is from OFF to ON, the
output produces one time-cycle (one-shot) signal.
Example:
( )
I001 O005
When the input I001 is from OFF to ON, the output O005 is ON for one time
cycle. (one-shot)
ON
OFF
Input Signal I001
Output Signal O005
1time cycle
<ADDR> is the bit address, 0~127. When the input signal is from ON to OFF, the
output produces one time-cycle (one-shot) signal.
Example:
( )
I001 O005
When the input I001 is from ON to OFF, the output O005 is ON for one time
cycle. (one-shot)
ON
OFF
Input Signal I001
Output Signal O005
1time cycle
13
HUST PLC Editor
♦ ARITH ADD:
XXXX
Input ADD Output
YYYY
Add the value in XXXX to YYYY and put the result into YYYY. The value that
both XXXX and YYYY can hold is in the range of -32767~+32767. If the result
after arithmetic operation is outside this range, the result is overflowing. In this case,
it will trigger the output signal to ON.
Example 1:
#1234
ADD ( )
I001 R001 O005
Example 2:
R002
ADD ( )
I001 R001 O005
14
HUST PLC Editor
♦ ARITH SUB:
SUB XXXX
Input Output
YYYY
Subtract the value in XXXX from YYYY and put the result into YYYY. The value
that both XXXX and YYYY can hold is in the range of -32767~+32767. If the
result after arithmetic subtraction is zero (0), it will trigger the output signal to ON.
Example 1:
#1234
SUB ( )
I001 R001 O005
When I001 is ON, do arithmetic SUB operation.
Assuming the initial value, R001 = 9999 (a decimal)
Subtracting the number, 1234
The result, R001 = 8765
Example 2:
R002
SUB ( )
I001 R001 O005
15
HUST PLC Editor
♦ ARITH MUL:
Multiply the value in YYYY by XXXX and put the result into YYYY. The value
that both XXXX and YYYY can hold is in the range of -32767~+32767. If the
result after arithmetic operation is zero (0), it will trigger the output signal to ON.
Example 1:
#1234
MUL ( )
I001 R001 O005
When I001 is ON, do arithmetic MUL operation.
Assuming the initial value, R001 = 2 (a decimal)
Multiplying the number, 1234
The result, R001 = 2468
Example 2:
R002
MUL ( )
I001 R001 O005
16
HUST PLC Editor
♦ ARITH DIV:
XXXX
Input DIV Output
YYYY
Divide the value in YYYY by XXXX and put the result into YYYY. The value that
both XXXX and YYYY can hold is in the range of -32767~+32767. If the result
after arithmetic operation is zero (0), it will trigger the output signal to ON.
Example 1:
#1234
DIV ( )
I001 R001 O005
When I001 is ON, do arithmetic DIV operation.
Assuming the initial value, R001 = 1234 (a decimal)
Dividing by the number, 1234
The result, R001 = 1
Example 2:
R002
DIV ( )
I001 R001 O005
When I001 is ON, do arithmetic DIV operation.
Assuming the initial value, R001 = 1234
Dividing by the value of R002 = 1234
The result, R001 = 1
17
HUST PLC Editor
♦ DATA MOVE:
XXXX
Input MOV Output
YYYY
Move the data in XXXX to YYYY. When MOVE command is completed, the
output signal will be ON.
Example 1:
#1234
MOV ( )
I001 R001 O005
Example 2:
I016
MOV ( )
I001 R001 O005
When I001 is ON, do MOV operation.
Assuming the initial value, R001 = 9999
and I016~I031 = 0000 0100 1101 0010 in binary
The result after MOV, R001 = 0000 0100 1101 0010 in binary or 1234
18
HUST PLC Editor
CMP XXXX
Input Output
? YYYY
Compare the data in XXXX with that in YYYY. After comparison, the output
signal will be ON if the statement is TRUE, and OFF if FALSE.
Example 1:
CMP R002
( )
I001 > R001 O005
When I001 is ON, do CMP operation.
Assuming the initial value, R001 = 1234, R002 = 9999
Compare if R002 (9999) > R001 (1234)
After CMP, the statement is TRUE and O005 will be set ON.
Example 2:
CMP #1234
( )
I001 = R001 O005
19
HUST PLC Editor
♦ LOGIC AND:
AND XXXX
Input Output
YYYY
AND the value in YYYY with XXXX and put the result into YYYY. Before doing
logic AND operation, all the values in XXXX and YYYY will be converted into
binary form, then do ANDing operation. If the result after AND operation is zero
(0), it will trigger the output signal to ON.
Example 1 :
R001
AND ( )
I001 R001 O005
20
HUST PLC Editor
♦ LOGIC OR:
OR XXXX
Input Output
YYYY
OR the value in YYYY with XXXX and put the result into YYYY. The value that
both XXXX and YYYY can hold is in the range of -32767~+32767. Before doing
logic OR operation, all the values in XXXX and YYYY will be converted into
binary form, then do ORing operation. If the result after OR operation is zero (0), it
will trigger the output signal to ON.
Logic OR table:
X Y Result
1 1 1
1 0 1
0 1 1
0 0 0
Example 1:
#1234
OR ( )
I001 R001 O005
When I001 is ON, do LOGIC OR operation.
Assuming the initial value, R001 = 9999 or 0010 0111 0000 1111 in binary
ORing the value of 1234 or 0000 0100 1101 0010 in binary
The result, R001 = 10207 or 0010 0111 1101 1111 in binary
Since the result is not equal to zero (0), O005 will be OFF.
21
HUST PLC Editor
♦ LOGIC XOR:
XOR XXXX
Input Output
YYYY
XOR the value in YYYY with XXXX and put the result into YYYY. The value that
both XXXX and YYYY can hold is in the range of -32767~+32767. Before doing
logic XOR operation, all the values in XXXX and YYYY will be converted into
binary form, then do XORing operation. If the result after XOR operation is zero
(0), it will trigger the output signal to ON.
Example 1:
#1234
OR ( )
I001 R001 O005
When I001 is ON, do LOGIC XOR operation.
Assuming the initial value, R001 = 9999 or 0010 0111 0000 1111 in binary
ORing the value of 1234 or 0000 0100 1101 0010 in binary
The result, R001 = 9181 or 0010 0011 1101 1101 in binary
Since the result is not equal to zero (0), O005 will be OFF.
22
HUST PLC Editor
♦ TIMER:
TMR XXXX
Input Output
tttt YYYY
Where "tttt" is the Timer base unit, 50 ms, 0.1 sec., 1 second .
When the input signal is ON, the Timer XXXX starts counting. When the time is
equal to (tttt * YYYY), the output signal will be turned ON. For example, if
YYYY=100 with timer base unit of 50 ms, the total elapses time = 100 x 50 = 5000
ms before the output signal is turned ON.
Example 1:
TMR T002
( )
0.1sec #10
I001 O005
( )
TM001 O007
Every timer has an internal contact, acting like a normal contact. TM001 is the
internal contact of Timer T001. When the time in T001 is ON, TM001 is also
ON. Consequently, the output O007 is ON also.
23
HUST PLC Editor
♦ Up Counter:
CNT XXXX
Input Output
UP YYYY
When the input signal is ON, the Counter XXXX starts counting UP the number of
times that the input signal comes in. When the Counter counts UP to the number
specified by YYYY, the output signal will be turned ON. Once the count reaches
YYYY, this number will stay in the counter unless you use Counter Set to re-define
its value.
Note that the starting value in the Counter XXXX is very important. If it's a 0, the
number of times that the input signal comes in will be equal to YYYY. If it's greater
than YYYY, the counter will not count at all and the output will never be turned
ON.
Example 1:
CNT C001
( )
UP #5
I001 O005
( )
CNT001 O007
Count in C001 1 2 3 4 5 5 5 5
Input Signal I001
Output Signal O005
Input Signal CNT1
Output Signal O007
When the input signal I001 is ON five (5) times as registered by C001
(assuming that C001=0 initiallt), the output O005 will be ON.
Every counter has an internal contact, acting like a normal contact. CNT001
is the internal contact of Counter C001. When the number in C001 is up to 5,
CNT001 is also ON. Consequently, the output O007 is ON also.
24
HUST PLC Editor
♦ DOWN Counter:
CNT XXXX
Input DOWN
Output
YYYY
When the input signal is ON, the Counter XXXX starts counting DOWN the
number of times that the input signal comes in, as specified by YYYY. When the
Counter counts to zero (0), the output signal will be turned ON. For next count, you
have to use Counter Set to reset the starting value in the counter.
Example 1:
CNT C001
DOWN
( )
I001 #5 O005
( )
CNT001 O007
Count in C001 5 4 3 2 1 0
Input Signal I001
Output Signal O005
Input Signal CNT1
Output Signal O007
Each time the signal I001 is ON, Counter C001 (=5 initially) counts down
one step. When C001 becomes zero (0), the output O005 will be ON.
Every counter has an internal contact, acting like a normal contact. CNT001
is the internal contact of Counter C001. When the number in C001 is down
to zero (0), CNT001 is also ON. Consequently, the output O007 is ON also.
25
HUST PLC Editor
♦ Ring_Up Counter:
CNT XXXX
Input RING- Output
-UP YYYY
When the input signal is ON, the Counter XXXX starts counting UP the number of
times that the input signal comes in. When the Counter counts UP to the number
specified by YYYY, the output signal will be turned ON. Once the count reaches
YYYY, the counter will reset to zero (0) and is ready for the next count.
Example 1:
CNT C001
RING- ( )
I001 -UP #5 O005
( )
CNT001 O007
Count in C001 1 2 3 4 5 0 1 2
Input Signal I001
Output Signal O005
Input Signal CNT1
Output Signal O007
When the input signal I001 is ON five (5) times as registered by C001, the
output O005 will be ON. The counter will then reset to zero (0) and is ready
for the next count.
Every counter has an internal contact, acting like a normal contact. CNT001
is the internal contact of Counter C001. When the number in C001 is up to 5,
CNT001 is also ON. Consequently, the output O007 is ON also. When C001
repeats counting from 0, the output signal will turn OFF.
26
HUST PLC Editor
♦ Ring_Down Counter:
CNT XXXX
Input RING- Output
-DN YYYY
When the input signal is ON, the Counter XXXX starts counting DOWN the
number of times that the input signal comes in, starting from the number specified
by YYYY. When the Counter counts to zero (0), the output signal will be turned
ON. The counter will reset to YYYY and is ready for the next count.
Example 1:
CNT C001
RING- ( )
I001 DN #5 O005
( )
CNT001 O007
Count in C001 5 4 3 2 1 0 5 4
Input Signal I001
Output Signal O005
Input Signal CNT1
Output Signal O007
When the input signal I001 is ON, Counter C001 will start counting down
from 5 for each I001 ON signal. Once the count in C001 becomes 0, the
output signal O005 will be turned ON. Counter will then reset to 5 and is
ready for the next count. At the same time, the output signal O005 will be
turned OFF until C001 reaches 0 again.
CNT001 is the internal contact of Counter C001. It acts the same way as
explained before.
27
HUST PLC Editor
♦ Counter Setting:
CNT XXXX
Input Output
SET YYYY
This command is used to set a value specified by YYYY into the Counter XXXX.
The current number in the counter XXXX will be replaced by the specified value.
Example 1:
CNT C001
( )
DOWN # 5 O005
I001
♦ Ladder END:
- - - - ] END [ - - - - - - - -
End of ladder program. Each ladder diagram must have this statement at the end.
28