<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Setting two seperate bits with one data point...]]></title><description><![CDATA[<p dir="auto">Hey Guys, I'm trying to work out how to set two bits in a solar regulator to switch an output via MODBUS over IP using only one data point, or setting two data points simultaneously.<br />
Here is an excerpt from the solar regulator manufacturer.</p>
<pre><code>
Register 4165 can be used to enable and disable both AUX1 and AUX2. It is split in half, the lower 8-bits control AUX1 the upper 8 bits control AUX2.
Setting bits 6&amp;7 will effect AUX 1 and bits 14&amp;15 will control AUX 2.
Setting these bits to 00 (decimal 0) will set the AUX OUTPUT LOW (0v)
Setting these bits to 01 (decimal 1) will enable the AUX port function (PV ON HIGH, WASTE NOT, etc).
Setting these bits to 10 (decimal 2) will set the AUX output HIGH (12v).
Setting these bits to 11 (decimal 3) is undefined and has no guaranteed functionality (it could do anything including turning into a blowfish). 

</code></pre>
<p dir="auto">What I need to do is have a clickable button on my graphical view which when clicked, changes the LED to Green Flashing and sets bit 6&amp;7 to 10 to switch ON<br />
Then to switch off, I need to have the button go red solid and set bits 6&amp;7 to 00, then 1 second later, set to 01 OFF</p>
]]></description><link>https://forum.mango-os.com/topic/1602/setting-two-seperate-bits-with-one-data-point</link><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 23:36:05 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/1602.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 22 Jul 2014 10:22:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Setting two seperate bits with one data point... on Wed, 23 Jul 2014 01:26:07 GMT]]></title><description><![CDATA[<p dir="auto">Thanks guys I'll see if I can get that to work.</p>
<p dir="auto">Cheers<br />
Dan</p>
]]></description><link>https://forum.mango-os.com/post/8819</link><guid isPermaLink="true">https://forum.mango-os.com/post/8819</guid><dc:creator><![CDATA[dan]]></dc:creator><pubDate>Wed, 23 Jul 2014 01:26:07 GMT</pubDate></item><item><title><![CDATA[Reply to Setting two seperate bits with one data point... on Tue, 22 Jul 2014 20:09:52 GMT]]></title><description><![CDATA[<p dir="auto">I'm not sure you want to set the bits individually, but I am somewhat of a modbus beginner. I would think you would want to find the right data type (probably 4 or 2 byte integer) and set it using bitshift's and or's. Something like</p>
<pre><code>if( turn_on )
  control.set( 1 &lt;&lt; 6 ); //0b01000000
else
  control.set( 1 &lt;&lt; 5 ); //0b00100000
</code></pre>
<p dir="auto">To set more bits, use a bitwise 'or' ( | ) wherever your logic is being done (actionscript in DGLux, a scripting data source, or perhaps in the view itself), i.e. control.set(1 &lt;&lt; 6 | 1 &lt;&lt; 5);</p>
<p dir="auto">I agree with Jeremy that this would probably be easier to work out in DGLux than with a graphical view, and I appreciate his answering!</p>
]]></description><link>https://forum.mango-os.com/post/8811</link><guid isPermaLink="true">https://forum.mango-os.com/post/8811</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 22 Jul 2014 20:09:52 GMT</pubDate></item><item><title><![CDATA[Reply to Setting two seperate bits with one data point... on Tue, 22 Jul 2014 14:24:08 GMT]]></title><description><![CDATA[<p dir="auto">I am only a Mango beginner, but I think you could:</p>
<ul>
<li>Set up a modbus-tcp binary datapoint to set bit 6 of register 4165, and another one to set bit 7</li>
<li>Set up a meta data source and add a binary datapoint to it called 'Aux'</li>
<li>Set up a scripting data source and add your two modbus points and the meta datapoint to its context</li>
<li>Have the script examine the meta datapoint and set your two points accordingly</li>
</ul>
<p dir="auto">I have never used the scripting data source myself, maybe you can update the script itself without having to create the meta datapoint.</p>
<p dir="auto">I never worked out how to make a clickable button/toggle in graphical views, but check this thread:<br />
<a href="http://forum.infiniteautomation.com/forum/posts/list/97.page" rel="nofollow ugc">http://forum.infiniteautomation.com/forum/posts/list/97.page</a></p>
<p dir="auto">I think all this would be simpler to do in DGLux, as you could create the button and set data actions for it. There is a DGLux mobile app which makes bringing this up this on your phone/tablet very convenient.</p>
]]></description><link>https://forum.mango-os.com/post/8806</link><guid isPermaLink="true">https://forum.mango-os.com/post/8806</guid><dc:creator><![CDATA[jeremyh]]></dc:creator><pubDate>Tue, 22 Jul 2014 14:24:08 GMT</pubDate></item></channel></rss>