Automatic addressing

Previous chapterNext chapter Show allShow all    Hide allHide all

We use the same example as above, but in the properties of the structure variable we change the array dimension 1 from 0 to 2.

After clicking on Finish, the variable list looks as follows:

The existing structure was changed to the effect that now each structure element is available twice.

For our example with the S7 driver, this results in the following automatic addressing, provided that we activated: Each data type starts with new offset:

"Engine Speed Control[1].Engine Speed.Set": Net address 0, datablock 50, offset 100, bit 0

"Engine Speed Control[1].Engine Speed.Actual": Net address 0, datablock 50, offset 101, bit 0

"Engine Speed Control[1].Engine Speed.Ein/Aus[1]": Net address 0, datablock 50, offset 103, bit 0

"Engine Speed Control[1].Engine Speed.Ein/Aus[2]": Net address 0, datablock 50, offset 103, bit 1

"Engine Speed Control[1].Engine Speed.Monitoring": Net address 0, datablock 50, offset 104, bit 0

"Engine Speed Control[2].Engine Speed.Set": Net address 0, datablock 50, offset 105, bit 0

"Engine Speed Control[2].Engine Speed.Actual": Net address 0, datablock 50, offset 106, bit 0

"Engine Speed Control[2].Engine Speed.Ein/Aus[1]": Net address 0, datablock 50, offset 108, bit 0

"Engine Speed Control[2].Engine Speed.Ein/Aus[2]": Net address 0, datablock 50, offset 108, bit 1

"Engine Speed Control[1].Engine Speed.Monitoring": Net address 0, datablock 50, offset 109, bit 0

"Last used offset": 109 bit 7

The array structure was created exactly like a simple structure. The second structure array starts exactly, where the first ends.

Changing the driver to S5 results in the following:

"Engine Speed Control[1].Engine Speed.Set": Net address 0, datablock 50, offset 100, bit 0

"Engine Speed Control[1].Engine Speed.Actual": Net address 0, datablock 50, offset 101, bit 0

"Engine Speed Control[1].Engine Speed.Ein/Aus[1]": Net address 0, datablock 50, offset 102, bit 0

"Engine Speed Control[1].Engine Speed.Ein/Aus[2]": Net address 0, datablock 50, offset 102, bit 1

"Engine Speed Control[1].Engine Speed.Monitoring": Net address 0, datablock 50, offset 102, bit 8

"Engine Speed Control[2].Engine Speed.Set": Net address 0, datablock 50, offset 103, bit 0

"Engine Speed Control[2].Engine Speed.Actual": Net address 0, datablock 50, offset 104, bit 0

"Engine Speed Control[2].Engine Speed.Ein/Aus[1]": Net address 0, datablock 50, offset 105, bit 0

"Engine Speed Control[2].Engine Speed.Ein/Aus[2]": Net address 0, datablock 50, offset 105, bit 1

"Engine Speed Control[1].Engine Speed.Monitoring": Net address 0, datablock 50, offset 105, bit 7

"Last used offset": 105 bit 15

The array structure was created exactly like a simple structure. The second structure array starts exactly, where the first ends. Here, differences are possible, depending on the option Each data type starts with new offset: If this option is activated, the next structure array always starts at a new offset, even if the next structure would fit into the same offset.

Example Example

The last structure element is a SINT (8 bit) and uses offset 102 bit 0 to 7. For the example with the S5 driver (16 bit offsets), the next structure would start as follows:

Option "Each data type starts with new offset" activated: Offset 103 bit 0

Option "Each data type starts with new offset" deactivated: Offset 102 bit 8

 

One structure is now directly after the other.