Speak with authority, quality is trustworthy.

By reducing the number of program statements to improving the efficiency of the PLC program -

by:Coolmay     2020-08-14

optimized by this method can greatly reduce the number of program statements, make the PLC controller program more concise, readable, because do not need to do time consuming type conversion, process efficiency is also improved. And mathematical computation, the greater the efficiency, the more obvious.

disadvantage is to take up two bytes of memory, more later in the program cannot use VW0. But S7 - 200 RAM space is very big, generally is to burn, in 226, for example, there are as many as 10 k RAM, I never had more than 1 k. The RAM are bought, not white, not also is wasted.

in the same way, if there is a byte type variables often need and word type transformation, let take up a word memory byte variable width waste a byte, avoid type conversion. Specific steps are as follows:

1: according to the practical demand, function block planning, write a subroutine

neutron in the PLC program is compiled for the purposes of some specific control relatively independent program. Instruction execution CALL subroutine CALL, etc. , if the condition does not meet the subroutine CALL, the application of scanning is only in the main program, no longer to scan the jokes, thus reducing unnecessary scan time.

2: words or double word is rumored to DO some methods to control the output

there are usually a lot of in the application of PLC output control, words or double word is rumored to DO some methods to control the output can improve the speed, as long as according to the requirements of practical application, the reasonable distribution of output address, commutation control output control word, can greatly reduce the steps of PLC program execution, so as to speed up the PLC program is running.

3: pulse triggering the SET and RESET

PLC, using the SET command can be executed only once, don't need to scan every time to carry out the instructions, fit and pulse output ( PLS/PLF) Instruction. Some engineering personnel to overlook the problem, using the conventional method to drive a SET order, inadvertently increased the PLC program scans the running time.

4: avoid type conversion, the method is as follows:

to S7 - 200 as an example, its memory format is the opposite of our commonly used PC, it is the high word before, and the low word in the back. So we can put two bytes after word variable, two bytes before the program initialization time will reset ( The rest of the program may not use this two bytes) 。

if we define symbols defined word variable in VW2, while maintaining VW0 value is zero. The program can be used in the VW2 to access the variable type, at the same time also can VD0 with double word access, to avoid the type conversion.

in order to avoid confusion when using, in order to make clear the best symbol definition to distinguish word type and double word type. In this class are strongly recommended to Hungarian: with a prefix indicating variable types, with capitalize the first letter of the English words in the group cooperation variable names. I used the following compose: b - — — — Byte type variable ( byte)

        w— — — — Type variable ( 词)

        d— — — — Double word variable ( 双)

        r— — — — Real variables ( real)

        f— — — — A variable ( 国旗)

        btn— — - - - - - - Since the reset button input ( 按钮)

        sw— — — — Toggle switch, or the lock button input ( 开关)

        sig— — - - - - - - Sensor, the coding level signal input (such as 信号)

r - — - - - - - - The output relay ( relay)

of course, this according to personal habits, there is no rule, mainly to distinguish his advantages.

if there is a word type variable named VarName, for using the above transformation technique, we can define like this:

wVarName - — — — VW2

        dVarName— — — — VD0

in the program initialization time will VW0 reset ( If you don't need to memory variables, directly to the dVarName reset can also) Or in the heart of the data block VW0 set to zero. Later need to word with wVarName when type variable access, need to double word type with dVarName when variable access. No need to type conversion.


An increasing dependence on the use of plc manufacturers programmable control systems has made numerous changes in the plc controller price industry over the past decades.
Shenzhen Coolmay Technology Co., Ltd. also values the time, skills, and expert opinions of our staff. We are committed to providing fair and living wages, reasonable, structured work schedules, and clear duties and spheres of rights and responsibilities for each team member.
Shenzhen Coolmay Technology Co., Ltd. will need to find one that fits our needs and budgets, and still turns out a quality product.
Chat Online
Chat Online
Chat Online inputting...
Sign in with: