Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
dev_buck_ptemp_pwm.c
1 /*
2  * File: dev_buck_ptemp_pwm.c
3  * Author: M91406
4  *
5  * Created on October 29, 2020, 10:31 AM
6  */
7 
8 #include "xc16_pral.h" // include peripehral register abstraction layer drivers
9 #include "dev_buck_ptemp_pwm.h" // include peripheral register configuration values header
10 
11 
16 volatile struct P33C_PWM_MODULE_s buckPwmModuleConfig =
17 {
19  .vFSCL.value = 0x0000,
20  .vFSMINPER.value = 0x0000,
21  .vMPHASE.value = 0x0000,
22  .vMDC.value = 0x0000,
23  .vMPER.value = 0x0000,
24  .vLFSR.value = 0x0000,
25  .vCMBTRIGL.value = REG_CMBTRIGL,
26  .vCMBTRIGH.value = REG_CMBTRIGH,
27  .LOGCON_A.value = REG_LOGCONA,
28  .LOGCON_B.value = REG_LOGCONB,
29  .LOGCON_C.value = REG_LOGCONC,
30  .LOGCON_D.value = REG_LOGCOND,
31  .LOGCON_E.value = REG_LOGCONE,
32  .LOGCON_F.value = REG_LOGCONF,
33  .PWMEVT_A.value = REG_PWMEVTA,
34  .PWMEVT_B.value = REG_PWMEVTB,
35  .PWMEVT_C.value = REG_PWMEVTC,
36  .PWMEVT_D.value = REG_PWMEVTD,
37  .PWMEVT_E.value = REG_PWMEVTE,
38  .PWMEVT_F.value = REG_PWMEVTF
39  };
40 
41 
42 
48 {
50  .PGxCONH.value = REG_PGxCONH,
51  .PGxSTAT.value = 0x0000,
52  .PGxIOCONL.value = REG_PGxIOCONL,
53  .PGxIOCONH.value = REG_PGxIOCONH,
54  .PGxEVTL.value = REG_PGxEVTL,
55  .PGxEVTH.value = REG_PGxEVTH,
56  .PGxCLPCIL.value = REG_PGxCLPCIL,
57  .PGxCLPCIH.value = REG_PGxCLPCIH,
58  .PGxFPCIL.value = REG_PGxFPCIL,
59  .PGxFPCIH.value = REG_PGxFPCIH,
60  .PGxFFPCIL.value = REG_PGxFFPCIL,
61  .PGxFFPCIH.value = REG_PGxFFPCIH,
62  .PGxSPCIL.value = REG_PGxSPCIL,
63  .PGxSPCIH.value = REG_PGxSPCIH,
64  .PGxLEBL.value = REG_PGxLEBL,
65  .PGxLEBH.value = REG_PGxLEBH,
66  .PGxPHASE.value = 0x0000,
67  .PGxDC.value = 0x0000,
68  .PGxDCA.value = 0x0000,
69  .PGxPER.value = 0x0000,
70  .PGxTRIGA.value = 0x0000,
71  .PGxTRIGB.value = 0x0000,
72  .PGxTRIGC.value = 0x0000,
73  .PGxDTL.value = 0x0000,
74  .PGxDTH.value = 0x0000,
75  .PGxCAP.value = 0x0000
76 };
77 
78 // end of file
79 
REG_LOGCONB
#define REG_LOGCONB
LOGCONB: COMBINATORIAL PWM LOGIC CONTROL REGISTER B.
Definition: dev_buck_ptemp_pwm.h:180
REG_LOGCOND
#define REG_LOGCOND
LOGCOND: COMBINATORIAL PWM LOGIC CONTROL REGISTER D.
Definition: dev_buck_ptemp_pwm.h:230
REG_PGxFPCIL
#define REG_PGxFPCIL
PGxFPCIL: PWM GENERATOR FAULT PCI REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:716
REG_PWMEVTD
#define REG_PWMEVTD
PWMEVTD: PWM EVENT OUTPUT CONTROL REGISTER D.
Definition: dev_buck_ptemp_pwm.h:380
REG_LOGCONF
#define REG_LOGCONF
LOGCONF: COMBINATORIAL PWM LOGIC CONTROL REGISTER F.
Definition: dev_buck_ptemp_pwm.h:280
REG_PGxIOCONL
#define REG_PGxIOCONL
PGxIOCONL: PWM GENERATOR x I/O CONTROL REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:564
REG_PGxLEBH
#define REG_PGxLEBH
PGxLEBH: PWM GENERATOR x LEADING-EDGE BLANKING REGISTER HIGH.
Definition: dev_buck_ptemp_pwm.h:866
REG_PWMEVTB
#define REG_PWMEVTB
PWMEVTB: PWM EVENT OUTPUT CONTROL REGISTER B.
Definition: dev_buck_ptemp_pwm.h:330
REG_LOGCONC
#define REG_LOGCONC
LOGCONC: COMBINATORIAL PWM LOGIC CONTROL REGISTER C.
Definition: dev_buck_ptemp_pwm.h:205
P33C_PWM_MODULE_s::vPCLKCON
union P33C_PWM_MODULE_s::@0 vPCLKCON
REG_CMBTRIGH
#define REG_CMBTRIGH
CMBTRIGH: COMBINATIONAL TRIGGER REGISTER HIGH.
Definition: dev_buck_ptemp_pwm.h:130
REG_PGxSPCIH
#define REG_PGxSPCIH
PGxSPCIH: PWM GENERATOR SOFTWARE PCI REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:841
REG_CMBTRIGL
#define REG_CMBTRIGL
CMBTRIGL: COMBINATIONAL TRIGGER REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:105
REG_PGxLEBL
#define REG_PGxLEBL
PGxLEBL: PWM GENERATOR x LEADING-EDGE BLANKING REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:891
REG_PGxFFPCIH
#define REG_PGxFFPCIH
PGxFFPCIH: PWM GENERATOR FEED FORWARD PCI REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:791
P33C_PWM_GENERATOR_s
Definition: p33c_pwm.h:195
REG_PWMEVTF
#define REG_PWMEVTF
PWMEVTF: PWM EVENT OUTPUT CONTROL REGISTER F.
Definition: dev_buck_ptemp_pwm.h:430
P33C_PWM_MODULE_s
Definition: p33c_pwm.h:86
P33C_PWM_GENERATOR_s::value
uint16_t value
Definition: p33c_pwm.h:198
P33C_PWM_MODULE_s::value
uint16_t value
Definition: p33c_pwm.h:90
REG_PCLKCON
#define REG_PCLKCON
PCLKCON: PWM CLOCK CONTROL REGISTER.
Definition: dev_buck_ptemp_pwm.h:80
REG_PWMEVTC
#define REG_PWMEVTC
PWMEVTC: PWM EVENT OUTPUT CONTROL REGISTER C.
Definition: dev_buck_ptemp_pwm.h:355
REG_PWMEVTA
#define REG_PWMEVTA
PWMEVTA: PWM EVENT OUTPUT CONTROL REGISTER A.
Definition: dev_buck_ptemp_pwm.h:305
REG_PGxFFPCIL
#define REG_PGxFFPCIL
PGxFFPCIL: PWM GENERATOR FEED FORWARD PCI REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:766
REG_LOGCONA
#define REG_LOGCONA
LOGCONA: COMBINATORIAL PWM LOGIC CONTROL REGISTER A.
Definition: dev_buck_ptemp_pwm.h:155
REG_PGxCONH
#define REG_PGxCONH
PGxCONH: PWM GENERATOR x CONTROL REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:539
REG_PWMEVTE
#define REG_PWMEVTE
PWMEVTE: PWM EVENT OUTPUT CONTROL REGISTER E.
Definition: dev_buck_ptemp_pwm.h:405
REG_PGxCONL
#define REG_PGxCONL
PGxCONL: PWM GENERATOR x CONTROL REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:514
buckPwmGeneratorConfig
volatile struct P33C_PWM_GENERATOR_s buckPwmGeneratorConfig
PWM generator default configuration.
Definition: dev_buck_ptemp_pwm.c:47
buckPwmModuleConfig
volatile struct P33C_PWM_MODULE_s buckPwmModuleConfig
PWM module default configuration.
Definition: dev_buck_ptemp_pwm.c:16
REG_PGxIOCONH
#define REG_PGxIOCONH
PGxIOCONH: PWM GENERATOR x I/O CONTROL REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:589
REG_PGxEVTH
#define REG_PGxEVTH
PGxEVTH: PWM GENERATOR x EVENT REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:639
REG_PGxCLPCIH
#define REG_PGxCLPCIH
PGxCLPCIH: PWM GENERATOR CURRENT LIMIT PCI REGISTER HIGH.
Definition: dev_buck_ptemp_pwm.h:691
REG_LOGCONE
#define REG_LOGCONE
LOGCONE: COMBINATORIAL PWM LOGIC CONTROL REGISTER E.
Definition: dev_buck_ptemp_pwm.h:255
P33C_PWM_GENERATOR_s::PGxCONL
union P33C_PWM_GENERATOR_s::@54 PGxCONL
REG_PGxFPCIH
#define REG_PGxFPCIH
PGxFPCIH: PWM GENERATOR FAULT PCI REGISTER HIGH.
Definition: dev_buck_ptemp_pwm.h:741
REG_PGxSPCIL
#define REG_PGxSPCIL
PGxSPCIL: PWM GENERATOR SOFTWARE PCI REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:816
REG_PGxEVTL
#define REG_PGxEVTL
PGxEVTL: PWM GENERATOR x EVENT REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:614
REG_PGxCLPCIL
#define REG_PGxCLPCIL
PGxCLPCIL: PWM GENERATOR CURRENT LIMIT PCI REGISTER LOW.
Definition: dev_buck_ptemp_pwm.h:665