View Single Post
  #11   Spotlight this post!  
Unread 04-02-2008, 17:24
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
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