
Of 0 foreword Introduction article corroding appearance is to monitor what petroleum pipeline path corrodes field to spend and be designed, corrode degree of influence to be produced to petrolic as a result of what petroleum pipeline, can cause pecuniary loss and safe accident, reason corrodes the spent dispute that monitor to its constant necessary. In this system, can pass detect the small electric current in conduit, change those who consider a conduit current to corrode next through inputting experience parameter degree, pass go up an engine order file data, scale corrodes degree of change graph, so that operate,personnel can understand what petroleum pipeline intuitionisticly to corrode metabolic circumstance. 1.1 designs of of of design of 1 overall program are overall design of of case of compose set prescription is main by fall a machine and go up two parts constitute a plane. Leave an opportunity with sheet piece machine for core, the collection that applies programme controll to have electricity, processing, show, store concerned data IC gets stuck. Go up a machine criterion it is to pass the computer and Q series contact IC card is read write implement between the RS232 that undertake corresponds, IC Carrie's data guides the computer. If the graph is shown 1 times,its issue an engine system block diagram. Pursue 1 times its get on a of engine system block diagram the systematic block diagram of an engine system is shown 2 times like the graph. Graph 2 go up a of of engine system block diagram 1.2 design of an Electromechanical road in the design process of this system, main element includes 12 collateral models / several changeover are chip AD1674, patulous muti_function interface chip 8155, DS12887 of clock calendar chip, AT89C52 is odd a machine. Without care enlarge chip used AD524 amplifier. Considering the extraction of corrosion current value scope is 0uA~100uA, reason chooses fixed gain to be worth GAIN=1000, the input that makes the electric flow after enlarge satisfies AD1674 carries a requirement. Imitate electric current measures the number that answers in couples through the changeover after AD1674. If the circuit of interface of strong put oneself in another's position of the AD1674 in this system and AT89C52 pursues 3: ?12V of take along sth to sb, - power supply of 12V double power source, sheet pole inputs means, imitate quantity is inputted from 10VIN. Among them 18 pin that CS accepts GAL16V8, its address that start is 4000H, 8 tall the address is 4002H, low 8 addresses are 4003H. Changeover ends signal STS to receive INT0 to go up, of AT89C52 read those who write signal W/R, RD to make can carry CE to control AD1674 through receiving the operation of AD1674 with blame door / changeover operation. Usable break pattern, also can use inquiry means. Inquiry means is used in this system, its flow is shown 4 times like the graph. Graph the of circuit of interface of strong put oneself in another's position of 3 AD1674 and AT89C52 pursues the C51 language course that 4 AD1674 changes its correspondence of flow chart is shown as follows: #define LOW_READ XBYTE[0x4003] of of of #define HIGH_READ XBYTE[0x4002] of of of relevant definition of #define ADSEL XBYTE[0x4000] //AD1674 does not have {Uchar High of of of Unsigned Int Ad1674() of care , low, unsigned Int Ad_value2 of of J=0; Unsigned Int Ad_value1; , ad[20] , {ADSEL="0x00"; // of of For(j=0;jlt;10;j++) of Sum=0; starts While(STS of 12 changeover ==1) ; // awaits AD to change ending High="HIGH"_READ; // to read count the Low="LOW"_READ; // that occupy 8 high to read low Ad_value1=high*256+low; // of of Lowgt;gt;=4; of 4 data is amalgamative 12 binary number are Ad_value2=ad_value1*0.0002442*10; //1/0XFFF=0.0002442 of of decimal numeral, here takes an unit to be For(j=0;jlt;10;j++) Sum+=ad[j]; // of of of} of of Ad[j]=ad_value2; of MA class to beg below 12 3 of on average one page one page to collecting a cost 10 times
0 引言
本文介绍的侵蚀仪是为了监测野外输油管道侵蚀度而设计的,因为输油管道的侵蚀度影响到石油的出产,会造成经济损失和安好事情,故对其侵蚀度的监测长短常需要的。本系统中,能够经由过程检测管道里的微电流,而后经由过程输入经验参数来换算出管道当前的侵蚀度,并经由过程上位机挨次把数据存档,绘制侵蚀度转变曲线图,以便操作人员能够直观的理解输油管道的侵蚀转变情况。
1 总体方案设计
1.1 设计总体组成方案
设计首要由下位机和上位机两个部门组成。下位机以单片机为核心,运用挨次节制来进行电流的采集、措置、显示,并将无关数据存储到IC卡。上位机则是经由过程计较机与Q系列接触式IC卡读写器之间进行的RS232通信,将IC卡里的数据导入计较机。
其下位机系统框图如图1所示。
图1 下位机系统框图
其上位机系统的系统框图如图2所示。
图2 上位机系统框图
1.2 下位机电路的设计
本系统的设计过程中,首要元件包括12位并行模/数转换芯片AD1674、扩展多性能接口芯片8155、时钟日历芯片DS12887、AT89C52单片机。无忧
放大芯片采用了AD524放大器。思忖到侵蚀电流的取值规模为0uA~100uA,故拔取固定增益值GAIN=1000,使放大后的电流量满足AD1674的输入端要求。
模拟电流量经由过程AD1674后转换成对应的数字量。本系统中AD1674与AT89C52的硬体接口电路如图3:采用+12V、-12V双电源供电,单极输入体例,模拟量从10VIN输入。其中CS接GAL16V8的18号管脚,它的启动地址为4000H,高八位地址为4002H,低八位地址为4003H。转换竣事信号STS接到INT0上,AT89C52的读写信号W/R、RD经由过程与非门接到AD1674的操作使能端CE来节制AD1674的读/转换操作。可用间断体例,也可用查问体例。本系统中采用查问体例,其流程如图4所示。
图3 AD1674与AT89C52的硬体接口电路
图4 AD1674转换流程图
其对应的C51说话挨次如下所示:
#define ADSEL XBYTE[0x4000] //AD1674相干界说
#define HIGH_READ XBYTE[0x4002]
#define LOW_READ XBYTE[0x4003]无忧
unsigned int ad1674()
{ uchar high,low,j=0;
unsigned int ad_value1;
unsigned int ad_value2,ad[20],sum=0;
for(j=0;jlt;10;j++)
{ ADSEL="0x00"; //启动12位转换
while(STS==1) ; //期待AD转换完毕
high="HIGH"_READ; //读高八位数据
low="LOW"_READ; //读低四位数据
lowgt;gt;=4;
ad_value1=high*256+low; //合并12位二进制数为十进制数
ad_value2=ad_value1*0.0002442*10;
//1/0XFFF=0.0002442,这里取单元为mA级
ad[j]=ad_value2;
}
for(j=0;jlt;10;j++) sum+=ad[j]; //对10次采集值求平均值
12 3
发布日期:2009-1-1 【返回】