Reply To: PIC C Compiler and HC-SR04 Ultrasonic Sensor

Home Forums Microcontrollers PIC Microcontroller PIC C Compiler and HC-SR04 Ultrasonic Sensor Reply To: PIC C Compiler and HC-SR04 Ultrasonic Sensor

#10164

Ligo George
Keymaster

Hello, It seems like you converted our program in the article Interfacing HC-SR04 with PIC Microcontroller to CCS C.

In that tutorial I used prescaler : 2, so you should use :

setup_timer_0(RTCC_INTERNAL|RTCC_DIV_2);

and you should change a-4 to a in printf().

Please check the above program after making these changes and let me know whether it works or not. If it works, I can include it too in that article such that it will help others too.