資源簡介
F2812 AD采樣程序 自己用的一個程序,已經測試過,可以幫助理解F2812AD模塊

代碼片段和文件信息
#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]=((float)AdcRegs.RESULT0)*3.0/65520.0+adclo;
a1[1]=((float)AdcRegs.RESULT1)*3.0/65520.0+adclo;
a1[2]=((float)AdcRegs.RESULT2)*3.0/65520.0+adclo;
a1[3]=((float)AdcRegs.RESULT3)*3.0/65520.0+adclo;
a1[4]=((float)AdcRegs.RESULT4)*3.0/65520.0+adclo;
a1[5]=((float)AdcRegs.RESULT5)*3.0/65520.0+adclo;
a1[6]=((float)AdcRegs.RESULT6)*3.0/65520.0+adclo;
a1[7]=((float)AdcRegs.RESULT7)*3.0/65520.0+adclo;
a1[8]=((float)AdcRegs.RESULT8)*3.0/65520.0+adclo;
a1[9]=((float)AdcRegs.RESULT9)*3.0/65520.0+adclo;
a1[10]=((float)AdcRegs.RESULT10)*3.0/65520.0+adclo;
a1[11]=((float)AdcRegs.RESULT11)*3.0/65520.0+adclo;
a1[12]=((float)AdcRegs.RESULT12)*3.0/65520.0+adclo;
a1[13]=((float)AdcRegs.RESULT13)*3.0/65520.0+adclo;
a1[14]=((float)AdcRegs.RESULT14)*3.0/65520.0+adclo;
a1[15]=((float)AdcRegs.RESULT15)*3.0/65520.0+adclo;
AdcRegs.ADC_ST_FLAG.bit.INT_SEQ1_CLR=1;
AdcRegs.ADCTRL2.bit.SOC_SEQ1=1;
EINT;
}
//===========================================================================
//?No?more.
//===========================================================================
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2119??2007-04-24?17:34??ad\ad.c
?????文件??????16058??2009-04-01?15:15??ad\AD.MAP
?????文件??????10559??2009-04-01?15:18??ad\AD.paf
?????文件???????1172??2007-04-24?17:34??ad\AD.pjt
?????文件??????10173??2007-04-24?17:34??ad\ad.wks
?????文件???????2893??2009-04-01?15:15??ad\cc_build_Debug.log
?????文件??????19427??2009-04-01?15:15??ad\Debug\ad.obj
?????文件???????8089??2009-04-01?15:15??ad\Debug\DSP28_Adc.obj
?????文件???????4670??2009-04-01?15:15??ad\Debug\DSP28_CpuTimers.obj
?????文件??????11576??2009-04-01?15:15??ad\Debug\DSP28_DefaultIsr.obj
?????文件????????465??2009-04-01?15:15??ad\Debug\DSP28_ECan.obj
?????文件????????453??2009-04-01?15:15??ad\Debug\DSP28_Ev.obj
?????文件?????138526??2009-04-01?15:15??ad\Debug\DSP28_GlobalVariableDefs.obj
?????文件??????11087??2009-04-01?15:15??ad\Debug\DSP28_Gpio.obj
?????文件????????850??2009-04-01?15:15??ad\Debug\DSP28_InitPeripherals.obj
?????文件????????467??2009-04-01?15:15??ad\Debug\DSP28_Mcbsp.obj
?????文件???????4362??2009-04-01?15:15??ad\Debug\DSP28_PieCtrl.obj
?????文件??????13569??2009-04-01?15:15??ad\Debug\DSP28_PieVect.obj
?????文件????????454??2009-04-01?15:15??ad\Debug\DSP28_Sci.obj
?????文件????????454??2009-04-01?15:15??ad\Debug\DSP28_Spi.obj
?????文件???????5129??2009-04-01?15:15??ad\Debug\DSP28_SysCtrl.obj
?????文件???????3275??2009-04-01?15:15??ad\Debug\DSP28_Xintf.obj
?????文件????????473??2009-04-01?15:15??ad\Debug\DSP28_XIntrupt.obj
?????文件????????740??2009-04-01?15:15??ad\Debug.lkf
?????文件????????740??2009-04-01?15:15??ad\Debug.lkv
?????文件???????2747??2007-04-24?17:34??ad\DSP28_Adc.c
?????文件???????6469??2007-04-24?17:34??ad\DSP28_Adc.h
?????文件???????3808??2007-04-24?17:34??ad\DSP28_CpuTimers.c
?????文件???????5211??2007-04-24?17:34??ad\DSP28_CpuTimers.h
?????文件??????25191??2007-04-24?17:34??ad\DSP28_DefaultIsr.c
............此處省略36個文件信息
- 上一篇:匯編課程設計模板-進制轉換
- 下一篇:visio2019激活批注文件bat
評論
共有 條評論