Hi,
Code on the website has a few errors. And i've been trying to resolve them.
this code needs to be written like this : void __interrupt () speed_isr(void)
This is the closest form of the code i managed to do.
rpm = (1000/milli_sec) * 60;
speed = 0.21 * rpm; // (Assuming the wheel radius to be 31cm)
INTF = 0; // clear the interrupt flag
milli_sec=0;
distance = 1 + distance;
Problem is that on the website it is 028.2 Wich the program will read 28 meters. Meaning that everytime it reads the sensor puts 28 meters. Actualy is 28 cm. But if you try to put 0.28 in the code does not work. Even an equation does not work.
Example for my need : 0.66 m
distance = 0.66 + distance; FAIL
distance = (2 / 3) + distance; NOPE
Seems that PIC reads only full numbers ( 1, 2, 3, 4 ...... )
In order for the distance to be correct i need to put 0.66 wich is meters. distance + 0.66
Program won't allow me to do that .
Any help ideas ?
Please i've been hitting my head on a wall for a week and still no evolution