Temperature is one of the most basic environmental paramenters,and it usually must be measured in daily life and industrial & agricultural production. With the rapid development of semiconductor technology,more and more,digital & intelligent temperature measuring technology is widely applied.So it is particularly important to master the technology of designing a temperature measurement & control system in hardware and software.
In this project,a temperature measuring & transmition system controlled by SCM is designedll. At front end, the real-time temperature data acquired and converted to digital type through DS18B20 sensor are sent into SCM, and it is display on LCD1602 module . In addition , the acquired temperature data are transmitted to back end PC via RS-232 interface so as to be displayed ,storied an continued process.
The design achieved the results in proteus. It verify the validity and correctness of the proposed scheme. Finally, it complete and developed the theoretical knowledge.
[14]Halang W A.Measuring the Performance of Real-time Systems[J].The International Journal of Time-critical Computing Systems , 2000 , 18( 1): 59-68
[15]Stao N, Hasegawa K.A computer controlled irrigation system for muskmelon using stem diameter sensor[J].Acta Horticulturae, 1995, 226: 91-98.
[16]Kang Jianli, Wu Zhiqian. Methods of data fitt ing and graph draw ing in Visual Basic[ J].Comput er and Applied Chemistry , 2009, 26( 6) : 763- 766.
附录A:电路原理图绘制
附录B:一篇引用的引文文献及翻译
DS18B20,Programmable Resolution,1-Wire® Digital Thermometer
(P1 ~ P4)
DESCRIPTION
The DS18B20 Digital Thermometer provides 9 to 12–bit centigrade temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points.The DS18B20 communicates over a 1-wire bus that by definition requires only one data line (and ground) for communication with acentral microprocessor.It has an operating temperature range of –55°C to +125°C and is accurate to ±0.5°C over the range of –10°C to +85°C.In addition, the DS18B20 can derive power directly from the data line (“parasite power”), eliminating the need for an external power supply.
Each DS18B20 has a unique 64-bit serial code,which allows multiple DS18B20s to function on the same 1–wire bus;thus,it is simple to use one microprocessor to control many DS18B20s distributed over a large area.Applications that can benefit from this feature include HVAC environmental controls,temperature monitoring systems inside buildings,equipment or machinery,and process monitoring and control systems.
DETAILED PIN DESCRIPTIONS Table 1
8-PIN SOIC*
TO-92
SYMBOL
DESCRIPTION
5
1
GND
Ground.
4
2
DQ
Data Input/Outputpin.Open-drain 1-wire interface pin.Also provides power to the device when used in parasite power mode (see “Parasite Power” section.)
3
3
VDD
Optional VDDpin.VDD must begrounded for operation in parasite power mode.
*All pins not specified in this table are “No Connect” pins.
OVERVIEW
Figure 1 shows a block diagram of the DS18B20,and pin descriptions are given in Table 1.The 64-bit ROM stores the device’s unique serial code.Thescratchpad memory contains the 2-byte temperature register that stores the digital output from the temperature sensor.In addition,the scratchpad provides accessto the 1-byte upper and lower alarm trigger registers(TH and TL),and the 1-byte configuration register.The configuration register allows the user to set theresolution of the temperature-to-digital conversion to 9,10,11,or12 bits.The TH,TL and configuration registers are nonvolatile(EEPROM),so they will retain datawhen the device is powered down.
The DS18B20 uses Dallas’ exclusive 1-wire bus protocol that implements bus communication using one control signal.The control line requires a weak pullup resistor since all devices are linked to the bus via a 3-state or open-drain port(the DQ pin in the case of the DS18B20).In this bus system,the microprocessor(the master device)identifies and addresses devices on the bus using each device’s unique 64-bit code.Because each device has a unique code, the number of devices that can be addressed on one bus is virtually unlimited.The 1-wire bus protocol, including detailed explanations of the commands and “time slots,” is covered in the 1-WIRE BUS SYSTEM section of this datasheet.
Another feature of the DS18B20 is the ability to operate without an external power supply.Power is instead supplied through the 1-wire pullup resistor via the DQ pin when the bus is high.The high bus signal also charges an internal capacitor (CPP), which then supplies power to the device when the bus is low.This method of deriving power from the 1-wire bus is referred to as “parasite power.”As an alternative, the DS18B20 may also be powered by an external supply on VDD.
DS18B20 BLOCK DIAGRAM Figure 1
OPERATION –MEASURINGTEMPERATURE
The core functionality of the DS18B20 is its direct-to-digitaltemperature sensor. The resolution of the temperature sensor isuser-configurable to 9,10,11,or 12 bits, corresponding toincrements of 0.5°C,0.25°C,0.125°C,and0.0625°C, respectively.The default resolution at power-up is 12 bit.The DS18B20 powers-up in a low-power idle state;to initiate a temperature measurement and A-to-D conversion, the master mustissue a Convert T[44h] command.Following the conversion, theresulting thermal data is stored in the 2-byte temperature register inthe scratchpad memory and the DS18B20 returns to its idle state.Ifthe DS18B20 is powered by an external supply, the master can issue “read time slots” (see the 1-WIRE BUS SYSTEM section) after the Convert T command and the DS18B20 will respond by transmitting 0 while the temperature conversion is in progress and 1 when the conversion is done.If the DS18B20 is poweredwith parasite power, this notification technique cannot be used since the bus must be pulled high by a strong pullup during the entire temperature conversion.The bus requirements for parasite power are explained in detail in the POWERING THE DS18B20 section of this datasheet.
The DS18B20 output temperature data is calibrated in degrees centigrade;for Fahrenheit applications,a lookup table or conversion routine must be used.The temperature data is stored as a 16-bit sign-extended two’s complement number in the temperature register (see Figure 2).The sign bits (S) indicate if the temperatureis positive or negative:for positive numbers S=0 and for negative numbers S=1.If the DS18B20 is configured for 12-bit resolution,all bits in the temperatureregister will contain valid data.For 11-bit resolution,bit 0 is undefined.For 10-bit resolution, bits 1 and 0 are undefined,and for 9-bit resolution bits 2,1 and 0 areundefined.Table 2 gives examples of digital output data and the corresponding temperature reading for 12-bit resolution conversions.
TEMPERATUREREGISTERFORMATFigure 2
TEMPERATURE/DATARELATIONSHIPTable2
TEMPERATURE
DIGITALOUTPUT (Binary)
DIGITAL OUTPUT(Hex)
+125°C
0000 0111 1101 0000
07D0h
+85°C*
0000 0101 0101 0000
0550h
+25.0625°C
0000 0001 1001 0001
0191h
+10.125°C
0000 0000 1010 0010
00A2h
+0.5°C
0000 0000 0000 1000
0008h
0°C
0000 0000 0000 0000
0000h
-0.5°C
1111 1111 1111 1000
FFF8h
-10.125°C
1111 1111 0101 1110
FF5Eh
-25.0625°C
1111 1110 0110 1111
FE6Fh
-55°C
1111 1100 1001 0000
FC90h
*The power-on reset value of the temperature register is +85°C
OPERATION –ALARMSIGNALING
After the DS18B20 performs a temperature conversion, the temperature value is compared to the user-defined two’s complement alarm trigger values storedin the 1-byte TH and TL registers (see Figure 3).The sign bit(S) indicates if the value is positive or negative: for positive numbers S=0 and for negative numbersS=1.The TH and TL registers are nonvolatile (EEPROM) so they will retain data when the device is powered down.TH and TL can be accessed through bytes 2and 3 of the scratchpad as explained in the MEMORY section of this datasheet.
THAND TLREGISTER FORMATFigure 3
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
S
26
25
25
25
22
21
20
Only bits 11 through 4 of the temperature register are used in the TH and TL comparison since TH and TL are 8-bit registers.If the result of a temperaturemeasurement is higher than TH or lower than TL,an alarm condition exists and an alarm flag is set inside the DS18B20.This flag is updated after every temperaturemeasurement; therefore, if the alarm condition goes away, the flag will be turned off after the next temperature conversion.
The master device can check the alarm flag status of all DS18B20s on the bus by issuing an Alarm Search [ECh] command.Any DS18B20s with a set alarmflag will respond to the command, so the master can determine exactly which DS18B20s have experienced an alarm condition.If an alarm condition exists and theTH or TL settings have changed,another temperature conversion should be done to validate the alarm condition.
POWERING THEDS18B20
The DS18B20 can be powered by an external supply on the VDD pin, or it can operate in “parasite power” mode, which allows the DS18B20 to functionwithout a local external supply.Parasite power is very useful for applications that require remote temperature sensing or that are very space constrained. Figure 1shows the DS18B20’s parasite-power control circuitry, which “steals” power from the 1-wire bus via the DQ pin when the bus is high.The stolen charge powers the DS18B20 while the bus is high, and some of the charge is stored on the parasite power capacitor (CPP) to provide power when the bus is low.When the DS18B20 is used in parasite power mode, the VDD pin must be connected to ground.
外文译文:(From:DS18B20,Programmable Resolution,1-Wire® Digital Thermometer)