• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

srf04 ultrasonic sensors

Status
Not open for further replies.

cjgalway1000

New Member
Hi,
I'm trying to interface two srf04 ultrasonic sensors to a PIC16F872. I'm wondering if any of you have already done this as I'm having problems writing the code in assembly and cannot find sample code on the net.
 

falleafd

New Member
You may post your code onto here, we may help.

I wrote for SRF04, but with AT89C51, and I'm writing on PIC for Polaroid (not finished). But I think it's easy as you send or read a signal on a pin.

The fact that SRF04 has only 4 pins, 2 are connected to pwr, 2 other pins are the signal wires.

You have to do nothing, except start with a pulse and wait until an interrupt on the second pin. It's the simplest way.
 

odense

New Member
SRF04 with Pic 16F876

I have just done to build and program for SRF04 and 08 with PIC16F876. That is quite easy. You can use command output_low and output_high and delay_us(10) to make a output trigger pulse to activate module and write down some simple code lines to measure the time of flight. You should use interrupt routine which is set up for period of time of interrupt routine to calculate the echo. Actually, it is quite simple so you can do it by your self.
If you have any stuck, let email to me and I can help you.
Email to: [email protected]
Good luck
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top