Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
init_dsp.c
1 /*
2  * File: init_dsp.c
3  * Author: M91406
4  *
5  * Created on October 16, 2018, 12:00 PM
6  */
7 
8 
9 #include <xc.h>
10 #include "xc16_pral.h"
11 
12 
48 volatile uint16_t sysDsp_Initialize(void) {
49 
50  CORCONbits.ACCSAT = CORCON_ACCSAT_131; // Accumulator Saturation Mode Selection: 9.31 saturation (super saturation)
51  CORCONbits.IF = CORCON_IF_FRACTIONAL; // Integer or Fractional Multiplier Mode Selection: Fractional mode is enabled for DSP multiply
52  CORCONbits.RND = CORCON_RND_UNBIASED; // Rounding Mode Selection: Unbiased (convergent) rounding is enabled
53  CORCONbits.SATA = CORCON_SATA_ON; // ACCA Saturation Enable: Accumulator A saturation is enabled
54  CORCONbits.SATB = CORCON_SATB_ON; // ACCB Saturation Enable: Accumulator B saturation is enabled
55  CORCONbits.SATDW = CORCON_SATDW_OFF; // Data Space Write from DSP Engine Saturation Enable: Data Space write saturation is enabled
56  CORCONbits.US = CORCON_US_SIGNED; // DSP Multiply Unsigned/Signed Control: DSP engine multiplies are signed
57  CORCONbits.VAR = CORCON_VAR_FIXED; // Variable Exception Processing Latency Control: Fixed exception processing is enabled
58 
59 // CORCONbits.DL = CORCON_DL_0; // (read only)
60 // CORCONbits.EDT = CORCON_EDT_RUN; // control bit => do not set during configuration
61 // CORCONbits.SFA = CORCON_SFA_ACTIVE; // (read only)
62 // CORCONbits.IPL3 = CORCON_IPL3_STAT_LT7; // (read only)
63 
64  Nop();
65  Nop();
66  Nop();
67 
68  return(1);
69 }
70 
sysDsp_Initialize
volatile uint16_t sysDsp_Initialize(void)
Digital Signal Processor initialization.
Definition: init_dsp.c:48