//---------------------------------------------------------------------------
// InitAdc:
//---------------------------------------------------------------------------
// This function initializes ADC to a known state.
void DSP28x_usDelay(Uint32 Count)
{
while(--Count);
}
void InitAdc(void)
{
DSP28x_usDelay(1000000);
// To powerup the ADC the ADCENCLK bit should be set first to enable
// clocks, followed by powering up the bandgap and reference circuitry.
// After a 5ms delay the rest of the ADC can be powered up. After ADC
// powerup, another 20us delay is required before performing the first
// ADC conversion. Please note that for the delay function below to
// operate correctly the CPU_CLOCK_SPEED define statement in the
// DSP28_Examples.h file must contain the correct CPU clock period in
// nanoseconds. For example:
EALLOW;
//ADC RESET
AdcRegs.ADCTRL1.bit.RESET = 1;
// asm("RPT #10||NOP"); //delay 12 nop
AdcRegs.ADCTRL1.bit.RESET = 0;
//ADC上电
// DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL3.bit.ADCBGRFDN = 3; // Power up bandgap/reference circuitry
DELAY_US(ADC_usDELAY); // Delay before powering up rest of ADC
AdcRegs.ADCTRL3.bit.ADCPWDN = 1; // Power up rest of ADC
DELAY_US(ADC_usDELAY2); // Delay after powering up ADC
AdcRegs.ADCTRL3.bit.ADCEXTREF = 0;
#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File
//---------------------------------------------------------------------------
// InitEv:
//---------------------------------------------------------------------------
// This function initializes to a known state.
//
void InitEv(void)
{
EvaRegs.T1CNT =0;
EvaRegs.T1PR =0x0BB8;
EvaRegs.T1CON.all =0x1042;