<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[REXYGEN Community Forum / Reading temperature - Modbus]]></title>
	<link rel="self" href="https://www.rexygen.com/oldforum/extern.php?action=feed&amp;tid=359&amp;type=atom"/>
	<link href="http://www.rexygen.com/oldforum/viewtopic.php?id=359"/>
	<updated>2017-05-11T18:46:14Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.rexygen.com/oldforum/viewtopic.php?id=359</id>
	<entry>
		<title type="html"><![CDATA[Re: Reading temperature - Modbus]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1622#p1622"/>
		<content type="html"><![CDATA[<p>According to the <a href="https://elkom.com.tw/wp-content/uploads/2015/08/PLC2011B1_Manual_English_25_07_2015.pdf" rel="nofollow">PLC2011 B1 manual</a>, page 111, you should divide the value in the Modbus register by 16 to obtain the value in degrees Celsius. </p><p>The value 49408 is 1100000100000000 in binary form which is not a valid value for the DS18B20 sensor. See table 1 in the <a href="https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf" rel="nofollow">DS18B20 datasheet</a>. Therefore you need to swap HIGH and LOW bytes of the Modbus register. You can do so in the Modbus driver configuration. Just tick the &quot;Swap bytes&quot; option. Remember to tick also the &quot;Signed&quot; option because DS18B20 uses signed 16-bit numbers. </p><p>Afterwards you get the value 193 (0000000011000001 in binary form), which gives you the temperature of 193/16=12.0625 deg Celsius.</p><p>Hope I&#039;m right, it&#039;s tough without the device to validate my thoughts...</p><p>Jaroslav</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2017-05-11T18:46:14Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1622#p1622</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Reading temperature - Modbus]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1614#p1614"/>
		<content type="html"><![CDATA[<p>One of the devices I am using is a PLC2011 B1 alarm module. I am connecting a DS18B20 temperature sensor (OWS) to the PLC2011B1 </p><p>See attached.<br /><span class="postimg"><img src="https://www.rexygen.com/oldforum/img/members/13/ds18.png" alt="ds18.png" /></span></p><p>Thanks.</p>]]></content>
		<author>
			<name><![CDATA[hendrik]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=13</uri>
		</author>
		<updated>2017-05-10T11:04:04Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1614#p1614</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Reading temperature - Modbus]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1608#p1608"/>
		<content type="html"><![CDATA[<p>@hendrik: Please clarify how the value 49408 is obtained and what value it represents (at least approximately). What 3rd party device are you using? </p><p>@scoobsalamander: Excellent work. One could also solve that using standard function blocks. Let&#039;s wait for additional input from hendrik.</p><p>Jaroslav</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2017-05-09T11:25:47Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1608#p1608</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Reading temperature - Modbus]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1606#p1606"/>
		<content type="html"><![CDATA[<p>If my assumption was ok then you could try something like this : <a href="https://www.rexygen.com/oldforum/img/members/6/ByteSwap.zip" rel="nofollow">EXAMPLE</a></p><p><span class="postimg"><img src="https://www.rexygen.com/oldforum/img/members/6/REX_20170509.jpg" alt="REX_20170509.jpg" /></span></p>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2017-05-09T09:19:49Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1606#p1606</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Reading temperature - Modbus]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1605#p1605"/>
		<content type="html"><![CDATA[<p>Hi,</p><p>I am measuring temperatures inside control panels and rooms, the temperature range will be 0 - 50degC<br />The idea is to display the temperature values on my custom Rex HMI and also use the values (Hi/Lo temp) to perform certain actions</p>]]></content>
		<author>
			<name><![CDATA[hendrik]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=13</uri>
		</author>
		<updated>2017-05-09T08:23:52Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1605#p1605</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Reading temperature - Modbus]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1604#p1604"/>
		<content type="html"><![CDATA[<p>What temperature are you measuring? </p><p>This might be the solution :</p><p>If the value should be somewhere around 19°C then I think you should divide by 256 (= 8 bit shift to the right) and then divide by 10 to get 19,3°C.&#160; </p><p>49408&#160; &#160; --&gt;&#160; &#160;1100000100000000</p><p>divide by 256</p><p>193&#160; &#160;--&gt;&#160; &#160;11000001</p><p>divide by 10</p><p>19,3°C</p><p>...I&#039;m just guessing</p><p>(edit : maybe it&#039;s a big vs little endian thing and you need to swap both bytes and then divide by 10 to get your value....in this case it will be 19,3°C as well. ...)</p>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2017-05-07T20:31:37Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1604#p1604</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Reading temperature - Modbus]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1603#p1603"/>
		<content type="html"><![CDATA[<p>Hi,</p><p>I am using a 1 wire DS18B20 temperature sensor on a 3rd party device, I then send the temperature reading over Modbus to my unipi.</p><p>Question, how do I convert the value which I receive over Modbus to a decimal number to display the actual temperature? Please see the attached.<span class="postimg"><img src="https://www.rexygen.com/oldforum/img/members/13/temp.png" alt="temp.png" /></span></p><p>(16 bit register - Modbus)</p><p>Thanks,<br />Hendrik</p>]]></content>
		<author>
			<name><![CDATA[hendrik]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=13</uri>
		</author>
		<updated>2017-05-07T19:04:26Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1603#p1603</id>
	</entry>
</feed>
