Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
Dear Manager,
I debug the below code which is the example of buffed dac.
it works well, however how can I check it in outside pin?
when I measured the all multimeter, there are all around 0.
// Included Files
//
#include "F28x_Project.h"
//
// Globals
//
volatile struct DAC_REGS* DAC_PTR[4] = {0x0,&DacaRegs,&DacbRegs,&DaccRegs};
Uint16 dacval = 2048;
//
// Defines
//
#define REFERENCE_VDAC 0
#define REFERENCE_VREF 1
#define DACA 1
#define DACB 2
#define DACC 3
#define REFERENCE REFERENCE_VDAC
#define DAC_NUM DACA
//
// Function Prototypes
//
void configureDAC(Uint16 dac_num);
void main(void)
{
//
// Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the F2837xD_SysCtrl.c file.
//
InitSysCtrl();
//
// Disable CPU interrupts
//
DINT;
//
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags are cleared.
// This function is found in the F2837xD_PieCtrl.c file.
//
InitPieCtrl();
//
// Clear all interrupts and initialize PIE vector table:
//
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
//
// Configure DAC
//
configureDAC(DAC_NUM);
configureDAC(DAC_NUM+1);
while(1)
{
DAC_PTR[DAC_NUM]->DACVALS.all = dacval;
DELAY_US(2);
DAC_PTR[DAC_NUM+1]->DACVALS.all = dacval/2;
DELAY_US(2);
}
}
//
// configureDAC - Configure specified DAC output
//
void configureDAC(Uint16 dac_num)
{
EALLOW;
DAC_PTR[dac_num]->DACCTL.bit.DACREFSEL = REFERENCE;
DAC_PTR[dac_num]->DACOUTEN.bit.DACOUTEN = 1;
DAC_PTR[dac_num]->DACVALS.all = 0;
DELAY_US(10); // Delay for buffered DAC to power up
EDIS;
}
//
// End of file
//