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

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

+ Collaboration diagram for Buck Converter:
#define BUCK_VOUT_FEEDBACK_GAIN   (float)((BUCK_VOUT_DIV_R2) / (BUCK_VOUT_DIV_R1 + BUCK_VOUT_DIV_R2))
 Conversion macros of output voltage feedback parameters. More...
 
#define BUCK_VOUT_REF   (uint16_t)(BUCK_VOUT_NOMINAL * BUCK_VOUT_FEEDBACK_GAIN / ADC_GRANULARITY)
 Macro calculating the integer number equivalent of the output voltage reference given above in [V]. More...
 
#define BUCK_VOUT_NOM   (uint16_t) BUCK_VOUT_REF
 Alias macro of the integer number equivalent of the nominal output voltage given above in [V]. More...
 
#define BUCK_VOUT_DEV_TRIP   (uint16_t)((BUCK_VOUT_TOLERANCE_MAX * BUCK_VOUT_FEEDBACK_GAIN) / ADC_GRANULARITY)
 Macro calculating the integer number equivalent of the maximum allowed output voltage deviation given above in [V], which will lead to a converter shut down when exceeded. More...
 
#define BUCK_VOUT_DEV_RELEASE   (uint16_t)((BUCK_VOUT_TOLERANCE_MIN * BUCK_VOUT_FEEDBACK_GAIN) / ADC_GRANULARITY)
 Macro calculating the integer number equivalent of the maximum allowed output voltage deviation given above in [V], which needs to be underrun before a shut-down converter can recover. More...
 
#define BUCK_VOUT_OVP_TRIP   (uint16_t)((BUCK_VOUT_MAXIMUM * BUCK_VOUT_FEEDBACK_GAIN) / ADC_GRANULARITY)
 Over Voltage Protection voltage trip signal level. More...
 
#define BUCK_VOUT_OVP_RELEASE   (uint16_t)((BUCK_VOUT_MAXIMUM - BUCK_VOUT_HYSTERESIS) * BUCK_VOUT_FEEDBACK_GAIN / ADC_GRANULARITY)
 Over Voltage Protection voltage recovery signal level. More...
 
#define BUCK_VOUT_OFFSET   (uint16_t)(BUCK_VOUT_FEEDBACK_OFFSET / ADC_GRANULARITY)
 Macro calculating the integer number equivalent of the physical, static signal offset of this feedback channel. More...
 
#define BUCK_VOUT_ADC_TRGDLY   (uint16_t)(BUCK_VOUT_ADC_TRG_DELAY / PWM_CLOCK_PERIOD)
 Macro calculating the integer number equivalent of the signal chain time delay between internal PWM timebase and effective switching edge of the leading FET. More...
 
#define BUCK_VOUT_NORM_INV_G   (float)(1.0/BUCK_VOUT_FEEDBACK_GAIN)
 Inverted feedback gain required for value normalization. More...
 
#define BUCK_VOUT_NORM_SCALER   (int16_t)(ceil(log(BUCK_VOUT_NORM_INV_G)/log(2)))
 VOUT normalization bit-shift scaler
More...
 
#define BUCK_VOUT_NORM_FACTOR   (int16_t)((BUCK_VOUT_NORM_INV_G / pow(2.0, BUCK_VOUT_NORM_SCALER)) * (pow(2.0, 15)-1))
 VOUT normalization factor scaled in Q15. More...
 
#define BUCK_VOUT_RANGE_MAX   (float)(ADC_REFERENCE * BUCK_VOUT_NORM_INV_G)
 Macro calculating the integer number equivalent of the total output voltage range defined by the settings given above in [V]]. More...
 

Detailed Description

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

Macro Definition Documentation

◆ BUCK_VOUT_ADC_TRGDLY

#define BUCK_VOUT_ADC_TRGDLY   (uint16_t)(BUCK_VOUT_ADC_TRG_DELAY / PWM_CLOCK_PERIOD)

Macro calculating the integer number equivalent of the signal chain time delay between internal PWM timebase and effective switching edge of the leading FET.

Definition at line 538 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_DEV_RELEASE

#define BUCK_VOUT_DEV_RELEASE   (uint16_t)((BUCK_VOUT_TOLERANCE_MIN * BUCK_VOUT_FEEDBACK_GAIN) / ADC_GRANULARITY)

Macro calculating the integer number equivalent of the maximum allowed output voltage deviation given above in [V], which needs to be underrun before a shut-down converter can recover.

Definition at line 534 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_DEV_TRIP

#define BUCK_VOUT_DEV_TRIP   (uint16_t)((BUCK_VOUT_TOLERANCE_MAX * BUCK_VOUT_FEEDBACK_GAIN) / ADC_GRANULARITY)

Macro calculating the integer number equivalent of the maximum allowed output voltage deviation given above in [V], which will lead to a converter shut down when exceeded.

Definition at line 533 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_FEEDBACK_GAIN

#define BUCK_VOUT_FEEDBACK_GAIN   (float)((BUCK_VOUT_DIV_R2) / (BUCK_VOUT_DIV_R1 + BUCK_VOUT_DIV_R2))

Conversion macros of output 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. Feedback gain required for value normalization

Definition at line 529 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_NOM

#define BUCK_VOUT_NOM   (uint16_t) BUCK_VOUT_REF

Alias macro of the integer number equivalent of the nominal output voltage given above in [V].

Definition at line 532 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_NORM_FACTOR

#define BUCK_VOUT_NORM_FACTOR   (int16_t)((BUCK_VOUT_NORM_INV_G / pow(2.0, BUCK_VOUT_NORM_SCALER)) * (pow(2.0, 15)-1))

VOUT normalization factor scaled in Q15.

Definition at line 542 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_NORM_INV_G

#define BUCK_VOUT_NORM_INV_G   (float)(1.0/BUCK_VOUT_FEEDBACK_GAIN)

Inverted feedback gain required for value normalization.

Definition at line 540 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_NORM_SCALER

#define BUCK_VOUT_NORM_SCALER   (int16_t)(ceil(log(BUCK_VOUT_NORM_INV_G)/log(2)))

VOUT normalization bit-shift scaler

Definition at line 541 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_OFFSET

#define BUCK_VOUT_OFFSET   (uint16_t)(BUCK_VOUT_FEEDBACK_OFFSET / ADC_GRANULARITY)

Macro calculating the integer number equivalent of the physical, static signal offset of this feedback channel.

Definition at line 537 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_OVP_RELEASE

#define BUCK_VOUT_OVP_RELEASE   (uint16_t)((BUCK_VOUT_MAXIMUM - BUCK_VOUT_HYSTERESIS) * BUCK_VOUT_FEEDBACK_GAIN / ADC_GRANULARITY)

Over Voltage Protection voltage recovery signal level.

Definition at line 536 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_OVP_TRIP

#define BUCK_VOUT_OVP_TRIP   (uint16_t)((BUCK_VOUT_MAXIMUM * BUCK_VOUT_FEEDBACK_GAIN) / ADC_GRANULARITY)

Over Voltage Protection voltage trip signal level.

Definition at line 535 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_RANGE_MAX

#define BUCK_VOUT_RANGE_MAX   (float)(ADC_REFERENCE * BUCK_VOUT_NORM_INV_G)

Macro calculating the integer number equivalent of the total output voltage range defined by the settings given above in [V]].

Definition at line 544 of file dpsk3_hwdescr.h.

◆ BUCK_VOUT_REF

#define BUCK_VOUT_REF   (uint16_t)(BUCK_VOUT_NOMINAL * BUCK_VOUT_FEEDBACK_GAIN / ADC_GRANULARITY)

Macro calculating the integer number equivalent of the output voltage reference given above in [V].

Definition at line 531 of file dpsk3_hwdescr.h.