XINJE PLC
XINJE PLC
XINJE PLC
In PLC there are a lot of virtual relays, timers, counters. They all have "a" contacts
- normally open and "b" - normally closed.
The main PLC unit contains entrance and weekend relays numbered in the eight-
eighth X000-X007, X010-X017... and Y000-Y007, X010-X017....
The first digit of the designation indicates the block in which the entrance or exit is
located. 0 - main block, 1-7 possible expansion number. For example, in the first
extension, the ins/outs will start with the X100/Y100.
Auxiliary relay M
Auxiliary relays are not embodied in PLC, receives control only at the information
level, that is from the user program, the PPC management program or on
commands taken through the Modbus interface. The concept of auxiliary relays is
close to the concept of flags or semaphores in high-level programming
languages. Some of the auxiliary relays have the function of energy-independent
storage of their son-in-law, that is, long breaks in the nutrition of PLC will not
violate the conditions established by the program during normal
operation. Auxiliary relays with numbers starting from 8000 have special service
assignments: they allow you to manage the work of PLC and are sources of
information about the performance of the program or the operation of plc in
general for the user's program.
Status S
This software unit has the same properties as the auxiliary relay, but is used to
control branching in the program.
Counter C
The counter counts the number of signs of the control signal at its entrance.
Divided into:
16 bit with positive account direction, range of values 0..32767
32 bits with positive/negative account direction, range of values -
2,147,483,648..
high-speed 32-bit with positive/negative account direction, range of values -
2,147,483,648..z2,147,483,647
The first two types of meters are used only for the meter inside the program,
respectively, taking into account the cycle cycle cycle period of 10-50 ms and the
fact that to re-apply the control signal it before it is necessary to remove, the
minimum signal period to the program counters is 20-100 ms or 10-50 Hz for
periodic signals.
The latter type of counters does not depend on the software cycle and has electrical
inputs, which use part of the discrete inputs. The maximum score frequency is 200
kHz. Account modes are possible: easy to increase, with direction and two-phase.
Timer T
Data Registers D, FD
Registers are designed to store data. The discharge of each register is 16 bits. Two
registers can be combined into a register pair and used as a 32-bit number in
calculations. The numbers in the floating view are stored in the conroller in register
pairs. Registers with prefix D are designed to quickly store the information needed
for the program. Some of them are stored in the controller's RAM, some in RAM,
soaked from the lithium battery. The latter retain their values after the controller is
deactivated.
FD registers have the same properties when reading from them. They are located in
the controller's flash memory, not dependent on any power, but this imposes the
following restrictions:
The record cannot be done by commands that assume that the result is placed
on the general register. At the same time, these registers are modified in the
same way as regular registers under the Modbus interface.
enrollment is slower than in the general register
there is a limit on the number of recording cycles per memory cell
Constants K, H
Pointers P, I
The LD language used for the programming of this PLC was originally intended to
describe devices based on relay logic. With the advent of PLC and their
replacement with relay logic, the argument for its adoption as their primary
programming language was that many professionals would not have to
relearn. Using analogies with electrical devices, it will be easy for them to switch
to new equipment. Although this argument is no longer so relevant, because in
PLC often behind this graphic representation there is a program in some more
"habitual" (for people associated with programming) language and execution is
consistent, unlike relay schemes, where all devices work in parallel, which breaks
the analogy, the language of LD is still a tradition.PLC. Its advantage is that a pre-
exercise algorithm that could be implemented in relay logic can be described on it
without using any keywords of the controller programming language, only by
graphic language tools. At the same time, since management systems today are not
limited to discrete signals, in the PLC, the implementation of the LD language in
question allows the integration of the data command, whether mathematical or
related to the shipment or processing of binary data, into the program. In fact, the
entire program for PLC consists of commands in the language of IL (Instruction
List). This transformation occurs when the program is compiled in the LD
language. Specialists who prefer traditional microprocessor programming
languages can immediately write a management program for PLC using the IHL
language mmmocode.
Ld language is the language of rules. Its name is associated with a visual analogy
that occurs when viewing the program on it, with a ladder that has 2 tires and a
crossbar between them. The left tire is associated with a power bus for relays and
electromagnetic actuators. Every crossbar is the rule. The right tyre is the executive
mechanisms, the relays connected to the shared power source bus.
The rule is considered to work if there is at least one way from the imaginary
power source on the left to the executive mechanism on the right, and then the
executive mechanism is given a signal of permission to work.
In the future, when describing programming methods, commands of the cotroller
language will be cited, as well as their graphic and electrical analogies where
applicable.
Basic instructions.
The LD command downloads the state of bit devices such as ins, PLC exits,
auxiliary coils, timer outs and counters. When you read the state of the inputs, a
high logical level, as a result of the execution of the command, will be in case the
contacts connected to the input are closed to the general input conductor. The LDI
command will return the logical 1 if the contacts at the entrance are unlocked or
the readable bit is 0.
The OUT command activates the executable mechanism specified in its argument
if the result of the previous operation is logical 1.
example:
The program above reads the X0 login state and, if the contacts at that entrance
have been closed, trigger y0. Thus, the X0 entry state is transmitted to Y0 without
alterations. The Y1 exit is transmitted to the inverted X1 entry state. Having been
converted into controller instructions, this program looks like this.
LD X0
OUT Y0
LDI X1
OUT Y1
To understand, the result of the LD command is loaded into the battery (the data
storage register in the early microprocessors in which the command arguments
were stored and which retained the result of their execution), and then the OUT
team takes it to the specified port.
AND, ANI
example:
LD X0
AND X1
OUT Y0
LD X2
ANI X3
OUT Y1
example:
LD X0
OR X1
OUT Y0
The LDP command returns the result of detecting a positive drop at the entrance,
specified as an argument. That is, if in the previous cycle of the program execution
(scan) the specified entry gave a low level, and in the current high - the result of
execution - a high level. It follows that the high level as a result of the performance
of this command will be maintained during one scan, as the next scan will not be
sufficient to detect a positive difference, because from the point of view of the next
scan in the previous one there was already a high level and a positive difference
can not occur.
LDF returns the result of detecting a negative drop at the entrance in the same way.
From previous descriptions of commands, such as AND, it is clear that when they
are executed, it is essentially first the loading of the state of the specified entry, as
if it was made by the LD command, and then the application of the appropriate
logical operation. Logical function commands, whose mmmocode ends on P and F,
load the state specified in the entry arguments, as would be the case with LDP and
LDF commands, respectively.
Applied instructions
type designation function
CJ conditional jump
CALL Calling a routine
SRET Return from the routine
STL Start a disconnected section of code
subroutine STLE End of the code section that's being disconnected
SET Turn on the code section
ST Turn off the section of code without disabling the current
FOR FOR-NEXT cycle
NEXT the FOR-NEXT cycle
FEND The first end of the program
= L
> L
< L
<> L
<= ≠
L
>= ≤
L
= ≥
A
N
A
>
)A
N
Comparison <
of data <> N
A
<= <
N
)
A
>= (S1)≠(S2)
N
A
= ≤
N
O
(S1)≥(S2)
> )
O
< >
O
<> <
O
)
<= ≠
O
>= ≤
O
MOV ≥ Copy value into one register
BMOV Copy value into multiple registers
FMOV Fill move
Copy FWRT Record in Flash Memory
content MSET Turning on the zone
ZRST Turning off the zone
SWAP Senior 8 words change with junior 8 grades
XCH permutation
ADD addition
SUB subtraction
MUL multiplication
DIV division
INC increment
Data DEC decrement
operations MEAN average
WAND The word "I"
WOR The word "OR"
WXOR The word "Excluding or"
CML supplement
NEG negative
(Next at the beginning of each description should follow a sign with features, I will
give an example as I see them, but I will not put, otherwise if you need to remake
for some aesthetic or typographical purposes - will have to redo everything.)
Apply to blocks:
Source 1
K/H DX DY DM DS TD CD D FD
Source 2
K/H DX DY DM DS TD CD D FD
destination (or recipient)
DY DM DS TD CD D
The execution of the instruction causes the program to switch to the instruction
following the pointer specified in the argument, provided that the previous
instruction returned a high level.
In practice, the instructions reduce the duration of the scan, avoid repeated
exposure to the same devices, and change the behavior of the device depending on
its mode of operation.
The above program shows that there are two rules for influencing Y0. At the same
time, the first Y0 rule will only be considered when the X0 input is low.
The instruction does not move from one STLE instruction to another.
C
A
L
Acceptable argument for CALL: Pointer - P
L
Valid argument boundaries: P0-P9999
(rice
- from 76/86)
c
a
l
The CALL instruction triggers a shift to the routine that the pointer indicates in the
argument, provided that the previous instruction returned a high level. The SRET
instruction returns program execution control to the instruction following the last
CALL statement.
In this example, the routine between the P10 and the SRET is performed at a high
level at the X0 input. The FEND instruction shows the end of the core program's
body, and the END shows the whole program.
These 4 instructions allow you to create and manage software flows. In the text of
the program, the beginning of the stream is denoted by the STL instruction, and
ended with the STLE instruction.
Then, in order to allow the thread to be executed, you must execute set or ST
instructions with an argument pointing to the flow number. The difference between
them is that SET stops the flow from which it is executed. You can ban the thread
from running with the RST instruction, with an argument pointing to the flow.
Keep in mind that once the flow is complete, the timers they use, as well as the
registers used by the PLS, PLF instructions, are zeroed.
FOR-NEXT Cycle
:DX、DY、DM、DS、T、C、D、FD、K
t
h
e
F
O
R
-
N
E
X
T
i
n
s
t
M0
FOR K5
M1
FOR K6
INC D0 [A]
NEXT
M3 [C]
FOR K7
INC D1 [B]
NEXT
NEXT
The FEND block is used to indicate the end of the main program and the start of
the sub-programme blocks (streams).
- If the CALL instruction is in the program after the FEND instruction, there
should be an SRETinstruction. )
- After following the CALL instruction and before SRET is followed, if the
FEND is followed or FEND is followed after the FOR instruction is performed and
before following THE NEXT - this situation will cause an error
- If you use the FEND instruction, the end of the program should end
with END,if FEND is not used - the use of END is not necessary.
MOV Block
Arguments - DX、DY、DM、DS、T、C、D、FD、K
S· D·
In X0
this code,MOV
when theK10
X0 coilD10is triggered, register Dwill be enteredto 10 (the
value is automatically converted to binary code).