I’ve been working with creating Symbols (also Hierarchical Blocks) that use Programmable Attributes.
A GREAT set of features! Right?
For example, I can specify an Attribute as follows:

This declares the “Test” attribute as an int and with entry limits of 8 to 100 inclusive.
If I use the symbol and alter the “Test” attribute outside the limits, it warns me and prevents setting the new value outside the limits. Excellent … right? PRO
Here’s the CON:
I create a global parameter
.param Targ=10
I then try to set the “Test” attribute with “Targ”. I get the limit error message even if Targ is within the limits.
Here’s a simple .qsch illustrating both the PRO and CON.
Prog_attr_issue.qsch (572 Bytes)
To test the PRO, set “Test” to a value outside the limits. The Error is thrown and prevents you from setting a value outside the limit. This is expected.
To test the CON, set “Test” to “Targ”. The Error is thrown and prevents you from setting to a global parameter. This is because the error checking occurs at design-time.
The fix 1
By changing the Symbol Attribute definition to eliminate int[MIN:MAX], this prevents the design-time limit checking and allows me to place the param name “Targ” into “Test”.
However… if I want to perform limits testing, I need to do it inside the CBlock. For example here is a simple code snippet:
if((Test<8) || (Test>100)) Exit(“Test=%d. Limit exceeded\n”,Test);
This will flag the error exceeding the limit at run-time.
The fix 2
I can leave the design-time checking on the Symbol Attribute if I don’t use parameters in this field. If I want to use a global parameter in the Attribute, I can eliminate limit checking in the Symbol Attribute for that instance of the Symbol.
Any thoughts?
Any other PROs or CONs with Programming Attributes?
