PLC英文版
PLC英文版
PLC英文版
Division 1
Division 2
Division N
The PLC is executed separately in the PLC-ARM7. The 1ms of each 8ms
is the communication time for CNC to read and write PLC data. The 5ms is
the communication time for PLC to obtain system control signals (F, X),
upload control result data (G, Y parameters) and external port I/O (X, Y).
The PLC is executing ladder diagram operation at other times except for
interrupt response exchange data.
The first level
The second level
Division 1 Division 2 Division N
After the execution of the second level program with the final split number
of n, the program starts from the beginning again. Thus, when the number
of partitions is n, the execution time of a cycle is 8 * n ms. The first level
program is executed once every 8ms, and the second level program is
executed once every 8 * n ms. If the number of steps of the first level
program increases, the number of steps executed by the second level
program will be correspondingly reduced within 8ms, so the number of
partitions will become more and the processing time of the whole program
will become longer. Therefore, the first level procedure should be as short
as possible.
Task A
Task B
2) Nesting
The subprogram can call other subprograms to complete the task.
Task A12
Task B
Task An
3) Conditional branching
The main program executes circularly and checks whether the conditions
are met. If the conditions are met, execute the corresponding
subprogram. If the conditions are not met, the corresponding subprogram
will not be executed.
main program A subroutine 1
Task A Processing 1 Processing 11
Processing A12
Task B
Processing 2
Processing A12
Chapter 3 Address
The address is used to distinguish signals. Different addresses
correspond to the input/output signals on the machine tool side, the
input/output signals on the CNC side, internal relays, counters, timers,
holding relays and data tables. Each address consists of address number
and tag number. The numbering rules are as follows:
Address numbering rules:
The address number consists of address type, address number and tag
number.
X 000 . 6
Type Address No Tag No
The INT8U data type is an unsigned 8-bit character type, and the INT16U
data type is an unsigned 16 bit integer type.
3.1 Machine tool → PLC address (X)
The X address of the PLC is divided into two categories:
1. The X address is allocated to the system's CN61 input interface and
CN15 spindle interface (see Appendix 3: Definition of spindle interface), a
total of 36.
2. The X address is assigned to the input key on the MDI panel of the
system.
3.2 PLC → address on machine side (Y)
The Y address of the PLC is divided into two categories:
1. Y address is allocated to the CN62 output interface and CN15 spindle
interface of the system (see Appendix 3: Definition of spindle interface),
totaling 36.
2. The Y address is assigned to each indicator on the MDI panel of the
system.
3.3 Address of PLC → CNC (G)
The address is G0 to G63. Definition type: INT8U, 64 bytes in total. The
meaning of each address signal is shown in Appendix 4: G and F signals.
3.4 Address of CNC → PLC (F)
The address is from F0 to F63. Definition type: INT8U, 64 bytes in total.
The meaning of each address signal is shown in Appendix 4: G and F
signals.
3.5 Internal relay address (R)
This address area is cleared when the system is powered on. R510 and
R511 are occupied by the system.
Definition type: INT8U, 512 bytes in total.
Address no.
R relay area
ON shut
200ms cycle signal
ON shut
1s cycle signal
K relay area
Logical OR
Code name
Mnemonics and Functions
Mnemonics Functions
Move the contents of the register to the left by 1 bit, and set the signal
status of the specified address to St0
Move the contents of the register to the left by 1 bit, and set the signal
status of the specified address to ST0 after the value is set to none
Output the logical operation result to the specified address
Code description:
●WRT、WRT. NOT code is the coil driving code for output relay and
internal relay. The input relay cannot be used.
●Parallel WRT commands can be used continuously for many times,
but can not be output in double coils.
Programming chapter 4 PLC basic code
Mnemonics Functions
Logical AND
Logical AND after the
specified state is not taken
Code description
Use AND, AND The NOT code can connect 1 contact in series. The
number of series contacts is unlimited, and the code can be used
multiple times.
For example, programming:
Mnemonics Functions
Logical OR
Take the specified state as non
post logical OR
Code description
●Use OR, OR The NOT code can connect 1 contact in parallel.
●OR and OR.NOT refer to parallel connection with the aforementioned
RD and RD.NOT code steps starting from the step of the code
Such as programming
Mnemonics Functions
and Shift stack register right one bit after logical OR
Code description
●The OR.STK code is a separate code without an address.
Such as programming
As shown in the figure, there are three branches ①, ②, ③ from the left
bus to node N1, and branches ① and ② are all series circuit blocks.
When there are parallel series circuit blocks between the bus to node or
between nodes, except for the first branch, RD code is used at the end
of subsequent branches. Branch ③ is not a series circuit block, and the
OR code can be used.
OR.STK and AND.STK are codes without operating elements,
representing the OR, AND relationship between circuit blocks.
Programming chapter 4 PLC basic code
Mnemonics Functions
After the logical sum of ST0 and ST1,
the stack register is shifted one bit to the right
Code Description
●The AND.STK code is used when a branch circuit (parallel circuit block) is
connected in series with a previous circuit. The starting point of the branch
is RD, RD.NOT code, and after the parallel circuit block is completed, AND
is used The STK code is connected in series with the previous loop.
●AND.STK code is independent code without address.
The upper ladder diagram and instruction table, ⑴ OR.STK represents the
series circuit block in block ② in parallel, ⑵ AND.STK represents the series
connection between circuit block ① and circuit block ②.
Chapter 5 PLC Function Code
When it is difficult to program some machine tool actions with basic
instruction codes, functional instruction codes can be used to simplify
programming.
Table 5-1 (PLC function instruction code)
Format:
Programming chapter 5 PLC function code
Format:
Format:
Control conditions:
ACT=0, the next code after CALL is executed.
ACT=1, call the subprogram with the specified subprogram
number.
Parameters:
Sub procedure SN: specifies the sub procedure SN to be called.
The range of subprocess serial numbers is 0~99.
Format:
Parameters:
Sub procedure SN: specifies the sub procedure SN to be called. The
range of subprocess serial numbers is 0~99.
5.5 SP (subroutine)
Function:
SP is used to generate a subprogram. The subprogram serial number is
used as the name of the subprogram. The SP code is used with the SPE
code described later to specify the scope of the subprogram.
be careful:
1. The subprogram must be written after END2.
2. It is not allowed to set another subprogram within one subprogram.
Format:
Parameters:
Subprocedure No.: specifies the subprogram label to be called. The
range of subprocess serial numbers is 0~99.
Graphic format:
For example:
5.7 SET(Set)
Function:
Set 1 on the specified address.
Format:
Control conditions:
ACT=0,add. The state of b remains unchanged.
ACT=1,add. B Set to 1.
Parameters:
Add. b: Set the element address bit, which can be output coil, Add=Y, G, R,
K, A.
5.8 RST (reset)
Function:
Set 0 on the specified address.
Format:
Control conditions:
ACT=0,add. The state of b remains unchanged.
ACT=1,add. B Set to 0.
Parameters:
Add. b: Reset element address bit, which can be output coil, Add=Y, G,
R, K, A.
Format:
Control conditions:
ACT=0, no jump, execute the next code after JMPB.
ACT=1, jump to the specified label, and execute the next code after the
label
Parameters:
Lx: Specify the destination label of the jump. Any value from 0 to 99 can
be specified.
Programming chapter 5 PLC function code
5.10 LBL(label)
Function:
Specify a label in the ladder, that is, specify the jump destination for
JMPB.
Note that an xx label can only be specified once with LBL. Multiple
alarms.
Format:
Parameters:
Xx: specifies the target label of the jump. The label range is 0-99.
For example:
Format:
Control conditions:
ACT=0, turn off the timer.
ACT=1, start the timer.
The specific work is as follows:
Parameters:
TIMER: Timer number, represented by xxx, with xxx as a number
(0~127).
Output:
W: Output coil. When the preset is reached, W=1. W=0 when not
reached.
Note: Timer TIMER is executed every 8ms, with ms as the setting unit
and 8ms as the execution base. If it is less than 8ms, 8ms shall be
supplemented. For example, if it is set as 54ms, 54=6 * 8+6, 2ms shall
be supplemented, and the actual execution is 56ms. The timer time is
set in [TMR] under the PLC parameter interface. The system will
automatically detect the range of the timer serial number, and give an
alarm if the serial number is repeated or exceeds the range.
Format:
Control conditions:
ACT=0, turn off the timer.
ACT=1, start the timer.
Parameters:
TIMER: fixed timer number, represented by xxx, xxx is a number (0~127).
Programming chapter 5 PLC function code
Preset time:
Fixed timer timing time setting, value range (0~65535).
Output:
W: Output coil. When the preset is reached, W=1. W=0 when not
reached.
Note: The system will automatically detect the range of the timer serial
number, and give an alarm if the serial number is repeated or exceeds
the range. The preset time in this timer is fixed in ROM with the ladder,
so the timer time can only be changed by modifying the ladder file.
Format:
Control conditions:
ACT=0, turn off the timer.
ACT=1, start the timer.
Parameters:
TIMER: Timer number, represented by xxx, with xxx as a number (0~127).
Table 5-12-1 (Timer Accuracy)
Timer accuracy Set NO Set time range Error range
0 to first level program
scanning cycle
0 to first level program
scanning cycle
0 to first level program
scanning cycle
0 to first level program
scanning cycle
0 to 1 s
0 to first level program
scanning cycle
Output:
W: Output coil. When the preset is reached, W=1. W=0 when not reached.
Note: The timer time is set in [TMR] under the PLC parameter interface.
TMRC timer and TMR timer share the same address, so TMRC timer and
TMR timer cannot have the same serial number. The system will
automatically detect the range of the timer serial number, and give an
alarm if the serial number is repeated or exceeds the range.
Format:
Programming chapter 5 PLC function code
Control conditions:
Specify initial value (Cn0):
CN0=0 The counter starts from 0.
CN0=1 counter starts from 1.
Specify ascending or descending counter (UPDOWN):
UPDOWN=1 minus counter.
UPDOWN=0 plus counter.
Reset (RST):
RST=0 to remove the reset.
RST=1 is reset, W is reset to 0, and the count value is reset to the initial
value. Set RST to 1 only when a reset is required.
Count signal (ACT):
When ACT=1: count at the rising edge of ACT.
When ACT=0, the counter will not act and W will not change.
Parameters:
COUNTER: specify the counter number, represented by xxx, and xxx is a
number (0~127).
Output:
W: Coil output, when the preset value is reached, W=1.
Note 1: The system will automatically detect the range of the counter
serial number, and give an alarm if the serial number is repeated or
exceeds the range.
Note 2: After the ladder is re converted and downloaded, the current
value of the counter will be reset automatically.
Format:
Control conditions:
ACT=0: reset all output bits.
ACT=1: Perform data decoding, and set the processing result at the
output data address.
Parameters:
Length: set the size of code data in the first data of the parameter.
0001: Code data is one byte binary code data.
0002: Code data is binary code data of two bytes.
S1: code data address. Give an address to store code data.
S2: Decode the specified number. The first bit of 8 (1-byte) or 16 (2-byte)
consecutive digits to be decoded is given.
S3: decoding result address. Give an address to output the decoding
result. The storage area must have a one byte or two byte area for output.
For example:
Format:
Parameters:
Length1: Specifies the number of bytes of binary data of converted data
in the conversion table.
1: One byte binary.
2: Two byte binary.
Lengthh2: the capacity of the conversion table data. The capacity of
each conversion table cannot exceed 100. It is 100 bytes when 1 byte
format is specified, and 100 words when 2 byte format is specified. The
total capacity of all COD code conversion tables shall not exceed 512
bytes.
S1: The data in the conversion table can be retrieved by specifying the
table number. The address of the specified table number is called the
input address of the conversion data. This address requires one byte of
memory.
S2: Output address of converted data. The number of bytes of the
memory specified in the format specification starting at the specified
address.
Output:
If there is an exception during the COD code execution, W=1, it indicates
that an error has occurred.
Note: The maximum capacity of the conversion data table is 100 bytes
(words). The table is arranged between the output address of parameter
conversion data and the error output (W).
5.17 COM (Common Line Control)
Function:
COM specifies to control coil operation up to the range of common end
code COME. If no common line end code is specified, the system will
give an alarm.
Format:
Control conditions:
When ACT=0, the coil within the specified range is unconditionally turned
on and off (W=0).
ACT=1 is the same as COM code does not perform an operation.
Note 1: It is not allowed to specify other COM codes within the scope
specified by one COM code.
Note 2: When ACT of COM=0, the coil of WRT NOT within the specified
range is unconditionally set as 1 (WRT NOT=1).
Note 3: JMPB, END1, END2, CALL, CALLU, LBL, SP, SPE, COM, COME
and other function codes cannot be used between COM and COME,
otherwise the system will give an alarm.
5.18 COME (End of common line control)
Function:
This code specifies the control range of the common control line code
(COM). It cannot be used alone and must be used together with COM.
Format:
Control conditions:
Specify the initial number of the turntable (Cn0):
CNO=0 counter starts from 0.
CNO=1 counter starts from 1.
Select rotation direction by short path (DIR):
DIR=0 No selection, rotation direction is only positive
DIR=1 for selection, and the rotation direction can be divided into
positive and negative directions.
Specify operating conditions (POS):
POS=0 count target location.
POS=1 Previous position of counting target.
Specify number of positions or steps (INC):
INC=0 Number of counting positions. To calculate the previous position
of the target position, specify INC=0 and POS=1.
INC=1 counting steps. To calculate the gap between the current position
and the target position, the codes INC=1 and POS=0.
Execution code (ACT):
When ACT=0: ROT code is not executed. W has not changed.
When ACT=1: execute ROT code. Generally, set ACT=0. If the operation
result is required, set ACT=1
Parameters:
S1: Give the turntable positioning number.
S2: Address of given storage current position.
S3: Specify the address (or code value) of the storage target location.
For example, the address to store the T code output by CNC.
S4: Calculate the result output address, calculate the steps of the
turntable to rotate, and the steps to reach the target position or the
previous position. When using the calculation results, always check
whether ACT is 1.
Output:
W: Rotation direction output. Output to W through the direction of short-
circuit rotation. When W=0, the direction is positive (FOR); When W=1,
it is the reverse direction (REV). The definitions of FOR and REV are
shown in the figure below. The direction in which the position number of
the turntable increases is the positive direction (FOR); If reduced to
REV. The address of W can be selected arbitrarily. However, when using
the result of W, always check the condition of ACT=1.
For example:
There is a turntable as follows:
current location
Perform short path rotation and calculate the position number of the
previous position of the target position.
The current position number S2=1, the number of indexing positions
S1=12, CNO=1, DIR=1, POS=1, INC=0.
Then:
S3=10 When the target position is A, under ACT=1, S4=11, W=1
S3=8 When the target position is B, under ACT=1, S4=9, W=1
S3=5 When the target position is C, under ACT=1, S4=4, W=0
S3=3 When the target position is D, under ACT=1, S4=2, W=0
5.20 SFT (register shift)
Function:
This code can shift 1-byte long (8-bit) data by the number of bits
specified in the code parameter each time. For cyclic shift, each overflow
"1" will be added from the opposite direction. If the highest bit is "1" and
overflow occurs during left shift, the lowest bit will be added to "1", and
the opposite direction is also.
Programming chapter 5 PLC function code
Format:
Mobile Format
bit data specification
address
Control conditions:
Specify shift direction (DIR)
DIR=0 Shift Left
DIR=1 Shift Right
Status assignment (CONT)
CONT=0 Do not rotate
CONT=1 Rotate
Reset (RST)
Reset shift output data (W=1) is (W=0)
RST=0 W does not reset
RST=1 W reset (W=0)
Execution conditions (ACT)
Do not execute SFT code when ACT=0.
If ACT=1, execute the shift. If only 1 bit is moved, set ACT to 0 after the
code is executed.
Parameters:
S1: Set the shift data address, which is composed of a byte storage
area.
Length: a four digit number, as defined in the following figure:
Move Status
Output:
W: After W=0 shift operation, no "1" state is moved out.
After W=1 shift operation, a "1" state is moved out.
Format:
Control conditions:
Input signal: Set the output signal to 1 at the rising edge of the input
signal (0 1).
Output signal: When this function code is executed, the output signal is
kept as 1 during a scanning cycle of the ladder.
Parameters:
50: The rising edge is 0~255. If another DIFU code or DIFD code in the
ladder uses the same number, the system will alarm.
Operation:
The system will automatically detect the range of the serial number of
the rising edge, and give an alarm if the serial number is repeated or
exceeds the range.
Control conditions:
Input signal: Set the output signal to 1 at the falling edge (1◆0) of the
input signal.
Output signal: when this function code is executed, the status of output
signal 1 will keep a scanning cycle of ladder.
Parameters:
50: The number of falling edge, ranging from 0 to 255. If there is
another DIFU code or DIFD code number in the ladder, the system will
alarm.
Operation:
Execution cycle
The system will automatically detect the range of the serial number of
the falling edge, and give an alarm if the serial number is repeated or
exceeds the range.
5.23 COM(binary number comparison)
Function:
Compares the size of two binary data. You need to specify enough
bytes in the storage area to store the input data and comparison data.
Format:
Length S1 input S2
format data Comparison
specification address data address
Control conditions:
ACT=0, do not execute COMP code. The W value remains unchanged.
ACT=1, execute COMP code
Parameters:
Length: the specified form (constant or address) of input data and the
specified data length (1, 2 bytes).
Specify data length
Format specification 1: 1 byte long
0: Constant 2: 2 bytes long
1: Address
Format:
Control conditions:
ACT=0, do not execute COIN code. The W value remains unchanged.
ACT=1, execute COIN code.
Parameters:
Length: the specified form (constant or address) of input data and the
specified data length (1, 2 bytes).
Output:
W: W=0: input value ≠ comparison value.
W=1: input value=comparison value.
5.25 MOVN (data transmission)
Function:
To transfer source address data or specified binary data to the destination
address.
Graphic format:
Control conditions:
ACT=0, no data is transmitted.
ACT=1, a specified number of bytes are transmitted.
Parameters:
Length: the number of bytes or data to be transmitted.
S1: Source starting address or constant.
Select the transmission mode according to S1:
1. When S1 is a constant, if S2 is a single byte address, copy S1 by byte
to the address of corresponding Length bytes starting from S2 address;
If S2 is a word address, take S1 as a word, and the address of the
corresponding Length word starting from S2 address.
2. When S1 is an address, data will be transmitted by byte address
regardless of whether S1 and S2 address types match.
S2: Target starting address.
For example:
Graphic format:
Delivery Delivery
source destination
address address
Control conditions:
ACT=0, no data is transmitted.
ACT=1, 1 byte is transmitted.
Parameters:
S1: Source address or constant.
If S2 is a single byte address, copy S1 to S2 by byte; If S2 is a word
address, copy S1 to the low byte address of S2 by byte.
S2: Destination address.
Graphic format:
Delivery Delivery
source destination
address address
Control conditions:
ACT=0, no data is transmitted.
ACT=1, 1 byte is transmitted.
Parameters:
S1: Source address or constant.
S2: Destination address.
Programming chapter 5 PLC function code
Format:
Length S1 data S2 Data S3 input/ S4 Table
format table header output number
specification capacity address data storage
storage address address
address
Control conditions:
Specify read or write operations (RW)
RW=0: Read data from the data table.
RW=1: write data to the data table.
Reset (RST)
RST=0: reset is released.
RST=1: reset W=0.
Execution code (ACT)
ACT=0: XMOV code is not executed, and W remains unchanged.
ACT=1: execute XMOV code.
Parameters:
Length: the format specifies the length of data to be transferred.
1: 1 byte long.
2: 2 bytes long.
S1: Data table data capacity storage address. This address is used to
store the data capacity of the data table. The number of bytes it
occupies should conform to the length specified by Length. The
effective range of data is determined by the length of bytes specified in
the Length1 format.
1 byte: 1 to 256.
2 bytes long: 1 to 128, i.e. 128 × 2=256 bytes, which is the capacity of
PLC data table.
S2: Set data header address. The storage area of data table is byte
length × The number of data in the data table. The header address must
be the value set in the D data sheet.
S3: Input/output address. When reading data, set the address for
storing the reading results. When writing data, set the address to store
the written data. The number of bytes it occupies should conform to the
Length format setting. Limit the address to a D register.
S4: Table number storage address. Used to store the number in the
table that is read out or written into data. The number of bytes it
occupies should conform to the specification in Length. If the set table
number is greater than the data stored in S1, the error output W=1. The
actual transmission address=header address+number in the table, the
number in the table is 0~(S1-1), and the actual transmission address
cannot exceed the data table.
Output:
When the number in the table exceeds the value in S1, W=1, the read or
write operation of the data table will not be executed.
W=0, indicating no error.
W=1, indicating an error.
Format:
Length S1 data S2 Data S3 S4
format table header Search Search
specification capacity address Data result
storage Address output
address address
Control conditions:
Duplicate detection (REP)
REP=0: Execute the DSCH code and start the search from the first
address of the data table. Whether the target data appears repeatedly
will not be considered. When the target data is detected for the first time,
the search will be stopped and its address will be output. If the retrieved
data is not found, W=1.
REP=1: Execute DSCH code. If the retrieved data is not found or there
are two (more than two), then W=1.
Reset (RST)
RST=0: reset is released.
RST=1: reset W=0.
Execution code (ACT)
ACT=0: DSCH code is not executed, and W remains unchanged.
ACT=1: execute DSCH code. If the retrieved data is found, the number in
the table is output. If it is not found or there are two (more than two), then
W=1.
Parameters:
Length: The format specifies the length of the retrieved data.
1: 1 byte long.
2: 2 bytes long.
S1: Storage address of data number in data table. The byte length
specified by this address allocates the storage area of the required
bytes. The number of data in the data table is n+1 (the header is 0, and
the footer is n).
Programming chapter 5 PLC function code
S2: Set data header address.
S3: Set the retrieval data input address.
S4: Search result output address. Actual address=head address+number
in the table, the number in the table is 0~(S1-1), and the actual address
cannot exceed the data table. After retrieval: if the retrieved data is
found, the number in the table is output, and the number in the table is
output to the retrieval result output address. The number of storage bytes
required for this address should conform to the specified format.
Output:
W=0, find the retrieved data.
W=1, the retrieved data is not found.
Control conditions:
Reset (RST):
RST=0: reset is released.
RST=1: reset W=0.
Execution code (ACT):
ACT = 0: Do not execute the ADD code, W remains unchanged.
ACT=1: execute the ADD code.
Parameters:
Length: Specify the data length (1 byte or 2 bytes) and the specified
method (constant or address) of the addend.
Output:
W=0: the operation is normal.
W=1: Abnormal operation.
When the addition result exceeds the specified data length, W=1.
5.31 SUB (binary subtraction)
Function:
This code is used for subtraction of 1-byte and 2-byte binary data. The
minuend data and the output data of the subtraction result need to set
the storage address of the corresponding byte length.
Format:
Output
Format Minuend Subtract address
specification address of
operation
result
Control conditions:
Reset (RST):
RST=0: reset is released.
RST=1: reset W=0.
Execution code (ACT):
ACT=0: no SUB code is executed, W remains unchanged.
ACT=1: execute SUB code.
Parameters:
Length: Specify the data length (1 or 2 bytes) and the specified method
(constant or address) of the addend.
Output:
W=0: the operation is normal.
W=1: Abnormal operation.
When the result of subtraction exceeds the specified data length, W=1.
5.32 ANDF (bitwise AND)
Function:
This code matches the content in address A with a constant (or the
content in address B), and stores the result in address C.
Format:
Control conditions:
ACT=0: no ANDF code is executed.
ACT=1: execute ANDF code.
Parameters:
Length: specify the data length (1 or 2 bytes), and enter the data format
(constant or address).
S1: Specify the input data to be compared with. Start from this address
and the data length is consistent with the length specified.
S2: Input data corresponding to input data. When the format
specification is selected as the address specification, it starts from this
address and the data length is consistent with that specified by Length.
S3: Address used to store ANDF operation results. The results of ANDF
operation are stored at this address, and the data length is consistent
with the length specified by Length.
For example, when address A and address B contain the following data:
The results of ANDF operation are as follows:
Address C
Format:
Control conditions:
ACT=0: No ORF code is executed.
ACT=1: execute ORF code.
Parameters:
Length: specify the data length (1 or 2 bytes), and enter the data format
(constant or address).
S1: Specify the input data to be phased or. Start from this address and
the data length is consistent with the length specified.
S2: Input data corresponding to or corresponding to input data. When
the format specification is selected as the address specification, it
starts from this address and the data length is consistent with that
specified by Length.
S3: Address used to store ORF operation results. The result of ORF
operation is stored at this address, and the data length is consistent
with the length specified by Length.
Format:
Control conditions:
ACT=0, do not execute NOT code.
ACT=1, execute NOT code.
Parameters:
Length: Specify the data length (1 or 2 bytes).
S1: Input data inverted bit by bit. Start from this address and the data
length is consistent with the length specified.
S2: Address used to output the NOT operation result. The result of the
NOT operation is stored at this address, and the data length is
consistent with the length specified by Length.
For example:
When address A and address B contain the following data:
Address A
Address B
5.35 EOR(XOR)
Function:
This code distinguishes the content in address A from the constant (or
the content in address B) or, and stores the result in address C.
Format:
Control conditions:
ACT=0: EOR code is not executed.
ACT=1: execute EOR code.
Parameters:
Length: specify the data length (1 or 2 bytes), and enter the data format
(constant or address).
S1: Specify the input data to be differentiated or. Start from this address
and the data length is consistent with the length specified.
S2: Input data different from or. When the format specification is
selected as the address specification, it starts from this address and is
consistent with the length specified by Length.
S3: Address used to store EOR operation results. The EOR operation
results are stored at this address, and the data length is consistent with
the length specified by Length.
For example: when address A and address B contain the following data:
red
The button is locked after being pressed, and the method of release
varies with the manufacturer of the bed. Normally the right rotation is
released.
Emergency stop signal ESP (G008.4)
● Signal type: PLC → NC
● Signal function: input emergency stop signal to stop the machine
tool immediately. When the emergency stop signal ESP changes to 1,
the CNC is reset and the machine tool is in the emergency stop state.
● Signal address
Overtravel signal
+L1~+L4(G30.0~G30.3)
-L1~-L4(G31.0~G31.3)
● Signal type: PLC → NC
● Signal function: it indicates that the control shaft has reached the
limit of travel, and each direction of each control shaft has this signal.
The+and - of the signal name indicate the direction, and the number
corresponds to the control axis.
● Signal address
1 X axis feed
2 The Z-axis feed
3 The Y-axis feed
4 The A-axis feed
+Feed in positive direction
-Feed in negative direction
When No. is 1, the control unit acts as follows:
*When JOG feed or incremental feed is valid, the control unit moves the
specified axis in the specified direction. In JOG feeding, when the signal
is 1, the control unit makes the control axis move continuously.
*In incremental feeding, the control unit makes the specified axis feed
according to the defined step, and then the control unit stops moving.
When the axis is fed, the control unit will not stop feeding even if the
signal is 0. To move the axis again, set the signal to 0 and then to 1.
● Signal address
Manual rapid feed selection signal RT (G019.7)
● Signal type: PLC → NC
● Signal function: select the rapid feed speed of JOG feed or
incremental feed.
When the signal becomes 1, the control unit operates as follows:
The control unit performs JOG feed or incremental feed at rapid feed
rate. The rapid feed rate is valid.
During JOG feed or incremental feed, when the signal is switched from
1 to 0 or vice versa, the feed speed decreases until 0. Then it increases
to the defined value. During acceleration and deceleration, the feed
axis and direction selection signal can be kept at 1.
● Signal address
5.2 Reset
Under the following conditions, the CNC is reset and enters the reset
state.
1. Set the emergency stop signal (ESP) to 1
2. Press the<RESET>key on the MDI
When the CNC is reset, the reset signal RST is output to the PLC. After
the above conditions are removed, the reset signal RST is 0 after the
reset signal output time set by parameter 71.
RST=T reset (reset processing time)+parameter 71 setting value
tool tool
Fast moving
magnification 50%
● Signal address
FV00~FV07 (G012)
● Signal type: PLC → NC
● Signal function: cutting feed rate multiplying signal. There are 16
gears from 0% to 150%. In automatic operation, the actual feed speed is
obtained by multiplying the specified cutting feed speed by the
multiplying value selected by these signals.
● Signal address
The processing is as follows: (Change the M code to S, T code, that is, the
processing of spindle speed function and tool function)
A: Assume that M is specified in the program. If CNC is not specified, an
alarm will be generated.
B: After the code signals M00 ~ M31 are sent to the PLC, the strobe signal
MF is set to 1, and the code signal expresses the program instruction
value in binary form.
C: When the pass signal MF is 1, the PLC reads the code signal and
executes the corresponding operation.
D: At the end of the operation, the PLC sets the end signal FIN to 1. The
end signal is used for auxiliary functions, spindle speed and tool functions.
If these functions operate at the same time, the end signal FIN must not be
set to 1 until all functions are completed.
F: When the end signal FIN is 1 and must last for a period of time, CNC will
set the strobe signal to 0 and confirm that the end signal has been
received.
G: When the pass signal is 0, the FIN signal is set to 0 in PLC.
H: When FIN signal is 0, CNC sets all code signals to 0 and ends all
sequence operations of auxiliary functions. (When executing the spindle
speed function and tool function, the code signal remains until a
corresponding new code is assigned)
1: When the execution of instructions in the same program segment is
completed, CNC will execute the next program segment. In practical
application, PLC adopts the following timing sequence:
Function Chapter 7 Auxiliary Functions
● Signal address
Function Chapter 7 Auxiliary Functions
● Signal address
AFL(G0005.6):
● Signal type: PLC → NC
● Signal function: PLC sets G5.6 to 1, and then transfers it to NC,
prohibiting the execution of M, S, and T functions.
● Precautions:
When AFL signal is 1, CNC performs the following processing:
A: For automatic operation and operation in the input mode, the CNC does
not perform the specified M, S and T functions, that is, the code signal and
strobe signal are not output.
B: If AFL is set to 1 after the code signal is output, it will be executed in the
normal way until the execution ends (until the FIN signal is received and the
strobe signal is set to 0).
C: When AFL is 1, M00, M01, M02 and M30 commands can be executed,
and the corresponding code signal, strobe signal and decoding signal are
output in the normal way.
D: When AFL is 1, the auxiliary functions M98 and M99 are still executed in
the normal way, but the execution results are not output.
E: When AFL is 1, the spindle analog quantity can still be output.
● Signal address
S12 bit code (R12O ~ R01O) output: NC calculates the spindle speed of each
gear through gear shift processing, that is, S12 bit code signal R12O ~ R01O
(0~4095) is output to the spindle motor and PLC. The relationship between
10V voltage and S12 bit code is shown in the figure below:
Function Chapter 7 Auxiliary Functions
SPHD(G036.0)
● Signal type: PLC → NC
● Signal function: When the analog spindle function is valid, the PLC sets
G036.0 to 1 and sends it to NC, and the designated spindle inching function
is valid. When the spindle rotates normally, G036.0 is 0.
● Signal address
MSPHD(F043.0):
● Signal type: NC → PLC
● Signal function: when CNC is executing the spindle jogging, NC will set
F043.0 to 1, and then send it to PLC to inform PLC that the spindle jogging is
being executed; F043.0 is 0 in the non spindle jogging execution state.
● Signal address
Rigid tapping refers to synchronizing the tapping shaft with the main shaft in
the normal tapping fixed cycle. In rigid tapping, CNC needs to detect the
rotation direction signal of the spindle to determine the cutting feed direction
and processing process.
Execution process: spindle rotation → Z-axis feeding and tapping →
sending M05 stop command to the spindle → waiting for the spindle to stop
completely → sending reverse command → Z-axis tool retraction to the
starting point → spindle stop. Therefore, in order to achieve rigid tapping,
corresponding ladder diagram must be prepared to inform the rotation
direction of the CNC external spindle.
SRVB(G025.4)、SFRB(G025.5):
● Signal type: PLC → NC
● Signal function: During rigid tapping, the PLC sets G25.4 and G25.5, and
then sends them to the NC to inform the NC whether the spindle is rotating
forward or backward. Thus starting the cutting feed; SRVB=1 when the
spindle is in forward rotation; When the spindle reverses, SFRB=1; When
the spindle stops, SRVB and SFRB are set to 0.
● Precautions: When CNC starts rigid tapping, PLC must set SRVB and
SFRB to inform CNC of the current spindle rotation direction.
Function Chapter 7 Auxiliary Functions
● Signal address
Although the subprogram is very useful for repeating the same operation,
the user macro program function allows the use of variables, arithmetic
operations, logical operations and conditional branches, which is very
easy for developing general programs. The processing program can use
a simple code to call the user macro program just like the subroutine.
This means that programming a function with macro program can make it
a general function. That is, programs can be written with data variables
(variable data or unknown data). For example, user macro program can
be used for group process.
● Signal address
Function Chapter 10 Display/Setting
Chapter 11 Display/Setting
11.1 Soft operation panel
The function of the soft operation panel is to replace some control
switches of the machine tool operation panel with soft switches. Use the
key on the MDI panel to turn the soft switch on or off. The status of all
soft switches shall be informed to PLC by output signals. For example,
setting the single section soft switch SBKO to 1 does not enable the
CNC to select single section operation. Only when the PLC changes the
input signal SBK of single section operation to 1 can the CNC select
single section operation.
Step X1000 Soft key X1000 (F032.7)
Step X100 soft key X100 (F032.6)
Step X10 soft key X10 (F032.5)
Step X1 soft key X1 (F032.4)
X+soft key X+(F034.2)
X soft key X - (F034.3)
Z+soft key Z+(F034.4)
Z-soft key Z - (F034.5)
Spindle forward rotation soft key SCW (F034.6)
Spindle stop soft key SSTOP (F034.7)
Spindle counterclockwise soft key SCCW (F035.7)
Select the stop soft key MSTOP (F035.6)
Auxiliary function locking soft key AFLO (F035.5)
Program skip section soft key BDTO (F035.4)
Single program segment soft key SBKO (F035.3)
Machine lock soft key MLKO (F035.2)
DRNO (F035.1)
Fast moving soft key QFAST (F035.0)
Feed multiplying rate increase soft key FEED+(F036.0)
Feed multiplying rate decrease soft key FEED - (F036.1)
Fast multiplying soft key FAST+(F036.4)
Fast multiplying soft key FAST - (F036.5)
Spindle multiplying soft key S+(F036.6)
● Signal type: NC → PLC
● Signal function: NC sets the above F signal and then transmits it to
PLC; PLC sets the corresponding G signal according to the F signal
status, transmits it to NC, and selects the corresponding function.
● Signal address
Chapter 12 Measurement
12.1 Jump function
As with G01, the axis movement can be specified after the G31 code to
command linear interpolation. If an external jump signal is input during
the execution of this command, the execution of this command is
interrupted and the next program segment is executed. When the
measuring end point is not programmed, but the processing is
completed with the signal command from the machine tool, the jump
function is used. For example, when grinding. The jump function can
also be used to measure the workpiece size. The coordinate values
when the jump signal is turned on can be used in the user macro
program because they are stored in the system variables # 5061 to #
5068 of the user macro program, as follows:
#5011 Coordinate value of the first axis
#5012 Coordinate value of the second axis
#5013 Coordinate value of the third axis
Jump signal SKIPP (G006.6)
● Signal type: PLC → NC
● Signal function: this signal ends skip cutting. That is, in a block
containing G31, the position where the jump signal becomes "1" is
stored in the user macro variable. At the same time, the motion code of
the program segment is ended.
When the jump signal becomes "1", the controlled device works as
follows:
A. When the program segment includes the skip processing code G31,
the control device reads and stores the signal as the current position of
the code axis in era 1. The control unit stops the movement of the axis,
and then clears the remaining movement distance of the code axis in
this block.
B. The jump signal is monitored not for its rising edge, but for its state. In
this way, if the jump signal continues to be "1", when the next jump
cutting is instructed, it is considered that its jump condition is met
immediately.
● Precautions
Jump signal width shall be at least 10ms.
● Signal address
Operation Chapter 1 PLC Interface Display
1. Press the "Ladder Diagram" key on the panel to switch to the PLC
information page, as shown in Fig. 1-2-1-1.
2. Press the page turning key on the panel under the PLC information
interface to enter the next PLC information interface, as shown in the
following figure:
(1) When the system is powered on for initialization, the number of the
ladder file currently running is set by the data parameter. If the format is
incorrect, the file will be deleted and rebuilt. You need to carefully specify
the file number of the running ladder. The file name of all ladder drawing
files must be "ladderXX. grp" (XX means number), otherwise the files will
not be recognized by the system. The file format is specified by the
system, and users cannot modify it outside the system, otherwise it may
be deleted or unrecognized.
(2) Selection of ladder diagram file. Move the cursor or enter "LX"/"LXX"
(X/XX is a number) to specify the file name. When pressing the "Enter"
key, the system will detect whether "X"/"XX" is a known file number. If it is
not detected, the ladder file will be created according to the file name
"ladder0X. grp" or "ladderXX. grp". When creating a new file, the system
automatically generates two function blocks, "END1" and "END2", so
that users can continue to operate the ladder diagram file (if the file is
opened without conversion, the instruction list will always be empty).
After opening a ladder diagram for editing, the system will automatically
save the current file when opening another file without saving it. Before
saving, the system will first check the ladder diagram syntax. If an error is
detected, the system will give up saving.
(3) The file header contains the basic information of the file, such as the
number of lines and steps. The step information is updated only after the
conversion, otherwise it will always be the information when the file is
opened. To edit the currently running ladder diagram, you need to stop its
running state first. When the cursor stays at the position of editing file,
the user can open PLC information modification by pressing
the<Convert>key on the panel to modify the ladder diagram version
number, adaptive machine tool and ladder diagram maintainer of the file
being edited.
You can use the page up/down key and the four direction keys on the
panel to search and locate, and view or modify the corresponding
address.
1.2.4 PLC diagnosis interface
Press the key "Ladder Diagram" on the panel to switch the screen and
enter the PLC diagnosis interface.
(1) PLC signal diagnosis interface:
As shown in Fig. 1-2-4-1:
Output coil
Vertical conductor
3. Position the cursor at the beginning of the next line, press the [ ]
soft key, a symbol of normally open contact will appear at the cursor
location, input the component name G008.4 directly, press
the<Enter>key to confirm, and the component G008.4 will appear at the
current cursor position. Press the [ ] soft key, a symbol of normally
closed contact will appear at the cursor location, input the component
name F001.1 directly, press the<Enter>key to confirm, and the
component F001.1 will appear at the current cursor position.
4. Move the cursor one position to the right, press the [ ] soft key,
and draw a horizontal conducting line at the current cursor position;
5. Move the cursor up one position, press the [ ] soft key, and draw
a vertical conducting line at the lower right position of the current cursor;
6. Press the [ ] soft key, the system will automatically generate the
output coil, that is, the necessary horizontal conducting wire, and the
output coil will be generated on the right side of the ladder. Input the
component name G8.4 directly, press<Enter>, and press the key to
confirm. The component G008.4 appears at the current cursor position.
Note: The green element in the ladder diagram, whether normally open, normally
closed or output coil, indicates that the element is in the on state, while the white
element indicates that it is in the off state. (Due to the printing problem, the dark
color in the figure is the off state, and the light color is the on state)
In the function code list, 35 PLC function codes are listed. For the format
and usage of the function code, please refer to Part II Programming. The
operation of the function code is written in accordance with the operation
instructions of 2.3 ladder diagram.
2.5 Editing Order
Press the [Edit Order] soft key in Fig. 2-1-1 to enter the editing order
operation interface. As shown in Fig. 2-5-1.
[ Insert Line]: Position the cursor to any line of the target line, and then
press the [Insert Line] soft key to insert a blank line above the line
specified by the cursor. The subsequent rows are moved down one row
in turn.
[Delete Line]: Position the cursor to the target line and press the [Delete
Line] soft key to delete the current line and move the subsequent lines
up one line in turn.
[Save]: press the [Save] soft key to save the modified ladder.
[Line Note]: Press the [Line Note] soft key to modify the current line
note of the ladder.
[Return]: return to the parent menu.
4.1 General
At present, the system supports the supporting ladder diagram editing
software.
Ladder diagram editing software is a series of ladder diagram editors,
which mainly provides ladder diagram editing, conversion, error
checking and printing functions. This software can run on Windows 98,
Windows Me, Windows 2000, Windows XP and Windows 2003.
4.2 Software introduction
4.2.1 Start software
Ladder diagram editing software is a green software, which does not
need to be installed. Double click Lad Edit Exe to run the software.
4.2.2 Function introduction
□ File menu
The File menu includes functions such as creating, opening and saving
program files, generating executable ladder files or binary files, printing,
print preview and print settings, and listing recently opened files.
Note: In the dialog box "Edit ladder information", the columns "Ladder version number",
"Applicable machine tool" and "Last modified by" can only be expressed in English, not in
Chinese, otherwise an error will occur after transmission.
□ Edit menu
The edit menu includes the functions of cutting, copying, pasting,
searching, converting and editing ladder diagrams.
□ View menu
Controls the display and hiding of toolbars, status bars, output windows,
and command list windows.
□ Window menu
Controls the selection and layout of various window openings.
□ Help Menu
Version information of this software.
Convert ladder
Find Component
Add a vertical conductive line (at the bottom right of the cursor)
Delete the vertical conductive line at the lower right of the component
1. Click the small arrow on the right of the button to pop up the drop-down
menu and select the function code.
2. Or click the button icon to pop up the function code selection dialog
Installation and connection Chapter 4 Machine Tool Debugging
When selecting a block, press the left mouse button at the beginning of
the block and drag it to the end line of the block. Before releasing the left
mouse button, the selected area is represented by a rectangle of dots
and lines.
After loosening, the whole ladder is inverted, which means that the
ladder within the range is selected and can be used for the next
operation, such as cutting, deleting, copying, etc.
2. Select Edit [Alt+E] in the main menu ---- Modify Note [M].
Enter comments in the pop-up dialog box and click OK to save.
The saved comments will appear in the output window at the bottom
of the screen when selecting components, as shown below:
4.3.5 Export
1.5 F signal
Zp15: 5TH axis returned to the first reference point end signal
ZP14: 4TH axis returned to the first reference point end signal
ZP13: End signal of Y-axis returning to the first reference point
ZP12: End signal of Z-axis returning to the first reference point
ZP11: End signal of X-axis returning to the first reference point
Zp25: 5TH axis returns to the second reference point end signal
ZP24: 4TH axis returned to the second reference point end signal
ZP23: End signal of Y-axis returning to the second reference point
ZP22: End signal of Z-axis returning to the second reference point
ZP21: End signal of X-axis returning to the second reference point
Zp35: 5TH axis returned to the third reference point end signal
ZP34: 4TH axis returned to the third reference point end signal
ZP33: End signal of Y-axis returning to the third reference point
ZP32: End signal of Z-axis returning to the third reference point
ZP31: End signal of X-axis returning to the third reference point
Zp45: 5TH axis returns to the fourth reference point end signal
ZP44: 4TH axis returned to the fourth reference point end signal
ZP43: End signal of Y-axis returning to the fourth reference point
ZP42: End signal of Z-axis returning to the fourth reference point
ZP41: End signal of X-axis returning to the fourth reference point
TLIFE: The service life of all tools in the same group has reached
Operation panel key input address Operation panel key input address
Edit mode key User1 key
Automatic mode key Z axis handwheel/direction selection key
Input method key Fast moving key
Machine tool zero point mode key Z axis negative direction selection key
Hand wheel mode key Spindle jogging key
Manual mode key Spindle stop key
DNC mode key Cooling key
4th axis handwheel/direction selection key Lubrication key
Z axis handwheel/direction selection key X1 key
Y axis negative direction selection key X10 key
Spindle quasi stop button X100 key
Spindle counterclockwise rotation key X1000 key
Spindle multiplying ratio+key 5th axis handwheel/direction selection key
Fast multiplying+key Z axis negative direction selection key
Feed rate+key 4th axis negative direction selection key
Cycle start key Tool change key
Single segment key Spindle clockwise rotation key
Skip key Spindle magnification - key
Machine lock key Fast multiplying - key
Auxiliary lock key Feed rate - key
Empty run key Feed holding key
Select Stop key
2.3 Y address on CN62 output interface (standard ladder):
2.5 F signal
Zp15: 5TH axis returned to the first reference point end signal
ZP14: 4TH axis returned to the first reference point end signal
ZP13: End signal of Z-axis returning to the first reference point
ZP12: End signal of Y-axis returning to the first reference point
ZP11: End signal of X-axis returning to the first reference point
Zp25: 5TH axis returns to the second reference point end signal
ZP24: 4TH axis returned to the second reference point end signal
ZP23: End signal of Z-axis returning to the second reference point
ZP22: End signal of Y-axis returning to the second reference point
ZP21: End signal of X-axis returning to the second reference point
Zp35: 5TH axis returned to the third reference point end signal
ZP34: 4TH axis returned to the third reference point end signal
ZP33: End signal of Z-axis returning to the third reference point
ZP32: End signal of Y-axis returning to the third reference point
ZP31: End signal of X-axis returning to the third reference point
Zp45: 5TH axis returns to the fourth reference point end signal
ZP44: 4TH axis returned to the fourth reference point end signal
ZP43: End signal of Z-axis returning to the fourth reference point
ZP42: End signal of Y-axis returning to the fourth reference point
ZP41: End signal of X-axis returning to the fourth reference point
2.6 G signal