Method for shortening the scan cycle of PLC program

The scan cycle is an important indicator of the PLC. The scan cycle of a small PLC is generally from ten to several tens of milliseconds. The length of the scan cycle of the PLC depends on the scan speed and the length of the user program. The scan time in milliseconds is usually allowed for general industrial equipment, and the short delay of the PLC to the input is also allowed. However, for devices that respond quickly to certain I/Os, appropriate actions should be taken. If you select a high-speed CPU, increase the scanning speed; select fast response module, high-speed counting module and different interrupt processing to reduce the lag time.

Method for shortening the scan cycle of PLC program

Improve PLC operation efficiency and shorten execution time when completing the same task.

01
You can avoid using "double words" when using "words". When you can use integers, try to avoid real numbers.
02
Priority is given to IB, IW, ID, QB, QW, QD (except hardware connections), followed by M, S;
03
Try to avoid data type conversion. When you have to use it, try to use AC to store intermediate variables and reduce the number of conversions. Or, when programming, first reserve the storage space. For example, when VW2 is used to store an integer, VW0 is not used, and the data in VW2 can be directly accessed in the form of VD0.
04
Reduce unnecessary network scanning, classify networks that can be conditionally executed (especially AIW, AQW) into subroutines for conditional calls (such as timed interrupts);
05
Use XOR instruction to achieve arbitrary bit negation (this instruction is slightly more difficult, more need to be carefully aligned during debugging, binary number is recommended when programming);
06
Under the premise of ensuring the process requirements, appropriately reduce the frequency of interruptions;
07
The subroutine should minimize the number of conditional judgments, normalize the subroutine import and export parameters, and thus reduce code redundancy.
08
For repetitive, time-consuming tasks, sub-cycle processing should be used; this includes: apportioning the initialization work to multiple cycles. The sampling time of multiple PID loops is slightly different to avoid multiple interrupt calls in the same cycle, which makes the scan cycle more uniform and stable.
09
For subroutine calls with less input data, you can first determine whether the input data has changed. If there is no change (for comparison, refer to the 48th floor), you can skip the subroutine directly, thus reducing the scan cycle.
10
Try to arrange the bit variable in the V area in V511.7, and arrange the VB/VW/VD variable with high frequency to be placed in V4095, which can shorten the program scanning period.
11
If SM0.0 is connected in series with other signals, it only increases the program size and execution time. It has no other effect (if the network has already met the necessary contacts on the left side, it is not necessary to connect SM0.0 in parallel);
12
When there is no need to share signals, multiple instructions placed in the same network will generate additional inbound and outbound operations (which can be converted to STL for analysis), and if not logical, avoid horizontal in-line, so that at least one can be reduced. With the "instruction. The benefit is just to put it in a network and feel a bit compact.

13
Reasonable use of the immediate IO command (to minimize use) saves the conversion time of the PLC processing immediate instructions.
14
Try to use the calculation result memory instead of the transition memory in the calculation.

Construction And Building Staple

Construction And Building Staple,Construction 16 Gauge Nail,Fine Wire Staples,Medium Wire Staples

Zhejiang Best Nail Industrial Co., Ltd. , https://www.beststaple.com