Once an expansion module is fitted, a fixed rule connects the address used in the program with the module's physical position. Lose track of that rule and you get "the module is clearly plugged in but the program cannot read it", or an address range shifted by one place. The sections below set out the relationship between physical position, start address and program address.
The physical view asks which slot the module occupies and what type it is; the logical view asks how the program addresses it. An allocation rule links the two: each slot corresponds to a block of addresses, and the module type decides whether that block is organised by bit or by channel. The address written in the program is the logical one; it carries no memory of which slot the module sits in and simply reads the physical location the rule points to. The heart of the matter is therefore the slot-to-address conversion.
Two approaches exist. With fixed addresses, each slot maps to a preset range, so swapping the module does not change the range and the program needs no edit. With automatic allocation, the controller assigns addresses module by module in order and by type, so change the slot order and every module downstream shifts. The first is convenient for porting, while the second is more flexible but demands care on insertion and removal: after any change the addresses must be rechecked.
The usual rule is that the built-in I/O of the base unit occupies a block of base addresses, and expansion modules start at a defined point and accumulate upwards by point count or channel count. Digital modules occupy a number of bits or bytes according to their point count; analog modules occupy a number of words according to their channel count. Note that "occupying by point count" is not the same as "occupying whole bytes": some families pad a partial byte up to a byte boundary, which leaves a gap between the start address of one module and the next. When checking addresses, read the family's allocation rule first and then accumulate module by module.
An analog channel normally corresponds to one word, or a double word. Take a typical module: if the expansion block starts at a given number, channel 1 corresponds to the start word, channel 2 to the start word plus one, and so on. If the module is an analog input, the program reads on that pattern; if it is an analog output, the program writes on the same pattern. With mixed modules, the word count of each module must be accumulated separately rather than treating inputs and outputs as one pool.
On families using automatic allocation, moving a module's slot or inserting a new one shifts the start address of every module downstream. So export a program backup and record the original allocation before the change, then verify online afterwards that each module's address still matches its reference in the program. The step most often overlooked is inserting a small module in the middle: it occupies little address space itself, yet pushes the whole row of modules behind it along, and the program misses on every one of them unless it is edited.
| Module position | Physical slot | Start address (indicative) | How the program addresses it |
|---|---|---|---|
| Built-in inputs | Slot 0, internal | Start of the base input block | Bit addressing with offset |
| Built-in outputs | Slot 0, internal | Start of the base output block | Bit addressing with offset |
| First digital input module | Expansion slot 1 | Start of the expansion block | Bit addressing, by point count |
| Second digital output module | Expansion slot 2 | After the previous module | Bit addressing, by point count |
| Third analog input module | Expansion slot 3 | Accumulated from the modules before | Word read per channel |
| Fourth analog output module | Expansion slot 4 | Accumulated from the modules before | Word write per channel |
| Special function module | Expansion slot 5 onwards | Its own block by type | Function block or dedicated registers |
| Remote I/O station | Separate station | Block assigned by station number | Station number plus module number |
| High-speed counter module | Expansion slot n | Fixed channel block | Count value read by function block |
| Communication module | Expansion slot n | Occupies no I/O address block | Communication instructions or data area |
The most practical defence against address displacement is a "module position to address" table kept alongside the I/O allocation table and updated whenever a module is added or removed. Using symbolic names in the program rather than hard-coded addresses also confines the fallout of a slot change to one place. Where the family supports automatic allocation, fix the module order in the hardware configuration and discourage casual plugging and unplugging, which is what causes large-scale displacement when someone adjusts a rack on site.
The I/O requirements and electrical characteristics of PLC equipment follow GB/T 15969.2 (IEC 61131-2). Programming languages, variables and addressing methods follow GB/T 15969.3 (IEC 61131-3). The specific allocation rules, slot definitions and module address blocks of a family are as stated in its hardware manual; the items listed here illustrate the conversion.
Fitting, removing or swapping modules requires the machine to be isolated, proved dead and locked off; after the change, verify each module's address against its reference in the program online before returning to service.