摘要
本文研究了在非实时操作系统下温度传感器DS18B20的应用。在非实时操作系统下,各个进程严格按照时间片轮转的方法来调度,而DS18B20是单总线传输的数字温度传感器,在没有时钟线且CPU繁忙的情况下,很容易导致读数错误。本文提出了一种软件优化方法,屏蔽掉错误读数,使得上层应用总是可以读到正确的温度值。
In the paper,the application of temperature sensor DS18B20 in non real-time operating system is studied.Because in the non real-time operating system,each process is scheduled strictly according to the method of time slice rotation,DS18B20 is a digital temperature sensor with single bus transmission.It is easy to cause reading error when there is no clock line and CPU is busy.In this article,a software optimization method is proposed to shield the wrong reading,so that the upper application can always read the correct temperature value.
作者
张旭伟
苏涵彬
Zhang Xuwei;Su Hanbin(The 10th Research Institute of China Electronics Technology Group Corporation,Chengdu 610036,China;Xi'an Chengquan Lanchuang Measurement and Control Technology Co.,Ltd.)
出处
《单片机与嵌入式系统应用》
2021年第5期84-86,共3页
Microcontrollers & Embedded Systems