TMS320F2812 AD 转换程序(已调试通过)/* ==================================================================================File name: F28XADC04U.C Originator: Digital Control Systems Group Texas InstrumentsDescription: This file contains source for the F28X general purpose 4 conversions ADC driver for unipolar signalsJoyshang=====================================================================================History:-------------------------------------------------------------------------------------27-02-2025 Release Rev 1.0 ----------------------------------------------------------------------------------*/#include "IQmathLib.h"#include "DSP28_Device.h"#include "f28xadc04u.h"#include "f28xbmsk.h"#define CPU_CLOCK_SPEED 6.6667L // for a 150MHz CPU clock speed#define ADC_usDELAY 5000L#define DELAY_US(A) DSP28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_CLOCK_SPEED) - 9.0L) / 5.0L)extern void DSP28x_usDelay(unsigned long Count);void F28X_adc04u_drv_init(ADCVALS *p){ DELAY_US(ADC_usDELAY); AdcRegs.ADCTRL1.all = ADC_RESET_FLAG; /* Reset the ADC Module */ asm(" NOP "); asm(" NOP "); AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3; /* 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 */ AdcRegs.ADCTRL3.bit.ADCCLKPS = 6; //ADCCLK=HSPCLK/[(ADCCTRL1[7]+1)]/* Set up ADCTRL3 register */ DELAY_US(ADC_usDELAY); AdcRegs.ADCTRL1.all = 0x0110; /* Set up ADCTRL1 register 0x0110 级联模式 */ AdcRegs.ADCTRL2.all = 0x0100; /* Set up ADCTRL2 register 0x0100 EVA 启动转换 */ AdcRegs.ADCMAXCONV.bit.MAX_CONV = 3; /* Specify four conversions */ AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; //IU AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x4; //地 AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x8; //IV AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0xC; /...