36#include <p33CH512MP506S1.h>
38#include "../../../mcc_generated_files/system/pins.h"
44#include "../../misc/MCC_add_on.h"
84#ifdef ADAPTIVE_STEPRESPONSE_ENABLED
98#if defined MODE_INTERLEAVED
128#ifdef VOUT_PRECHARGE_PCS_ENABLE
134#ifdef AC_CYCLE_SKIPPING_ENABLED
141#ifdef MODE_GRID_TIE_INVERTER
200#ifdef MODE_INTERLEAVED
209#ifdef DUTY_RATIO_FEEDFORWARD_ENABLED
221#ifdef MODE_INTERLEAVED
267 static uint32_t VoutAVGsum, PH1AVGCurrentsum, PH2AVGCurrentsum;
268 static uint32_t PH1AVGCurrentOffset, PH2AVGCurrentOffset;
269 static uint16_t vac_pol_changed_counter;
270 static uint16_t PH1vac_pol_changed_counter, PH2vac_pol_changed_counter;
285 vac_pol_changed_counter++;
286 PH1vac_pol_changed_counter++;
287 PH2vac_pol_changed_counter++;
296 vac_pol_changed_counter = 0;
310 PH1AVGCurrentsum = 0;
311 PH1AVGCurrentOffset = 0;
312 PH1vac_pol_changed_counter = 0;
319 PH2AVGCurrentsum = 0;
320 PH2AVGCurrentOffset = 0;
321 PH2vac_pol_changed_counter = 0;
332 PH1AVGCurrentsum = 0;
333 PH1AVGCurrentOffset = 0;
334 PH1vac_pol_changed_counter = 0;
426 PWM_SwapEnable(PWMnr);
433 PWM_SwapDisable(PWMnr);
460 PWM_SwapDisable(PWMnr);
472 PWM_SwapEnable(PWMnr);
520 PWM_SwapEnable(PWMnr);
530 PWM_SwapDisable(PWMnr);
541#ifdef COMMON_MODE_DETECTION
554#ifdef COMMON_MODE_DETECTION
558#ifdef CHARGEPUMP_ENABLED
577#if defined CHARGEPUMP_ENABLED
587 PWM_SwapEnable(PWMnr);
593 PWM_SwapDisable(PWMnr);
601#if defined RECTIFIER_SWITCH
643 uint16_t var1_ui, var2_ui;
649 if (var1_ui > var2_ui)
653 else if (var1_ui < var2_ui)
669#ifdef SYNCHRONOUS_ACTIVE_SWITCH
674#ifndef MODE_GRID_TIE_INVERTER
682#ifndef MODE_GRID_TIE_INVERTER
693#ifndef MODE_GRID_TIE_INVERTER
701#ifndef MODE_GRID_TIE_INVERTER
736 var_ul = (uint32_t) var1_ui * MPER;
863#ifndef ADAPTIVE_GAIN_ENABLED
867#ifdef ADAPTIVE_GAIN_SLIDER_MODE
871#if defined (MODE_PFC) || defined (MODE_INTERLEAVED)
875 mul02 = (uint16_t) (mul01 >> 15);
881 mul02 = (uint16_t) (mul01 >> 15);
893#ifdef MODE_GRID_TIE_INVERTER
uint16_t OpenLoopStartupDuration
PHASE_VALUES_t Phase_Values_PH2
PWR_CTRL_STATE_e pwr_ctrl_state
uint16_t Adaptive_Gain_Factor
VMC_VALUES_t Vout_Control
PHASE_VALUES_t Phase_Values_PH1
This is the typedef file for power controller.
SMPS_2P2Z_T PHx_AVG_CM2p2z[3]
This is the driver header file for the power controller.
static void DutyCycleFeedForward_PHx(struct PHASE_VALUES_s *PhaseX)
static void VOUT_HystereticCheck(void)
static void SoftstartAfterZC_PHx_PFCMode(struct PHASE_VALUES_s *PhaseX, uint16_t PWMnr)
static void BurstMode_PHx(struct PHASE_VALUES_s *PhaseX, uint16_t PWMnr)
static void Handler_PHx(struct PHASE_VALUES_s *PhaseX, uint16_t PWMnr)
static void CCM_PHx(struct PHASE_VALUES_s *PhaseX, uint16_t PWMnr)
void Application_handler_PH2(void)
static void VOUTaveraging(void)
static void ZeroCross_PHx(struct PHASE_VALUES_s *PhaseX, uint16_t PWMnr)
void Application_handler_PH1(void)
static void SoftstartAfterZC_PHx_GTIMode(struct PHASE_VALUES_s *PhaseX, uint16_t PWMnr)
static void Adaptive_Currentcontroller_Gain(uint16_t PWMnr)
This is the driver header file for the power controller app.
void XFT_SMPS_Controller2P2ZUpdate(SMPS_2P2Z_T *controllerData, volatile uint16_t *controllerInputRegister, int16_t reference, volatile uint16_t *controllerOutputRegister)
void SMPS_Controller2P2ZUpdate(SMPS_2P2Z_T *controllerData, volatile uint16_t *controllerInputRegister, int16_t reference, volatile uint16_t *controllerOutputRegister)
Allows the user to change the advanced operating parameters.
#define GAINSLOPE_HIGHLINE
#define GAINOFFSET_LOWLINE
#define BURST_MODE_VMC_REF_FREEZE
#define BURST_MODE_LEVEL_HIGH
#define GAINSLOPE_LOWLINE
#define GAINOFFSET_HIGHLINE
static void PWM_OverrideLowEnable(enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWML output for specific PWM generator selected by the a...
static void PWM_DutyCycleSet(enum PWM_GENERATOR genNum, uint16_t dutyCycle)
This inline function sets the PWM generator specific duty cycle register.
static void PWM_OverrideHighEnable(enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWMH output for specific PWM generator selected by the a...
static void PWM_OverrideHighDisable(enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWMH output for specific PWM generator selected by the ...
static void PWM_OverrideLowDisable(enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWML output for specific PWM generator selected by the ...
#define GPIO_Y_L_SetHigh()
Sets the RD5 GPIO Pin which has a custom name of GPIO_Y_L to High.
#define GPIO_Y_H_SetHigh()
Sets the RD6 GPIO Pin which has a custom name of GPIO_Y_H to High.
#define PWM_H_N_SetLow()
Sets the RD1 GPIO Pin which has a custom name of PWM_H_N to Low.
#define PWM_L_N_SetHigh()
Sets the RD0 GPIO Pin which has a custom name of PWM_L_N to High.
#define GPIO_Y_L_SetLow()
Sets the RD5 GPIO Pin which has a custom name of GPIO_Y_L to Low.
#define PWM_H_N_SetHigh()
Sets the RD1 GPIO Pin which has a custom name of PWM_H_N to High.
#define GPIO_Y_H_SetLow()
Sets the RD6 GPIO Pin which has a custom name of GPIO_Y_H to Low.
#define PWM_L_N_SetLow()
Sets the RD0 GPIO Pin which has a custom name of PWM_L_N to Low.
volatile int16_t Rectified
volatile uint16_t Filtered
volatile uint16_t PreviousValue
volatile uint16_t FilterCounter
volatile int16_t Vin_div_Averaged2
volatile uint16_t Rectified_Shift
volatile uint16_t VOUT_Hystresis_High
volatile unsigned VOUT_dV_dt_Active
volatile uint16_t VOUT_Hystresis_Low
volatile uint16_t Voltage_Loop_Output
volatile unsigned VOUT_dV_dt_Up
volatile uint16_t VOUT_dV_dt_Hystresis_High
volatile uint16_t Reference_Internal
volatile uint16_t BurstModeCycleCounter
volatile uint16_t PWM_Counter
volatile uint32_t IAC_Reference_l
volatile uint16_t IAC_Reference
volatile uint16_t Duty_Cycle_Set_Value
volatile uint16_t CCM_Counter
volatile uint16_t BurstModeCyclesOn
volatile unsigned Control_Freeze
struct CONTROL_STATUS_FLAGS_s::@24::@26 bits
volatile unsigned Reference_Changed
volatile unsigned VAC_Polarity_last
volatile unsigned VAC_Polarity_Changed
volatile unsigned BurstModeDetected
volatile unsigned BurstModeLatched
volatile unsigned Soft_Start_Zero_Cross
volatile unsigned VAC_Polarity_Changed_last
volatile unsigned VAC_Polarity
volatile unsigned Zero_Cross_Range
struct ACCONTROL_PHASE_STATUS_FLAGS_s::@27::@29 bits
volatile unsigned VDC_Input_Voltage
ACCONTROL_PHASE_STATUS_FLAGS_t ACcontrol_Status_Flags_perPhase
ANALOG_VALUES_t Phase_Voltage
CONTROLLER_VALUES_t Controller_Values
ANALOG_VALUES_t Phase_Current
CONTROL_STATUS_FLAGS_t Control_Status_Flags
CONTROL_REFERENCE_VALUES_t Reference
struct PFC_FLAGS_s::@30::@32 bits
This is the generated driver header file for the CMP1 driver.