TI中文支持网
TI专业的中文技术问题搜集分享网站

28377d,adc采样

Other Parts Discussed in Thread:C2000WARE

我参照ti\c2000\C2000Ware_3_03_00_00\device_support\f2837xd\examples\cpu1\adc_soc_software\cpu01

修改后,debug时发现没有读数,不知怎么回事

//###########################################################################
//
// FILE:main.c
//
//###########################################################################

//
// Included Files
//
#include "main.h"
#include "algorithm.h"Uint16 AdcdResult0;

//
// Main
//
void main(void)
{

//
// Step 1. Initialize System Control
//InitSysCtrl();

//
// Step 2. Initialize GPIO
//InitGpio();ConfigureGpio();

//
// Step 3. Clear all interrupts and initialize PIE vector table
//DINT;

//
// Initialize the PIE control registers to their default state
//InitPieCtrl();

//
// Disable CPU interrupts and clear all CPU interrupt flags
//IER = 0x0000;IFR = 0x0000;

//
// Initialize the PIE vector table with pointers to the shell Interrupt Service Routines (ISR)
//InitPieVectTable();ConfigurePieVectTable();

//
// Step 4. Initialize the Device Peripheral
//
//ConfigureADC();SET_MUX_EN;SET_MUX_A1;SET_MUX_A0;EALLOW;AdcdRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4AdcSetMode(ADC_ADCD, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1;AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1;DELAY_US(1000);EDIS;EALLOW;AdcdRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin A2AdcdRegs.ADCSOC0CTL.bit.ACQPS = 63; //sample window is acqps +AdcdRegs.ADCINTSEL1N2.bit.INT1SEL = 1; //end of SOC1 will set INT1 flagAdcdRegs.ADCINTSEL1N2.bit.INT1E = 1;//enable INT1 flagAdcdRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is clearedEDIS;

//InitCpuTimers();
//ConfigureCpuTimer();

//ConfigureExternalInterrupt();ConfigureSci();DisableEpwm();ConfigureEPwm();
//EnableEpwm();

//
// Step 5. User specific code, enable interrupts
//EnablingInterrupts();

//
// Enable global Interrupts and higher priority real-time debug events
//EINT; // Enable Global interrupt INTMERTM; // Enable Global realtime interrupt DBGM

//
// for(;;)
//do{AdcdRegs.ADCSOCFRC1.all = 0x0001; //SOC0 and SOC1while(AdcdRegs.ADCINTFLG.bit.ADCINT1 == 0);AdcdRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;AdcdResult0 = AdcdResultRegs.ADCRESULT0;}while(1);

}

Green Deng:

你好,方便标注一下具体修改的是哪些代码吗?
另外,你读取的是哪个寄存器的值?程序运行是否正常?

,

Susan Yang:

能否说明下您修改的部分?另外您使用的是launchpad还是自制板?

,

WilliamFang:

line 63-78

line106-114

主要就是改成只才ADCD的SOC0

读的就是AdcdResultRegs.ADCRESULT0和AdcdResult0

,

WilliamFang:

见上
自制版,硬件没有问题,运行另外的程序可以正常读值

赞(0)
未经允许不得转载:TI中文支持网 » 28377d,adc采样
分享到: 更多 (0)