Connecting the CMPS01/03 to the BS2 using the PWM Signal

Introduction
The compass module uses either a PWM output or the I2C bus for communications.
This example uses the PWM Signal. The example provided here uses PULSIN command.
The PULSIN timing varies with the type of Stamp used. The BS2 and BS2e have 2uS
resolution. The BS2sx has 0.8uS and the BS2p is 0.75uS. The example code
below shows the calculation for each and is therefore suitable for use
with all BS2 variants. It has been tested with the BS2 and BS2p.
The BS2 internal 5v regulator is not suitable for powering much external
circuitry. I therefore recommend you use a separate 5v regulator.
Circuit Schematic for connecting the BS2 Stamp to the CMPS01/CMPS03 Compass Module using the PWM Signal
Note the switch connecting pin 6 to Ground. This is all that is needed for calibration of Rev7 Firmware.
Software
The sample code below displays the compass bearing in Degrees (0-359) in a Debug window on the PC.
It can be downloaded here
| '{$STAMP BS2}
'*********************************************************** bearing var word main: |
You can find Compass Documentation Here as well as a small FAQ