| SensComp to BrainStem Example Last Modified: 2008-06-12 | | |
| Acroname Robotics | PDF webpage version | ||
| ![]() Introduction In this example, an BrainStem GP microcontroller uses a 6500 SensComp Ranging Module combined with a 600 Series Instrument grade transducer to measures distances to obstacles. The BrainStem GP tells the sonar module to emit a "ping" and measures the time it takes to receive an echo. It reveals the distance as a raw time in increments of the timer's resolution. Circuit Schematic The digital pin selection between a BrainStem and the Senscomp ranging module will vary depending on which module that is being used. Senscomp interfacing requires a digital pin to trigger a ultrasonic pulse and another digital pin to monitor the echo pulse that comes back from the transducer. On a BrainStem, any digital pin that is not being used will work to trigger a pulse on the INIT line. Measuring the digital pulse back requires the pin to have pulse timing functionality. Please view the BrainStem Reference manual to determine which pins are capable for pulse timing for the particular BrainStem module you are using. The example uses the Digital 1 and Digital 2 pin on the BrainStem GP 2.0 module. The following wiring diagram illustrates the interface between the Senscomp ranging module and the BrainStem. One detail when using the Senscomp module is the ECHO pin requires a pull-up resistor for operation. Also, a power filtering capacitor is recommended between the VCC pin and Ground on the Senscomp module. ![]() Source Code This code uses the TEA language, which is a subset of ANSI C. It is compiled using the BrainStem Console application. The code takes a single reading from the Senscomp ranger and prints the value out to the Console application in an infinite loop. A short delay is introduced to allow the Console application the chance to print all the readings to the screen. /* file: 6500_Example.tea */
/* included for the display routines */
#include <aCore.tea>
#include <aPrint.tea>
/* set which pins control the 6500 */
#define a6500_INIT 1
#define a6500_ECHO 2
/* now include the 6500 driving routines */
#include <a6500.tea>
void main()
{
int num = 0;
int reading;
a6500_Setup();
while (1) {
reading = a6500_ReadInt();
aPrint_String("Reading ");
aPrint_IntDec(num++);
aPrint_String(" = ");
aPrint_IntDec(reading);
aPrint_Char(10);
aCore_Sleep(10000);
} /* while */
} /* main */
Revision History:
| |||||||||
Related Links: Senscomp (Polaroid) Sonar Ranging Primer How To: Adding Pull-Up Resistors to the BrainStem GP 2.0 Related Examples: | ||||||||||
| voice: 720-564-0373, email: sales@acroname.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy © Copyright 1994-2008 Acroname, Inc., Boulder, Colorado. All rights reserved. |