• 大小: 108KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-16
  • 语言: 其他
  • 标签: 2812  ADC  

资源简介

TMS320F2812 ADC的采样例程,用于测试DSP2812开发板的ADC模块

资源截图

代码片段和文件信息

//2006-06-15调试AD,采样全为0,未加外部信号。
#include “DSP28_Device.h“

float a1[16];
unsigned int a2=0;
float adclo=0.0;

// Prototype statements for functions found within this file.
interrupt void ad(void);

void main(void)
{

InitSysCtrl();

DINT;
IER = 0x0000;
IFR = 0x0000;

InitPieCtrl();


InitPieVectTable();


EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.ADCINT=&ad;
EDIS;   // This is needed to disable write to EALLOW protected registers
    
    InitAdc();

    // Enable INT14 which is connected to CPU-Timer 2:
IER |= M_INT1;
//KickDog();
    // Enable global Interrupts and higher priority real-time debug events:

EINT;   // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
while(AdcRegs.ADC_ST_FLAG.bit.SEQ1_BSY==0)
{

AdcRegs.ADCTRL2.bit.SOC_SEQ1=1;

}

for(;;)
{
KickDog();
}



interrupt void ad(void)
{
IFR=0x0000;
// PieCtrl.PIEIFR1.all = 0;
PieCtrl.PIEACK.all=0xffff;
a2++;
a1[0]=((AdcRegs.RESULT0>>4)*3)/4095.0+adclo;
a1[1]=((AdcRegs.RESULT1>>4)*3)/4095.0+adclo;
a1[2]=((AdcRegs.RESULT2>>4)*3)/4095.0+adclo;
a1[3]=((AdcRegs.RESULT3>>4)*3)/4095.0+adclo;
a1[4]=((AdcRegs.RESULT4>>4)*3)/4095.0+adclo;
a1[5]=((AdcRegs.RESULT5>>4)*3)/4095.0+adclo;
a1[6]=((AdcRegs.RESULT6>>4)*3)/4095.0+adclo;
a1[7]=((AdcRegs.RESULT7>>4)*3)/4095.0+adclo;
a1[8]=((AdcRegs.RESULT8>>4)*3)/4095.0+adclo;
a1[9]=((AdcRegs.RESULT9>>4)*3)/4095.0+adclo;
a1[10]=((AdcRegs.RESULT10>>4)*3)/4095.0+adclo;
a1[11]=((AdcRegs.RESULT11>>4)*3)/4095.0+adclo;
a1[12]=((AdcRegs.RESULT12>>4)*3)/4095.0+adclo;
a1[13]=((AdcRegs.RESULT13>>4)*3)/4095.0+adclo;
a1[14]=((AdcRegs.RESULT14>>4)*3)/4095.0+adclo;
a1[15]=((AdcRegs.RESULT15>>4)*3)/4095.0+adclo;
AdcRegs.ADC_ST_FLAG.bit.INT_SEQ1_CLR=1;
AdcRegs.ADCTRL2.bit.SOC_SEQ1=1; //在这里设置断点
EINT;

}

//===========================================================================
// No more.
//===========================================================================

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-09-01 16:48  Ex10_ADC\
     文件        2103  2006-08-10 21:37  Ex10_ADC\ad.c
     文件        2183  2006-08-04 21:52  Ex10_ADC\ad.c.bak
     文件       16487  2007-06-25 14:22  Ex10_ADC\AD.MAP
     文件       10606  2007-06-25 14:30  Ex10_ADC\AD.paf
     文件        1306  2007-06-25 13:46  Ex10_ADC\AD.pjt
     文件       10173  2003-11-12 10:05  Ex10_ADC\ad.wks
     文件        2773  2007-06-25 14:22  Ex10_ADC\cc_build_Debug.log
     目录           0  2007-06-22 16:34  Ex10_ADC\Debug\
     文件        1178  2007-06-25 14:22  Ex10_ADC\Debug.lkf
     文件        1178  2007-06-25 14:22  Ex10_ADC\Debug.lkv
     文件        2747  2002-12-04 10:46  Ex10_ADC\DSP28_Adc.c
     文件        6469  2002-12-03 16:26  Ex10_ADC\DSP28_Adc.h
     文件        3808  2002-05-27 11:22  Ex10_ADC\DSP28_CpuTimers.c
     文件        5211  2002-05-27 11:23  Ex10_ADC\DSP28_CpuTimers.h
     文件       25191  2002-05-27 11:23  Ex10_ADC\DSP28_DefaultIsr.c
     文件        4797  2002-05-27 11:23  Ex10_ADC\DSP28_DefaultIsr.h
     文件        2447  2002-05-27 11:23  Ex10_ADC\DSP28_DevEmu.h
     文件        3948  2002-12-02 18:19  Ex10_ADC\DSP28_Device.h
     文件        1159  2002-05-27 11:20  Ex10_ADC\DSP28_ECan.c
     文件       46740  2002-05-27 11:24  Ex10_ADC\DSP28_ECan.h
     文件        1153  2002-05-27 11:23  Ex10_ADC\DSP28_Ev.c
     文件       20967  2002-05-27 11:24  Ex10_ADC\DSP28_Ev.h
     文件        1199  2002-05-27 11:24  Ex10_ADC\DSP28_GlobalPrototypes.h
     文件        3026  2002-05-27 11:21  Ex10_ADC\DSP28_GlobalVariableDefs.c
     文件        1748  2002-05-27 11:21  Ex10_ADC\DSP28_Gpio.c
     文件       29551  2002-05-24 09:11  Ex10_ADC\DSP28_Gpio.h
     文件        1889  2005-02-16 16:42  Ex10_ADC\DSP28_InitPeripherals.c
     文件        1186  2002-05-27 11:21  Ex10_ADC\DSP28_Mcbsp.c
     文件       34739  2002-05-27 11:24  Ex10_ADC\DSP28_Mcbsp.h
     文件        2058  2002-12-04 09:16  Ex10_ADC\DSP28_PieCtrl.c
............此处省略16个文件信息

评论

共有 条评论