SRF04 Help

Started by John Baker March 29, 2004
Hello. I am new to PICs and migrated from BS2s. I have PicBasic Pro, the EPIC programmer, and Microcode Studio. I have interfaced a Devantech SRF04 module to a PIC16F84a running at 4MHz. It doesn't seem to work. Here is my test code.
 

 dist var word
 
 main:
 gosub checkit
 if dist < 300
 then beep_light
 goto main
 
 beep_light:
 low portb.2
 pause 1000
 high portb.2 
 goto main
 
 checkit:
 pulsout portb.0,10
 pause 10
 rctime portb.1,1,dist
 return
 goto main
 
I have an LED and 470 Ohm resistor (low-enable) connected to portb.2. The pulse trigger for the sonar is connected to portb.0 and the echo for the sonar is connected to portb.1. If anyone could help me, I'd be very appreciative. I've googled my situation, and look at the list's archives, and nothing close enough to what I'm doing came up. I am also willing to work with assembly if need be.
 
Thank you,
  John Baker