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 coding for Gyro (L3G4200D)

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



Joined: 09 Jan 2013
Posts: 1

View user's profile Send private message

I2C coding for Gyro (L3G4200D)
PostPosted: Wed Jan 09, 2013 1:45 pm     Reply with quote

Hi, I'm working on a Gyro sensor (L3G4200D) which interfaces thru i2c.
Does anyone have code or library, or just put some simple i2c code, so I can understand it and change it according to my need?

regards
umair
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed Jan 09, 2013 2:00 pm     Reply with quote

Hi,

Which PIC are you using, and what is your compiler version?

Also, have you done a search of the forum? Here is a thread that discusses
this device, and apparently works to some extent. It's probably a good
start: https://www.ccsinfo.com/forum/viewtopic.php?p=163387

John
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jan 09, 2013 2:06 pm     Reply with quote

As a new poster here's a few helpful hints..

1) check with the mfr of the device, as they usually will have application notes about the device.

2) download the datasheet from the mfr. It is important and necessary to KNOW what commands,data structure,etc. the device has

3) check with retailers of the product,they usually have 'forums' or sample code

4) let Google be your best friend! I found over 100,000 hits and within the first 20-30 there were great sites about the product

5)Be sure to understand that 5 volt PICs don't electronically interface with 3 volt devices!! You'll need either 3 volt PICs or a 'logic level translator IC.

6) Be sure to use the correct pullup resistors on the I2C bus lines! usually 2k2 to 4k7 will work,but speed,distance,etc. dictate the value

7) There is code out 'there', written in various forms of Basic, that can be adapted to CCS C.

8) Download the I2C diagnostic program from this forum( or the code library). It's a 'must have' when using I2C devices. It'll quickly confirm if your PIC can 'see' your devices.A GREAT starting point as it proves your hardware is good.

9) cut code and learn to use the 'code' button here to allow others to easily see your program

10) be sure to list PIC type, compiler version

11) please read PIC101 and remember this is NOT a 'Proteus' forum AND Proteus is full of bugs,errors, and faulty DRCs...so do NOT use it.If you do don't trust the 'results'.


hth
jay
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