The following example illustrates how the IO address assignment works.
A simple hardware declaration file Example.hwl.json may look like the one below:
DI_1is an input module which contains anIoConfigurationwith the input address9.0in the hardware declaration file.DQ_1is an output module for which no address is defined in the hardware declaration file.
{
"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"
}
}
]
}
]
}
To generate the IO address file, run
apax hwc compile --input "Example.hwl.json" --output "output/"
A lock file named PLC_1.IoAddresses.json will be generated.
It contains a list of all IO modules and their addresses:
Device1/DI_1has an input address of9.0as specified in the hardware declaration file (indicated by theSourcevalue ofUserDefined)- The address of
Device1/DQ_1was automatically set to0.0. Thus, theSourceproperty isAutoAssigned.
{
"Version": 1,
"IoAddresses": [
{
"Ref": "Device1/DI_1",
"IoConfiguration": {
"InputAddress": [
{
"StartAddress": "9.0",
"EndAddress": "12.7",
"Length": 32,
"Source": "UserDefined"
}
]
}
},
{
"Ref": "Device1/DQ_1",
"IoConfiguration": {
"OutputAddress": [
{
"StartAddress": "0.0",
"EndAddress": "3.7",
"Length": 32,
"Source": "AutoAssigned"
}
]
}
}
]
}
Each module is identified by its logical path in the hardware declaration which is saved in the Ref property.
It uses the same syntax as Ref options in the hardware declaration file (e.g., for assigning a module to a device).