7.4.05


The Gyro and Accel test Posted by Hello

2.4.05

The first gadget.

I received an electronic compass. the CMPS03 from robot-electronics.co.uk look for the I2C compass module.

WOW they have some documentation and .... Sample programs :)

Connected the CMPS03 to the developmentboard put some wires on it so the ATOM can communicate using the I2C interface.

The setup

Closer
Quickly zapped the samplecode and imported it into the ATOM-Pro IDE.


SDA Con P8 ' Define Data pin
SCL Con P9 ' Define Clk pin
Compass Con 0xC0 ' Compass I2C Address
CmdReg Con 0 ' Compas Command register
BearingReg Con 2 ' Compas 1st Range register
Bearing Var Word ' 16 bit variable for Bearing
revision var byte ' revision of compass module

Serout S_OUT, i9600, ["Compass start", 13]
Main

pause 100
i2cin p8, p9, Err, 0xc0, 2, [Bearing.HighByte, Bearing.LowByte]

Serout S_OUT, i9600, ["Compass Bearing ", DEC Bearing/10, " graden", 13]

goto Main

Err

'Serout S_OUT, i9600, ["Compass error", 13]

goto Main


And .... I did not work! BUMMER. Some scoping showed a nice clock output, but no data-out on the data pin. Ok it was 3:00AM at that time so later we will look into the problem. After a good night sleep i woke up and remembered something i read in the renesas H8/3664 documentation about the ports on the micro. They need to be pulled up :) Glued a 10K resistor between the data-pin and VSS and whoopy :)


Note the damn pull-up resistor.

Finaly working communication. Yep i know RTFM.

Quickly zapped some code from some Swiss guys look here. The VB program was quickly adapted and see i have got my own electronic compass working.


TaDa...

Now the fun begins. the compass shows nicely how it is rotated in the horizontal plane. But tilted it shows eratic values. After discussing this with my dad he told met this problem with electronic compasses was first mentioned in the 50's duh! The Philips documentation below allso has some references to gimbaling. Not that i had a real purpose for the compass but it is a nice thingy.

The CMPS03 works with two Philips KMZ51 snsors. On the KMZ51 site there is a nice app-note for these sensors.

Hello World

The basics.

Run the ATOM-Pro IDE ( get it from www.basicmicro.com) and just slam in the code.


Out_Line VAR BYTE(20)
Out_Line = "Hello World", 10, 13, 0

loop
SEROUT S_OUT, I9600, [str Out_Line\13\0]
pause 1000
goto loop
end

To my surprise IT WORKS.........

Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World

To work.

As i have what, i think, i need to start experimenting. The work begins.

First of all i have to make a serial cable to connect the Basic Atom-24 Pro to my laptop.

A basic cable is all it takes.

DB9 female (PC) ......... DB9 male (Atom)
2 ---------------------------- 2
3 ---------------------------- 3
4 ---------------------------- 4
5 ---------------------------- 5


Power to the developmentboard by 2 serial LiPo cells (approx 8V) must be sufficient. The 78L05 on the board will take it down to 5V to power up the Atom.

Ready for takeoff.

1.4.05

Today an other happy day.

The final shipment of ordered goods arrived.
Again it was fun to unpack. More fun was to see that they shipped me three instead of two developmentboards :)


The box...


Sesame open!


The stuff.