An address can be assigned to a module in the hardware declaration using the IoConfiguration option.
The following example shows a PLC module (PLC_1) with an input (DI_1) and output module (DQ_1):
- The address for the
DI_1module is set to9.0and - The outputs of the
DQ_1module is set to be available from the address32
{
"Devices": [
{
"Name": "Device1",
"Modules": [
{
"Name": "PLC_1",
"TypeIdentifier": {
"OrderNumber": "6ES7 516-3AN01-0AB0",
"Version": "V2.9"
},
"AccessProtection": {
"AccessLevel": "NoAccess"
}
},
{
"Name": "DI_1",
"TypeIdentifier": {
"OrderNumber": "6ES7 521-1BL00-0AB0",
"Version": "V2.2"
},
"IoConfiguration": {
"InputAddress": "9.0"
}
},
{
"Name": "DQ_1",
"TypeIdentifier": {
"OrderNumber": "6ES7 522-1BL01-0AB0",
"Version": "V1.1"
},
"IoConfiguration": {
"OutputAddress": "32"
}
}
]
}
]
}
For both the input and the output address, the configured value represents the "start address", i.e. the address at which the module's address space starts.
The length of the address space depends on the type of the module being specified in the hardware declaration.
After running apax hwc compile, the length can be seen in the IO Address Lock File.
Note that both the InputAddress and OutputAddress options are of type string.
The address can be specified in two formats:
- Either as a plain number (e.g.
32) where the number represents the byte address of the module, or - In the notation
<BYTE>.<BIT>where<BYTE>represents the byte address of the module and<BIT>specifies the index of the bit within that byte. Thus, the address values32and32.0are equivalent. - The absolute bit-address is computed from the address using the formula
(BYTE * 8) + BIT. For example1.3is the 11th ((1 * 8) + 3) bit.
CAUTION
The S7-1500 PLC family only accepts whole bytes as an IO start address (x, x.0).