Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
dev_buck_pconfig.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: dev_buck_pconfig.h
24  * Author: M91406
25  * Comments: Peripheral configuration template header file for generic buck converter driver
26  * Revision history:
27  * 1.0 initial release
28  */
29 
30 // This is a guard condition so that contents of this file are not included
31 // more than once.
32 #ifndef BUCK_CONVERTER_PERIPHERAL_CONFIGURATION_H
33 #define BUCK_CONVERTER_PERIPHERAL_CONFIGURATION_H
34 
35 #include <xc.h> // include processor files - each processor file is guarded.
36 #include <stdint.h> // include standard integer data types
37 #include <stdbool.h> // include standard boolean data types
38 #include <stddef.h> // include standard definition data types
39 
40 #include "dev_buck_typedef.h"
41 
42 /* ********************************************************************************
43  * DEVICE GPIO INSTANCE CONFIGURATION
44  * *******************************************************************************/
45 
46 extern volatile uint16_t buckGPIO_Initialize(volatile struct BUCK_CONVERTER_s* buckInstance);
47 extern volatile uint16_t buckGPIO_Set(volatile struct BUCK_GPIO_INSTANCE_s* buckGPIOInstance);
48 extern volatile uint16_t buckGPIO_Clear(volatile struct BUCK_GPIO_INSTANCE_s* buckGPIOInstance);
49 extern volatile bool buckGPIO_GetPinState(volatile struct BUCK_GPIO_INSTANCE_s* buckGPIOInstance);
50 
51 /* ********************************************************************************
52  * HIGH SPEED PWM MODULE CONFIGURATION
53  * *******************************************************************************/
54 
55 extern volatile uint16_t buckPWM_ModuleInitialize(volatile struct BUCK_CONVERTER_s* buckInstance);
56 extern volatile uint16_t buckPWM_ChannelInitialize(volatile struct BUCK_CONVERTER_s* buckInstance);
57 extern volatile uint16_t buckPWM_Start(volatile struct BUCK_CONVERTER_s* buckInstance);
58 extern volatile uint16_t buckPWM_Stop(volatile struct BUCK_CONVERTER_s* buckInstance);
59 extern volatile uint16_t buckPWM_Suspend(volatile struct BUCK_CONVERTER_s* buckInstance);
60 extern volatile uint16_t buckPWM_Resume(volatile struct BUCK_CONVERTER_s* buckInstance);
61 
62 extern volatile struct P33C_PWM_MODULE_s buckPwmModuleConfig;
63 extern volatile struct P33C_PWM_GENERATOR_s buckPwmGeneratorConfig;
64 
65 /* ********************************************************************************
66  * HIGH SPEED ADC MODULE CONFIGURATION
67  * *******************************************************************************/
68 
69 extern volatile uint16_t buckADC_ModuleInitialize(void);
70 extern volatile uint16_t buckADC_ChannelInitialize(volatile struct BUCK_ADC_INPUT_SETTINGS_s* adcInstance);
71 extern volatile uint16_t buckADC_Start(void);
72 
73 /* ********************************************************************************
74  * HIGH ANALOG COMPARATOR INSTANCE CONFIGURATION
75  * *******************************************************************************/
76 
77 // (not supported yet)
78 
79 #endif /* BUCK_CONVERTER_PERIPHERAL_CONFIGURATION_H */
80 
buckADC_ModuleInitialize
volatile uint16_t buckADC_ModuleInitialize(void)
This fucntion initializes the buck by resetting all its registers to default.
Definition: dev_buck_pconfig.c:429
buckGPIO_Clear
volatile uint16_t buckGPIO_Clear(volatile struct BUCK_GPIO_INSTANCE_s *buckGPIOInstance)
This function clears the selected general purpose input/output pin.
Definition: dev_buck_pconfig.c:688
buckPWM_Suspend
volatile uint16_t buckPWM_Suspend(volatile struct BUCK_CONVERTER_s *buckInstance)
This function disables the PWM generator IOs.
Definition: dev_buck_pconfig.c:327
P33C_PWM_GENERATOR_s
Definition: p33c_pwm.h:195
BUCK_ADC_INPUT_SETTINGS_s
ADC input channel configuration.
Definition: dev_buck_typedef.h:425
P33C_PWM_MODULE_s
Definition: p33c_pwm.h:86
buckADC_ChannelInitialize
volatile uint16_t buckADC_ChannelInitialize(volatile struct BUCK_ADC_INPUT_SETTINGS_s *adcInstance)
This function initializes the settings for the ADC channel.
Definition: dev_buck_pconfig.c:528
buckPWM_Start
volatile uint16_t buckPWM_Start(volatile struct BUCK_CONVERTER_s *buckInstance)
This function enables the buck PWM operation.
Definition: dev_buck_pconfig.c:212
buckGPIO_GetPinState
volatile bool buckGPIO_GetPinState(volatile struct BUCK_GPIO_INSTANCE_s *buckGPIOInstance)
This function gets the state of the selected pin.
Definition: dev_buck_pconfig.c:723
buckPWM_Stop
volatile uint16_t buckPWM_Stop(volatile struct BUCK_CONVERTER_s *buckInstance)
This function stops the buck PWM output.
Definition: dev_buck_pconfig.c:281
buckPwmGeneratorConfig
volatile struct P33C_PWM_GENERATOR_s buckPwmGeneratorConfig
PWM generator default configuration.
Definition: dev_buck_ptemp_pwm.c:47
buckGPIO_Initialize
volatile uint16_t buckGPIO_Initialize(volatile struct BUCK_CONVERTER_s *buckInstance)
This function initializes the buck input pins.
Definition: dev_buck_pconfig.c:754
buckPwmModuleConfig
volatile struct P33C_PWM_MODULE_s buckPwmModuleConfig
PWM module default configuration.
Definition: dev_buck_ptemp_pwm.c:16
buckPWM_Resume
volatile uint16_t buckPWM_Resume(volatile struct BUCK_CONVERTER_s *buckInstance)
This function resumes the buck PWM operation.
Definition: dev_buck_pconfig.c:369
buckPWM_ModuleInitialize
volatile uint16_t buckPWM_ModuleInitialize(volatile struct BUCK_CONVERTER_s *buckInstance)
Initializes the buck PWM module by resetting its registers to default.
Definition: dev_buck_pconfig.c:54
buckADC_Start
volatile uint16_t buckADC_Start(void)
This function enables the ADC module and starts the ADC cores analog inputs for the required input si...
Definition: dev_buck_pconfig.c:622
BUCK_CONVERTER_s
BUCK control & monitoring data structure.
Definition: dev_buck_typedef.h:501
buckGPIO_Set
volatile uint16_t buckGPIO_Set(volatile struct BUCK_GPIO_INSTANCE_s *buckGPIOInstance)
This function sets the selected general purpose input/ouput pins.
Definition: dev_buck_pconfig.c:653
BUCK_GPIO_INSTANCE_s
GPIO instance of the converter control GPIO.
Definition: dev_buck_typedef.h:470
buckPWM_ChannelInitialize
volatile uint16_t buckPWM_ChannelInitialize(volatile struct BUCK_CONVERTER_s *buckInstance)
This function initializes the output pins for the PWM output and the default buck PWM settings.
Definition: dev_buck_pconfig.c:110