项目的研究内容是对硅微谐振式加速度计的数据采集电路开展研究工作。硅微谐振式加速度计敏感结构输出的是两路差分的频率信号
源代码在线查看: data.cpp
// DATA.cpp: implementation of the DATA class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "item4.h"
#include "DATA.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
DATA::DATA()
{
}
DATA::~DATA()
{
}
int DATA::GetXLong()
{
return this->mPointNum;
}
void DATA::SetmGetNumAndmNum(int num,int kind)
{
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance("ADODB.Connection");
m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\频率测量数据库.mdb","","",adModeUnknown);
_RecordsetPtr m_pRecordset;
m_pRecordset.CreateInstance("ADODB.Recordset");
CString strSQL="SELECT * FROM "+this->mTableName;
m_pRecordset->Open((_variant_t)strSQL,_variant_t((IDispatch *)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
_variant_t name;
m_pRecordset->Move(num);
CString temp;
switch(kind)
{
case 0:temp="a路频率Hz";break;
case 1:temp="b路频率Hz";break;
case 2:temp="两路频率差Hz";break;
}
name=m_pRecordset->GetCollect((_variant_t)temp);
CString s=(LPCTSTR)_bstr_t(name);
this->mGetData=(float)atof(s);
this->mNum=num;
}
void DATA::SetmTableName(CString str)
{
this->mTableName=str;
}
void DATA::SetmAccurateData(float a)
{
this->mAccurateData=a;
}
void DATA::SetmPointNum()
{
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance("ADODB.Connection");
m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\频率测量数据库.mdb","","",adModeUnknown);
_RecordsetPtr m_pRecordset;
m_pRecordset.CreateInstance("ADODB.Recordset");
CString strSQL="SELECT * FROM "+this->mTableName;
m_pRecordset->Open((_variant_t)strSQL,_variant_t((IDispatch *)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
_variant_t name;
m_pRecordset->MoveLast();
name=m_pRecordset->GetCollect("序号");
CString s=(LPCTSTR)_bstr_t(name);
this->mPointNum=atoi(s);
}
POINT DATA::GetPoint(int kind)
{
POINT p;
if(kind {
p.y=250-(this->mGetData-this->mAccurateData)/0.05*180;
p.x=this->mNum*710/(this->mPointNum-1)+70;
}
else
{
p.y=250-(this->mGetData-this->mAccurateData)/0.1*180;
p.x=this->mNum*710/(this->mPointNum-1)+70;
}
return p;
}