高频动弹模测试仪电路.docx

上传人:李司机 文档编号:6755280 上传时间:2024-01-20 格式:DOCX 页数:191 大小:474.93KB
返回 下载 相关 举报
高频动弹模测试仪电路.docx_第1页
第1页 / 共191页
高频动弹模测试仪电路.docx_第2页
第2页 / 共191页
高频动弹模测试仪电路.docx_第3页
第3页 / 共191页
高频动弹模测试仪电路.docx_第4页
第4页 / 共191页
高频动弹模测试仪电路.docx_第5页
第5页 / 共191页
点击查看更多>>
资源描述

《高频动弹模测试仪电路.docx》由会员分享,可在线阅读,更多相关《高频动弹模测试仪电路.docx(191页珍藏版)》请在三一办公上搜索。

1、笔者开发了一种动弹模测定仪,这款产品可以发出100oOHZ的超声波用来测试混凝体的动弹模量。该产品由安装有WINCE的CORTEXA8的嵌入式电脑控制。COXTEXA8模组产生150HZ-100oHZ的占空比为50%的PWM信号,该信号经过电路放大以后驱动超声波探头对混凝土试件发射超声波。超声波信号经过混凝土试件反射后,被测试探头接收。由于接收的信号非常弱,所以该信号经过微小电压放大电路后放大,最终被COXTEXa8模组接收,并存储。CORTEXA8比较计算后最终得到这个混凝土试件的动弹模量。仪器的电路如下图所示:CoXTEXa8模组由WlNCE下的上位机软件控制,该软件的程序为:usingS

2、ystem;usingSystem.Linq;usingSystem-Collections.Generic;usingSystem.Text;usingSystem.Drawing;usingSystem-DrawingJmaging;namespaceSmartDeviceProjectS(classClassl()publicclassReaITimeImageMaker(privateintWidth;要生成的曲线图的宽度privateintheight;要生成的曲线图的高度privatePointPointList;用来绘制曲线图的关键点,依次将这些点连接起来即得到曲线图privat

3、eRandomrandom=newRandom();用于生成随机数privateBitmapCUrrentHage;当前要绘制的图片privateColorbackColor;图片背景色privateColorforeColor;图片前景色/图片的高度/publicintHeight(getreturnheight;setheight=value;)/图片的宽度/publicintWidth(getreturnwidth;setwidth=value;)/构造函数,指定生成的曲线图的宽度和高度III/要生成的曲线图的宽度HI要生成的曲线图的高度publicRealTimelmageMaker(

4、intwidth,intheight):this(widthzheight,CoIorGray,CoIocBIue)(/构造函数,指定生成的曲线图的宽度、高度及背景色和前景色H/H1要生成的曲线图的宽度H/要生成的曲线图的高度HI曲线图背景色HI曲线图前景色publicReaITimeImageMakerfintwidth,intheight,ColorbackColor,ColorforeColor)(this.width=width;this.height=height;this.backColor=backColor;this.foreColor=foreColor;pointUst=n

5、ewPointwidth;PointtempPoint;初始化曲线上的所有点坐标for(inti=0;iwidth;i+)tempPoint=newPoint();曲线的横坐标沿X轴依次递增,在横向位置上每个像素都有一个点tempPoint.X=i;曲线上每个点的纵坐标随机生成,但保证在显示区域之内tempPoint.Y=random.Next()%height;pointListi=tempPoint;)/获取当前依次连接曲线上每个点绘制成的曲线/HH/publicImageGetCurrentCurveO/currentimage=historymage.Clone(newRectangl

6、e(l,0,width-lfheight),PixeIFormat.Format24bppRgb);/currentimage=newBitmap(width,height);currentimage=newBitmap(800z600);Pointp;将当前定位曲线图的坐标点前移,并且将横坐标减1,这样做的效果相当于移除当前第一个点for(inti=0;iwidth-1;i+)p=pointListi+1;pointListi=newPoint(p.X-1,p.Y);)PointtempPoint=newPoint();新生成曲线图定位点的最后一个点的坐标tempPoint.X=width;

7、曲线上每个点的纵坐标随机生成,但保证在显示区域之内tempPoint.Y=random.Next(DateTime-Now-MiIIisecond)%height;在最后再添加一个新坐标点pointListwidth-1=tempPoint;Graphicsg=Graphics.FromImage(CurrentImage);g.Clear(backColor);绘制曲线图g.DrawLines(newPen(foreColor)zpointUst);g.Dispose();returncurrentimage;usingSystem;usingSystem.Linq;usingSystem-

8、Collections.Generic;usingSystem.Text;usingSystem.Drawing;usingSystem.DrawingJmaging;namespaceSmartDeviceProjectS(classClass2()/说明:实时图片生成类,在本例中横向坐标上每个像素都会有一个控制点/实际开发中可以减少控制点,比如每5个像素用一个控制点/这样的效果或许更加逼真/首发地址:/publicclassReaITimeImageMaker(privateintWidth;要生成的曲线图的宽度privateintheight;要生成的曲线图的高度privatePoint

9、PointList;用来绘制曲线图的关键点,依次将这些点连接起来即得到曲线图privateRandomrandom=newRandom();用于生成随机数privateBitmapCUrTentImage;当前要绘制的图片privateColorbackColor;图片背景色privateColorforeColor;图片前景色/图片的高度/IllIllpublicintHeight(getreturnheight;setheight=value;)/图片的宽度/publicintWidthgetreturnwidth;setwidth=value;)/构造函数,指定生成的曲线图的宽度和高度/

10、要生成的曲线图的宽度/要生成的曲线图的高度publicRealTimelmageMaker(intwidth,intheight)lhis(widthzheight,Color.Gray,Color.Blue)()/构造函数,指定生成的曲线图的宽度、高度及背景色和前景色/要生成的曲线图的宽度/要生成的曲线图的高度/曲线图背景色/曲线图前景色publicRealTimelmageMaker(intwidth,intheight,ColorbackColorzColorforeColor)(this.width=width;this.height=height;this.backColor=bac

11、kColor;this.foreColor=foreColor;pointList=newPointwidth;POinttemPPoint;初始化曲线上的所有点坐标for(inti=0;iwidth;i+)(tempPoint=newPoint();曲线的横坐标沿X轴依次递增,在横向位置上每个像素都有一个点tempPoint.X=i;曲线上每个点的纵坐标随机生成,但保证在显示区域之内tempPoint.Y=random.Net()%height;pointListi=tempPoint;)/获取当前依次连接曲线上每个点绘制成的曲线/publicImageGetCurrentCurveI)(/

12、currentimage=historylmage.Clone(newRectangle(l,Ozwidth-1,height),PixelFormat.Format24bppRgb);currentimage=newBitmap(width7height);Pointp;将当前定位曲线图的坐标点前移,并且将横坐标减1,这样做的效果相当于移除当前第一个点for(inti=0;iwidth-1;i+)(p=pointListi+1;pointListi=newPoint(p.X-lzp.Y);)PointtempPoint=newPoint();新生成曲线图定位点的最后一个点的坐标tempPoi

13、nt.X=width;曲线上每个点的纵坐标随机生成,但保证在显示区域之内tempPoint.Y=random.NextfDateTime.Now.Millisecond)%height;在最后再添加一个新坐标点pointListwidth-l=tempPoint;Graphicsg=Graphics.FromImage(CurrentImage);g.Clear(baCkCoIoj;绘制曲线图g.DrawUnesfnewPen(foreColor)zpointList);g.Dispose();returncurrentimage;usingSystem;usingSystem.Linq;us

14、ingSystem.Collections.Generic;usingSystem.Text;usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Drawing;usingSystem.DrawingJmaging;namespaceSmartDeviceProjectS(classClass3()/说明:实时图片生成类,在本例中横向坐标上每个像素都会有一个控制点/实际开发中可以减少控制点,比如每5个像素用一个控制点/这样的效果或许更加逼真/作者:周公usingSystem;usingSystem.L

15、inq;usingSystem-Collections.Generic;usingSystem.Text;usingSystem-Collections.Generic;usingSystem.Text;usingSystem.Drawing;usingSystem.DrawingJmaging;namespaceSmartDeviceProjectS(classClass4()usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Drawing;usingSystem

16、.Windows.Forms;namespaceDrawPIane(classDraw(/publicBitmapmybitmap;用于双缓冲的位图,和画布等大PUbliCCharj;用于双缓冲的位图,和画布等大Randomrm=newRandom();publicvoidcd()(Charj;用于双缓冲的位图,和画布等大)usingSystem;usingSystem.Linq;usingSystem.Collections.Generic;usingSystem-ComponentModeI;usingSystem.Data;usingSystem.Drawing;usingSystem.

17、Text;usingSystem.Windows.Forms;usingSystem-RuntimejnteropServices;usingSystem.Drawing.Drawing2D;usingSystem.Data.SQLite;usingSystemJO;usingSystem.10.Ports;namespaceSmartDeviceProjectSpublicunsafepartialclassForml:Form(Dlllmport(HDI_API.dll)publicstaticexternboolAPI_PWM_SetDiv(intchannel,intdiv);Dlll

18、mport(HDI_API.dll)publicstaticexternboolAPI_PWM_Start(intchannel,intcntbzintcmpb);Dlllmport(HDI_API.dll)publicstaticexternboolAPI_PWM_Stop(intchannel);Dlllmport(HDI_API.dll)publicstaticexternboolAPI_PWM_GetFrequency(intChanneIJntfrequency);Dlllmport(HDI_API.dll)publicstaticexternboolAPI_ADC_Read(int

19、channel,int*plevel);Dlllmport(HDI_API.dll)publicstaticexternboolAPI_GPIO_Output(bytechannel,bytelevel);Dlllmport(HDI_API.dll)publicstaticexternboolAPI_GPIO_lnput(bytechannel,byte*level);Dlllmport(HDI_API.dll)publicstaticexternboolAPI_BEEP_Delay(intchannel);Dlllmport(HDI_API.dll)publicstaticexternboo

20、lAPI_GPIO_Output(intchzintlevel);Dlllmport(HDI_API.dll,)publicstaticexternboolAPI_GPIO_lnput(intchzint*pLevel);privateSeriaIPortcomport=newSerialPort();privateintDataMode=1;delegatevoidHandlelnterfaceUpdateDeIegateIstringtext);publicint*IeveIO;publicint*Ievell;publicint*Ievel2;publicint*Ievel3;strin

21、gDbName=ResidentFlash2test.db;publicForml()(InitializeComponentO;new/comport.DataReceived+=SerialDataReceivedEventHandler(comport_DataReceived);)privatevoidForml_Load(objectsendeeEventArgse)(APLGPlCLOUtPUt(O,O);API_GPIO_Output(l,O);API_GPI0_0utput(2,O);APLGPQOUtPUt(3,O);API_GPI0_0utput(4,O);API_GPI0

22、_0utput(5,O);API_GPI0_0utput(6,O);APLGPIOJDUtPUt(7,O);this.timer2.Enabled=true;可以使用SciLiteConnection-CreateFiIe(DbName);/MeSSageBOX.Show(数据库创建完成。”);/连接数据库stringconnStr=datasource=+DbName+”;POOIing=true;FaillfMiSSing=false;SQLiteConnectionconn=newSQLiteConnection(ConnStr);conn.Open();/MeSSageBOX.Show

23、(数据库连接完成。);/创建表SQLiteCommandcmd=newSystem.Data.SQLite.SQLiteCommand();stringsql=CREATETABLEtest(usernamevarchar(20)zpasswordvarchar(20);Cmd-CommandText=sql;cmd.Connection=conn;cmd.ExecuteNonQueryO;/MeSSageBoX.Show(,数据表创建完成。);)privatevoidbuttonl_Click(objectsender,EventArgse)(/11ne();API_BEEP_Delay(5

24、0);/this.timerl.Enabled=true;可以使用/stringresult=GlobaIFldJIdI;/sjbh.Text=result;/MessageBox.ShowfresuIt);/stringresult=GIobaIFId.Fldl;/MessageBox.Show(result);/GIobaIFId,FIdl=aaa;/GIobaIFId-FIdl=,aaa;/DrawLineS();/cd.j=aaa;/cd();/rm=aaa;/DateTimedt=DateTime.Now;/datagrid();/stringstrtxt=textBox4.Text

25、.ToString();/FiIeStreamfsl=newFileStream(,ResidentFlash2dtm.txt,FiIeMode-CreatezFiIeACCeSS.Write);创建写入文件/StreamWritersw=newStreamWriter(fsl);/sw.WriteLine(this.textBox3.Text.Trim()+this.textBox4.Text);开始写入值sw.Write(Strtxt);开始写入值/sw.Write(textBox3.Text);开始写入值/sw.Close();/fsl.Close();表示清空txt/StreamWri

26、tersw=newStreamWriter(D:l.txt);/stringw=;/sw.Write(w);/sw.Close();表示向txt写入文本/StreamWritersw=newStreamWriter(ResidentFlash2sjbhl.txt);/stringw=sjbh.Text;/StreamReadersw=newStreamReader(ResidentFlash2sjbhl.txt);/stringw=sjbh.Text;/charw=sjbh.Text;/sw.Reade(w);/sjbh.Text=sw;/sw.Close();/StreamWritersw=

27、newStreamWriter(D:l.txt);/stringw=10;/sw.Write(w);/sw.Close();表示追加文本/StreamWritersw=File.AppendText(D:l.txt);/StreamWritersw=File.AppendText(ResidentFlash2dtm.txt);/stringw=dt+混凝土震动量+textBox4.Text+J;/stringw=dt+混凝土震动量+textBox4.Text+/sw.Write(w);/sw.Close();/this.textBox6.SeIectedText=dt+混凝土震动量+textB

28、o4.Text+/label2.Text=textBox6.Text;/IistBoxlJext=textBox6.Text;/chartext;/stringtext=System.IO.File.OpenRead(ResidentFlash2sjbhl.tt);/file.Close();/sjbh.Text=System.10.File.OpenRead(C:testDirtest.txt);/foreach(stringlineinlines)/ConsoIe-WriteLine(Iine);/StreamReadersr=newStreamReader(ResidentFlash2s

29、jbhl.txtzEncoding-Default);Stringchicun;/Charline;/line=sr.ReadLine();chicun=sr.ReadLine();sjbh.Text=chicun;StreamReadersrl=newStreamReader(ResidentFlash2sjcdl.txt,zEncoding-Default);StreamReadersr2Encoding-Default);=newStreamReader(ResidentFlash2sjkdl.txt,StreamReadersr3Encoding-Default);StringIine

30、l,line2zline3;Iinel=srl.ReadLine();Iine2=sr2.ReadLinef);Iine3=sr3.ReadLine();newStreamReader(ResidentFlash2sjgdl.txtzsjcc.Text=Iinel+line2+Iine3;StreamReadersr4Encoding-Default);StringIine4;/Charline;/line=sr.ReadLine();Iine4=sr4.ReadLine();jyry.Tet=Iine4;newStreamReader(ResidentFlash2jyryl.txt,Stre

31、amReadersr5Encoding-Default);StringIine5;/Charline;/line=sr.ReadLine();Iine5=sr5.ReadLine();sjzl.Text=Iine5;newStreamReaderfResidentFlash2Wsjzll.txt,StreamReadersr6Encoding-Default);StringIine6;/Charline;newStreamReader(,ResidentFlash2clxhl.txtz/line=sr.ReadLine();Iine6=sr6.ReadLine();clxh.Text=Iine

32、6;/while(line=sr.ReadLine()!=null)/ConsoIe-WriteUne(IineJoStringO);/clsj.Text=label4.Text;/API_PWM_SetDiv(Oz200);/API_PWM_Start(0,333,166);/PWM计算方法是66.6MHZ除以DIVCNTB,此例分别为2,和33300/API_BEEP_Delay(50);/csbpl.Text=(int.Parse(csbpl.Text.Trim()+l).ToString();/API_PWM_SetDiv(0,2)2850656057/API_PWM_Start(O,

33、33300,16650);/PWM计算方法是66.6MHZ除以DlVCNTB,此例分别为2,和33300/API_BEEP_Delay(50);/intb=3-a.Length;ZdjI();API_PWM_Stop(0);API_BEEP_Delay(100);)publicvoidzdj2()(intb=1000;/boolb=1000;switch(b)(case1000:API_PWM_SetDiv(0,2)2850656057APLPWM_Start(O,3330,1665);/PWM计算方法是66.6MHZ除以DIVCNTB,此例分别为2,和33300break;case3000:

34、API_PWM_SetDiv(O,2)2850656057APLPWM_Start(O,3330,1665);/PWM计算方法是66.6MHZ除以DIVCNTB,此例分别为2,和33300break;)privatebyteHexStringTByteArray(strings)(s=s.Replace(z);bytebuffer=newbytes.Length/2;for(inti=0;is.Length;i+=2)bufferi/2=(byte)Convert.ToByte(s.Substring(iz2),16);returnbuffer;)privatestringByteArrayT

35、HexString(bytedata)(StringBuiIdersb=newStringBuilder(data.Length*3);foreach(bytebindata)sb.Append(Convert.ToString(bz16).PadLeft(2z0,).PadRight(3,);returnsb.ToString().7bUpper();)publicvoidzdjl()(/intb=3-a.Length;/intb=1000;intb;intc;intd;/StreamReadersr9=newStreamReader(,ResidentFlash2.HZXZ.ttzEnco

36、ding-Default);/intb=sr9;StreamReadersr8=newStreamReader(ResidentFlash2HZXZl.txt,Encoding-Default);StringPINLVl;/Charline;/line=sr.ReadLine();PINlAl=sr8.ReadLine();b=Convert.Tolnt32(PINLVl);/StreamReadersr9=newStreamReader(ResidentFlash2.HZXZ.txt,Encoding-Default);/intb=sr9;StreamReader sr9newStreamR

37、eader(ResidentFlash2HZXZ2.txt,Encoding-Default);StringPINLV2;/Charline;/line=sr.ReadLine();PINLV2=sr9.ReadLine();c=Convert.Tolnt32(PINLV2);/intb=100;/boolc;/c=Convert.TBoolean(b);/Threadt=newThread(datathread);/t.Start();if(comport.lspen)comport.Close();/SettheportssettingsComport-BaudRate=int.Parse

38、(9600);comport.DataBits=int.Parse(8);comport.StopBits=(StopBits)Enum.Parse(typeof(StopBits),One,true);comport.Parity=(Parity)Enum.Parse(typeof(Parity)zNone,true);Comport.PortName=COM1;/Opentheportcomport.Open();d=c-b;for(inti=O;iO&bc)switch(b)(case125:APLGPQoUtPUt(0,1);APLGPIOJDUtPUt(1,0);APLGPleLoU

39、tPUt(2,0);APLGPIOJDUtPUt(3,0);APLGPQoUtPUt(4,0);APLGPIOjDUtPIIt(5,0);APLGPleLoUtPUt(6,0);APLGPlOJDUtPUt(7,0);66.6MHZ除以API-PWM-SetDiv(O,16)2850656057APLPWM_Start(O,33300,16650);/PWM计算方法是DIVCNTB,此例分别为2,和3330066.6MHZ除以break;case132:/APLGP1。_OUtPUtO1);API_PWM_SetDiv(Oz16)2850656057APLPWM_Start(O,31426,157

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号