Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
app_power_control.h
1 /* Microchip Technology Inc. and its subsidiaries. You may use this software
2  * and any derivatives exclusively with Microchip products.
3  *
4  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
5  * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
6  * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
7  * PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
8  * WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
9  *
10  * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
11  * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
12  * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
13  * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
14  * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS
15  * IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF
16  * ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
17  *
18  * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
19  * TERMS.
20  */
21 
22 /*
23  * File: app_power_control.h
24  * Author: M91406
25  * Comments: Power control application layer
26  * Revision history:
27  */
28 
29 // This is a guard condition so that contents of this file are not included
30 // more than once.
31 #ifndef APPLICATION_LAYER_POWER_CONTROL_H
32 #define APPLICATION_LAYER_POWER_CONTROL_H
33 
34 #include <xc.h> // include processor files - each processor file is guarded.
35 #include <stdint.h> // include standard integer data types
36 #include <stdbool.h> // include standard boolean data types
37 #include <stddef.h> // include standard definition data types
38 
39 #include "power_control/devices/dev_buck_typedef.h"
40 
41 // PUBLIC DATA OBJECT DECLARATIONS
42 extern volatile struct BUCK_CONVERTER_s buck;
43 
44 // PUBLIC FUNCTION PROTOTYPE DECLARATIONS
45 extern volatile uint16_t appPowerSupply_Initialize(void);
46 extern volatile uint16_t appPowerSupply_Execute(void);
47 extern volatile uint16_t appPowerSupply_Start(void);
48 extern volatile uint16_t appPowerSupply_Stop(void);
49 extern volatile uint16_t appPowerSupply_Suspend(void);
50 extern volatile uint16_t appPowerSupply_Resume(void);
51 
52 
53 // CONTROL LOOP USER EXTENSION FUNCTIONS
54 
55 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56  *
57  * PowerSmart DCLD allows users to create and call user extension
58  * functions from specific locations of the main control loop to
59  * cover design-specific requirements and features which are not
60  * supported by the main controller by default.
61  *
62  * Control Loop User Extension Declaration Example:
63  *
64  * buck.v_loop.controller->ExtensionHooks.ptrExtHookStartFunction = (uint16_t)&my_function;
65  *
66  * Please refer to the PowerSmart DCLD User Guide for more details about
67  * how to use this feature, its requirements and limitations.
68  *
69  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 */
71 // extern void __attribute__((near)) my_function(void); // Control Loop User Extension Example
72 
73 
74 //#else
75 // #pragma message "app_power_control.h inclusion bypassed"
76 #endif /* APPLICATION_LAYER_POWER_CONTROL_H */
77 
appPowerSupply_Resume
volatile uint16_t appPowerSupply_Resume(void)
This function resumes the power supply operation.
Definition: app_power_control.c:233
appPowerSupply_Stop
volatile uint16_t appPowerSupply_Stop(void)
This function calls the buck converter device driver function stopping the power supply.
Definition: app_power_control.c:192
appPowerSupply_Start
volatile uint16_t appPowerSupply_Start(void)
This function calls the buck converter device driver function starting the power supply.
Definition: app_power_control.c:164
appPowerSupply_Suspend
volatile uint16_t appPowerSupply_Suspend(void)
This function stops the power supply operation.
Definition: app_power_control.c:212
appPowerSupply_Execute
volatile uint16_t appPowerSupply_Execute(void)
This is the top-level function call triggering the most recent state machine of all associated power ...
Definition: app_power_control.c:63
BUCK_CONVERTER_s
BUCK control & monitoring data structure.
Definition: dev_buck_typedef.h:501
appPowerSupply_Initialize
volatile uint16_t appPowerSupply_Initialize(void)
Calls the application layer power controller initialization.
Definition: app_power_control.c:133
buck
volatile struct BUCK_CONVERTER_s buck
Global data object for a BUCK CONVERTER.
Definition: app_power_control.c:28