Pages: [1]   Go Down
Author Topic: Problem with my lis3lv02dq  (Read 669 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everybody,
I have a problem with my sensor lis3lv02dq.
I want to do a function that when you press a button, set to 0 the values of the 3-axis sensor to start from a point of reference.
I'm playing with several values in CTRL_REG2, but I can not reset using the boot.

I leave part of the code of my accelerometer

Code:
void Sensor_Init(void)
{
unsigned int xx = 0;
unsigned int yy = 0;
unsigned int zz = 0;
 xx= Sensor_RX(WHO_AM_I);
 yy= Sensor_RX(CTRL_REG1);
 zz= Sensor_RX(CTRL_REG3);
 printf(" W: %x 1: %x  2: %x \n", xx, yy, zz);


 // war: Sensor_TX(CTRL_REG1, 0x87); // Power on device, enable all axis, and turn off self test
 // war: Sensor_TX(CTRL_REG2, 0x45);

 //Axel: REG2: 0x65, REG1: 0x47
//Sensor_TX(CTRL_REG2, 0x14);
Sensor_TX(CTRL_REG2, 0x44);
Sensor_TX(CTRL_REG1, 0x87);

   if ((B1) == 0 && b1_flag == 0)          //if B1 pressed
     {
       draw_array32_to_lcd("Calibrate  ");
      
       b1_flag = 1;
     }
   if ((B1) != 0 && b1_flag != 0)          //if B1 released
     {
       Sensor_TX(CTRL_REG2, 0x14);
       b1_flag = 0;
     }

}
« Last Edit: January 19, 2011, 04:35:53 pm by trank » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14026
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a website or URL that points to the datasheet of the sensor, that would be a great help.
Furthermore posting the whole code helps also, please use the # butto so the code appears between the [ code] and [/code] tags
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26627
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but I can not reset using the boot
What does that mean?

As well as your code, it would be useful to see your debug print output.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The datasheet is this:
http://symbrion.org/tiki-download_file.php?fileId=225

Thks
Logged

0
Offline Offline
Shannon Member
****
Karma: 221
Posts: 12710
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You say you are trying to set the values to zero somehow - yet your code seems to simply reboot the chip.

So what exactly are you trying to do and what makes you think its not happening?
Logged

[ I won't respond to messages, use the forum please ]

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My idea is, when you press B1, display counters are in 0 to start measuring from a reference point.
It is a very simple idea, but I can not.
My problem is, when I press B1, don´t get to set 0
« Last Edit: January 20, 2011, 02:23:44 am by trank » Logged

Pages: [1]   Go Up
Jump to: