Digital Power Starter Kit 3 Firmware
dsPIC33C Boost Converter Voltage Mode Control Example
npnz16b.h
1 /* *********************************************************************************
2  * PowerSmartâ„¢ Digital Control Library Designer, Version 0.9.14.676
3  * *********************************************************************************
4  * Generic library header for z-domain compensation filter assembly functions
5  * CGS Version: 3.0.8
6  * CGS Date: 03/12/2021
7  * ********************************************************************************/
8 // This is a guard condition so that contents of this file are not included
9 // more than once.
10 #ifndef __SPECIAL_FUNCTION_LAYER_LIB_NPNZ16B_H__
11 #define __SPECIAL_FUNCTION_LAYER_LIB_NPNZ16B_H__
12 
13 #include <xc.h> // include processor files - each processor file is guarded
14 #include <dsp.h> // include DSP data types (e.g. fractional)
15 #include <stdint.h> // include standard integer number data types
16 #include <stddef.h> // include standard definition data types
17 #include <stdbool.h> // include standard boolean data types (true/false)
18 
19 /***************************************************************************************************
20  * @ingroup special-function-layer-npnz16-macros
21  * @def __PSDCLD_VERSION
22  * @brief Generic macro allowing to identify the file version of 'npnz16b.h'
23  *
24  * @details
25  * This version key represents the product version of PS-DCLD as integer number
26  * of the form [MAJOR][MINOR][REVISION] => version 0.9.3.xxx would be shown as 903.
27  * User code can check if the file version is compliant with the proprietary user
28  * code by using pre-compiler directives such as
29  *
30  * @code{.c}
31  * #if (__PSDCLD_VERSION > 908)
32  * #pragma message "This code has not been tested with the recently included version of npnz16b.h"
33  * #endif
34  * @endcode
35  *
36  ***************************************************************************************************/
37 
38 #ifndef __PSDCLD_VERSION
39  #define __PSDCLD_VERSION 914
40 #endif
41 
42 /***************************************************************************************************
43  * @enum NPNZ_STATUS_FLAGS_e
44  * @brief Common Controller Status and Control Flag Bits
45  * @details
46  * The 16-bit wide NPNZ_STATUS_s data object holds status and control bits for
47  * monitoring and control of the NPNZ16b_s controller during runtime. The lower 8 bit
48  * of the status word are used for status indication while the upper 8 bit are used
49  * by control bits.
50  * For enhanced programming convenience, definitions of status and control flags are
51  * provided in single bit and full word format. All available flags are consolidated
52  * in the npnzFlagList object.
53  ***************************************************************************************************/
54 
55 enum NPNZ_STATUS_FLAGS_e
56 {
57  NPNZ_STATUS_CLEAR = 0b0000000000000000,
58  NPNZ_STATUS_SATUATION_MSK = 0b0000000000000011,
59  NPNZ_STATUS_LSAT_ACTIVE = 0b0000000000000001,
60  NPNZ_STATUS_LSAT_CLEAR = 0b0000000000000000,
61  NPNZ_STATUS_USAT_ACTIVE = 0b0000000000000010,
62  NPNZ_STATUS_USAT_CLEAR = 0b0000000000000000,
63  NPNZ_STATUS_AGC_DISABLE = 0b0000000000000000,
64  NPNZ_STATUS_AGC_ENABLED = 0b0000100000000000,
65  NPNZ_STATUS_TARGET_DEFAULT = 0b0000000000000000,
66  NPNZ_STATUS_TARGET_SWAPED = 0b0001000000000000,
67  NPNZ_STATUS_SOURCE_DEFAULT = 0b0000000000000000,
68  NPNZ_STATUS_SOURCE_SWAPED = 0b0010000000000000,
69  NPNZ_STATUS_INV_INPUT_OFF = 0b0000000000000000,
70  NPNZ_STATUS_INV_INPUT_ON = 0b0100000000000000,
71  NPNZ_STATUS_ENABLE_OFF = 0b0000000000000000,
72  NPNZ_STATUS_ENABLE_ON = 0b1000000000000000
73 };
74 typedef enum NPNZ_STATUS_FLAGS_e NPNZ_STATUS_FLAGS_t;
75 
76 /***************************************************************************************************
77  * @enum NPNZ_STATUS_SATURATION_e
78  * @brief Enumeration of control loop saturation status bits
79  **************************************************************************************************/
80 enum NPNZ_STATUS_SATURATION_e{
81  NPNZ_SAT_CLEAR = 0b0,
82  NPNZ_SAT_ACTIVE = 0b1
83 };
84 typedef enum NPNZ_STATUS_SATURATION_e NPNZ_STATUS_SATURATION_t;
85 extern volatile enum NPNZ_STATUS_SATURATION_e npnzEnumControlStatusSaturation;
86 
87 /* Control flags (bit-field) */
88 /***************************************************************************************************
89  * @enum NPNZ_STATUS_AGC_ENABLE_e
90  * @brief Enumeration of Adaptive Gain Modulation enable/disable control bits
91  **************************************************************************************************/
92 enum NPNZ_STATUS_AGC_ENABLE_e{
93  NPNZ_AGC_DISABLED = 0b0,
94  NPNZ_AGC_ENABLED = 0b1
95 };
96 typedef enum NPNZ_STATUS_AGC_ENABLE_e NPNZ_STATUS_AGC_ENABLE_t;
97 extern volatile enum NPNZ_STATUS_AGC_ENABLE_e npnzEnumControlAgcEnable;
98 
99 /***************************************************************************************************
100  * @enum NPNZ_STATUS_SOURCE_SWAP_e
101  * @brief Enumeration of control input port swap control bits
102  **************************************************************************************************/
103 enum NPNZ_STATUS_SOURCE_SWAP_e{
104  NPNZ_SOURCE_DEFAULT = 0b0,
105  NPNZ_SOURCE_SWAPED = 0b1
106 };
107 typedef enum NPNZ_STATUS_SOURCE_SWAP_e NPNZ_STATUS_SOURCE_SWAP_t;
108 extern volatile enum NPNZ_STATUS_SOURCE_SWAP_e npnzEnumControlSourceSwap;
109 
110 /***************************************************************************************************
111  * @enum NPNZ_STATUS_TARGET_SWAP_e
112  * @brief Enumeration of control output port swap control bits
113  **************************************************************************************************/
114 enum NPNZ_STATUS_TARGET_SWAP_e{
115  NPNZ_TARGET_DEFAULT = 0b0,
116  NPNZ_TARGET_SWAPED = 0b1
117 };
118 typedef enum NPNZ_STATUS_TARGET_SWAP_e NPNZ_STATUS_TARGET_SWAP_t;
119 extern volatile enum NPNZ_STATUS_TARGET_SWAP_e npnzEnumControlTargetSwap;
120 
121 /***************************************************************************************************
122  * @enum NPNZ_STATUS_INPUT_INV_e
123  * @brief Enumeration of input value inversion control bits
124  **************************************************************************************************/
125 enum NPNZ_STATUS_INPUT_INV_e{
126  NPNZ_INPUT_DEFAULT = 0b0,
127  NPNZ_INPUT_INVERTED = 0b1
128 };
129 typedef enum NPNZ_STATUS_INPUT_INV_e NPNZ_STATUS_INPUT_INV_t;
130 extern volatile enum NPNZ_STATUS_INPUT_INV_e npnzEnumControlInputInversion;
131 
132 /***************************************************************************************************
133  * @enum NPNZ_STATUS_ENABLE_e
134  * @brief Enumeration of control loop enable/disable control bits
135  **************************************************************************************************/
136 enum NPNZ_STATUS_ENABLE_e{
137  NPNZ_DISABLED = 0b0,
138  NPNZ_ENABLED = 0b1
139 };
140 typedef enum NPNZ_STATUS_ENABLE_e NPNZ_STATUS_ENABLE_t;
141 extern volatile enum NPNZ_STATUS_ENABLE_e npnzEnumControlEnable;
142 
143 /****************************************************************************************************
144  * @struct NPNZ_FLAGS_s
145  * @brief Structure providing all public enumerated lists of constants
146  **************************************************************************************************** */
148 {
149  volatile enum NPNZ_STATUS_FLAGS_e StatusWordFlags;
150  volatile enum NPNZ_STATUS_SATURATION_e flagSaturation;
151  volatile enum NPNZ_STATUS_AGC_ENABLE_e flagAgcControl;
152  volatile enum NPNZ_STATUS_SOURCE_SWAP_e flagSourceSwap;
153  volatile enum NPNZ_STATUS_TARGET_SWAP_e flagTargetSwap;
154  volatile enum NPNZ_STATUS_INPUT_INV_e flagCtrlInputInversion;
155  volatile enum NPNZ_STATUS_ENABLE_e flagControlEnable;
156 };
157 typedef struct NPNZ_FLAGS_s NPNZ_FLAGS_t;
158 extern volatile struct NPNZ_FLAGS_s npnzFlagList;
159 
160 /***************************************************************************************************
161  * @ingroup special-function-layer-npnz16-object-members
162  * @struct NPNZ_STATUS_s
163  * @brief NPNZ16b controller object status and control word
164  * @extends NPNZ16b_s
165  *
166  * @details
167  * The NPNZ16b_s status word is providing status flag bits for monitoring and controlling the
168  * NPNZ16b control library code execution from outside the library module.
169  *
170  * 1) Status Byte
171  * The low byte of the NPNZ16b_s status word is used for READ ONLY status flags, set and cleared
172  * automatically by the control loop library routine.
173  *
174  * 2) Control Byte
175  * The high byte of the status word is used for control flags, through which users can control
176  * the control loop execution. This includes enabling/disabling the control loop execution,
177  * switch between different input and output sources, invert input values or enable/disable
178  * advanced functions.
179  *
180  ***************************************************************************************************/
181 
182 /* Controller status data structure */
184  union {
185  struct {
186  volatile bool lower_saturation_event : 1;
187  volatile bool upper_saturation_event : 1;
188  volatile unsigned : 1;
189  volatile unsigned : 1;
190  volatile unsigned : 1;
191  volatile unsigned : 1;
192  volatile unsigned : 1;
193  volatile unsigned : 1;
194 
195  volatile unsigned : 1;
196  volatile unsigned : 1;
197  volatile unsigned : 1;
198  volatile bool agc_enabled: 1;
199  volatile bool swap_target: 1;
200  volatile bool swap_source: 1;
201  volatile bool invert_input: 1;
202  volatile bool enabled : 1;
203  } __attribute__((packed))bits;
204  volatile uint16_t value;
205  };
206 } __attribute__((packed));
207 typedef struct NPNZ_STATUS_s NPNZ_STATUS_t;
208 
209 /***************************************************************************************************
210  * @ingroup special-function-layer-npnz16-object-members
211  * @struct NPNZ_PORT_s
212  * @brief Data Input/Output Port declaration of memory addresses, signal offsets and normalization settings
213  * @extends NPNZ_PORTS_s
214  *
215  * @details
216  * The NPNZ_PORT_s data object defines the basic parameters required to read data from or write
217  * data to user-defined memory addresses as well as offers data fields for additional settings
218  * such as normalization scaling factors or signal offsets, which can be used to compensate analog
219  * offsets and normalize raw ADC data to other ADC input values and their respective physical
220  * struct NPNZ_PORT_t declares its individual source/target memory address, normalization
221  * quantity.
222  *
223  ***************************************************************************************************/
224 
225 /* Controller Input/Output Port */
226 struct NPNZ_PORT_s{
227 
228  volatile uint16_t* ptrAddress;
229  volatile int16_t NormScaler;
230  volatile fractional NormFactor;
231  volatile int16_t Offset;
232 
233 } __attribute__((packed));
234 typedef struct NPNZ_PORT_s NPNZ_PORT_t;
235 
236 /***************************************************************************************************
237  * @ingroup special-function-layer-npnz16-object-members
238  * @struct NPNZ_PORTS_s
239  * @brief Filter Coefficient Arrays, Number Format Handling and Input/Output History Parameters
240  * @extends NPNZ16b_s
241  *
242  * @details
243  * The NPNZ_PORTS_t data object holds a list of nested NPNZ_PORT_t data objects, each
244  * defining an individual controller input or output port. The NPNZ16b_s data objects defines
245  * up to two input and two output ports of type struct NPNZ_PORT_t and one additional
246  * pointer to an external, user-defined 16-bit reference source variable. Each port of type
247  * struct NPNZ_PORT_t declares its individual source/target memory address, normalization
248  * scaler and offset:
249  *
250  * - Primary Source: common feedback input object
251  * - Alternate Source: additional, alternate feedback input object (optional)
252  * - Primary Target: common control output target object
253  * - Alternate Target: additional, alternate control output target object (optional)
254  * - Control Reference: pointer to external 16-bit reference source variable
255  *
256  ***************************************************************************************************/
257 
258 /* List of Controller Input/Output Ports */
260 
261  volatile struct NPNZ_PORT_s Source;
262  volatile struct NPNZ_PORT_s AltSource;
263  volatile struct NPNZ_PORT_s Target;
264  volatile struct NPNZ_PORT_s AltTarget;
265  volatile uint16_t* ptrControlReference;
266 
267 } __attribute__((packed));
268 typedef struct NPNZ_PORTS_s NPNZ_PORTS_t;
269 
270 /***************************************************************************************************
271  * @ingroup special-function-layer-npnz16-object-members
272  * @struct NPNZ_FILTER_PARAMS_s
273  * @brief Filter Coefficient Arrays, Number Format Handling and Input/Output History Parameters
274  * @extends NPNZ16b_s
275  *
276  * @details
277  * The NPNZ_FILTER_PARAMS_t data object holds all configuration parameters of the compensation
278  * filter. These parameters include pointers to external arrays of filter coefficients, error
279  * and control history as well as number format normalization parameters like pre- and post-
280  * scalers.
281  *
282  ***************************************************************************************************/
283 
285 
286  volatile int32_t* ptrACoefficients;
287  volatile int32_t* ptrBCoefficients;
288  volatile fractional* ptrControlHistory;
289  volatile fractional* ptrErrorHistory;
290 
291  // Array size information
292  volatile uint16_t ACoefficientsArraySize;
293  volatile uint16_t BCoefficientsArraySize;
294  volatile uint16_t ControlHistoryArraySize;
295  volatile uint16_t ErrorHistoryArraySize;
296 
297  // Feedback scaling Input/Output Normalization
298  volatile int16_t normPreShift;
299  volatile int16_t normPostShiftA;
300  volatile int16_t normPostShiftB;
301  volatile int16_t normPostScaler;
302 
303  // P-Term Coefficients (for plant measurements only)
304  volatile int16_t PTermScaler;
305  volatile int16_t PTermFactor;
306 
307 } __attribute__((packed));
309 
310 /***************************************************************************************************
311  * @ingroup special-function-layer-npnz16-object-members
312  * @struct NPNZ_LIMITS_s
313  * @brief System Anti-Windup (Output Clamping) Thresholds
314  * @extends NPNZ16b_s
315  *
316  * @details
317  * The NPNZ_LIMITS_t data object holds all parameters required to automatically clamp the
318  * most recent control output to user-defined thresholds. This data type allows the
319  * definition of individual minimum and maximum output values for the NPNZ controller primary
320  * and alternate output port.
321  *
322  * This feature is optional and needs to be enabled, configured and managed manually in
323  * user code.
324  *
325  ***************************************************************************************************/
326 
328 
329  volatile int16_t MinOutput;
330  volatile int16_t MaxOutput;
331  volatile int16_t AltMinOutput;
332  volatile int16_t AltMaxOutput;
333 
334 } __attribute__((packed));
335 typedef struct NPNZ_LIMITS_s NPNZ_LIMITS_t;
336 
337 /***************************************************************************************************
338  * @ingroup special-function-layer-npnz16-object-members
339  * @struct NPNZ_ADC_TRGCTRL_s
340  * @brief Automated ADC Trigger handling
341  * @extends NPNZ16b_s
342  *
343  * @details
344  * The NPNZ_ADC_TRGCTRL_t data object holds all parameters required to automatically position
345  * ADC triggers based on the most recent control output. This feature is used in voltage or
346  * average current mode control to automatically track average values in triangular feedback
347  * signal waveforms.
348  *
349  * This feature is optional and needs to be enabled, configured and managed manually in
350  * user code.
351  *
352  ***************************************************************************************************/
353 
355 
356  volatile uint16_t* ptrADCTriggerARegister;
357  volatile uint16_t ADCTriggerAOffset;
358  volatile uint16_t* ptrADCTriggerBRegister;
359  volatile uint16_t ADCTriggerBOffset;
360 
361 } __attribute__((packed));
362 typedef struct NPNZ_ADC_TRGCTRL_s NPNZ_ADC_TRGCTRL_t;
363 
364 /***************************************************************************************************
365  * @ingroup special-function-layer-npnz16-object-members
366  * @struct NPNZ_DATA_PROVIDERS_s
367  * @brief Data Provider Target Memory Addresses
368  * @extends NPNZ16b_s
369  *
370  * @details
371  * The NPNZ_DATA_PROVIDERS_t data object holds pointers to external, user-defined, global
372  * variables allowing the NPNZ controller to push internal data to external, user-defined,
373  * global variables during the execution of the NPNZ controller, resulting in an automated
374  * updated of user-code variable values during runtime.
375  *
376  * This feature is optional and needs to be enabled, configured and managed manually in
377  * user code.
378  *
379  ***************************************************************************************************/
380 
382 
383  volatile uint16_t* ptrDProvControlInput;
384  volatile uint16_t* ptrDProvControlInputCompensated;
385  volatile uint16_t* ptrDProvControlError;
386  volatile uint16_t* ptrDProvControlOutput;
387 
388 } __attribute__((packed));
390 
391 /**************************************************************************************************
392  * @ingroup special-function-layer-npnz16-object-members
393  * @struct NPNZ_EXTENSION_HOOKS_s
394  * @brief User Extension Function Call Parameters
395  * @extends NPNZ16b_s
396  *
397  * @details
398  * The NPNZ_EXTENSION_HOOKS_s data object holds all parameters required to call user-defined extension
399  * functions supporting advanced use cases, which are not covered by the standard functions provided.
400  * When enabled, the NPNZ controller can automatically call user-defined functions at specific points
401  * within the control loop execution flow. Each function pointer is supporting function calls with one
402  * additional, 16-bit wide function parameter for each extension call. These parameters can either be
403  * variables or pointers to variables including start addresses of user defined data structures.
404  *
405  * Each extension function call is optional and needs to be enabled, configured and managed manually
406  * in user code.
407  *
408  ***************************************************************************************************/
409 
411 
412  volatile uint16_t ptrExtHookStartFunction;
413  volatile uint16_t ExtHookStartFunctionParam;
414 
415  volatile uint16_t ptrExtHookSourceFunction;
416  volatile uint16_t ExtHookSourceFunctionParam;
417 
420 
423 
424  volatile uint16_t ptrExtHookEndOfLoopFunction;
425  volatile uint16_t ExtHookEndOfLoopFunctionParam;
426 
427  volatile uint16_t ptrExtHookExitFunction;
428  volatile uint16_t ExtHookExitFunctionParam;
429 
430 } __attribute__((packed));
432 
433 /***************************************************************************************************
434  * @ingroup special-function-layer-npnz16-object-members
435  * @struct NPNZ_GAIN_CONTROL_s
436  * @brief Adaptive Gain Control Modulation Parameters
437  * @extends NPNZ16b_s
438  *
439  * @details
440  * The NPNZ_GAIN_CONTROL_t data object holds all parameters required to perform real-time
441  * gain modulation of the z-domain feedback loop. The loop gain is modulated by multiplying
442  * the result of the NPNZ controller B-term with an additional scaling factor. This scaling
443  * factor is represented by a fast floating point number, consisting of a factional factor
444  * <AgcFactor> between -1 and 1 and an integer bit-shift scaler <AgcScaler>.
445  *
446  * This feature is optional and needs to be enabled, configured and managed manually in
447  * user code.
448  *
449  ***************************************************************************************************/
450 
452 
453  volatile uint16_t AgcScaler;
454  volatile fractional AgcFactor;
455  volatile fractional AgcMedian;
456  volatile uint16_t ptrAgcObserverFunction;
457 
458 } __attribute__((packed));
460 
461 /***************************************************************************************************
462  * @ingroup special-function-layer-npnz16-object-members
463  * @struct NPNZ_USER_DATA_BUFFER_s
464  * @brief User Data Space for Advanced Control Functions
465  * @extends NPNZ16b_s
466 
467  * @details
468  * The NPNZ_USER_DATA_BUFFER_t data object reserves four word of additional data space for
469  * user parameters. These parameters may be handled by user code and are not assigned to any
470  * specific, pre-defined functions.
471  *
472  ***************************************************************************************************/
473 
475 
476  volatile uint16_t usrParam0;
477  volatile uint16_t usrParam1;
478  volatile uint16_t usrParam2;
479  volatile uint16_t usrParam3;
480  volatile uint16_t usrParam4;
481  volatile uint16_t usrParam5;
482  volatile uint16_t usrParam6;
483  volatile uint16_t usrParam7;
484 
485 } __attribute__((packed));
487 
488 /***************************************************************************************************
489  * @ingroup special-function-layer-npnz16-data-objects
490  * @struct NPNZ16b_s
491  * @brief Global NPNZ controller data object
492  *
493  * @details
494  * The NPNZ16b_s data object holds all configuration, status, control and monitoring values
495  * of a z-domain lead-lag compensator based controller. All data types of this data object,
496  * including floating, are scaled to a 16 bit number space, optimized for code execution on
497  * Microchip dsPIC33 family of devices. Please refer to the description of nested data
498  * structures above for more information about nested data objects.
499  *
500  ***************************************************************************************************/
501 
502 struct NPNZ16b_s {
503 
504  volatile struct NPNZ_STATUS_s status;
505  volatile struct NPNZ_PORTS_s Ports;
506  volatile struct NPNZ_FILTER_PARAMS_s Filter;
508  volatile struct NPNZ_LIMITS_s Limits;
513 
514 } __attribute__((packed)) ;
515 typedef struct NPNZ16b_s NPNZ16b_t;
516 
517 /* ********************************************************************************/
518 
519 #endif // end of __SPECIAL_FUNCTION_LAYER_LIB_NPNZ16B_H__ header file section
520 
521 
522 //**********************************************************************************
523 // Download latest version of this tool here: https://areiter128.github.io/DCLD
524 //**********************************************************************************
525 
volatile uint16_t value
Controller status full register access.
Definition: npnz16b.h:204
volatile uint16_t ptrAgcObserverFunction
Function Pointer to Observer function updating the AGC modulation factor. This function pointer is st...
Definition: npnz16b.h:456
volatile uint16_t ptrExtHookSourceFunction
Pointer to Function which will be called after the source has been read and compensated....
Definition: npnz16b.h:415
volatile unsigned
Bit 2: reserved.
Definition: npnz16b.h:188
enum NPNZ_STATUS_SATURATION_e flagSaturation
List of all status and control flags of the NPNZ16b status word.
Definition: npnz16b.h:150
volatile int16_t MinOutput
Minimum output value used for clamping (R/W)
Definition: npnz16b.h:329
volatile uint16_t * ptrDProvControlInput
Pointer to external data buffer of most recent, raw control input.
Definition: npnz16b.h:383
volatile struct NPNZ_PORT_s AltSource
Secondary data input port declaration.
Definition: npnz16b.h:262
volatile uint16_t ExtHookSourceFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:416
volatile struct NPNZ_PORTS_s Ports
Controller input and output ports.
Definition: npnz16b.h:505
volatile int16_t normPostShiftA
Normalization of A-term control output to Q15 (R/W)
Definition: npnz16b.h:299
volatile uint16_t * ptrDProvControlError
Pointer to external data buffer of most recent control error.
Definition: npnz16b.h:385
volatile int16_t Offset
Value/signal offset of this port.
Definition: npnz16b.h:231
volatile uint16_t ExtHookExitFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:428
volatile bool swap_source
Bit 13: when set, AltSource is used as data input to controller.
Definition: npnz16b.h:200
volatile int16_t PTermScaler
Q15 P-Term Coefficient Bit-Shift Scaler (R/W)
Definition: npnz16b.h:304
volatile fractional * ptrErrorHistory
Pointer to n+1 delay-line samples located in Y-space with first sample being the most recent.
Definition: npnz16b.h:289
volatile uint16_t ControlHistoryArraySize
Size of the control history array in Y-space.
Definition: npnz16b.h:294
volatile uint16_t usrParam3
generic 16-bit wide, user-defined parameter #4 for advanced control options
Definition: npnz16b.h:479
volatile struct NPNZ_PORT_s Source
Primary data input port declaration.
Definition: npnz16b.h:261
volatile fractional AgcFactor
Q15 value of Adaptive Gain Modulation factor.
Definition: npnz16b.h:454
enum NPNZ_STATUS_AGC_ENABLE_e flagAgcControl
List of all status and control flags of the NPNZ16b status word.
Definition: npnz16b.h:151
volatile uint16_t usrParam6
generic 16-bit wide, user-defined parameter #7 for advanced control options
Definition: npnz16b.h:482
volatile struct NPNZ_PORT_s Target
Primary data output port declaration.
Definition: npnz16b.h:263
volatile fractional * ptrControlHistory
Pointer to n delay-line samples located in Y-space with first sample being the most recent.
Definition: npnz16b.h:288
volatile uint16_t usrParam1
generic 16-bit wide, user-defined parameter #2 for advanced control options
Definition: npnz16b.h:477
volatile struct NPNZ_LIMITS_s Limits
Input and output clamping values.
Definition: npnz16b.h:508
volatile bool agc_enabled
Bit 11: when set, Adaptive Gain Control Modulation is enabled.
Definition: npnz16b.h:198
enum NPNZ_STATUS_ENABLE_e flagControlEnable
List of Supported Control Modes.
Definition: npnz16b.h:155
volatile fractional AgcMedian
Q15 value of Adaptive Gain Modulation nominal operating point.
Definition: npnz16b.h:455
volatile struct NPNZ_USER_DATA_BUFFER_s Advanced
Parameter section for advanced user control options.
Definition: npnz16b.h:512
volatile uint16_t * ptrDProvControlInputCompensated
Pointer to external data buffer of most recent, compensated control input.
Definition: npnz16b.h:384
volatile uint16_t AgcScaler
Bit-shift scaler of Adaptive Gain Modulation factor.
Definition: npnz16b.h:453
enum NPNZ_STATUS_FLAGS_e StatusWordFlags
List of all status and control flags of the NPNZ16b status word.
Definition: npnz16b.h:149
volatile bool lower_saturation_event
Bit 0: control loop is clamped at minimum output level.
Definition: npnz16b.h:186
volatile uint16_t usrParam0
generic 16-bit wide, user-defined parameter #1 for advanced control options
Definition: npnz16b.h:476
enum NPNZ_STATUS_INPUT_INV_e flagCtrlInputInversion
List of State Machine Operating State Return Values.
Definition: npnz16b.h:154
volatile int32_t * ptrACoefficients
Pointer to A coefficients located in X-space.
Definition: npnz16b.h:286
volatile uint16_t ACoefficientsArraySize
Size of the A coefficients array in X-space.
Definition: npnz16b.h:292
volatile uint16_t BCoefficientsArraySize
Size of the B coefficients array in X-space.
Definition: npnz16b.h:293
volatile int32_t * ptrBCoefficients
Pointer to B coefficients located in X-space.
Definition: npnz16b.h:287
volatile uint16_t ptrExtHookExitFunction
Pointer to Function which is called at the end of the control loop and will also be called when the c...
Definition: npnz16b.h:427
volatile uint16_t usrParam4
generic 16-bit wide, user-defined parameter #5 for advanced control options
Definition: npnz16b.h:480
volatile int16_t AltMinOutput
Alternate minimum output value used for clamping (R/W)
Definition: npnz16b.h:331
volatile uint16_t ExtHookPreTargetWriteFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:422
enum NPNZ_STATUS_SOURCE_SWAP_e flagSourceSwap
List of State Machine Operating State IDs.
Definition: npnz16b.h:152
volatile uint16_t ADCTriggerAOffset
ADC trigger #1 offset to compensate propagation delays.
Definition: npnz16b.h:357
volatile uint16_t ExtHookPreAntiWindupFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:419
volatile struct NPNZ_STATUS_s status
Control Loop Status and Control flags.
Definition: npnz16b.h:504
volatile int16_t NormScaler
Bit-shift scaler of the Q15 normalization factor.
Definition: npnz16b.h:229
volatile uint16_t ExtHookStartFunctionParam
Parameter of function called (can be a variable or pointer to a data structure). This parameter is op...
Definition: npnz16b.h:413
volatile uint16_t ADCTriggerBOffset
ADC trigger #2 offset to compensate propagation delays.
Definition: npnz16b.h:359
volatile int16_t MaxOutput
Maximum output value used for clamping (R/W)
Definition: npnz16b.h:330
volatile struct NPNZ_PORT_s AltTarget
Secondary data output port declaration.
Definition: npnz16b.h:264
volatile uint16_t ptrExtHookPreTargetWriteFunction
Pointer to Function which will be called before the most recent control output is written to target....
Definition: npnz16b.h:421
volatile uint16_t ErrorHistoryArraySize
Size of the error history array in Y-space.
Definition: npnz16b.h:295
volatile int16_t normPreShift
Normalization of ADC-resolution to Q15 (R/W)
Definition: npnz16b.h:298
volatile uint16_t * ptrAddress
Pointer to register or variable where the value is read from (e.g. ADCBUFx) or written to (e....
Definition: npnz16b.h:228
volatile bool invert_input
Bit 14: when set, most recent error input value to controller is inverted.
Definition: npnz16b.h:201
volatile struct NPNZ_DATA_PROVIDERS_s DataProviders
Automated data sources pushing recent data points to user-defined variables.
Definition: npnz16b.h:510
Consolidated list of status bit value enumerations.
Definition: npnz16b.h:147
volatile int16_t normPostScaler
Control output normalization factor (Q15) (R/W)
Definition: npnz16b.h:301
volatile uint16_t usrParam2
generic 16-bit wide, user-defined parameter #3 for advanced control options
Definition: npnz16b.h:478
volatile uint16_t ptrExtHookPreAntiWindupFunction
Pointer to Function which will be called after the compensation filter computation is complete and be...
Definition: npnz16b.h:418
volatile fractional NormFactor
Q15 normalization factor.
Definition: npnz16b.h:230
volatile int16_t normPostShiftB
Normalization of B-term control output to Q15 (R/W)
Definition: npnz16b.h:300
volatile bool upper_saturation_event
Bit 1: control loop is clamped at maximum output level.
Definition: npnz16b.h:187
volatile uint16_t ptrExtHookStartFunction
Pointer to Function which will be called at the beginning of the control loop. This function pointer ...
Definition: npnz16b.h:412
volatile uint16_t * ptrDProvControlOutput
Pointer to external data buffer of most recent control output.
Definition: npnz16b.h:386
volatile uint16_t ExtHookEndOfLoopFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:425
volatile uint16_t * ptrADCTriggerBRegister
Pointer to ADC trigger #2 register (e.g. TRIG2)
Definition: npnz16b.h:358
volatile int16_t AltMaxOutput
Alternate maximum output value used for clamping (R/W)
Definition: npnz16b.h:332
volatile uint16_t usrParam5
generic 16-bit wide, user-defined parameter #6 for advanced control options
Definition: npnz16b.h:481
volatile uint16_t * ptrControlReference
Pointer to global variable of input register holding the controller reference value (e....
Definition: npnz16b.h:265
volatile struct NPNZ_GAIN_CONTROL_s GainControl
Parameter section for advanced control options.
Definition: npnz16b.h:507
volatile struct NPNZ_FILTER_PARAMS_s Filter
Filter parameters such as pointer to history and coefficient arrays and number scaling.
Definition: npnz16b.h:506
enum NPNZ_STATUS_TARGET_SWAP_e flagTargetSwap
List of State Machine Sub-State IDs.
Definition: npnz16b.h:153
volatile int16_t PTermFactor
Q15 P-Term Coefficient Factor (R/W)
Definition: npnz16b.h:305
volatile uint16_t * ptrADCTriggerARegister
Pointer to ADC trigger #1 register (e.g. TRIG1)
Definition: npnz16b.h:356
volatile struct NPNZ_ADC_TRGCTRL_s ADCTriggerControl
Automatic ADC trigger placement options for ADC Trigger A and B.
Definition: npnz16b.h:509
volatile bool swap_target
Bit 12: when set, AltTarget is used as data output of controller.
Definition: npnz16b.h:199
volatile bool enabled
Bit 15: enables/disables control loop execution.
Definition: npnz16b.h:202
volatile uint16_t ptrExtHookEndOfLoopFunction
Pointer to Function which is called at the end of the control loop but will be bypassed when the cont...
Definition: npnz16b.h:424
volatile uint16_t usrParam7
generic 16-bit wide, user-defined parameter #8 for advanced control options
Definition: npnz16b.h:483
volatile struct NPNZ_EXTENSION_HOOKS_s ExtensionHooks
User extension function triggers using function pointers with parameters.
Definition: npnz16b.h:511