Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   I2C Digital Compass Programming (http://www.chiefdelphi.com/forums/showthread.php?t=32050)

CyberWolf_22 02-01-2005 17:38

I2C Digital Compass Programming
 
I was looking around Newark InOne and found a digital compass.

I read the data sheet and it looks like it will interface nicely with are Robot Controller.
My only problem is going to be figuring out how to program the I2C interface. I have read the PIC datasheet on using the I2C interface but I have not been able to get a good grasp on how I would go about programming it. Does anyone have any examples of programming this sensor or setting up an I2C interface in general?

Rickertsen2 02-01-2005 18:12

Re: I2C Digital Compass Programming
 
Well you are in luck. There is a prewritten library of I2C functions that comes with the compiler. They are documented in the following link:
http://ww1.microchip.com/downloads/e...ies_51297d.pdf

Also, source code for all of these functions can be found in the C18 install directory assuming you selected it when you installed C18.

Elgin Clock 02-01-2005 18:58

Re: I2C Digital Compass Programming
 
Compass you say?

http://www.chiefdelphi.com/forums/sh...94&postcount=5

We tried that a few years back. Look for mention of the I.D.A.N. system.

Gdeaver 02-01-2005 20:52

Re: I2C Digital Compass Programming
 
Note the accuracy in the data sheet. Don't confuse resolution and accuracy. I've been playing with a PNI compass board. I I've got it working to with in 1deg accuracy. However to get this accuracy the are only 2 readings per second. They're slow devices. Enable the set reset register. The board has to be at least 1.5 away from any motors or solenoids. The more the better.
1 degree of error over the length of a playing field is allot. It may have it's uses.

Astronouth7303 02-01-2005 21:21

Re: I2C Digital Compass Programming
 
Quote:

Originally Posted by Gdeaver
The board has to be at least 1.5 away from any motors or solenoids.

1.5 what?

Gdeaver 02-01-2005 21:28

Re: I2C Digital Compass Programming
 
Feet. More if the motors are under high load. The drill motors really put out magnetic distortions. Cims aren't nearly as bad. Fortunately the magnetic field from the motors is not uniform.

Kevin Watson 03-01-2005 00:14

Re: I2C Digital Compass Programming
 
Quote:

Originally Posted by CyberWolf_22
...My only problem is going to be figuring out how to program the I2C interface. I have read the PIC datasheet on using the I2C interface but I have not been able to get a good grasp on how I would go about programming it. Does anyone have any examples of programming this sensor or setting up an I2C interface in general?

The hardware I2C interface is unavailable because the Master Synchronous Serial Port Module is being used for the intraprocessor SPI link.

-Kevin

Rickertsen2 03-01-2005 00:20

Re: I2C Digital Compass Programming
 
Quote:

Originally Posted by Kevin Watson
The hardware I2C interface is unavailable because the Master Synchronous Serial Port Module is being used for the intraprocessor SPI link.

-Kevin

Hrmm... True... This will make things harder but not impossible. You will not be able to take advantage of the built in hardware and will have to "bitbang" the I2C interface. The good new is that I2C is synchronous and so timing isn't critical. If you look in the document i listed earlier, you will see that they have some basic I2C bitbanging functions described in section 3.5.


All times are GMT -5. The time now is 17:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi