Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example

Conversion macros for user-declarations of input voltage feedback parameters of the buck converter. More...

+ Collaboration diagram for Buck Converter:
#define BUCK_VIN_FEEDBACK_GAIN   (float)((BUCK_VIN_R2) / (BUCK_VIN_R1 + BUCK_VIN_R2))
 Conversion macros of input voltage feedback parameters. More...
 
#define BUCK_VIN_MIN   (uint16_t)(BUCK_VIN_MINIMUM * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)
 Minimum input voltage. More...
 
#define BUCK_VIN_NOM   (uint16_t)(BUCK_VIN_NOMINAL * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)
 Nominal input voltage. More...
 
#define BUCK_VIN_MAX   (uint16_t)(BUCK_VIN_MAXIMUM * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)
 Maximum input voltage. More...
 
#define BUCK_VIN_HYST   (uint16_t)(BUCK_VIN_HYSTERESIS * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)
 Over Voltage LOck Out voltage
More...
 
#define BUCK_VIN_UVLO_TRIP   (uint16_t)(BUCK_VIN_UNDER_VOLTAGE * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)
 Under Voltage LOck Out voltage. More...
 
#define BUCK_VIN_UVLO_RELEASE   (uint16_t)((BUCK_VIN_UNDER_VOLTAGE + BUCK_VIN_HYSTERESIS) * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)
 Under Voltage LOck Out voltage. More...
 
#define BUCK_VIN_OVLO_TRIP   (uint16_t)(BUCK_VIN_OVER_VOLTAGE * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)
 Over Voltage LOck Out voltage. More...
 
#define BUCK_VIN_OVLO_RELEASE   (uint16_t)((BUCK_VIN_OVER_VOLTAGE - BUCK_VIN_HYSTERESIS) * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)
 Over Voltage LOck Out voltage. More...
 
#define BUCK_VIN_ADC_TRGDLY   (uint16_t)(BUCK_VIN_ADC_TRG_DELAY / PWM_CLOCK_PERIOD)
 Input voltage ADC trigger delay. More...
 
#define BUCK_VIN_OFFSET   (uint16_t)(BUCK_VIN_FEEDBACK_OFFSET / ADC_GRANULARITY)
 Input voltage feedback offset. More...
 
#define BUCK_VIN_NORM_INV_G   (float)(1.0/BUCK_VIN_FEEDBACK_GAIN)
 Inverted feedback gain required for value normalization. More...
 
#define BUCK_VIN_NORM_SCALER   (int16_t)(ceil(log(BUCK_VIN_NORM_INV_G)/log(2)))
 VIN normalization
More...
 
#define BUCK_VIN_NORM_FACTOR   (int16_t)((BUCK_VIN_NORM_INV_G / pow(2.0, BUCK_VIN_NORM_SCALER)) * (pow(2.0, 15)-1))
 VIN normalization factor scaled in Q15. More...
 
#define BUCK_VIN_RANGE_MAX   (float)(ADC_REFERENCE * BUCK_VIN_NORM_INV_G)
 

Detailed Description

Conversion macros for user-declarations of input voltage feedback parameters of the buck converter.

Macro Definition Documentation

◆ BUCK_VIN_ADC_TRGDLY

#define BUCK_VIN_ADC_TRGDLY   (uint16_t)(BUCK_VIN_ADC_TRG_DELAY / PWM_CLOCK_PERIOD)

Input voltage ADC trigger delay.

Definition at line 457 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_FEEDBACK_GAIN

#define BUCK_VIN_FEEDBACK_GAIN   (float)((BUCK_VIN_R2) / (BUCK_VIN_R1 + BUCK_VIN_R2))

Conversion macros of input voltage feedback parameters.

These conversion macros are used to convert user settings defined as physical quantities into binary (integer) numbers, which will be written to registers and variables and used in calculations throughout the firmware.

Definition at line 448 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_HYST

#define BUCK_VIN_HYST   (uint16_t)(BUCK_VIN_HYSTERESIS * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)

Over Voltage LOck Out voltage

Definition at line 452 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_MAX

#define BUCK_VIN_MAX   (uint16_t)(BUCK_VIN_MAXIMUM * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)

Maximum input voltage.

Definition at line 451 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_MIN

#define BUCK_VIN_MIN   (uint16_t)(BUCK_VIN_MINIMUM * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)

Minimum input voltage.

Definition at line 449 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_NOM

#define BUCK_VIN_NOM   (uint16_t)(BUCK_VIN_NOMINAL * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)

Nominal input voltage.

Definition at line 450 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_NORM_FACTOR

#define BUCK_VIN_NORM_FACTOR   (int16_t)((BUCK_VIN_NORM_INV_G / pow(2.0, BUCK_VIN_NORM_SCALER)) * (pow(2.0, 15)-1))

VIN normalization factor scaled in Q15.

Definition at line 462 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_NORM_INV_G

#define BUCK_VIN_NORM_INV_G   (float)(1.0/BUCK_VIN_FEEDBACK_GAIN)

Inverted feedback gain required for value normalization.

Definition at line 460 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_NORM_SCALER

#define BUCK_VIN_NORM_SCALER   (int16_t)(ceil(log(BUCK_VIN_NORM_INV_G)/log(2)))

VIN normalization

Definition at line 461 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_OFFSET

#define BUCK_VIN_OFFSET   (uint16_t)(BUCK_VIN_FEEDBACK_OFFSET / ADC_GRANULARITY)

Input voltage feedback offset.

Definition at line 458 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_OVLO_RELEASE

#define BUCK_VIN_OVLO_RELEASE   (uint16_t)((BUCK_VIN_OVER_VOLTAGE - BUCK_VIN_HYSTERESIS) * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)

Over Voltage LOck Out voltage.

Definition at line 456 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_OVLO_TRIP

#define BUCK_VIN_OVLO_TRIP   (uint16_t)(BUCK_VIN_OVER_VOLTAGE * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)

Over Voltage LOck Out voltage.

Definition at line 455 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_RANGE_MAX

#define BUCK_VIN_RANGE_MAX   (float)(ADC_REFERENCE * BUCK_VIN_NORM_INV_G)

Definition at line 464 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_UVLO_RELEASE

#define BUCK_VIN_UVLO_RELEASE   (uint16_t)((BUCK_VIN_UNDER_VOLTAGE + BUCK_VIN_HYSTERESIS) * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)

Under Voltage LOck Out voltage.

Definition at line 454 of file dpsk3_hwdescr.h.

◆ BUCK_VIN_UVLO_TRIP

#define BUCK_VIN_UVLO_TRIP   (uint16_t)(BUCK_VIN_UNDER_VOLTAGE * BUCK_VIN_FEEDBACK_GAIN / ADC_GRANULARITY)

Under Voltage LOck Out voltage.

Definition at line 453 of file dpsk3_hwdescr.h.