Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
p33c_dsp.c
1
/*LICENSE *****************************************************************************************
2
*
3
* Software License Agreement
4
*
5
* Copyright (R) 2017 Microchip Technology Inc. All rights reserved. Microchip licenses to you the
6
* right to use, modify, copy and distribute Software only when embedded on a Microchip
7
* microcontroller or digital signal controller, which is integrated into your product or third
8
* party product (pursuant to the sublicense terms in the accompanying license agreement).
9
*
10
* You should refer to the license agreement accompanying this Software for additional information
11
* regarding your rights and obligations.
12
*
13
* SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
14
* IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT
15
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR
16
* OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
17
* OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT
18
* LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS
19
* OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY
20
* THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
21
*
22
* ***********************************************************************************************/
23
24
// Include Header Files
25
#include <xc.h>
// include processor files - each processor file is guarded.
26
#include <stdint.h>
// include standard integer number data types
27
#include <stdbool.h>
// include standard boolean data types (true/false)
28
29
#include "p33c_dsp.h"
30
31
40
53
volatile
uint16_t
Dsp_SetConfig
(
volatile
struct
DSP_CONFIG_s
dsp_cfg)
54
{
55
volatile
uint16_t retval = 0;
56
57
CORCON = dsp_cfg.
value
;
58
if
(CORCON == (dsp_cfg.
value
& REG_CORCON_VALID_DATA_WRITE_MSK))
59
retval = 1;
60
61
return
(retval);
62
63
}
64
65
66
78
volatile
struct
DSP_CONFIG_s
Dsp_GetConfig
(void)
79
{
80
volatile
struct
DSP_CONFIG_s
dsp_cfg;
81
82
dsp_cfg.
value
= (
volatile
uint16_t)(CORCON);
// & REG_CORCON_VALID_DATA_READ_MSK);
83
84
return
(dsp_cfg);
85
86
}
87
88
//------------------------------------------------------------------------------
89
//------------------------------------------------------------------------------
90
91
92
// end of file
DSP_CONFIG_s
Definition:
p33c_dsp.h:167
Dsp_SetConfig
volatile uint16_t Dsp_SetConfig(volatile struct DSP_CONFIG_s dsp_cfg)
Initializes the DSP engine in accordance to user settings.
Definition:
p33c_dsp.c:53
DSP_CONFIG_s::value
volatile uint16_t value
Definition:
p33c_dsp.h:186
Dsp_GetConfig
volatile struct DSP_CONFIG_s Dsp_GetConfig(void)
Reads the DSP engine configuration.
Definition:
p33c_dsp.c:78
dpsk_buck_vmc.X
sources
common
p33c_pral
p33c_dsp.c
© 2021, Microchip Technology Inc.