Building a Sonar System
nothing while waiting for the pulse width distance
figure to be computed, I replaced the NOP (No Operation)
instruction with an A-to-D conversion trigger. A ranging
cycle with the new A-to-D code resulted in the
analogdistance value you see in Screenshot 3. To
convert the analogdistance voltage value to inches, we
do the following:
1) Convert the analogdistance raw value to volts: 0x80 *
4.858 mV = 0.6218 volts.
ing with my set of LV-MaxSonar ultrasonic rangefinders.
I’ll post all of the PIC18F2620 LV-MaxSonar ultrasonic
rangefinder driver code we talked about plus the
PIC18F2620 RS-232 driver code on the SERVO
website ( www.servomagazine.com) so that you
can have just as much fun with your LV-MaxSonar
ultrasonic rangefinder as I had with mine. See you
next time! SV
Fred Eady can be reached via email at email@example.com.
2) Convert volts to inches: 0.6218
volts/9.707 mV = 64.062 inches.
If we consider the PW distance
golden, the A-to-D distance value is
well within tolerances, considering I’m
feeding the PIC18F2620’s A-to-D
converter with a piece of wirewrap
wire hung out in the wind. Let’s see
what the TX output has to say.
When you’re serious about hardware, you need serious tools.
Whether milling 0.020” traces on prototype PCBs or cutting ½”
steel battle armor, this CNC mill can do it all. Weighing in at more
than 1100 lbs, the PCNC can deliver the hardware end of your
combined hardware & software projects.
Automatic Ranging with
the TX Output
Transistor Q1 in Schematic 2 is
acting as an inverter. If we are to
make any sense of the TX ASCII
output, we must invert the TX serial
data before presenting it to the
PIC18F2620 RX input. The
PIC18F2620 doesn’t have a native
method of inverting the data that is
coming into its EUSART. So, Q1 acting
as a logic inverter is a necessary
hardware addition. From the looks
of Screenshot 4, it appears 64
inches is the consensus distance
Tormach PCNC 1100 Features:
Table size 34" x 9. 5"
R8 Spindle 1.5 hp variable speed to 4500 RPM
Computer controlled spindle speed and direction
Precision ground ballscrews
Digitizing and tool sensing support
4th axis and high speed spindle options
3 Axis Mill
Mill includes Control, CAD and CAM
software. Optional stand, coolant system,
computer and accessories are extra.
Product information and online ordering at www.tormach.com
Home on the Range
I’ve had a great time experiment-
MaxBotix — www.maxbotix.com
HI-TECH Software —
HI-TECH PICC- 18 C Compiler
Microchip — www.microchip.com
SERVO 06.2008 49