Connect with us

Gyroscope & Compass Readings not changing

Discussion in 'Microcontrollers, Programming and IoT' started by parag, Aug 17, 2015.

Scroll to continue with content
  1. parag

    parag

    4
    0
    Aug 17, 2015
    Hello

    Im interfacing IMU gy80 module with TivaC board.
    Accelerometer is working fine.
    Gyroscope & Compass Readings not changing continuously but when the device is power OFF and again ON that time readings before power OFF and after power ON are different.
    BUT untill the device is powered off the readings will remain constant.

    Hers my part of code..

    ---------------------------------------------------------------------------------
    I'm initializing the L3G4200D gyrometer registers with following mentioned values
    writeI2C0(Gyro_ADDR,CTRL_REG1,0xCF);
    writeI2C0(Gyro_ADDR,CTRL_REG2,0x00);
    writeI2C0(Gyro_ADDR,CTRL_REG3,0x08);
    writeI2C0(Gyro_ADDR,CTRL_REG4,0x30);
    writeI2C0(Gyro_ADDR,CTRL_REG5,0x00);
    -------------------------------------------------------------------------------------


    signed int getRotation_Y(){
    signed int short raw = (signed int short) getRotation_rawY();
    signed int Rotation = (signed int)raw;
    return Rotation;
    }

    uint16_t getRotation_rawY(){
    uint8_t rotData1, rotData2;
    rotData1=readI2C0(Gyro_ADDR,OUT_Y_L);
    rotData2=readI2C0(Gyro_ADDR,OUT_Y_H);
    uint16_t rawY = (rotData2<<8)|rotData1;
    return (rawY);
    }

    --------------------------------------------------------------------------------------

    UART_OutUDec((unsigned int) rotationX)
    {
    if(n >= 10){
    UART_OutUDec(n/10);
    n = n%10;
    }
    UART_OutChar(n+'0'); /* n is between 0 and 9 */
    }
    }

     
  2. donkey

    donkey

    1,289
    56
    Feb 26, 2011
    I am no programming genius but it sounds to me like you have asked for these inputs once, nothing to refresh so it won't refresh them live.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-