?? ad.c
字號:
#include "DSP28_Device.h"
extern float a0[3];
extern int a1[3];
extern int b1[400];
extern int b2[400];
extern int b3[400];
extern int c1[3];
extern int c2[3];
extern int c3[3];
extern int temp;
extern int temp1;
extern int a3,aa2;
extern unsigned int a2;
extern float adclo;
extern int press,oxsg,flux;
extern int cishu;
// Prototype statements for functions found within this file.
//interrupt void ad(void);
//void Mid(int *d);
//void press_C(float x);
//void oxsg_C(float x);
//void flux_C(float x);
//void AD(void)
//{
//InitSysCtrl();
//DINT;
//IER = 0x0000;
//IFR = 0x0000;
//InitPieCtrl();
//PieCtrl.PIEIER1.bit.INTx6 = 1;
//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;//使INT1口使能,因為ADC中斷在此進入
//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)//當SEQ1處于空閑狀態時
//{
//AdcRegs.ADCTRL2.bit.SOC_SEQ1=1;// 啟動數摸轉換器
//aa2=1;
//}
//aa2=0;
//while(aa2==0)//等待中斷
//{
// KickDog();
// }
//}
/*interrupt void ad(void)
{
IFR=0x0000;//
// PieCtrl.PIEIFR1.all = 0;
PieCtrl.PIEACK.all=0xffff;
a0[0]=((float)AdcRegs.RESULT0)*3.0/4095+adclo;
a0[1]=((float)AdcRegs.RESULT1)*3.0/4095+adclo;
a0[2]=((float)AdcRegs.RESULT2)*3.0/4095+adclo;
AdcRegs.ADC_ST_FLAG.bit.INT_SEQ1_CLR=1;//SEQ1中斷復位以便下次執行中斷
AdcRegs.ADCTRL2.bit.SOC_SEQ1=1;//關斷數摸轉換
EINT;//中斷返回
press_C(a0[0]);a1[0]=temp1;
oxsg_C(a0[1]);a1[1]=temp1;
flux_C(a0[2]);a1[2]=temp1;
c1[a2]=a1[0];
c2[a2]=a1[1];
c3[a2]=a1[2];
a2++;
if(a2==3)
{
Mid(c1);
b1[a3]=temp;
Mid(c2);
b2[a3]=temp;
Mid(c3);
b3[a3]=temp;
a2=0;a3++;
}
if(a3%30==0)
{press=b1[a3];oxsg=b2[a3];flux+=b3[a3];cishu++;}
if(a3==399)
{
a3=0;
}
aa2=0;
}
void Mid(int *d)
{
if((*d<*(d+1))&&(*(d+1)<*(d+2))||(*d>*(d+1))&&(*(d+1)>*(d+2)))
{
temp=(*(d+1));
}
if((*(d+1)<*d)&&(*d<*(d+2))||(*d<*(d+1))&&(*d>*(d+2)))
{
temp=(*d);
}
temp=(*(d+2));
}
void press_C(float x)
{
temp1=(int)(x*100/2.652);
}
void oxsg_C(float x)
{
temp1=(int)((x-2.106)/0.648*100);
}*/
//void flux_C(float x)
//{
//temp1=(int)();
//}
//===========================================================================
// No more.
//===========================================================================
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -