Digital Power Starter Kit 3 Firmware  DM330017-3, Rev.3.0
dsPIC33C Buck Converter Peak Current Mode Control Example

Conversion macros converting physical quantities of parameters into binary (integer) numbers for registers and variables. More...

+ Collaboration diagram for Conversion Macros:
#define CPU_TCY   (float)(1.0 / CPU_FREQUENCY)
 Conversion macros of fundamental microcontroller device settings. More...
 
#define ADC_GRANULARITY   (float)(ADC_REFERENCE / pow(2.0, ADC_RESOLUTION))
 ADC granularity in [V/tick]. More...
 
#define DAC_GRANULARITY   (float)(DAC_REFERENCE / pow(2.0, DAC_RESOLUTION))
 DAC granularity in [V/tick]. More...
 
#define ADC_VALUE_MAX   (uint16_t)(pow(2.0, ADC_RESOLUTION) - 1.0)
 
#define PWM_CLOCK_PERIOD   (float)(1.0 / PWM_CLOCK_FREQUENCY)
 PWM Clock Period in [sec]. More...
 
#define DAC_CLOCK_PERIOD   (float)(2.0 / AUX_FREQUENCY)
 DAC Clock Period in [sec]. More...
 
#define DAC_MIN   (uint16_t)(DAC_MINIMUM / DAC_GRANULARITY)
 Integer value of minimum DAC reference
More...
 
#define DAC_MAX   (uint16_t)(DAC_MAXIMUM / DAC_GRANULARITY)
 Integer value of maximum DAC reference. More...
 
#define DAC_TMODTIME   (uint16_t)((DAC_TRANSITION_TIME / AUX_PLL_CLOCK) / 2.0)
 Integer value of transition time period based on most recent auxiliary clock settings. More...
 
#define DAC_SSTIME   (uint16_t)((DAC_STEADY_STATE_TIME / AUX_PLL_CLOCK) / 2.0)
 Integer value of Steady-State time period based on most recent auxiliary clock settings. More...
 
#define DAC_TMCB   (uint16_t)((DAC_LEADING_EDGE_PERIOD / AUX_PLL_CLOCK) / 2.0)
 Integer value of Steady-State time period based on most recent auxiliary clock settings. More...
 

Detailed Description

Conversion macros converting physical quantities of parameters into binary (integer) numbers for registers and variables.

Macro Definition Documentation

◆ ADC_GRANULARITY

#define ADC_GRANULARITY   (float)(ADC_REFERENCE / pow(2.0, ADC_RESOLUTION))

ADC granularity in [V/tick].

Definition at line 137 of file dpsk3_hwdescr.h.

◆ ADC_VALUE_MAX

#define ADC_VALUE_MAX   (uint16_t)(pow(2.0, ADC_RESOLUTION) - 1.0)

Definition at line 139 of file dpsk3_hwdescr.h.

◆ CPU_TCY

#define CPU_TCY   (float)(1.0 / CPU_FREQUENCY)

Conversion macros of fundamental microcontroller device settings.

This section is used to convert device specific parameters like ADC reference and resolution, main execution clock frequency and peripheral time base settings, declared in physical quantities, into binary (integer) numbers to be written to variables and SFRs. Instruction period

Definition at line 136 of file dpsk3_hwdescr.h.

◆ DAC_CLOCK_PERIOD

#define DAC_CLOCK_PERIOD   (float)(2.0 / AUX_FREQUENCY)

DAC Clock Period in [sec].

Definition at line 141 of file dpsk3_hwdescr.h.

◆ DAC_GRANULARITY

#define DAC_GRANULARITY   (float)(DAC_REFERENCE / pow(2.0, DAC_RESOLUTION))

DAC granularity in [V/tick].

Definition at line 138 of file dpsk3_hwdescr.h.

◆ DAC_MAX

#define DAC_MAX   (uint16_t)(DAC_MAXIMUM / DAC_GRANULARITY)

Integer value of maximum DAC reference.

Definition at line 144 of file dpsk3_hwdescr.h.

◆ DAC_MIN

#define DAC_MIN   (uint16_t)(DAC_MINIMUM / DAC_GRANULARITY)

Integer value of minimum DAC reference

Definition at line 143 of file dpsk3_hwdescr.h.

◆ DAC_SSTIME

#define DAC_SSTIME   (uint16_t)((DAC_STEADY_STATE_TIME / AUX_PLL_CLOCK) / 2.0)

Integer value of Steady-State time period based on most recent auxiliary clock settings.

Definition at line 146 of file dpsk3_hwdescr.h.

◆ DAC_TMCB

#define DAC_TMCB   (uint16_t)((DAC_LEADING_EDGE_PERIOD / AUX_PLL_CLOCK) / 2.0)

Integer value of Steady-State time period based on most recent auxiliary clock settings.

Definition at line 147 of file dpsk3_hwdescr.h.

◆ DAC_TMODTIME

#define DAC_TMODTIME   (uint16_t)((DAC_TRANSITION_TIME / AUX_PLL_CLOCK) / 2.0)

Integer value of transition time period based on most recent auxiliary clock settings.

Definition at line 145 of file dpsk3_hwdescr.h.

◆ PWM_CLOCK_PERIOD

#define PWM_CLOCK_PERIOD   (float)(1.0 / PWM_CLOCK_FREQUENCY)

PWM Clock Period in [sec].

Definition at line 140 of file dpsk3_hwdescr.h.