2 ; **********************************************************************************
 
    3 ; Microchip Technology Inc. and its subsidiaries.  You may use 
this software 
 
    4 ;  and any derivatives exclusively with Microchip products. 
 
    6 ;  THIS SOFTWARE IS SUPPLIED BY MICROCHIP 
"AS IS".  NO WARRANTIES, WHETHER 
 
    7 ;  EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED 
 
    8 ;  WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A 
 
    9 ;  PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION 
 
   10 ;  WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. 
 
   12 ;  IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, 
 
   13 ;  INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND 
 
   14 ;  WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS 
 
   15 ;  BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE 
 
   16 ;  FULLEST EXTENT ALLOWED BY LAW, MICROCHIP
'S TOTAL LIABILITY ON ALL CLAIMS  
   17 ;  IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF  
   18 ;  ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.  
   20 ;  MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE  
   22 ; ********************************************************************************** 
   23 ; ********************************************************************************** 
   24 ;  SDK Version: PowerSmartâ„¢ Digital Control Library Designer v0.9.12.672 
   25 ;  CGS Version: Code Generator Script v3.0.7 (03/07/2021) 
   27 ;  Date/Time:   03/08/2021 12:42:58 
   28 ; ********************************************************************************** 
   30 ;------------------------------------------------------------------------------ 
   31 ; Define status flags bit positions 
   32     .equ NPNZ16_STATUS_ENABLED,      15     ; bit position of the ENABLE control bit 
   33     .equ NPNZ16_STATUS_INVERT_INPUT, 14     ; bit position of the INVERT_INPUT control bit 
   34     .equ NPNZ16_STATUS_SWAP_SOURCE,  13     ; bit position of the SWAP_SOURCE control bit 
   35     .equ NPNZ16_STATUS_SWAP_TARGET,  12     ; bit position of the SWAP_TARGET control bit 
   36     .equ NPNZ16_STATUS_AGC_ENABLED,  11     ; bit position of the AGC_ENABLED control bit 
   37     .equ NPNZ16_STATUS_USAT,         1      ; bit position of the UPPER_SATURATION_FLAG status bit 
   38     .equ NPNZ16_STATUS_LSAT,         0      ; bit position of the LOWER_SATURATION_FLAG status bit 
   40 ;------------------------------------------------------------------------------ 
   41 ; NPNZ16b_s data structure address offset declarations for data structure addressing 
   42     .equ Status,                        0   ; controller object status word at address-offset = 0 
   43     .equ ptrSourceRegister,             2   ; parameter group Ports.Source: pointer to source memory address 
   44     .equ SourceNormShift,               4   ; parameter group Ports.Source: bit-shift scaler of normalization factor 
   45     .equ SourceNormFactor,              6   ; parameter group Ports.Source: Q15 normalization factor 
   46     .equ SourceOffset,                  8   ; parameter group Ports.Source: value of source input signal/value offset 
   47     .equ ptrAltSourceRegister,          10  ; parameter group Ports.AltSource: pointer to alternate source memory address 
   48     .equ AltSourceNormShift,            12  ; parameter group Ports.AltSource: bit-shift scaler of normalization factor 
   49     .equ AltSourceNormFactor,           14  ; parameter group Ports.AltSource: Q15 normalization factor 
   50     .equ AltSourceOffset,               16  ; parameter group Ports.AltSource: value of alternate source input signal/value offset 
   51     .equ ptrTargetRegister,             18  ; parameter group Ports.Target: pointer to target memory address 
   52     .equ TargetNormShift,               20  ; parameter group Ports.Target: bit-shift scaler of normalization factor 
   53     .equ TargetNormFactor,              22  ; parameter group Ports.Target: Q15 normalization factor 
   54     .equ TargetOffset,                  24  ; parameter group Ports.Target: value of target output signal/value offset 
   55     .equ ptrAltTargetRegister,          26  ; parameter group Ports.AltTarget: pointer to alternate target memory address 
   56     .equ AltTargetNormShift,            28  ; parameter group Ports.AltTarget: bit-shift scaler of normalization factor 
   57     .equ AltTargetNormFactor,           30  ; parameter group Ports.AltTarget: Q15 normalization factor 
   58     .equ AltTargetOffset,               32  ; parameter group Ports.AltTarget: value of alternate target output signal/value offset 
   59     .equ ptrControlReference,           34  ; parameter group Ports.ConrolReference: pointer to control reference variable/register memory address 
   60     .equ ptrACoefficients,              36  ; parameter group Filter: pointer to A-coefficients array start address 
   61     .equ ptrBCoefficients,              38  ; parameter group Filter: pointer to B-coefficients array start address 
   62     .equ ptrControlHistory,             40  ; parameter group Filter: pointer to control history array start address 
   63     .equ ptrErrorHistory,               42  ; parameter group Filter: pointer to error history array start address 
   64     .equ ACoefficientsArraySize,        44  ; parameter group Filter: size of the A-coefficients array 
   65     .equ BCoefficientsArraySize,        46  ; parameter group Filter: size of the B-coefficients array 
   66     .equ ControlHistoryArraySize,       48  ; parameter group Filter: size of the control history array 
   67     .equ ErrorHistoryArraySize,         50  ; parameter group Filter: size of the error history array 
   68     .equ normPreShift,                  52  ; parameter group Filter: value of input value normalization bit-shift scaler 
   69     .equ normPostShiftA,                54  ; parameter group Filter: value of A-term normalization bit-shift scaler 
   70     .equ normPostShiftB,                56  ; parameter group Filter: value of B-term normalization bit-shift scaler 
   71     .equ normPostScaler,                58  ; parameter group Filter: control loop output normalization factor 
   72     .equ PTermScaler,                   60  ; parameter group Filter: P-Term coefficient scaler 
   73     .equ PTermFactor,                   62  ; parameter group Filter: P-Term coefficient fractional factor 
   74     .equ AgcScaler,                     64  ; parameter group GainControl: bit-shift scaler of Adaptive Gain Control Modulation factor 
   75     .equ AgcFactor,                     66  ; parameter group GainControl: Q15 value of Adaptive Gain Control Modulation factor 
   76     .equ AgcMedian,                     68  ; parameter group GainControl: Q15 value of Adaptive Gain Control Modulation nominal operating point 
   77     .equ ptrAgcObserverFunction,        70  ; parameter group GainControl: function pointer to observer function updating the AGC modulation factor 
   78     .equ MinOutput,                     72  ; parameter group Limits: minimum clamping value of primary control output 
   79     .equ MaxOutput,                     74  ; parameter group Limits: maximum clamping value of primary control output 
   80     .equ AltMinOutput,                  76  ; parameter group Limits: minimum clamping value of alternate control output 
   81     .equ AltMaxOutput,                  78  ; parameter group Limits: maximum clamping value of alternate control output 
   82     .equ ptrADCTriggerARegister,        80  ; parameter group ADCTriggerControl: pointer to ADC trigger A register memory address 
   83     .equ ADCTriggerAOffset,             82  ; parameter group ADCTriggerControl: value of ADC trigger A offset 
   84     .equ ptrADCTriggerBRegister,        84  ; parameter group ADCTriggerControl: pointer to ADC trigger B register memory address 
   85     .equ ADCTriggerBOffset,             86  ; parameter group ADCTriggerControl: value of ADC trigger B offset 
   86     .equ ptrDProvControlInput,          88  ; parameter group DataProviders: pointer to external variable/register the most recent, raw control input will be pushed to 
   87     .equ ptrDProvControlInputComp,      90  ; parameter group DataProviders: pointer to external variable/register the most recent, compensated control input will be pushed to 
   88     .equ ptrDProvControlError,          92  ; parameter group DataProviders: pointer to external variable/register the most recent control error will be pushed to 
   89     .equ ptrDProvControlOutput,         94  ; parameter group DataProviders: pointer to external variable/register the most recent control output will be pushed to 
   90     .equ ptrExtHookStartFunction,       96  ; parameter group ExtensionHooks: pointer to external extension function which will be called by this controller at the beginning after evaluating the enable flag. This function call will be bypassed when the controller is disabled. 
   91     .equ ExtHookStartFunctionParam,     98  ; parameter group ExtensionHooks: 16-bit wide function parameter variable or pointer to a parameter variable or data structure of extension function 
   92     .equ ptrExtHookSourceFunction,      100 ; parameter group ExtensionHooks: pointer to external extension function which will be called by this controller after the most recent controller input has been read and compensated but before the most recent error is calculated. 
   93     .equ ExtHookSourceFunctionParam,    102 ; parameter group ExtensionHooks: 16-bit wide function parameter variable or pointer to a parameter variable or data structure of extension function 
   94     .equ ptrExtHookPreAntiWindupFunction, 104 ; parameter group ExtensionHooks: pointer to external extension function which will be called by this controller after the most recent compensation filter result has been computed and before  anti-windup clamping is applied 
   95     .equ ExtHookPreAntiWindupFunctionParam, 106 ; parameter group ExtensionHooks: 16-bit wide function parameter variable or pointer to a parameter variable or data structure of extension function 
   96     .equ ptrExtHookTargetFunction,      108 ; parameter group ExtensionHooks: pointer to external extension function which will be called by this controller before the most recent controller output is written to target, after the value has passed through anti-windup clamping. 
   97     .equ ExtHookTargetFunctionParam,    110 ; parameter group ExtensionHooks: 16-bit wide function parameter variable or pointer to a parameter variable or data structure of extension function 
   98     .equ ptrExtHookStopFunction,        112 ; parameter group ExtensionHooks: pointer to external extension function which will be called by this controller after the compensation loop computation has been completed. This function call will be bypassed when the controller is disabled. 
   99     .equ ExtHookStopFunctionParam,      114 ; parameter group ExtensionHooks: 16-bit wide function parameter variable or pointer to a parameter variable or data structure of extension function 
  100     .equ ptrExtHookEndFunction,         116 ; parameter group ExtensionHooks: pointer to external extension function which will be called by this controller after the compensation loop computation has been completed, regardless of the loop execution being bypassed or not 
  101     .equ ExtHookEndFunctionParam,       118 ; parameter group ExtensionHooks: 16-bit wide function parameter variable or pointer to a parameter variable or data structure of extension function 
  102     .equ usrParam0,                     120 ; parameter group Advanced: generic 16-bit wide, user-defined parameter #1 for user-defined, advanced control options 
  103     .equ usrParam1,                     122 ; parameter group Advanced: generic 16-bit wide, user-defined parameter #2 for user-defined, advanced control options 
  104     .equ usrParam2,                     124 ; parameter group Advanced: generic 16-bit wide, user-defined parameter #3 for user-defined, advanced control options 
  105     .equ usrParam3,                     126 ; parameter group Advanced: generic 16-bit wide, user-defined parameter #4 for user-defined, advanced control options 
  106     .equ usrParam4,                     128 ; parameter group Advanced: generic 16-bit wide, user-defined parameter #5 for user-defined, advanced control options 
  107     .equ usrParam5,                     130 ; parameter group Advanced: generic 16-bit wide, user-defined parameter #6 for user-defined, advanced control options 
  108     .equ usrParam6,                     132 ; parameter group Advanced: generic 16-bit wide, user-defined parameter #7 for user-defined, advanced control options 
  109     .equ usrParam7,                     134 ; parameter group Advanced: generic 16-bit wide, user-defined parameter #8 for user-defined, advanced control options 
  111 ;------------------------------------------------------------------------------ 
  112 ;end of include of NPNZ16b_s data structure and global constants 
  114 ; ********************************************************************************** 
  115 ;  Download latest version of this tool here: https://areiter128.github.io/DCLD 
  116 ; **********************************************************************************