Using the I2C Bus for Connecting the CMPS03 to the PICAXE-28x

Introduction
The compass module uses either a PWM output or the I2C bus for communications.
This example uses the I2C Bus. The SDA
(data) and SCL (clock) lines are connected to pins 15 and 14 on the PICAXE-28x. The example presented here uses the
PICAXE readi2c command to read the compass bearing in a single line of code.
Circuit Schematic for connecting the PICAXE-28x to the CMPS03 Compass Module using the I2C bus
Software
The sample code below displays the CPMS03 software revision and compass bearing as
0-255 representing a full circle.
It can be downloaded here
'*********************************************************** '** ** '** CMPS03 Demonstration Software for the PICAXE-28x ** '** ** '** Copyright 2003 - Devantech Ltd ** '** Commercial use of this software is prohibited ** '** Private and educational use only is permitted ** '** ** '** Written by Gerald Coe - May 2003 ** '** ** '*********************************************************** main: i2cslave $C0,i2cfast,i2cbyte ' Define i2c slave address for the CMPS03 loop: goto loop |
You can find Compass Documentation Here as well as a small FAQ and the PICAXE website