|
Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
|
|
44 #ifndef P33C_PWM_SFR_ABSTRACTION_H
45 #define P33C_PWM_SFR_ABSTRACTION_H
84 #ifndef P33C_PWM_MODULE_s
89 struct tagPCLKCONBITS
bits;
130 struct tagCMBTRIGLBITS
bits;
134 struct tagCMBTRIGHBITS
bits;
138 struct tagLOGCONABITS
bits;
142 struct tagLOGCONABITS
bits;
146 struct tagLOGCONABITS
bits;
150 struct tagLOGCONABITS
bits;
154 struct tagLOGCONABITS
bits;
158 struct tagLOGCONABITS
bits;
162 struct tagPWMEVTABITS
bits;
166 struct tagPWMEVTABITS
bits;
170 struct tagPWMEVTABITS
bits;
174 struct tagPWMEVTABITS
bits;
178 struct tagPWMEVTABITS
bits;
182 struct tagPWMEVTABITS
bits;
186 } __attribute__((packed)) P33C_PWM_MODULE_t;
193 #ifndef P33C_PWM_GENERATOR_s
197 struct tagPG1CONLBITS
bits;
201 struct tagPG1CONHBITS
bits;
205 struct tagPG1STATBITS
bits;
209 struct tagPG1IOCONLBITS
bits;
213 struct tagPG1IOCONHBITS
bits;
217 struct tagPG1EVTLBITS
bits;
221 struct tagPG1EVTHBITS
bits;
225 struct tagPG1FPCILBITS
bits;
229 struct tagPG1FPCIHBITS
bits;
233 struct tagPG1CLPCILBITS
bits;
237 struct tagPG1CLPCIHBITS
bits;
241 struct tagPG1FFPCILBITS
bits;
245 struct tagPG1FFPCIHBITS
bits;
249 struct tagPG1SPCILBITS
bits;
253 struct tagPG1SPCIHBITS
bits;
263 struct tagPG1LEBHBITS
bits;
279 struct tagPG1DCABITS
bits;
307 struct tagPG1DTLBITS
bits;
311 struct tagPG1DTHBITS
bits;
320 } __attribute__((packed)) P33C_PWM_GENERATOR_t;
323 #define P33C_PWMGEN_SFR_OFFSET ((volatile uint16_t)&PG2CONL - (volatile uint16_t)&PG1CONL)
328 #if defined (PG8CONL)
329 #define P33C_PG_COUNT 8
330 #elif defined (PG4CONL)
331 #define P33C_PG_COUNT 4
377 volatile uint16_t period);
379 volatile uint16_t duty);
381 volatile uint16_t dead_time_rising,
volatile uint16_t dead_time_falling);
385 volatile uint16_t pgMotherTriggerOutput,
387 volatile bool ChildImmediateUpdate
union P33C_PWM_MODULE_s::@9 LOGCON_A
struct tagPG1CONLBITS bits
volatile uint16_t p33c_PwmGenerator_SetPeriod(volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t period)
Sets the period of a given PWM generator.
volatile struct P33C_PWM_GENERATOR_s pgConfigClear
Default RESET configuration of one PWM generator instance SFRs.
union P33C_PWM_GENERATOR_s::@70 PGxLEBH
union P33C_PWM_MODULE_s::@18 PWMEVT_D
union P33C_PWM_GENERATOR_s::@58 PGxIOCONH
union P33C_PWM_GENERATOR_s::@71 PGxPHASE
union P33C_PWM_MODULE_s::@12 LOGCON_D
union P33C_PWM_GENERATOR_s::@56 PGxSTAT
union P33C_PWM_MODULE_s::@8 vCMBTRIGH
volatile uint16_t p33c_PwmGenerator_Disable(volatile struct P33C_PWM_GENERATOR_s *pg)
Disables a given PWM generator.
volatile uint16_t p33c_PwmGenerator_ConfigWrite(volatile uint16_t pgInstance, volatile struct P33C_PWM_GENERATOR_s pgConfig)
Disposes a given PWM generator by resetting all its registers to default.
union P33C_PWM_MODULE_s::@4 vMDC
volatile struct P33C_PWM_MODULE_s pwmConfigClear
Default RESET configuration of the PWM module SFRs.
volatile uint16_t p33c_PwmModule_ConfigWrite(volatile struct P33C_PWM_MODULE_s pwmConfig)
Writes a user-defined configuration to the PWM base module registers.
union P33C_PWM_MODULE_s::@0 vPCLKCON
union P33C_PWM_GENERATOR_s::@78 PGxDTL
volatile uint16_t p33c_PwmGenerator_SyncGenerators(volatile struct P33C_PWM_GENERATOR_s *pgHandleMother, volatile uint16_t pgMotherTriggerOutput, volatile struct P33C_PWM_GENERATOR_s *pgHandleChild, volatile bool ChildImmediateUpdate)
Sets the synchronization triggers of two PWM generators, of which the Mother PWM generator is the tri...
union P33C_PWM_GENERATOR_s::@67 PGxSPCIL
volatile struct P33C_PWM_MODULE_s * p33c_PwmModule_GetHandle(void)
Gets pointer to PWM module SFR set.
union P33C_PWM_GENERATOR_s::@66 PGxFFPCIH
union P33C_PWM_MODULE_s::@2 vFSMINPER
volatile uint16_t p33c_PwmGenerator_GetGroup(volatile struct P33C_PWM_GENERATOR_s *pg)
Get the PWM generator group.
volatile struct P33C_PWM_GENERATOR_s * p33c_PwmGenerator_GetHandle(volatile uint16_t pgInstance)
Returns the PWM generator index.
union P33C_PWM_GENERATOR_s::@69 PGxLEBL
union P33C_PWM_MODULE_s::@20 PWMEVT_F
volatile uint16_t p33c_PwmModule_Dispose(void)
Resets all PWM base module registers to their RESET default values.
volatile uint16_t p33c_PwmGenerator_Suspend(volatile struct P33C_PWM_GENERATOR_s *pg)
Disables the PWM generator outputs but keeps the module running.
union P33C_PWM_MODULE_s::@16 PWMEVT_B
volatile uint16_t p33c_PwmGenerator_SetDeadTimes(volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t dead_time_rising, volatile uint16_t dead_time_falling)
Sets the dead-times of a given PWM generator.
union P33C_PWM_GENERATOR_s::@60 PGxEVTH
union P33C_PWM_MODULE_s::@17 PWMEVT_C
union P33C_PWM_MODULE_s::@10 LOGCON_B
volatile uint16_t p33c_PwmGenerator_GetInstance(volatile struct P33C_PWM_GENERATOR_s *pg)
Get the PWM generator instance index of a known PWM object pointer address.
volatile struct P33C_PWM_MODULE_s pwmConfigDefault
Default initialization configuration of the PWM module SFRs.
union P33C_PWM_GENERATOR_s::@79 PGxDTH
volatile uint16_t p33c_PwmModule_Initialize(void)
Initializes the PWM base module by resetting all its registers to default.
volatile uint16_t p33c_PwmGenerator_Resume(volatile struct P33C_PWM_GENERATOR_s *pg)
Disables a PWM generator IOs.
union P33C_PWM_MODULE_s::@14 LOGCON_F
union P33C_PWM_GENERATOR_s::@64 PGxCLPCIH
union P33C_PWM_GENERATOR_s::@55 PGxCONH
volatile uint16_t p33c_PwmGenerator_SetDutyCycle(volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t duty)
Sets the on-time of a given PWM generator.
union P33C_PWM_GENERATOR_s::@62 PGxFPCIH
volatile uint16_t p33c_PwmGenerator_Dispose(volatile uint16_t pgInstance)
Disposes a given PWM generator by resetting all its registers to default.
union P33C_PWM_MODULE_s::@3 vMPHASE
union P33C_PWM_GENERATOR_s::@61 PGxFPCIL
volatile struct P33C_PWM_MODULE_s p33c_PwmModule_ConfigRead(void)
Read the current configuration from the PWM base module registers.
union P33C_PWM_MODULE_s::@6 vLFSR
union P33C_PWM_GENERATOR_s::@74 PGxPER
union P33C_PWM_MODULE_s::@13 LOGCON_E
union P33C_PWM_MODULE_s::@15 PWMEVT_A
union P33C_PWM_MODULE_s::@7 vCMBTRIGL
union P33C_PWM_GENERATOR_s::@65 PGxFFPCIL
union P33C_PWM_GENERATOR_s::@75 PGxTRIGA
union P33C_PWM_GENERATOR_s::@59 PGxEVTL
union P33C_PWM_GENERATOR_s::@54 PGxCONL
union P33C_PWM_MODULE_s::@19 PWMEVT_E
union P33C_PWM_GENERATOR_s::@77 PGxTRIGC
union P33C_PWM_GENERATOR_s::@76 PGxTRIGB
volatile struct P33C_PWM_GENERATOR_s p33c_PwmGenerator_ConfigRead(volatile uint16_t pgInstance)
Disposes a given PWM generator by resetting all its registers to default.
union P33C_PWM_GENERATOR_s::@68 PGxSPCIH
struct tagPCLKCONBITS bits
union P33C_PWM_MODULE_s::@11 LOGCON_C
union P33C_PWM_MODULE_s::@1 vFSCL
union P33C_PWM_GENERATOR_s::@63 PGxCLPCIL
union P33C_PWM_GENERATOR_s::@57 PGxIOCONL
union P33C_PWM_GENERATOR_s::@73 PGxDCA
union P33C_PWM_GENERATOR_s::@72 PGxDC
volatile uint16_t p33c_PwmGenerator_Initialize(volatile uint16_t pgInstance)
Initializes a given PWM generator by resetting all its registers to default.
volatile uint16_t p33c_PwmGenerator_Enable(volatile struct P33C_PWM_GENERATOR_s *pg)
Enables a given PWM generator with output pins disabled.
union P33C_PWM_GENERATOR_s::@80 PGxCAP
union P33C_PWM_MODULE_s::@5 vMPER