|
Re: Ultrasonic sensors on digital ports 3-6 problems
Other issues...
return ReturnValue * .34029;
phasetest2++;
The second line never executes and your function is declared like this:
unsigned int Get_Distance(unsigned char Sensor_Number)
You can't return a float. I'm surprised the compiler did not issue a warning. This would never have worked no matter what input pin you were using. So the distance you are printing means nothing. But your Ultrasonic_3_Time variable should be changing. One more thing...
Leave your B-port interrupts on or reset the value Old_PortB just before the Ping. You can be incorporating all kinds of transitions the next time you read the port.
HTH
|