Gyro ITG-3200

  • 3-axis MEMS gyro IC
  • The part features enhanced bias and sensitivity temperature stability
  • 16-bit analog-to-digital converters (ADCs) for digitizing the gyro outputs
  • user-selectable internal low-pass filter bandwidth
  • Fast-Mode I2C (400kHz) interface
Bildergalarie

Die weiße Umrandung dient der Adressauswahl 0xD0 (GND) oder 0xD2(VDD) (Quelle:SparkFun Electronics ®)

Datenblatt
Modul
Anschaltung an Propeller

Softwaremodule
' Der i2c-Treiber ist hier im anhang einzufügen.

CON ' All the I2C registers for the ITG-3200 gyro I2C address maximum bus speed is 400kHz.
'  ITG3200                       = %1101_0010   '0xD0 if tied low, 0xD2 if tied high
  ITG3200                       = %1101_0000   
  ITG3200_WHO_AM_I              = $00 {{R/W    ID(6-1)}}
  ITG3200_SMPLRT_DIV            = $15 {{R/W    SMPLRT_DIV(7-0)}}
  ITG3200_DLPF_FS               = $16 {{R/W    FS_SEL(4-3) DLPF_CFG(2-0)}}
  ITG3200_INT_CFG               = $17 {{R/W    ACTL(7) OPEN(6) LATCH_INT_EN(5) INT_ ANYRD_2CLEAR(4) ITG_RDY_EN(2) RAW_ RDY_ EN(0)}}
  ITG3200_INT_STATUS            = $1A {{R      ITG_RDY(2) RAW_ DATA_ RDY(0)}}
  ITG3200_TEMP_OUT_H            = $1B {{R      TEMP_OUT_H(7-0)}}
  ITG3200_TEMP_OUT_L            = $1C {{R      TEMP_OUT_L(7-0)}}
  ITG3200_GYRO_XOUT_H           = $1D {{R      GYRO_XOUT_H(7-0)}}
  ITG3200_GYRO_XOUT_L           = $1E {{R      GYRO_XOUT_L(7-0)}}
  ITG3200_GYRO_YOUT_H           = $1F {{R      GYRO_YOUT_H(7-0)}}
  ITG3200_GYRO_YOUT_L           = $20 {{R      GYRO_YOUT_L(7-0)}}
  ITG3200_GYRO_ZOUT_H           = $21 {{R      GYRO_ZOUT_H(7-0)}}
  ITG3200_GYRO_ZOUT_L           = $22 {{R      GYRO_ZOUT_L(7-0)}}
  ITG3200_PWR_MGM               = $3E {{R/W    H_RESET(7) SLEEP(6) STBY_XG(5) STBY_YG(4) STBY_ZG(3) CLK_SEL(2-1)}}

VAR
  long XA, YA, ZA                        'Acc

PUB start
    waitcnt(clkfreq + cnt)                                  'start-up delay
    XG := YG := ZG := TG := 0
    WriteLocation(ITG3200, ITG3200_PWR_MGM, %1000_0000)                                 'reset to defaults
    waitcnt(clkfreq/200 + cnt)                                                          '5ms
    WriteLocation(ITG3200, ITG3200_DLPF_FS, %0001_1010)                                 '2000/sec, 1Khz, 98Hz low pass
    WriteLocation(ITG3200, ITG3200_SMPLRT_DIV, %0000_0011)                              '4 samples per sample
    WriteLocation(ITG3200, ITG3200_PWR_MGM, %0000_0001)                                 'PLL with X Gyro reference
    WriteLocation(ITG3200, ITG3200_INT_CFG, %0000_0001)                                 'Enable data ready status
    readLocation (ITG3200, ITG3200_INT_STATUS)                                          'reset data ready
    if ((readLocation(ITG3200, ITG3200_WHO_AM_I)<<1)&$FC) == (ITG3200 & $FC)            'check device id
      ' OK
      itg3200
    else
      ' nOK

PRI itg3200
    if readLocation(ITG3200, ITG3200_INT_STATUS) & 1
      XG := readLocation16(ITG3200, ITG3200_GYRO_XOUT_H)
      YG := readLocation16(ITG3200, ITG3200_GYRO_YOUT_H)
      ZG := readLocation16(ITG3200, ITG3200_GYRO_ZOUT_H)
      TG := readLocation16(ITG3200, ITG3200_TEMP_OUT_H)

i2c.spin

Funktionsbeispiel
sen_gyro_itg3200/start.txt · Zuletzt geändert: 08.10.2012 00:12 (Externe Bearbeitung)
 
Falls nicht anders bezeichnet, ist der Inhalt dieses Wikis unter der folgenden Lizenz veröffentlicht: GNU Free Documentation License 1.3
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki