Component functions

setVariable(name,value) Assigns the variable (with the specified value) to the current component. The variable exists with the component instance; it is not affected if the component is disabled, but for future extension it is not guaranteed that the variables will be preserved for disabled components. All variables are removed if variant of the peripheral initialization component is changed. It is not stored into the project. The function returns empty string. The variable name must be an identifier. The variable names starting with PE_ and PEx_ prefixes are reserved for interaction with Processor Expert core.
getVariable([@comp@]name[,default-value]) Returns value of the component variable; if the variable does not exists, returns default-value; if default-value is not specified generates script error; optional @comp@ prefix can be used to refer variables from other components (via component name), prefix @_CPU_@ can be used to refer processor component.
delVariable(name) Removes the component variable; if variable does not exists, returns string not_found, otherwise returns empty string.
Listing: Example - Count Execution of Script
%setVariable(exec_counter,%EXPR(1+%getVariable(exec_counter,0)))
%hint COUNTER = %getVariable(exec_counter)
%if (%getVariable(exec_counter) == "1000")
  %delVariable(exec_counter)
%endif  

Reserved script variables for Processor Expert Core:

PEx_RequiredInitMethodName Defines with non-empty value, if the component initialization is not called after reset, value contains name of the method, that needs to be invoked for the initialization.
PEx_RequiredPinRoutingInitMethodName Defines with non-empty value, if the pin-routing initialization is not called after reset; value contains name of the method, that needs to be invoked for the initialization; this variable is used to identify "dynamic" configuration for pins model.
PEx_RequiredPeripheralsModelInitMethodName Defines with non-empty value, if the peripheral initialization is not called after reset; value contains name of the method, that needs to be invoked for the initialization; this variable (if defined) is used to identify "dynamic" configuration for property model.
PEx_InitSequenceComment Contains comment displayed for the component in the InitializationSequence view; optional value.
PEx_ClkSigOutFreqTxt_<element> Reserved for interaction with clock diagrams custom view plug-in; specifies text to be displayed as output frequency for clock signal element in clock flow diagram; <element> is a name (identifier) of the clock signal element.
PEx_GeneratesComponentModule Used to disable generation of the component module using %INTERFACE and %IMPLEMENTATION; acceptable value is "no"; this information may be also specified statically in the Options section of .bean file.
PEx_PinAndPropertyModelDynamicConflictResolutionMsg Contains extension of dynamic (run-time) error message displayed for the component; the component may define the text to specify recommended resolution for the conflict.
PEx_ImplementationModules comma separated list of the component implementation modules including project relative path and file extension; “/” slashes are used to separate directories in the path (backslashes shall not be used); it is used if the implementation module does not match with component name, usually if static implementation module is provided from the component; the variable is used in Processor Expert to display code of the selected method; for example, GeneratedCode/UART3.c, GeneratedCode/UART3.h
PEx_ImplementationModules4Method{mthd} Same as PEx_ImplementationModules, but content is applicable only for method identified by symbol {mthd}.
PEx_ComponentMethodFirstParam Value of first method parameter (valid for all component methods); used for drag'n'drop method invocation in user code.
PEx_PddMethodFirstParam Value of first PDD/PESL parameter (valid for all PDD/PESL component commands); used for drag'n'drop command invocation in user code.
PEx_ NoModulePrefix the variable is alternative way to component option NoModulePrefix, how the component may specify, that generated code does not contain module prefix in the method name. If the variable is defined, the methods are generated without prefix. Value of the variable is ignored. This option does not affect code generation, the component script must ensure the corresponding code is generated.