基于TMS320F2812的数据采集及FFT设计(8)

2019-04-09 10:13

冷祁:基于TMS320F2812的数据采集及FFT设计

附录D 总源程序清单

#include \

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;

- 32 -

安徽工程科技学院毕业设计(论文)

}

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; }

- 33 -


基于TMS320F2812的数据采集及FFT设计(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2014版江苏市政计价定额有关问题答疑汇总

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: