<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>can anyone explain this function?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17981/can-anyone-explain-this-function</link><description>Hi i have to read some data from a temperature sensor. 
 twi_temp_read((int8_t *)&amp;amp;temperature);
 
 this below what do? 
 temperature = ((temperature &amp;gt;&amp;gt; 12) &amp;amp; 0x000F) | (temperature &amp;lt;&amp;lt; 4);

if((temperature &amp;amp; 0x0800) != 0){
// minus
temperature</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 25 Nov 2016 14:00:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17981/can-anyone-explain-this-function" /><item><title>RE: can anyone explain this function?</title><link>https://devzone.nordicsemi.com/thread/69330?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 14:00:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:824e41b5-cad7-44f3-b41b-2275343f140f</guid><dc:creator>Roberto</dc:creator><description>&lt;p&gt;Hi Jorgen exact!is a tmp102! thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: can anyone explain this function?</title><link>https://devzone.nordicsemi.com/thread/69329?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 12:21:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96637ef8-04e8-45f6-908e-090d1a9bc9ff</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Where did you get this code from? Which sensor are you reading?&lt;/p&gt;
&lt;p&gt;It looks like the code does conversion from binary to decimal temperature and stores this value in a string. For instance the &lt;a href="http://www.ti.com.cn/cn/lit/ds/symlink/tmp102.pdf"&gt;TI TMP102 I2C temperature sensor&lt;/a&gt; has a resolution of 0.0625°C, and you would have to use a function like this to convert the binary value read over I2C if you want to display the value as decimal number.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>