Share this

With so many variables in PLC programming, how can the addresses be planned to make them easy to remember?

2026-04-06 05:15:00 · · #1

First, let's look at the soft components that represent variables in a PLC. They mainly include inputs (X), outputs (Y), auxiliary relays (M), timers (T), counters (C), status indicators (S), and data registers (D). Small PLCs typically have very few X and Y components, usually 40 or 60 points. The planning can be done according to the input/output type. The main thing is to distinguish between high-speed inputs and high-speed outputs, and not to occupy the common ones.

There are two types of auxiliary relays (M): ordinary and power-off retention. The appropriate type should be selected based on the needs. When planning the addresses, a program or function block should use consecutive M numbers, starting from 0, 10, 20, etc., leaving some space in between for future additions. For example, if this block uses M206, the next block should start with M210 or M220. For parallel outputs, use LDM72ORM82ORM92OUTY1. Consistent numbering at the end makes it easier to remember and facilitates checking during final debugging.

Timers come in different time units, such as 1ms, 10ms, and 100ms, and also in standard and cumulative types, chosen according to requirements. Like the M type, their address numbers can be planned based on their application. Counters also come in standard and high-speed versions, 16-bit and 32-bit versions, and hold-type counters, etc., again determined by needs. Generally, high-speed counters have fixed usage, with each input having a fixed counter value.

Address planning and selection should first be determined by needs and functions. Then, the actions expressed in PLC programming should be uniformly numbered. For PLC sequential control programs, we should try to declare and comment segments accurately during programming, as shown in the figure below. Divide the entire PLC program into several small segments. Each segment can write specific action combinations, parts, functions, meanings, etc. Then, the address planning is arranged in each segment. The first segment uses M0~M100, the second segment uses M100~M200, etc. This makes it easier for us to find component variables and is very helpful for programming and later debugging.

Furthermore, to make it easier to remember, we can also use labels to mark software variables, eliminating the need for comments. For example, the label for X0 is "Start" and the label for Y0 is "Indicator Light". In the future, we can directly use "LD Origin OUT Indicator Light" to represent LDX0OUTY0, which is more convenient. Each variable in the PLC can be declared with a label.


Disclaimer: This article is a reprint. If it involves copyright issues, please contact us promptly for deletion (QQ: 2737591964). We apologize for any inconvenience.

Read next

CATDOLL Himari Hybrid Silicone Head

The hybrid silicone head is crafted using a soft silicone base combined with a reinforced scalp section, allowing durab...

Articles 2026-02-22