|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: SRF04 Ultrasonic Rangefinder Unresponsive
tried it. It is now official that we are not gettting any feedback...
|
|
#2
|
|||
|
|||
|
Re: SRF04 Ultrasonic Rangefinder Unresponsive
i have an SRF04 but also an SRF08, way better!!! and not to mention its controlled by i2c also it has a built in light sensor (CdS cell)
|
|
#3
|
||||
|
||||
|
Re: SRF04 Ultrasonic Rangefinder Unresponsive
I'm still not totally convinced. As Steve pointed out, the return pulse is very short, and it's possible that the pulse is coming and going faster than even the fast loop can keep up with. To be totally sure, could you set it up as an interrupt, and then see if you ever trigger it?
|
|
#4
|
||||
|
||||
|
Re: SRF04 Ultrasonic Rangefinder Unresponsive
It says that if there is no "echo," it won't timeout until 18 ms have passed. I'm sure the fast routine loops faster than 18 ms.
|
|
#5
|
|||
|
|||
|
Re: SRF04 Ultrasonic Rangefinder Unresponsive
how about something like this. It should fire a ~20us drive pulse and then listen on the echo line. The echo line should be asserted shortly after the sonar is fired and remain high until the first echo is detected -or- no echo and the line will drop in 36ms.
Code:
void ping()
{
unsigned int count;
char usec;
#define drive_pin rc_dig_in01
#define echo_pin rc_dig_in02
//~20uS pulse out
drive_pin = 1;
for (usec=20; --usec != 0; )
{
Nop();
Nop();
Nop();
Nop();
Nop();
}
drive_pin = 0;
//echo pulse should start shortly... timeout in ~20ms
count = 35500;
while(echo_pin == 0)
{
count++;
if (count == 0)
{
printf( "whoa, where'd the pulse go?\n");
return;
}
}
// ok, count the pulse width, count*2 is approx. uSec.
count = 0;
while (echo_pin != 1)
{
Nop(); Nop(); Nop(); Nop();
count++;
if (count == 0) break;
}
printf( "count = %d\n", count );
return;
}
|
|
#6
|
|||
|
|||
|
Re: SRF04 Ultrasonic Rangefinder Unresponsive
You could always fire up Easy C and check the operation with a Known working code.
|
|
#7
|
||||
|
||||
|
Re: SRF04 Ultrasonic Rangefinder Unresponsive
thanks a lot for your help! I will try this tuesday, when I can go back to the shop.
![]() |
|
#8
|
||||
|
||||
|
Re: SRF04 Ultrasonic Rangefinder Unresponsive
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ultrasonic will not work with another Ultrasonic plz help | Jackel148 | Programming | 10 | 10-05-2006 15:31 |
| Programming Parallax Ultrasonic Rangefinder | edman | Programming | 2 | 17-02-2006 08:35 |
| Ultrasonic Sensor | winners | Programming | 3 | 02-01-2006 20:55 |
| Ultrasonic Rangefinder Operating On I2C Bus | CapnBFG | Electrical | 10 | 04-06-2005 01:31 |
| Unresponsive camera | neilsonster | Programming | 9 | 17-02-2005 08:51 |