Digital Power Starter Kit 3 Firmware
dsPIC33C Boost Converter Voltage Mode Control Example
init_pmd.c
1
/*
2
* File: init_pmd.c
3
* Author: M91406
4
*
5
* Created on July 8, 2019, 6:26 PM
6
*/
7
8
9
#include <xc.h>
10
#include "init_pmd.h"
11
12
/***********************************************************************************
13
* @fn uint16_t sysPmd_Initialize(void)
14
* @ingroup pmd-initialization
15
* @brief Powers down all device peripherals
16
* @return unsigned integer (0=failure, 1=success)
17
*
18
* @details
19
* When the device is coming out of RESET, all peripheral modules are powered
20
* and active, ready to be initialized and used. However, each active peripheral
21
* consumes power and accidental writes to any of its specifal function registers
22
* may be a potential source for undesired behavior. Hence, in this application
23
* all power supply to all peripheral modules are disabled, minimizing the device
24
* power consumption and preventing potential misbehavior of unused peripheral
25
* modules.
26
*
27
* @note
28
* Unpowered peripherals cannot be initialized and reads from/write to the
29
* respective special function registers will fail until the power supply to
30
* the peripheral has been enabled. Hence, power to peripheral modules has to
31
* be enabled before any intialization of its register can take place.
32
*
33
* Depending on the peripheral a short delay period may be required for the
34
* peripheral functions to become available after power up.
35
*
36
* Please refer to the device data sheet for details.
37
*
38
**********************************************************************************/
39
40
volatile
uint16_t sysPmd_Initialize(
void
) {
41
42
volatile
uint16_t retval=1;
43
44
// Disable all peripheral modules
45
PMDCONbits.PMDLOCK = 0;
// Unlock writes to PMD registers
46
47
PMD1 = 0xffff;
//
48
PMD2 = 0xffff;
//
49
PMD3 = 0xffff;
//
50
51
PMDCONbits.PMDLOCK = 1;
// Lock writes to PMD registers
52
53
return
(retval);
54
}
55
56
// end of file
dpsk_boost_vmc.X
sources
config
init
init_pmd.c
© 2021, Microchip Technology Inc.