background image

Copyright © Parallax Inc.   

 

Page 7 of 12 

Propeller BOE and Propeller QuickStart 

 

Propeller BOE Wiring Diagram

 

 

Propeller QuickStart Wiring Diagram

 

 

OBJ 
 
  pst          : "FullDuplexSerial" 
 
CON 
 
  _clkmode      = xtal1 + pll16x 
  _clkfreq      = 80_000_000 
 
  SDApin         = 0            ' SDA of gyro connected to P0           
  SCLpin         = 1            ' SCL of gyro connected to P1  
 
  WRITE         = $D2           ' Request Write operation 
  READ          = $D3           ' Request Read operation 
 
  ' Control registers 
  CTRL_REG1     = $20  
  CTRL_REG2     = $21 
  CTRL_REG3     = $22 
  CTRL_REG4     = $23 
  STATUS_REG    = $27     
  OUT_X_INC     = $A8 
 
  x_idx = 0 
  y_idx = 1 
  z_idx = 2 
     
VAR 
 
  long x 
  long y 
  long z 
    
  long cx 

Summary of Contents for 27911

Page 1: ...alues for yaw pitch and roll Motion is indicated as a positive or negative value depending on the direction of rotation The sensor is useful in 3D simulation virtual gaming input devices robotics and for remotely controlled or unpiloted aircraft and submersibles Gyroscopes are commonly used with multi axis accelerometers where the data from both sensors can provide useful information detailing spe...

Page 2: ...th breadboard as needed 22 gauge solid conductor hookup wire Basic Wiring Power Requirements 2 7 to 6 5 VDC Communication Interface I2C up to 400 kHz or SPI 10 MHz 4 3 wire Dimensions 0 85 X 0 80 in 2 16 X 2 03 cm Program KickStarts The KickStart examples display raw data output for each of the three axes Values are retrieved from the module using the I2C interface ...

Page 3: ... READ_Data CON D3 Request Read operation Control registers CTRL_REG1 CON 20 CTRL_REG2 CON 21 CTRL_REG3 CON 22 CTRL_REG4 CON 23 STATUS_REG CON 27 OUT_X_INC CON A8 X VAR Word Y VAR Word Z VAR Word rawl VAR Word rawh VAR Word Variables for I2C communications I2C_DATA VAR Byte I2C_LSB VAR Bit I2C_REG VAR Byte I2C_VAL VAR Byte PAUSE 100 Power up delay Set up data ready signal I2C_REG CTRL_REG3 I2C_VAL ...

Page 4: ...e noise IF X BIT15 THEN X ABS X 114 X X ELSE X X 114 ENDIF IF Y BIT15 THEN Y ABS Y 114 Y Y ELSE Y Y 114 ENDIF IF Z BIT15 THEN Z ABS Z 114 Z Z ELSE Z Z 114 ENDIF DEBUG HOME RAW X 11 SDEC X CR Display data DEBUG RAW Y 11 SDEC Y CR DEBUG RAW Z 11 SDEC Z CR PAUSE 250 LOOP Gyro_Get_Raw GOSUB Wait_For_Data_Ready GOSUB I2C_Start I2C_DATA WRITE_DATA GOSUB I2C_Write Read the data starting I2C_DATA OUT_X_IN...

Page 5: ...I2C_Read rawL I2C_DATA GOSUB I2C_ACK GOSUB I2C_Read rawH I2C_DATA GOSUB I2C_NACK Z rawH 8 rawL GOSUB I2C_Stop RETURN I2C functions Read the status register until the ZYXDA bit is high Wait_For_Data_Ready DO I2C_REG STATUS_REG GOSUB I2C_Read_Reg LOOP UNTIL I2C_DATA 08 0 RETURN Set I2C_REG I2C_VAL before calling this I2C_Write_Reg GOSUB I2C_Start I2C_DATA WRITE_DATA GOSUB I2C_Write I2C_DATA I2C_REG ...

Page 6: ...SCL RETURN I2C_Stop LOW SDA INPUT SCL INPUT SDA RETURN I2C_ACK LOW SDA INPUT SCL LOW SCL INPUT SDA RETURN I2C_NACK INPUT SDA INPUT SCL LOW SCL RETURN I2C_Read SHIFTIN SDA SCL MSBPRE I2C_DATA RETURN I2C_Write I2C_LSB I2C_DATA BIT0 I2C_DATA I2C_DATA 2 SHIFTOUT SDA SCL MSBFIRST I2C_DATA 7 IF I2C_LSB THEN INPUT SDA ELSE LOW SDA INPUT SCL LOW SCL INPUT SDA INPUT SCL LOW SCL RETURN Note When this progra...

Page 7: ...llDuplexSerial CON _clkmode xtal1 pll16x _clkfreq 80_000_000 SDApin 0 SDA of gyro connected to P0 SCLpin 1 SCL of gyro connected to P1 WRITE D2 Request Write operation READ D3 Request Read operation Control registers CTRL_REG1 20 CTRL_REG2 21 CTRL_REG3 22 CTRL_REG4 23 STATUS_REG 27 OUT_X_INC A8 x_idx 0 y_idx 1 z_idx 2 VAR long x long y long z long cx ...

Page 8: ...ta WaitForDataReady at top of screen Read_MultiB OUT_X_INC Read XYZ bytes Divide by 114 to reduce noise x x cx 114 y y cy 114 z z cz 114 RawXYZ WaitCnt ClkFreq 4 Cnt Delay before next loop PUB RawXYZ Display Raw X Y Z data pst str string RAW X 11 pst dec x pst str string 13 RAW Y 11 pst dec y pst str string 13 RAW Z 11 pst dec z Below here routines to support I2C interfacing PUB WaitForDataReady s...

Page 9: ...yroscope start send WRITE send SUB3 stop start send READ multiBYTE x_idx receive true receive true 8 multiBYTE y_idx receive true receive true 8 multiBYTE z_idx receive true receive false 8 stop x multiBYTE x_idx y multiBYTE y_idx z multiBYTE z_idx PRI send value value value 8 repeat 8 dira SDApin value dira SCLpin false dira SCLpin true value 1 dira SDApin false dira SCLpin false result not ina S...

Page 10: ... start outa SDApin false outa SCLpin false dira SDApin true dira SCLpin true PRI stop dira SCLpin false dira SDApin false Note To view the results of the demonstration after uploading is complete run the Parallax Serial Terminal from the Run menu or press F12 Click the Enable button in the Terminal window then momentarily depress the Reset button on the Propeller QuickStart board to restart the pr...

Page 11: ...urn on all axes disable power down writeI2C CTRL_REG3 0x08 Enable control ready signal writeI2C CTRL_REG4 0x80 Set scale 500 deg sec delay 100 Wait to synchronize void loop getGyroValues Get new values In following Dividing by 114 reduces noise Serial print Raw X Serial print x 114 Serial print Raw Y Serial print y 114 Serial print Raw Z Serial println z 114 delay 500 Short delay between reads voi...

Page 12: ...sion Addr Wire write regAddr Wire write val Wire endTransmission Note To view the results of the demonstration after uploading is complete click the Serial Monitor icon in the Arduino IDE This displays the Serial Monitor window Momentarily depress the Reset button on the Arduino board to restart the sketch For More Information See the 3 Axis Gyroscope 27911 data sheet More information on gyroscope...

Reviews: