Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Help needed to explain bit 8 on Gyro Sensor data transfur

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
snow

Bascom Member



Joined: 28 Jun 2005
Posts: 150
Location: Ashburton / Mid Canterbury / New Zealand

newzealand.gif
PostPosted: Mon Aug 05, 2019 1:35 am    Post subject: Help needed to explain bit 8 on Gyro Sensor data transfur Reply with quote

Hi
Just been looking at some code dealing with L3GD20 Gyro.
Could someone explain to me why bit 8 is set in this piece of code.

Code:
Read_Gyro:
   I2cstart
    I2cwbyte L3GD20_W
    I2cwbyte &B1010_0110                                    ' (OUT_TEMP AND &B10000000)  <--------------------

   I2cstart
    I2cwbyte L3GD20_R
    I2crbyte Temp , Ack
    I2crbyte Status , Ack
    I2crbyte Xl , Ack
    I2crbyte Xh , Ack
    I2crbyte Yl , Ack
    I2crbyte Yh , Ack
    I2crbyte Zl , Ack
    I2crbyte Zh , Nack
   I2cstop
 


Referring to the data sheet the out_temp reg is &B010_0110 (Reg26) page 35.
Is it something to do with when receiving multi bytes in one go with out stopping the bus??

Thanks
Snow

(BASCOM-AVR version : 2.0.7.5 , Latest : 2.0.8.2 )
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 607

poland.gif
PostPosted: Mon Aug 05, 2019 8:05 am    Post subject: Reply with quote

Datasheet page 29 :
Quote:
In order to read multiple bytes, it is necessary to assert the most significant bit of the sub-
address field. In other words, SUB(7) must be equal to 1 while SUB(6-0) represents the
address of first register to be read.
Back to top
View user's profile Visit poster's website
snow

Bascom Member



Joined: 28 Jun 2005
Posts: 150
Location: Ashburton / Mid Canterbury / New Zealand

newzealand.gif
PostPosted: Mon Aug 05, 2019 9:17 am    Post subject: Reply with quote

Thanks for the reply Smile
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
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
You cannot attach files in this forum
You cannot download files in this forum