Temperature measurement processing transmitter design

Publisher:乐基儿vosLatest update time:2006-09-28 Source: 单片机与嵌入式系统ic网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Overview
  When burning lime in a lime furnace, the temperature may be different everywhere in the furnace. The production process requires obtaining the average temperature of four points in the furnace, understanding the temperature value of each point, and performing alarm processing on the average value and the temperature of each measuring point. ; If the signal somewhere is abnormal (sensor is damaged or disconnected), it can alarm in time and exclude it from data processing. This system can complete the above functions, detect the temperature of the lime furnace, and transmit the remote temperature average or the highest temperature in the form of 4-20mA. The working diagram of this product is shown in Figure 1 below. There are four thermocouples placed at four points in the lime furnace. These four thermocouples are the four input signal sources of the system. Use this system to measure the temperatures of four points (T1, T2, T3, T4) as shown in Figure 1 and send the temperature value of each point to the panel for display.

Note: T1, T2, T3, and T4 are the four detection points in the lime furnace,
which are the number of signal channels mentioned in the article.

Figure
12. System hardware design
1. System structure block diagram and human-machine interface The system
  structure block diagram is shown in Figure 2. The system hardware part mainly consists of front-end input circuit, A/D and D/A circuit, human-machine interface circuit, CPU and peripheral circuits. The main function of the system is to allow four signal inputs. The user can select the input thermocouple type through parameter settings. It usually displays the average temperature. If the operator needs to press the button on the panel to view the temperature of any signal. The four signals are independent. If one is short-circuited or disconnected, it will not affect the operation of the other signals. The instrument has an over-limit alarm function and a thermocouple disconnection prompt function. The average temperature or the highest temperature signal is transmitted as a 4-20mA current signal output. The system has a power-off protection function. When the power is off, the setting data can be saved.

Functional schematic (Figure 2)

Figure 3. Control panel
  The system is designed with a good human-machine interface. The operation display panel is shown in Figure 3. There are two rows of digital tubes and four buttons on the control display panel to display system work and modify parameters. The system working mode is divided into two states: programming and running. Use the No. 1 key K1 (state switching key) to switch between the two states. In the programming state, the upper row of digital tubes displays parameter codes, and the lower row of digital tubes displays corresponding parameters. In this state, use the No. 2 key K2 (shift key) to sequentially change different parameter codes and parameters. The parameters can be modified by using the No. 3 key K3 (plus key) and the No. 4 key K4 (minus key).

  In the running state, the upper row of digital tubes displays the sequence number of each signal loop (1~~5), and the lower row of digital tubes displays the corresponding temperatures. Among them, channels 1 to 4 display the four circuit numbers and their temperatures respectively, and channel 5 displays the average temperature of the four circuits. These five channels are automatically displayed in cycles, and the display content can be stopped on the current loop by using the No. 4 key K4 (positioning key). In the programming or running state, whenever K1 is pressed, the state can be changed to the initial stage of another state.

  There are no expansion buses, program memories and I/O ports in the circuit design. The four parallel ports of the CPU are all used as ordinary I/O ports. The CPU and peripheral circuits are all standard usage. Here we focus on the A/D with design features. And D/A circuit, human-machine interface circuit and power supply circuit.

2. Data acquisition circuit and amplification circuit The
  data acquisition circuit is shown in Figure 4. The current limiting resistor R1 and the voltage stabilizing tube TL431 generate a 2.5V standard voltage. The system has a total of 7 analog input signals, 4 thermocouple signal inputs (EXT1----EXT4), 1 cold junction compensation signal, a reference signal, and a ground signal (EXT5). The 2.5V voltage is added to the series branch of the 10K resistor and the external diode to form the cold-end compensation circuit of the thermocouple. It uses the voltage-temperature characteristics of the forward working diode to measure the cold-end temperature. The reference signal uses the 2.5V voltage and the voltage dividing resistor. produce. Therefore, an 8-select-to-1 multi-channel analog switch CD4051 is used, and the high and low levels of the three pins P2.0, P2.1, and P2.2 of the microcontroller control the selection of analog channels. Since the input thermocouple index number is set by the user, and the signal size of different index numbers is different, a program-controlled amplifier composed of OP07 and 4051 (U2) is designed. The input signal is amplified and then enters the A/D. After acquisition and processing Get the value of each signal. Program-controlled amplification uses the microcontroller to control the 4051, selects different channels, and also selects different amplification factors. The external resistors of 4051 are: R25=20K, R26=47K, R27=2.4K, R28=3.9K, R29=1.9K. There are 4 different amplification factors, respectively, amplification factor 1=(20+47+2.4+ 3.9+1.6)/(47+2.4+3.9+1.6)≈1.3 times, magnification factor 2=(20+47+2.4+3.9+1.6)/(2.4+3.9+1.6)≈10 times, magnification factor 3=( 20+47+2.4+3.9+1.6)/(3.9+1.6)≈14 times, magnification factor 4=(20+47+2.4+3.9+1.6)/1.6≈46 times. The 1.3x amplification factor is mainly used to collect cold-junction compensation diode signals. The four 22M pull-up resistors in the circuit complete the thermocouple disconnection detection function.

Figure 4. Data acquisition circuit.
  Four thermocouples are placed at 4 o'clock in the lime furnace as the four mV signal input terminals of the system. After the thermocouple signal is gated and input, it enters the program-controlled amplification circuit. Different signal graduation numbers lead to different mV values. Different amplification factors are selected through software to make the maximum value of these amplified signals close to the maximum allowable value of the A/D. value; to make full use of A/D resources and ensure measurement accuracy. Assuming the amplification factor is A, the signal amplified from the program control is AX. The determination of the amplification factor of various signals is related to the analog input of the subsequent A/D device. The A/D of this circuit selects 7135 (five and a half digits), the reference voltage is 0.5V, and the analog input range of 7135 is 0~1V voltage. . For example, for B and S standard thermocouples, the magnification factor should be 46, and for K, E, and standard thermocouples, the magnification factor should be 14. The cold compensation diode signal is about 0.65V, using 1.3 times amplification. Now we will take the conversion calculation of one channel of signal as an example. When measuring a certain thermocouple input, we sequentially collect the external thermocouple input millivolt value, cold junction compensation diode voltage drop, Reference voltage and analog ground. The V base input from the X2 terminal of the 4051 is a known voltage and is solidified in the program. D base, D zero, and Dx are the base, zero point, and real-time A/D acquisition value of the input thermocouple signal respectively. The zero point can be completed by the following formula Full scale self-correction to calculate the VX value. Since the three signals of V base, Vx and ground pass through the same hardware input channel, the discrete error of the hardware and the zero-point full-scale drift have the same impact on the three signals. The following formulas can be used to correct the zero point, amplification factor and A/D. Error, the measurement accuracy of the system can be guaranteed when using general devices.

D基-D零/Dx-D零=Vx/V基
  由于热电偶mV温度间关系是非线性的,我们采用了折线法进行非线性校正,VX通过分段非线性数据处理,可以算出对应温度CX,加上通过测量冷端补偿二极管电压得出的冷端补偿温度C0,就得到该路的实际测量温度C,即C=CX+C0。

  同时由于热电偶的原因,在测量端的电压值会被抵消了一部分。这种情况造成的误差影响较大。必须对它进行冷端补偿。因为二极管在温度变化时,其正向导通电压变化稳定,为-2mV/℃,因此我们采用二极管测冷端湿度进行补偿,具体做法如下:

  第一步,我们冷端补偿输入端输入一标准电压0.7V得到一个AD采样值D0,然后我们再输入一标准电压0.6V再得到一个AD采样值D1。两者相减得到一个值ΔD,根据二极管的特性,每1℃电压变化2mV,我们输入的第1个标准信号和第2个标准信号相差为100mV,相当于二极管正向电压变化100mV,对应冷端温度变化50℃,就可以求出冷端温度每变化1℃时其对应AD值变化多少的系数K=ΔD/50,由于冷端温度变化范围小(0-50℃),相对精度要求不高,因此设计产品批量生产时把该系数直接固化于程序中。当把冷补二极管1N4148接入输入端后,据上面所述,可以根据该系数及冷端AD采集值变化量的大小推算出冷端温度变化的大小。

  第二步:我们在仪表设置状态输入当前环境温度Ta,并及时测得二极管1N4148所在端电压经放大AD转换后的值Da,并将Ta、Da其存储到EEPROM里面,以后仪表处于工作状态时我们实时地测出二极管AD转换后的值Db,再把两者相减得ΔDab=Da-Db,ΔDab除以K(代表每一个1℃的AD采样值的大小)得到一个温度值差Y。然后Y加上设置环境温度初值Ta得到实际冷端温度C0=Y+Ta。这种冷端补偿有一定误差,当环境温度变化时,所测的实际冷端温度C0将会跟随变化,在一定时期内环境温度的变化不大,因此它引起的误差和热电偶相比十分的小,可以忽略。但当环境变化较大时,比如从冬天到夏天的变化,其变化为几十℃,如果冷补误差大于1度,我们可以重新输入基准Ta校正。

3、A/D电路
  A/D电路主要由74LS157、ICL7135芯片组成,7135采用0.5V基准信号,模拟电压输入范围为0-1V。ICL7135采用动态扫描BCD码输出方式,即万、千、百、十、个各字位BCD码轮流出现在B8,B4,B2,B1端上出现,并在D5-D1各端同步出现字位选通脉冲。采集到的微弱信号经程控放大后,经过AD转换变成数字信号。使用了74LS157四2选1选择器,使"万"位数据输出和其它的三个标志信号(超量程、欠量程、极性输出)与BCD码数据输出的B8、B4、B2、B1共用C52的P0.0-P0.3四条I/O口线,分时传送是通过D5控制74LS157的选择端SEL实现。SEL输入低电平时选择1A-4A输出,输入高电平时选择1B-3B输出。因为"万"位数据只能输出0或1,是个半位。所以,正好和OR(过量程)、UR(欠量程)和POL(正负极性)三位构成四位数据输出,供单片机读取。与C52的硬件接口方式是查询方式,软件上利用对D5、D4、D3、D2、D1查询来实现"万"、"千"、"百"、"十"、"个"上的数据输出。

4、控制面板电路
  该部分电路包括两部分:按键控制电路和显示电路。具体电路见图5。电路采用ZLG7289作为核心芯片,通过三个引脚与单片机连接,单片可完成动态显示扫描及按键查询,节约了单片机I/O口硬件资源及时间资源。实际电路中Zlg7289的选片/CS接地时钟线CLK接P2.7口数据线DIO接P2.6口键信号线KEY接P2.5口。

图5、控制面板的电路的原理图
  zlg7289具有SPI串行接口功能的可同时驱动8位共阴极数码管(或64只独立LED)的智能显示驱动芯片,无须外围元件可直接驱动八位LED数码管并可同时连接多达64键盘的键盘矩阵,单片即可完成LED显示及按键的扩展。zlg7289内部含有译码器,可直接接受BCD码或16进制码,并同时具有2种译码方式,此外,还具有多种控制指令,如消隐、闪烁、左移、右移、段寻址等。本系统用了两排4位数码管,数码管用的是动态显示的。根据zlg7289的要求,数码管选用共阴极的,Zlg7289的18脚~25脚接数码管的位驱动端,10脚~17脚接数码管的段驱动端,通过数据线和时钟线可以把要显示内容送入7289。本电路只设计了四个按键,当有键按下时,KEY引脚电平发生变化通知CPU通过数据线和时钟线读取键值。

5、报警电路及信号输出电路
  报警有两种:上限报警和下限报警,两个报警继电器分别通过PNP驱动三极管接在单片机的P0.5和P0.7,低电平有效。软件设计当四路信号及平均值超过各自所定的上限时,继电器就发出报警,同时在控制面板的上排数码管的最后一位显示H字样;同样,当四路信号及平均值低于设定的下限时,继电器也报警,并在同一个位置显示L字样。

  模拟输出部分的电路图如图6所示。单片机根据设定参数选择把温度平均值或温度最高那一测量点信号送到十位D/A芯片7520,配合LM741放大器得到电压输出;最后经再经过一个LM741构成的V/I转换电路,得到模拟电流4-20mA及1-5V电压形式输出。

图6输出电路原理图
6、开关电源电路
  本变送器采用DDZ-Ⅲ型的电动单元组合仪表24V直流电源,这种供电方式的优点是各单元省掉了电源电压器,没有工频电源进入单元仪表,既解决了仪表发热问题,也为仪表的防爆提供了有利条件。由于内部需要±5V,所以该系统采用了DC/DC开关电源,生成5V和-5V电压。电源部分电路如图7。

图7、电源电路图
  电源电路采用的MC34063是一种集成了DC-DC变换主要功能电路的芯片,它能被设计完成升(降)压和极性变换的功能,而且所需外接元件少。外输入24V电压,经过MC34063电压可以转换为+5V,而后,该电压又经过ICL7660变成-5V电压。24V电压可以同时供内部4-20mA输出电路使用。电路工作时5V最大电流0.4安培,-5v最大电流0.02安培。

三.软件设计及调试
  软件设计主要有主程序,ICL7135A/D转换程序,BCD码转换程序,运算比较程序,读写24C02子程序,查表程序,功能键子程序等功能模块。主程序流程图如图8所示。

  The main program mainly includes two branches, one is the programming state and the other is the running state.

  The microcontroller is first initialized, and the initial state of the program is set to the running state. In addition to entering the running state just after powering on, the program must judge the status flag bit in the future, and the program will enter the programming or running state according to the judgment result. In the running state, each parameter cannot be edited, and various operating parameters can only be read from 24C02, and the input signal is measured on a patrol basis. Finally, each measurement point is obtained through zero-point and full-scale self-correction processing, cold-end compensation calculation, and table lookup processing. temperature value. In this state, you can use the ← key to select and display various operating parameters such as measurement, alarm, and fault information. The system does not perform measurements in the parameter editing state. When entering the programming state, it is required to enter the programming permission password. Under the premise that the password is correct, each setting parameter can be selected through the ← keys, and can be modified through the ↑↓ keys. Store it in 24C02, and it will automatically enter the running state after stopping key operations for 5 minutes regardless of whether the status key is pressed or not.

  When the microcontroller is running, the upper four-digit digital tube displays the circuit number (the best two digits display alarm and fault information), and the lower four-digit digital tube displays corresponding data respectively. The K4 key can be used to switch to display different circuits and their parameters. The loop numbers 1-4 represent four different signals, and the average value is displayed on the fifth channel. After comparison, the largest channel and the average value of the four channels can be selected to be transmitted and output in the form of 4-20mA through parameter setting. The software determines the selection level of the four signals connected to the 4051 and AT89C52. After the selected analog signal is amplified by the program-controlled 4051 and the op amp, it enters the ICL7135 for A/D conversion, and the voltage signal is converted into a BCD code (from ten thousand to one, five-bit address output). Use the conversion subroutine to convert the BCD code into a hexadecimal number. Finally, perform various data processing to obtain the temperature value, find the maximum value and average value, and perform alarm and signal fault identification processing.

References
[1]. Chief editor Gao Haisheng and Yang Wenhuan. Encyclopedia of Single-chip Microcomputer and Application Technology [M]. Chengdu: Southwest Jiaotong University Press, 1996 [
2] Wang Furui. Encyclopedia of Single-chip Microcomputer Measurement and Control Design [M]. Beijing: Beihang University Press Society, 1999
[3] Sha Zhanyou. Design and application of new single-chip microcomputer switching power supply [M]. Beijing: Electronic Industry Press, 2001 [
4] Hou Zilin. Process control and automation instrumentation [M]. Beijing: Machinery Industry Publishing House, 2000

Reference address:Temperature measurement processing transmitter design

Previous article:Temperature measurement processing transmitter design
Next article:Apply AT89C2051-based decoder to security system

Recommended ReadingLatest update time:2024-11-16 22:33

A New Design Scheme of High Precision Voltage Source
1 Introduction A voltage source, or an ideal voltage source, is a model abstracted from an actual power source. It can always maintain a certain voltage at both ends regardless of the current flowing through it. A voltage source has two basic properties: First, its terminal voltage constant U or a certain t
[Power Management]
A New Design Scheme of High Precision Voltage Source
Reset circuit for low voltage detection IC
Reset circuit for low voltage detection IC • When the voltage of the built-in low voltage reset circuit is different from the application specification, the reset circuit of the external low voltage detection IC can be selected. • The low voltage reset function can be provided, and an external simple RC reset cir
[Analog Electronics]
Reset circuit for low voltage detection IC
XCM406: Dual-channel output high current high speed LDO voltage regulator
The XCM406 series achieves high precision, low noise, low voltage drop, and high current dual-channel output LDO voltage regulator chips using CMOS technology. The operating voltage range is 1.5V to 6.0V. The built-in low on-resistance transistor can suppress the potential difference between input and output to
[Power Management]
XCM406: Dual-channel output high current high speed LDO voltage regulator
理想二极管桥控制器可显著降低功耗和电压损失
Today, almost all electrical energy generated is in AC (alternating current or polarity) type, while electronic systems require DC (through current or fixed polarity). Even devices that traditionally only accept AC power (such as motors) are increasingly requiring DC power for their microcontrollers (embedded to provi
[Power Management]
理想二极管桥控制器可显著降低功耗和电压损失
Does the inverter control voltage or current? Wiring principles of inverter
Does the inverter control voltage or current? The inverter can control voltage and current, and is usually used to control the speed and load of AC motors. The inverter can achieve precise control of AC motors by adjusting the output voltage and frequency. Specifically, the inverter can convert the input DC sig
[Embedded]
What is the waveform of the inverter output voltage? How to control the motor through pulse modulation technology?
The frequency converter is an innovative product that combines modern power electronics technology with control theory. Its excellent speed regulation performance and wide application areas make it an important tool for industrial automation and energy saving. Traditionally, many people believe that the v
[Embedded]
What is the waveform of the inverter output voltage? How to control the motor through pulse modulation technology?
Method for Calculating Output Voltage Tolerance in Adjustable Voltage Regulators
introduce When designing a voltage regulator circuit, the designer is faced with the need to calculate the tolerance of the regulated output voltage. For fixed voltage regulators, this problem is easily solved because the required information is directly provided in the semiconductor manufacturer's data sheet
[Power Management]
Principle and performance parameters of LM2917 voltage converter
1. Overview LM2917 is a monolithic integrated frequency-voltage converter. The chip contains a high-gain operational amplifier/comparator. When the input frequency reaches or exceeds a given value, the output can be used to drive switches, indicator lights or other loads. The included tachometer uses charge pu
[Power Management]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号