









MSK030C-0900-NN-M1-UG0-NNNN
采用DS18B20芯片实现温度检测。高集成度数字
温度传感器DS18B20采用单总线式结构,具有体积小、成本低的优点
功耗和抗干扰。DS18B20数字温度计提供9至12位
(可配置)指示设备温度的温度读数。核心
DS18B20的功能是其直接数字温度传感器。委员会的决议
DS18B20可配置(9、10、11或12位),12位读数为出厂默认状态。这
相当于0.5°C、0.25°C、1.125°C或0.0625°C的温度分辨率。温度
执行转换,并且热数据以16位存储在草稿存储器中,
符号扩展为二的补码格式。温度信息可通过
转换完成后,通过发出读取草稿行[BEh]命令实现单线接口
执行。数据首先通过1线总线LSB传输。温度的高有效位
寄存器包含“符号”(S)位,表示温度是正还是负。
促动器
单片机通过光电开关和晶体管控制继电器的通断,终控制
冷却的目的。电机图2,当温度超过极限时,表明
冷却装置。当温度低于设定值时,微控制器P3.7发送
高电平信号光电开关无动作,继电器断开,电机不工作
旋转
当温度超过设定温度上限时,SCM P3.7发送低电平信号
光电开关动作,使继电器开关闭合电机运行,达到冷却的目的,
2.
当温度低于小MCU的设定温度值时,P3.7发送高
一个电平信号,电机停止运行。因此,温度可以在设置中保持稳定
温度范围。
继电器电路有一个晶体管的保护电路,它将使三个端部反向
连接方法如图2所示。当继电器突然断电时,继电器
产生大的反向电流。二极管的作用是反向电流分流
流过三管的电流很小,起到保护晶体管的作用。
图2.致动器电路
主程序设计流程图
程序的功能可分为两类:一类是主程序,它是核心
整个控制系统的目的是协调执行之间的关系
模块和操作员。二是一个子程序,用于完成各种实质性
功能,如测量、计算、显示等功能。软件子程序
本文未列出模块,主程序流程图如图3所示。
图3.主程序流程图
3.
显示模块LCD1602的参数功能
LCD1602有16个引脚,但程序的主引脚只有三个:RS(数据命令选择)、R/W
(读和写选择)、E(使能信号)。RS是寄存器选择,高电平选择数据寄存器,低电平
电平选择指令寄存器。R/W读写选择,高读电平,低写电平
活动E end以启用与之相关联的结束、返回和定时。此外,D0~D7为
8位双向数据线。
需要显示温度值,以便于冷库的监控和管理
经理。本设计使用LCD1602。P0为数据端口,P2为控制端口。图4为流程图
LCDl602的图表。
图4.LCDl602的流程图
测试结果
冷冻蔬菜、水果和乳制品,冷藏温度一般为5至13度
摄氏度,当温度超过设定温度上限时,SCM P3.7发送低电平
信号光电开关动作,使继电器开关闭合电机运行,达到
冷却,当温度再次回到以下设定温度值时
微控制器P3.7发出高电平信号,电机停止运行。如图5所示,当
温度在5摄氏度,LCD1602显示为16.5,红灯亮,电机开始旋转,
用于冷却的冷库。测试表明,设计达到了预期效果。
MSK030C-0900-NN-M1-UG0-NNNN

MSK030C-0900-NN-M1-UG0-NNNN
The DS18B20 chip is used to realize the temperature detection. High integrated digital
temperature sensor DS18B20 uses single bus type structure, has the advantages of small size, low
power consumption and anti-interference. The DS18B20 Digital Thermometer provides 9 to 12-bit
(configurable) temperature readings which indicate the temperature of the device. The core
functionality of the DS18B20 is its direct-to-digital temperature sensor. The resolution of the
DS18B20 is configurable (9, 10, 11, or 12 bits), with 12-bit readings the factory default state. This
equates to a temperature resolution of 0.5°C, 0.25°C, 0.125°C, or 0.0625°C. A temperature
conversion is performed and the thermal data is stored in the scratchpad memory in a 16-bit,
sign-extended two’s complement format. The temperature information can be retrieved over the
1-Wire interface by issuing a Read Scratchpad [BEh] command once the conversion has been
performed. The data is transferred over the 1-Wire bus, LSB first. The MSB of the temperature
register contains the “sign” (S) bit, denoting whether the temperature is positive or negative.
Actuator
SCM through the photoelectric switch and the transistor control relay on-off, the final control of the
purpose of cooling. Figure 2 of the motor, when the temperature exceeds the limit indicated that the
cooling device. When the temperature is lower than the set value, the microcontroller P3.7 sends a
high level signal photoelectric switch no action, so the relay is disconnected, the motor does not
rotate.
When the temperature exceeds the set temperature upper limit, SCM P3.7 send low level signal
photoelectric switch action so that relay switch closed motor operated, achieve the purpose of cooling,
2
when the temperature is lower than the set temperature value of the minimum MCU P3.7 sent a high
level signal, electric machine stops running. Thus, the temperature can be stable in the setting
temperature range.
The relay circuit has a protective circuit of the transistor, which is about to reverse the three ends
of the tube.. Connect methods as shown in Figure 2. When the relay suddenly power off, the relay
generates a large reverse current. The role of the diode is to reverse current diversion, so that the
current flow through the three tube current is small, to protect the role of the transistor.
Fig.2. Actuator circuit
Main program design flow chart
The function of the program can be divided into two categories: one is the main program, it is the core
of the whole control system, the purpose is to coordinate the relationship between the execution
module and the operator. Two is a subroutine, which is used to complete a variety of substantive
functions, such as measurement, calculation, display and other functions. The software subroutine
module is not listed in this paper, and the flow chart of the main program is shown in Figure 3.
Fig.3. Flow chart of main program
3
Parameter function of display module LCD1602
LCD1602 has 16 pin, but the main pin for program is only three: RS (data command select), R/W
(read and write select), E (enable signal). RS is a register selection, high level select data register, low
level select instruction register. R/W to read and write select, high level of reading, low level of write
operation. E end to enable the end, the back and the timing associated with. In addition, the D0~D7 is
8 bit bidirectional data line.
Temperature values need to be shown to facilitate the monitoring and management of cold storage
managers. This design uses LCD1602.P0 is the data port, P2 is the control port. Figure 4 is the flow
chart of LCDl602.
Fig.4. The flow chart of LCDl602
Test results
Frozen vegetables, fruits and dairy products, cold storage temperature is generally 5 to 13 degrees
Celsius, when the temperature exceeds the set temperature upper limit, SCM P3.7 send low level
signal photoelectric switch action so that relay switch closed motor operated, achieve the purpose of
cooling, when temperature once again return to the set temperature value of the following
microcontroller P3.7 sent a high level signal, the motor stopped running. As shown in Figure 5, when
the temperature at 5 degrees Celsius, LCD1602 display is 16.5, the red light, the motor starts to rotate,
the cold storage for cooling. The test shows that the design achieves the expected effect.
Copyright ©2019-2022 瑞昌明盛自动化设备有限公司 版权所有 赣ICP备2021006016号