Some tips on Siemens S7-200PLC programming - Database & Sql Blog Articles

Probe domestic switch needle KG-300K needle head diameter is 3.0mm normally open switch needle
Photocoupler

This article gives a little trick to avoid using these instructions, making your code look more concise and shrinking the scan cycle of the program.
It is the idea of ​​space-for-time in the design of algorithms in computer programming. For example, a word variable is often converted to a double word variable in the calculation. If we define the symbol, let the variable occupy the double word memory space, and if the unused word is cleared, it can be accessed in both font or double word. This variable does not require a special conversion.
The memory format of the Siemens S7-200plc is exactly the opposite of our usual PC. It is high in the front and low in the back. So we can put the word variable in the last two bytes and clear the first two bytes when the program is initialized (the two bytes must not be used elsewhere in the program).
When we define a symbol, we define the word variable at VW2 while keeping the value of VW0 to zero. In the program, VW2 can be used to access the variable in font form. At the same time, VD0 can be accessed in double font, which avoids type conversion.
To avoid confusion at the time of use, it is best to distinguish between word types and double word types with explicit symbol definitions. It is strongly recommended that the Hungarian nomenclature be used to indicate the variable type with a prefix, and the name of the group cooperation variable of the meaningful English word capitalized with the first letter. I am used to the following suffixes:
b ---- byte type variable (byte)
w ---- font variable (word)
d ---- double word variable (double)
r ---- real variable (real)
f ---- bit variable (flag)
Btn --- Self-reset button input (button)
Sw ---- switch or self-locking button input (switch)
Sig --- sensor, coding and other level signal input (signal)
Rly --- output relay bit (relay)
......
Of course, this is based on personal habits, there is no rule, mainly to facilitate their own distinction.
If there is a word type variable named VarName, in order to use the previous conversion technique, we can define it like this:
wVarName ---- VW2
dVarName ---- VD0
Clear VW0 to zero when the program is initialized (if it is a variable that does not need to be memorized, clear dVarName directly) or set VW0 to zero in the data block. Then you need to use wVarName when you need to access variables in word type. You need to use dVarName when you need to access variables in double word type. No type conversion is needed at all.
This method can greatly reduce the number of program statements, making the program more concise and readable, and the program running efficiency is also improved because no time-consuming type conversion is required. And the greater the amount of mathematical operations, the more obvious the efficiency improvement.

The disadvantage is that it takes up two more bytes of memory, and VW0 cannot be used in future programs. However, the RAM space of the S7-200 is very large, and it is generally inexhaustible. Taking 226 as an example, there is up to 10K of RAM, and even never exceeds 1K. These RAMs are all bought for money. They don't have to be used, and they are not wasted.
Similarly, if a byte type variable often needs to be converted to and from a word type variable, letting the byte variable occupy one byte of memory is wasted one byte, avoiding type conversion.

4k Home Projector

4K Home Projector-watch ultra-high-definition movies without going out. Very suitable for home, office and school, compact design, powerful functions, this projector must be your best partner for entertainment or work.Thanks to the wireless connectivity, you'll be able to use it to download the videos, share files, enjoy more media activities.


4K Home Projector,Best 4K Projector,4K Projector,Full Hd Projector

Shenzhen Happybate Trading Co.,LTD , https://www.happybateprojector.com