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

Gyro XV 3500CB angular rate sensor , i really need some help
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Wed Feb 01, 2012 2:38 am     Reply with quote

The module you're using is a Sure Electronics XV-3500CB prototyping board:

http://www.sphere.ws/got/elcontests/200907_usbgyro/DC-SS010_Ver1.0_EN.pdf

The XV-3500CB itself is an IC from Epson Toyocom:

http://www.eea.epson.com/portal/pls/portal/docs/1/424992.PDF

The XV-3500CB doesn't have an I2C interface, just the voltage. The prototyping board has a Microchip MCP3421 18bit delta sigma I2C ADC with I2C interface with 2.048V Vref and this is what you are talking to when you connect with I2C to the prototyping board. That ADC should be good enough to get decent results from this sensor. There's a lot more to reading it than simply waiting for data to come along! You have to configure it to get it converting. The MCP3421 appears to be pretty straightforward as delta sigma convertors go, but you'll need to get to grips with how it works before you get anything useful out of it.

RF Developer
rubenskc



Joined: 28 Sep 2011
Posts: 12

View user's profile Send private message

Hi Chaud...
PostPosted: Wed Feb 22, 2012 5:48 am     Reply with quote

I'm starting a project here with a 16F877a and the XV-3500CB, also using CCS. How's your project going? I have the same issue with you, a bit of difficulty with the I2C, and would like to know how's your code now. Would you share it?
_________________
Rubs
Chaud



Joined: 11 Jan 2012
Posts: 39

View user's profile Send private message

Hi rubenskc
PostPosted: Wed Feb 22, 2012 7:05 am     Reply with quote

Sure, so first of all you need to create i2c:

Code:

#use i2c(master,sda= PIN_B0,scl=PIN_B1)


so for I2C i use this method:

Code:


int32 readGyro(){
   int32 gyro;
   int value1;
   int value2;
   i2c_start();
   i2c_write(209);
   value1 = i2c_read(1);
   value2 = i2c_read(0);
   i2c_stop();
   gyro = make16(value2,value1);
   return gyro;

}

i2c_start() -> starts the i2c
i2c_write(209) -> sends the instruction necessary to tell the slave that we want to read values (209 is the same thing than "11010001" as you can see in xv-3500 datasheet).
i2c_read(1) -> reads the first 8-bit number, "1" means that i want to receive another 8-bit
i2c_read(0) - > reads the last or MSB 8-bit number, "0" means that we have the 16-bit number already.

And gyro (returned value) is the conversion of 16-bit number to decimal.

Normally my offset is "16133" but it is different in all XV-3500CB's, your can be something arround 15000 or something arround 17000, that number is easy to get, just see the value that you get when the gyro is stable.

Anything, feel free to ask,
Chaud


EDIT: dont forget you need to have a resistor in SCL and SDA gyro pins,for pull-up's, otherwise i2C wont work (i use 2.2Kohm), and connect it to SCL and SDA pic16 pins, see on datasheet
rubenskc



Joined: 28 Sep 2011
Posts: 12

View user's profile Send private message

Hm...
PostPosted: Fri Feb 24, 2012 9:27 am     Reply with quote

Thanks, mate!!! Fantastic, I'll try this next week. I have a working accelerometer, but now I'm implementing a LCD and that is not working. As soon as the LCD is working fine, I'll try! Is the reading via serial really better (more accurate) than the reading via ADC?
_________________
Rubs
rubenskc



Joined: 28 Sep 2011
Posts: 12

View user's profile Send private message

Also...
PostPosted: Fri Feb 24, 2012 9:37 am     Reply with quote

Also... how sensitive is the device? Did you get a good accuracy (1 degree or so) ?

We you able to integrate and get the angle from the reading info successfully? Would you share?
_________________
Rubs
rubenskc



Joined: 28 Sep 2011
Posts: 12

View user's profile Send private message

Any.....
PostPosted: Thu Aug 09, 2012 8:05 am     Reply with quote

Any news, Chaud? I'm still getting trouble - the I2C interface works... but in trouble calculating the angle....
_________________
Rubs
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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