Abstract:This paper designed an ultrasonic ranging system based on PIC16F877A. With the help of high?launch driving voltage, the temperature compensation, and software filter, we solved the problem that the traditional ranging system had a closer measuring distance. We greatly increased the detection range and improved the measurement accuracy and realized real-time alarm function. We explained the reason of the changing of CX20106A chip output single level, and put forward two alarm ideas and realized them. The experimental results show that this system can well meet the security of monitoring requirements.