CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

i2c for 16f877 with cmps03 digital compass

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
praneel
Guest







i2c for 16f877 with cmps03 digital compass
PostPosted: Tue Mar 11, 2003 1:28 am     Reply with quote

hey cud ne help me...m new to pcw....hav been trying to get the deventec cmps03 digital compass to work for over a week. it uses i2c communication, i hav been trying to figure out how the built-in functions works..but still cant get it running...
m using a 16f877 pic with 4MHz crystal...i need to get an accuracy of at least 1 degree

hope someone can help...

thanx
___________________________
This message was ported from CCS's old forum
Original Post ID: 12518
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: i2c for 16f877 with cmps03 digital compass
PostPosted: Tue Mar 11, 2003 2:11 pm     Reply with quote

:=hey cud ne help me...m new to pcw....hav been trying to get the deventec cmps03 digital compass to work for over a week. it uses i2c communication, i hav been trying to figure out how the built-in functions works..but still cant get it running...
:=m using a 16f877 pic with 4MHz crystal...i need to get an accuracy of at least 1 degree
:=
---------------------------------------------------
This page has source code for the cmps03. It's written in
Hi-Tech C.
<a href="http://www.robot-electronics.co.uk/shop/Examples.htm" TARGET="_blank">http://www.robot-electronics.co.uk/shop/Examples.htm</a>

Here's the code:
<a href="http://www.robot-electronics.co.uk/files/Example.c" TARGET="_blank">http://www.robot-electronics.co.uk/files/Example.c</a>

To convert this code to CCS, you need to do these things:
<PRE>
1. Use #byte and #bit statements to define each of the PIC
registers and register bits that are used by the program.
<BR>
Here's a link that has a lot of those definitions already
done for you:
<a href="http://www.pic-c.com/forum/general/posts/8364.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/8364.html</a>
<BR>
2. Everywhere that the Hi-Tech code uses an "int", change it
to a "long" (or "int16" -- same thing as a "long" in CCS).
<BR>
3. Add some printf() statements to their main() code, so
you can display the results of their demo program.
<BR>
4. Get rid of the "__CONFIG(0x3f72)" statement. CCS uses
the #fuses directive for this.

</PRE>
___________________________
This message was ported from CCS's old forum
Original Post ID: 12536
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group