The compiler used in this project is Microchip MPLAB XC8 (MPLAB X IDE with MPLAB XC8 compiler). This post shows how to make a simple distance meter using PIC16F887 microcontroller and HC-SR04 ultrasonic sensor. The HC-SR04 module includes ultrasonic transmitter, ultrasonic receiver and control circuit. The HC-SR04 ultrasonic sensor module can measure distances form 2 cm to 400 cm (4 m) with an accuracy of 3 mm.