Hardware template: Variable optional but no default value given

0
In the image below i have shown a part of a template file of the AQ_4xUI_ST-module from the ET200SP-family. The variable 'OUTPUTADDRESS' is optional, but there is no 'Value' parameter given with it that decides what the defaultvalue is. If the programmer decides to not use the variable in the configuration, what will the value of 'OUTPUTADRESS' be if there is no value given to it? Is it undeterministic or is there still a default value that will be given to it by the compiler?
asked
2 answers
0

Optional: True simply means the variable is not required. If the programmer does not provide it in the configuration, it will not cause an error.


However, this does not mean there is a default value. If no Value or DefaultValue is defined, most template engines will either leave the value empty/null or simply not generate that field.


If OUTPUTADDRESS should always have a value, the safest solution is to explicitly define it in the configuration or set a default value in the template logic instead of relying on Optional: True.


If this resolves your question, please mark the answer as accepted.

answered
0

If no output address is provided in the .yml files, either by the template designer nor by the template user, the hardware-compiler will internally choose an own address according to a specific pattern (automatically generated). Usually this is starting with 0 and counting upwards.


Ultimatly you can check the (generated) addresses in the
...\SystemConstants\xyz_HWIdentifiers.st

...\SystemConstants\xyz_IoAddresses.st
files.


Keep going & happy coding ...

🐱‍💻 BEEP, BOOP, BEEP, BEEP, BOOP 🐱‍🏍

answered