On Sun, 17 Mar 2002, Duane B wrote: > Would it be possible to get a snippet of the code to see how to set this all > up. This whole PIC, C code, robotic thing is very new to me. Now I don't > want to cheat you out of anything because I know you have put a lot of time > into the code you wrote. But, enough to get me going would be appreciated. > The one camera board, how did you connect it to the PIC, and which PIC did > you use? I used a 16F84, but pretty much any PIC will do. Interface to the sonar unit I have (Polaroid, but not from a camera) consists of INIT and ECHO... raising INIT fires the sonar, ECHO is raised by the sonar unit when an echo is detected. I believe there are pull-up resistors required on both lines, not sure right at the moment. Like I said, I set up a TIMER0 interrupt for 900uS, and during that interrupt service routine increment the variable sonar_range. That way all you have to do to get a range reading is something like this: sonar_range = 0; // Clear range value for this ping output_high(sonar_init); // Send a ping while((sonar_range < 80) && // Wait for either timeout !input(sonar_echo)); // OR an echo return... if(!input(sonar_echo)) { // If it's a timeout, return max range range = max_range; } else { range = sonar_range / 2; // Otherwise return the measured range } output_low(sonar_init); // Turn off INIT to sonar module I also use PCW. Hope this helps out some. Dale -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu