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

Public functions of the second library layer. More...

+ Collaboration diagram for Public Functions:

Functions

volatile uint16_t drv_BuckConverter_Initialize (volatile struct BUCK_CONVERTER_s *buckInstance)
 This function initializes all peripheral modules and their instances used by the power controller. More...
 
volatile uint16_t drv_BuckConverter_Execute (volatile struct BUCK_CONVERTER_s *buckInstance)
 This function is the main buck converter state machine executing the most recent state. More...
 
volatile uint16_t drv_BuckConverter_Start (volatile struct BUCK_CONVERTER_s *buckInstance)
 This function starts the buck converter. More...
 
volatile uint16_t drv_BuckConverter_Stop (volatile struct BUCK_CONVERTER_s *buckInstance)
 This function stop the buck converter opration. More...
 
volatile uint16_t drv_BuckConverter_Suspend (volatile struct BUCK_CONVERTER_s *buckInstance)
 This function suspends the operation of the buck converter. More...
 
volatile uint16_t drv_BuckConverter_Resume (volatile struct BUCK_CONVERTER_s *buckInstance)
 This function resume the operation of the buck converter. More...
 

Detailed Description

Public functions of the second library layer.

This is the detailed description of public functions of the buck converter device driver library application programming interface (API).

Function Documentation

◆ drv_BuckConverter_Execute()

volatile uint16_t drv_BuckConverter_Execute ( volatile struct BUCK_CONVERTER_s buckInstance)

This function is the main buck converter state machine executing the most recent state.

Parameters
buckInstancePointer to a Buck Converter data object of type struct BUCK_CONVERTER_s
Returns
0 = BUCK_OPSRET_REPEAT
1 = BUCK_OPSRET_COMPLETE
2 = BUCK_OPSRET_REPEAT

This function performs tasks in the state machine.

  • If state machine state returns ERROR, switch to ERROR state in next execution cycle
  • If state machine state signals state completion, move on to next state in line
  • When state machine state returns REPEAT, the recent state function will be called again
  • When state machine state returns an unknown result, the state machine will be reset to INITIALIZE again

Definition at line 82 of file dev_buck_converter.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drv_BuckConverter_Initialize()

volatile uint16_t drv_BuckConverter_Initialize ( volatile struct BUCK_CONVERTER_s buckInstance)

This function initializes all peripheral modules and their instances used by the power controller.

Parameters
buckInstancePointer to a Buck Converter data object of type struct BUCK_CONVERTER_s
Returns
unsigned integer (0=failure, 1=success)

This function initializes the PWM module, PWM channels, ADC channels for temperature, input voltage, output voltage and phase current. The buck IO pins are also initialize while keeping the buck converter operation disabled. The state machine is set to Initialize.

Definition at line 30 of file dev_buck_converter.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drv_BuckConverter_Resume()

volatile uint16_t drv_BuckConverter_Resume ( volatile struct BUCK_CONVERTER_s buckInstance)

This function resume the operation of the buck converter.

Parameters
buckInstancePointer to a Buck Converter data object of type struct BUCK_CONVERTER_s
Returns
unsigned integer (0=failure, 1=success)

This function executes the latest task in the state machine enforcing state switch immediately.

Definition at line 294 of file dev_buck_converter.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drv_BuckConverter_Start()

volatile uint16_t drv_BuckConverter_Start ( volatile struct BUCK_CONVERTER_s buckInstance)

This function starts the buck converter.

Parameters
buckInstancePointer to a Buck Converter data object of type struct BUCK_CONVERTER_s
Returns
unsigned integer (0=failure, 1=success)

This function starts the buck converter operation by enabling the the buck PWM and ADC peripherals, enabling the buck converter and reseting the state machine to Initialize.

Definition at line 197 of file dev_buck_converter.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drv_BuckConverter_Stop()

volatile uint16_t drv_BuckConverter_Stop ( volatile struct BUCK_CONVERTER_s buckInstance)

This function stop the buck converter opration.

Parameters
buckInstancePointer to a Buck Converter data object of type struct BUCK_CONVERTER_s
Returns
unsigned integer (0=failure, 1=success)

This function stops the buck converter operation by shutting down the PWM generator, disabling the voltage/current loop and reset the state machine to Initialize.

Definition at line 240 of file dev_buck_converter.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drv_BuckConverter_Suspend()

volatile uint16_t drv_BuckConverter_Suspend ( volatile struct BUCK_CONVERTER_s buckInstance)

This function suspends the operation of the buck converter.

Parameters
buckInstancePointer to a Buck Converter data object of type struct BUCK_CONVERTER_s
Returns
unsigned integer (0=failure, 1=success)

This function sets the suspend bit terminating operation. This bit will be evaluated in the State machine tasks which eventually shuts down the operation of the buck converter.

Definition at line 273 of file dev_buck_converter.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: