<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[REXYGEN Community Forum / Start of I2C TSL2561 lux sensor REXLANG block and question about param]]></title>
	<link rel="self" href="https://www.rexygen.com/oldforum/extern.php?action=feed&amp;tid=105&amp;type=atom"/>
	<link href="http://www.rexygen.com/oldforum/viewtopic.php?id=105"/>
	<updated>2016-04-12T14:54:42Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.rexygen.com/oldforum/viewtopic.php?id=105</id>
	<entry>
		<title type="html"><![CDATA[Re: Start of I2C TSL2561 lux sensor REXLANG block and question about param]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=464#p464"/>
		<content type="html"><![CDATA[<p>[Edit: You are right about the Tx buffer index, but when I changed them back to zero I&#039;m getting no output, I&#039;ll have to look more into this later, it probably means Channel Zero is reading as zero.]</p><p>I implemented your changes and the params are working now. I&#039;ll upload the fixed code. I changed some of the variable names to more closely match the documentation I&#039;ve read so far; i.e. paramZero is changed to param_p0. No changes were made to the exec or task functions</p><p><a href="https://www.rexygen.com/oldforum/img/members/54/tsl2561.c" rel="nofollow">tsl2561.c</a><br /><a href="https://www.rexygen.com/oldforum/img/members/54/tsl2561_task.mdl" rel="nofollow">tsl2561_task.mdl</a><br /><a href="https://www.rexygen.com/oldforum/img/members/54/tsl2561_exec.mdl" rel="nofollow">tsl2561_exec.mdl</a></p><p>Before the compiler did not produce any errors; Tracking the function block gave an IE 000: Success output, and the y_10 output was changing for different light levels, but the y_0 output did not match the parameter input, I see now why that is. Thanks for the first post on tracking variables, as the .c file gets more robust from adding intregration times and gains.</p><p>Thomas</p>]]></content>
		<author>
			<name><![CDATA[tomwoehlke]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=54</uri>
		</author>
		<updated>2016-04-12T14:54:42Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=464#p464</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Start of I2C TSL2561 lux sensor REXLANG block and question about param]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=455#p455"/>
		<content type="html"><![CDATA[<p>Edit to the parameter issue:</p><p>The problem is in variable declaration. The first declaration of paramZero is overwritten by the second one. This is a bug - the compile process should have ended up with an error.</p><p>Please try this workaround:</p><p>Declaration:</p><div class="codebox"><pre><code>double parameter(0) paramZero; //testing parameters
double output(0) output0; //testing parameters</code></pre></div><p>Add to main method:</p><div class="codebox"><pre><code>output0 = paramZero;</code></pre></div><p>Regards, Tomas</p>]]></content>
		<author>
			<name><![CDATA[tomáš čechura]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=39</uri>
		</author>
		<updated>2016-04-12T08:49:41Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=455#p455</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Start of I2C TSL2561 lux sensor REXLANG block and question about param]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=454#p454"/>
		<content type="html"><![CDATA[<p>Hello tomwoehlke,</p><p>first of all, let me thank you for your question and mainly for your will to share your code with our community. This can save others hours of coding and debugging <img src="http://www.rexygen.com/oldforum/img/smilies/wink.png" width="15" height="15" alt="wink" /> Thank you!</p><p>According to your issue with parameters:<br />Unfortunately I don&#039;t have the TSL2561 to test your project, however it seems that the executive is not running and therefore the output of &quot;p0&quot; is not assigned yet. Did you make it work and received any data from the sensor?<br />See REXLANG output &quot;iE&quot; for errors. You can also inspect task diagnostics to see if the executive is running as it should be. Open RexView, connect to your running target, select the task in the left tree view, choose &quot;Task&quot; tab and tick &quot;Enable&quot;:</p><p><span class="postimg"><img src="https://www.rexygen.com/oldforum/img/members/39/task_diagnostics2.png" alt="task_diagnostics2.png" /></span></p><p>It is also good to check &quot;System log&quot; tab to see any errors and their short description which can serve as a hint in debugging.</p><p>Opening the project files together:<br />When I downloaded your files and executed &quot;tsl2561_exec.mdl&quot; it also opened the task file. However, try to open manually both exec file and task file in one RexDraw. Click to the exec file and go to menu: File --&gt; Set as main. Hope it will solve your issue.</p><p>One more thing to your code - check variable i2c_bufTx for typo in indexes of read Ch.0 H, Ch.1 L and Ch.1 H: </p><div class="codebox"><pre><code>    i2c_bufTx[0] = 0x8D; //there should be zero index I think</code></pre></div><p>Let us know about your progress.</p><p>Good luck!<br />Tomas</p>]]></content>
		<author>
			<name><![CDATA[tomáš čechura]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=39</uri>
		</author>
		<updated>2016-04-12T07:23:43Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=454#p454</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Start of I2C TSL2561 lux sensor REXLANG block and question about param]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=446#p446"/>
		<content type="html"><![CDATA[<p>Hello,</p><p>I just wanted to say that Rex Draw is my introduction to PLC software and I think it is really cool, same with the rpi rex core.</p><p>Last night I finished a very crude REXLANG block for hooking up an I2C TSL2561 lux sensor to the raspberry pi. I was hoping I could maybe get some input on the block and then hopefully add it to the github Rex I2C repository after I add a few more features.</p><p>In it&#039;s current state It uses the default gains and integration times, with no interrupts, to add them I want to use parameters, but I&#039;m struggling with them.</p><p>In the .c file I state:</p><p>double parameter(0) paramZero; //testing parameters<br />double output(0) paramZero; //testing parameters</p><p>In the tsl2561_task.mdl file I specified parameter p0 to be &#039;1&#039;, but when I track the y0 value it says the output is &#039;0&#039;. Probably something I overlooked, but it seems to be in line with the example in the Rex Function Block documentation on I2C.</p><p>Another minor issue I&#039;m having is when I open the tsl2561_exec file it does not also open the tsl2561_task file, I have to open them separately, how do I fix that?</p><p>I uploaded tsl2561_task.mdl, tsl2561_exec.mdl, and tsl2561.c file.</p><p><a href="https://www.rexygen.com/oldforum/img/members/54/tsl2561_task.mdl" rel="nofollow">tsl2561_task.mdl</a><br /><a href="https://www.rexygen.com/oldforum/img/members/54/tsl2561_exec.mdl" rel="nofollow">tsl2561_exec.mdl</a><br /><a href="https://www.rexygen.com/oldforum/img/members/54/tsl2561.c" rel="nofollow">tsl2561.c</a></p>]]></content>
		<author>
			<name><![CDATA[tomwoehlke]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=54</uri>
		</author>
		<updated>2016-04-11T17:01:59Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=446#p446</id>
	</entry>
</feed>
