<?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[I2C EZO component]]></title><description><![CDATA[<p dir="auto">HI Everybody,</p>
<p dir="auto">I'm new with Rexygen, but I'm really surprise with the amount of possibilities, it's really amazing.<br />
I have already done some I/O simulation, and everything works perfectly.</p>
<p dir="auto">My project with Rexagen would be to integrate Ph / ORP /etc probes into my swimming pole management.<br />
To do that I'll add EZO I2C components ( <a href="https://www.whiteboxes.ch/shop/ezo-ph-circuit/">https://www.whiteboxes.ch/shop/ezo-ph-circuit/</a>) on the GPIO of my raspberry.<br />
I'm not familiar on how I can manage I2C data with rexygen.</p>
<p dir="auto">Is someone can guide on how to proceed ?</p>
<p dir="auto">Arnaud</p>
]]></description><link>https://forum.rexygen.com/topic/171/i2c-ezo-component</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 20:33:20 GMT</lastBuildDate><atom:link href="https://forum.rexygen.com/topic/171.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 07 Dec 2020 14:08:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to I2C EZO component on Mon, 25 Jan 2021 07:30:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/219">@belgacom</a> You are welcome <img src="https://forum.rexygen.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=6d51e091ff9" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://forum.rexygen.com/post/754</link><guid isPermaLink="true">https://forum.rexygen.com/post/754</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Mon, 25 Jan 2021 07:30:13 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Fri, 22 Jan 2021 13:26:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/133">@reitinge</a></p>
<p dir="auto">Everything works fine !<br />
Thank you.</p>
]]></description><link>https://forum.rexygen.com/post/749</link><guid isPermaLink="true">https://forum.rexygen.com/post/749</guid><dc:creator><![CDATA[belgacom]]></dc:creator><pubDate>Fri, 22 Jan 2021 13:26:08 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Wed, 20 Jan 2021 20:08:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/219">@belgacom</a><br />
Hi Arnaud,<br />
congratulations to your first received message! <img src="https://forum.rexygen.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=6d51e091ff9" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":-)" alt="🙂" /></p>
<p dir="auto">Your problem with publishing <em>message</em> outside of Rexlang is due to the names of your variables. Output 7, 8 and variable message have the same name and this is a problem. Try something like this:</p>
<ul>
<li>Rename outputs:</li>
</ul>
<pre><code>double output(7) outMessageDouble;
string output(8) outMessageStr;
</code></pre>
<ul>
<li>In the <em>main()</em> method, assign <em>message</em> variable value to output(8) and you can also convert the string value into double and assign it into output(7):</li>
</ul>
<pre><code>outMessageStr = message;
outMessageDouble = str2double(message);
</code></pre>
<p dir="auto">Please resize message variable length from 5 to 6. In the Rexlang, the last <em>char</em> array index contains "end-of-string indicator".  If you write something to the last index of the char array, you will have a memory leak problem.</p>
<p dir="auto">Cheers,<br />
Jan</p>
]]></description><link>https://forum.rexygen.com/post/744</link><guid isPermaLink="true">https://forum.rexygen.com/post/744</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Wed, 20 Jan 2021 20:08:45 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Tue, 19 Jan 2021 14:58:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/133">@reitinge</a></p>
<p dir="auto">Hi.</p>
<p dir="auto">I had time to dig  a littl bit, and I find solution to do the write and read in 1 rexlang.<br />
After that no more issue with alarm and I'm able to trace " message"</p>
<p dir="auto">It works fine.<br />
But still I don't understand how to display the value of  "message" in the HMI designer.</p>
<p dir="auto"><img src="/assets/uploads/files/1611067027482-trace.jpg" alt="trace.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">I tried with standard display and string display.<br />
I would like also to trend the ASCII value ( 3.xxxx)<br />
Can you give me a hand on this ?</p>
<p dir="auto">Thx.</p>
<p dir="auto">Arnaud.</p>
<p dir="auto">my code :</p>
<p dir="auto">/<em><strong><strong><strong><strong><strong>[5]</strong></strong></strong></strong></strong></em>*************************************<br />
*</p>
<ul>
<li>REXLANG - Reading data from MCP3422 AD converter via I2C</li>
<li></li>
</ul>
<p dir="auto">*************************************************************/</p>
<p dir="auto">string parameter(0) i2c_dev; // the I2C bus is defined by the p0 parameter</p>
<p dir="auto">//assigning variables to outputs, these variables are WRITE-ONLY<br />
long output(0) adc_value;<br />
long output(1) adc_value1;<br />
long output(2) adc_value2;<br />
long output(3) adc_value3;<br />
long output(4) adc_value4;<br />
long output(5) adc_value5;<br />
long output(6) adc_value6;<br />
long output(7) message;<br />
string output(8) message;</p>
<p dir="auto">//declaration of variables<br />
long i2c_bufTx[4]; //buffer for transmitting data<br />
long i2c_bufRx[7]; //buffer for receiving data<br />
long i2c_bus_handle;<br />
long i2c_chip_address;<br />
long i2c_write_count;<br />
long i2c_read_count;<br />
long i2c_ret_fun;<br />
int i;<br />
char message[5];</p>
<p dir="auto">//the init procedure is executed once when the REXLANG function block initializes<br />
int init(void)<br />
{<br />
i2c_bus_handle = OpenI2C(i2c_dev); // open I2C bus<br />
Trace(1,i2c_bus_handle);</p>
<p dir="auto">i2c_chip_address = 0x63; // 7-bit address of the I2C device</p>
<pre><code>return 0;
</code></pre>
<p dir="auto">}</p>
<p dir="auto">//the main procedure is executed once in each sampling period<br />
long main(void)<br />
{<br />
//i2c_bufTx[0] = 0x46;<br />
//i2c_bufTx[1] = 0x69;<br />
//i2c_bufTx[2] = 0x6E;<br />
//i2c_bufTx[3] = 0x64;</p>
<p dir="auto">i2c_bufTx[0] = 0x52;</p>
<p dir="auto">// i2c_bufTx[0] = 0x53;<br />
//i2c_bufTx[1] = 0x6C;<br />
//i2c_bufTx[2] = 0x65;<br />
//i2c_bufTx[3] = 0x65;<br />
//i2c_bufTx[4] = 0x70;</p>
<p dir="auto">i2c_write_count = 1;<br />
i2c_read_count = 0;</p>
<p dir="auto">//Sending data via I2C<br />
i2c_ret_fun = I2C(i2c_bus_handle, i2c_chip_address, i2c_bufTx, i2c_write_count, i2c_bufRx, i2c_read_count);</p>
<p dir="auto">Suspend (3);<br />
i2c_write_count = 0;<br />
i2c_read_count = 7;</p>
<p dir="auto">i2c_ret_fun = I2C(i2c_bus_handle, i2c_chip_address, i2c_bufTx, i2c_write_count, i2c_bufRx, i2c_read_count);</p>
<p dir="auto">adc_value = (i2c_bufRx[0]);<br />
adc_value1 = (i2c_bufRx[1]);<br />
adc_value2 = (i2c_bufRx[2]);<br />
adc_value3 = (i2c_bufRx[3]);<br />
adc_value4 = (i2c_bufRx[4]);<br />
adc_value5 = (i2c_bufRx[5]);</p>
<p dir="auto">for (i=1; i&lt;6; i++)<br />
message[i-1] = i2c_bufRx[i];<br />
Trace(1,message);</p>
<p dir="auto">return 0;<br />
}</p>
<p dir="auto">//the exit procedure is executed once when the task is correctly terminated<br />
// (system shutdown, downloading new control algorithm, etc.)<br />
long exit(void)<br />
{<br />
if(i2c_bus_handle&gt;=0) Close(i2c_bus_handle); // close I2C bus<br />
return 0;<br />
}</p>
]]></description><link>https://forum.rexygen.com/post/731</link><guid isPermaLink="true">https://forum.rexygen.com/post/731</guid><dc:creator><![CDATA[belgacom]]></dc:creator><pubDate>Tue, 19 Jan 2021 14:58:28 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Mon, 18 Jan 2021 09:50:03 GMT]]></title><description><![CDATA[<p dir="auto">Hi Arnaud,<br />
thanks, I hope you are fine too. Can you post here your actual code from Rexlang, please? When an error occurs, code execution stops, so the outputs may not be updated.  We will try to find and fix the Numeric range check error.</p>
<p dir="auto">Cheers,<br />
Jan</p>
]]></description><link>https://forum.rexygen.com/post/728</link><guid isPermaLink="true">https://forum.rexygen.com/post/728</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Mon, 18 Jan 2021 09:50:03 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Fri, 15 Jan 2021 11:46:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/133">@reitinge</a></p>
<p dir="auto">Hello, Happy new year. Hope you are going .<br />
I tried to use trace with you code up here, but even if the block is returning the correct value of my Ezo components,<br />
I have an 508 error.</p>
<p dir="auto"><img src="/assets/uploads/files/1610710951662-errore-508.jpg" alt="errore 508 .jpg" class=" img-fluid img-markdown" /><br />
therefore no trace is seen in the log . any idea why 508 error ?</p>
<p dir="auto">Anyway even if I hand write 5 values into message[5], how after do I see it on the HMI page.<br />
If I use a declaration of output like :</p>
<p dir="auto">long output(x) message; or string output(x) I can't manage to see values in message.<br />
How do I proceed ?</p>
<p dir="auto">thx</p>
<p dir="auto">Arnaud</p>
]]></description><link>https://forum.rexygen.com/post/722</link><guid isPermaLink="true">https://forum.rexygen.com/post/722</guid><dc:creator><![CDATA[belgacom]]></dc:creator><pubDate>Fri, 15 Jan 2021 11:46:45 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Sat, 02 Jan 2021 14:50:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/219">@belgacom</a><br />
Happy new year to you too. You are welcome. I'm sorry for decadic &lt;-&gt; hexadecimal converting trouble. I usually send values as a hex, but  I thought the decimal values would work as well.</p>
<ol>
<li>For converting DEC/HEX values into string, you can use something like this:<pre><code>  int i;    
  char message[5];    
  /*bufRx[1] = 51;    
  bufRx[2] = 46;    
  bufRx[3] = 56;    
  bufRx[4] = 57;    
  bufRx[5] = 54;*/    
  for (i=1; i&lt;6; i++)    
	message[i-1] = bufRx[i];    
  Trace(1,message); 
</code></pre>
</li>
<li>Yes, you can use one Rexlang block for reading / writing. The easiest way is to use some type of simple if-else or switch-case structure in the main() function. Rexlang provides functions as Sleep() or Suspend() (see documentation <a href="https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html#x270-26900015">https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html#x270-26900015</a>) but I think the right way is to send a request and periodically checking if the answer received. You should change the period of your task where the Rexlang block is too. <a href="https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/EXEC.html">https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/EXEC.html</a> The Rexlang block source code (and all others blocks in the task) are executed only once per period time.</li>
</ol>
<p dir="auto">Best regards,<br />
Jan</p>
]]></description><link>https://forum.rexygen.com/post/679</link><guid isPermaLink="true">https://forum.rexygen.com/post/679</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Sat, 02 Jan 2021 14:50:42 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Fri, 01 Jan 2021 20:20:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/133">@reitinge</a></p>
<p dir="auto">Hello, Happy new year. Thanks for your help and sorry for the time lost for my com issue. I was targeting Localhost and not my Pi. Except the fact that command need to be send in Hex and not in Dec, your code works find.</p>
<p dir="auto">I'm able to send command and read values back.<br />
Thanks a lot.</p>
<p dir="auto">I still have a couple of question for you :</p>
<ol>
<li>
<p dir="auto">now I have the reading of my probe in bufRx [1] to [5] in DEC. and I need to convert it in ASCII. (51 46 56 57 54 = 3.896 )<br />
Is there a function for that, in Rexlang or another FB to use ?</p>
</li>
<li>
<p dir="auto">Between a write and a read, I have for example 900ms to wait . So currently I have done 2 Rexlang, 1 to write, 1 to read.<br />
And I use a timer between both FB. Is there a way to do it directly in Rexlang, or do I have to continue to use 2 block ?<br />
I didn't find answer in the doc.</p>
</li>
</ol>
<p dir="auto">Have a good day.</p>
<p dir="auto">Arnaud.</p>
]]></description><link>https://forum.rexygen.com/post/678</link><guid isPermaLink="true">https://forum.rexygen.com/post/678</guid><dc:creator><![CDATA[belgacom]]></dc:creator><pubDate>Fri, 01 Jan 2021 20:20:31 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Thu, 31 Dec 2020 07:12:37 GMT]]></title><description><![CDATA[<p dir="auto">Error -106 means Invalid parameter. Error codes are documented here: <a href="https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/BRef_ENGap3.html">https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/BRef_ENGap3.html</a></p>
<ul>
<li>Please, delete the space between Trace and (.</li>
<li>Check value of the parameter p0 in the Rexlang block (attached figure). <img src="/assets/uploads/files/1609398086937-24b4564a-93f8-4b58-8b55-551866ceadce-image.png" alt="24b4564a-93f8-4b58-8b55-551866ceadce-image.png" class=" img-fluid img-markdown" /><br />
This is the value which is set into the variable <em>i2c_dev</em>. In my case, it is the bus /dev/i2c-1. This depends on your wiring.</li>
<li>Are you sure, you are running the Rexygen program on your Raspberry? The Error: <strong>REXLANG open this file type is not possible on this platform</strong> indicate, that you might run on your local PC and there is no I2C bus.</li>
</ul>
<p dir="auto">Cheers,<br />
Jan</p>
]]></description><link>https://forum.rexygen.com/post/677</link><guid isPermaLink="true">https://forum.rexygen.com/post/677</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Thu, 31 Dec 2020 07:12:37 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Wed, 30 Dec 2020 19:29:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/133">@reitinge</a></p>
<p dir="auto">I do have a negative result with the trace function .</p>
<p dir="auto">here is a print screen of the log and the current BF code :</p>
<p dir="auto"><img src="/assets/uploads/files/1609356517263-trace.jpg" alt="trace .jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">What could be the error to have the trace at -106.</p>
<p dir="auto">Arnaud</p>
]]></description><link>https://forum.rexygen.com/post/675</link><guid isPermaLink="true">https://forum.rexygen.com/post/675</guid><dc:creator><![CDATA[belgacom]]></dc:creator><pubDate>Wed, 30 Dec 2020 19:29:22 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Wed, 30 Dec 2020 06:31:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/219">@belgacom</a> I'm sorry, decadic ASCII value for "d" is 100, not 64.</p>
<pre><code>i2c_bufTx[3] =100;   //d
</code></pre>
]]></description><link>https://forum.rexygen.com/post/673</link><guid isPermaLink="true">https://forum.rexygen.com/post/673</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Wed, 30 Dec 2020 06:31:01 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Tue, 29 Dec 2020 17:31:21 GMT]]></title><description><![CDATA[<p dir="auto">Trace() function has capital T. Find Rexlang documentation for details (<a href="https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html#x270-26900015">https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html#x270-26900015</a>).</p>
<p dir="auto">The start and stop of each message is generated automatically with the I2C command. In main() method, you should need to specify only i2c_bufTx array and number of bytes from this array, which will be send.  You can try following for Find example:</p>
<pre><code>i2c_bufTx[0] = 70;   //F
i2c_bufTx[1] = 105;  //i
i2c_bufTx[2] = 110;  //n
i2c_bufTx[3] = 64;   //d
i2c_write_count = 4; 
i2c_read_count = 0; //nothing to read
//Sending data via I2C
i2c_ret_fun = I2C(i2c_bus_handle, i2c_chip_address, i2c_bufTx, i2c_write_count, i2c_bufRx, i2c_read_count);
</code></pre>
<p dir="auto">The <em>init ()</em> method does not change, nor does the <em>exit()</em> method.</p>
]]></description><link>https://forum.rexygen.com/post/672</link><guid isPermaLink="true">https://forum.rexygen.com/post/672</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Tue, 29 Dec 2020 17:31:21 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Tue, 29 Dec 2020 14:39:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/133">@reitinge</a></p>
<p dir="auto">Hello again thx for your time.</p>
<p dir="auto">When I try to add trace function, I have an error in the during compiling : function 'trace' is not declared ?<br />
The example that you attach in your response, is when you request data from device. ( so we read data )</p>
<p dir="auto">But if I want to write I have this data :</p>
<p dir="auto"><img src="/assets/uploads/files/1609252540940-send.jpg" alt="send.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">So Do I have to generate an array of 5 and send Start, I2c address, write, "the wanted function", stop ?<br />
And easy test for me is to make a led blinking on the EZo chip :</p>
<p dir="auto"><img src="/assets/uploads/files/1609252629407-find.jpg" alt="find.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">If I understand their example, I need to WRITE find in the EZO and there is no returns values because it's making a led blinking.<br />
The example with ascii code return, is when I do a reading of the probe for example.<br />
My question is if I write Find, Do I have to send ( write; find ) And I alerady have the start, with open I2c and adresse, and stop or do I have to send all data ?</p>
<p dir="auto">Hope I'm enough clear ?</p>
<p dir="auto">Arnaud.</p>
]]></description><link>https://forum.rexygen.com/post/671</link><guid isPermaLink="true">https://forum.rexygen.com/post/671</guid><dc:creator><![CDATA[belgacom]]></dc:creator><pubDate>Tue, 29 Dec 2020 14:39:41 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Tue, 29 Dec 2020 11:27:34 GMT]]></title><description><![CDATA[<p dir="auto">Hi Arnaud,<br />
it's always a little bit tricky to get communication done without testing and remotely, but I'll do my best.</p>
<p dir="auto">At beginning, it is handy to enable Information messages from Rexygen block in the system log:</p>
<ol>
<li>Open RexDraw and connect to your Target device (in the menu Target -&gt; Connect or F7 key).</li>
<li>Click on Target menu again and select Configure System Log.</li>
<li>Check the Function block messages -&gt; Information box (as marked on attached figure) and hit the OK button.<br />
<img src="/assets/uploads/files/1609234813422-55921c75-19ac-40f6-84e8-c733dd528a1c-image.png" alt="55921c75-19ac-40f6-84e8-c733dd528a1c-image.png" class=" img-fluid img-markdown" /></li>
</ol>
<p dir="auto">For I2C communication you should:</p>
<ol>
<li>
<p dir="auto">Firstly, you should open communication channel on specific bus. This is done only once in the <em>init()</em> method in Rexlang with command  <code>i2c_bus_handle = OpenI2C(deviceName);</code>, where deviceName is name of the bus you want to communicate on. For example /dev/i2c-1:<br />
<code>i2c_bus_handle = OpenI2C("/dev/i2c-1");</code><br />
Please check, if communication was established successfuly. You can do that with the <em>Trace()</em> command:<br />
<code>Trace(traceID,value);</code><br />
For example:<br />
<code>Trace(1,i2c_bus_handle);</code><br />
If you run your script, you should see in the Log something like this:<br />
<img src="/assets/uploads/files/1609235037919-a719830f-3a01-42c6-a6a1-077d36422833-image.png" alt="a719830f-3a01-42c6-a6a1-077d36422833-image.png" class=" img-fluid img-markdown" /><br />
The 0001 value is the traceID and 1 (0x1) is value of i2c_bus_handle.  If i2c_bus_value is negative, something went wrong.</p>
</li>
<li>
<p dir="auto">Next step is setting address of your device (0x63 for you). This step is done only once too in the <em>init()</em> method: <code>i2c_chip_address = 0x63;</code></p>
</li>
<li>
<p dir="auto">You have to prepare data which you want to send. Use the <em>i2c_bufTx</em> array variable which is prepared in the MCP3422 example.  For example on this image<br />
<img src="/assets/uploads/files/1609240081613-ad6c2c12-0275-4551-a838-b771f624625d-image.png" alt="ad6c2c12-0275-4551-a838-b771f624625d-image.png" class=" img-fluid img-markdown" /><br />
you should set following values to i2c_bufTx array: <code>i2c_bufTx[0] = 1; i2c_bufTx[1] = 57; i2c_bufTx[2] = 46; i2c_bufTx[3] = 53; i2c_bufTx[4] = 54; i2c_bufTx[5] = 48; i2c_bufTx[6] = 0;</code><br />
Be aware, in the Example the array has length only 3 bytes and you need 7 bytes. So enlarge the array in <em>Declaration variables</em> section.</p>
</li>
<li>
<p dir="auto">Use the <em>I2C()</em> method. This method will send and receive data in one step.  You can modify the <em>main()</em> method of MCP3422 example as follow:</p>
</li>
</ol>
<pre><code>i2c_bufTx[0] = 1;
i2c_bufTx[1] = 57;
i2c_bufTx[2] = 46;
i2c_bufTx[3] = 53;
i2c_bufTx[4] = 54;
i2c_bufTx[5] = 48;
i2c_bufTx[6] = 0;

i2c_write_count = 7; // you are sending 7 bytes
i2c_read_count = 5; // you are expecting receive 5 bytes long (you probably need to modify it!!!)
//Sending data via I2C
i2c_ret_fun = I2C(i2c_bus_handle, i2c_chip_address, i2c_bufTx, i2c_write_count, i2c_bufRx, i2c_read_count);
</code></pre>
<p dir="auto">The answer of your device should be stored in the i2c_bufRx array now. Make sure you read the correct number of bytes and have a long enough array.</p>
<p dir="auto">Try some easy write/read command first and let me know, if it works!</p>
<p dir="auto">Cheers,<br />
Jan</p>
]]></description><link>https://forum.rexygen.com/post/668</link><guid isPermaLink="true">https://forum.rexygen.com/post/668</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Tue, 29 Dec 2020 11:27:34 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Mon, 28 Dec 2020 13:19:48 GMT]]></title><description><![CDATA[<p dir="auto">Hello again everybody.</p>
<p dir="auto">I just received my I2c components, and I'm really lost to understand how adapt the i2c example for my hardware.<br />
I have understand the line of the rexlang MCP3422 ADC, with i2c handle, adress, ect. But I I don't understand the communication itself.</p>
<p dir="auto">I have as example for my hardware :</p>
<p dir="auto"><img src="/assets/uploads/files/1609160902564-4.jpg" alt="4.jpg" class=" img-fluid img-markdown" /> <img src="/assets/uploads/files/1609160902570-3.jpg" alt="3.jpg" class=" img-fluid img-markdown" /> <img src="/assets/uploads/files/1609160902559-2.jpg" alt="2.jpg" class=" img-fluid img-markdown" /> <img src="/assets/uploads/files/1609160902570-1.jpg" alt="1.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">With these information I don't understand how I need to adapt the rexlang function made for MCP3422 to match the EZO read/write.</p>
<p dir="auto">If I understand well, I would say that :</p>
<p dir="auto">Start is : Open I2C;<br />
I2C adress: is 0x63;<br />
<strong><em><strong>after I don't know how to code the Read or Write function.</strong></em><br />
In the example of MCP3422, the variable are 2 array [3] for bufTx and bufRx;<br />
and we put 0x88 ( I understand why with the explanation) in the bufTx[0]<br />
and there is a write count of 1 and read of 2.<br />
I think it's this part that I need to adapt ?</strong><br />
And stop is close I2C.</p>
<p dir="auto">Does anyone can help me to understand how to modify the code of an I2C example to match my hardware.<br />
It would be a nice Christmas present for me <img src="https://forum.rexygen.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=6d51e091ff9" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";-)" alt="😉" /></p>
<p dir="auto">Thanks.</p>
<p dir="auto">Arnaud.</p>
]]></description><link>https://forum.rexygen.com/post/664</link><guid isPermaLink="true">https://forum.rexygen.com/post/664</guid><dc:creator><![CDATA[belgacom]]></dc:creator><pubDate>Mon, 28 Dec 2020 13:19:48 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Wed, 09 Dec 2020 10:07:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/133">@reitinge</a> Hello thank you for your time</p>
<p dir="auto">I appreciate . I'll have a look at these example.<br />
Thx again.</p>
<p dir="auto">Arnaud</p>
]]></description><link>https://forum.rexygen.com/post/641</link><guid isPermaLink="true">https://forum.rexygen.com/post/641</guid><dc:creator><![CDATA[belgacom]]></dc:creator><pubDate>Wed, 09 Dec 2020 10:07:23 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Tue, 08 Dec 2020 07:42:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi Arnaud,<br />
you can use the <em>Rexlang</em> block for I2C communication. As Scoobsalamander has  mentioned, there are some I2C examples that can be used as a starting point of your own implementation.  Use the <em>Start from an Example Project</em> choice in the Rexygen Studio menu and search <em>0502 Generic I2C Communication</em>.  Description of examples can be found at <a href="https://www.rexygen.com/example-projects/0502_Generic_I2C_Communication/0502_Generic_I2C_Communication.html">https://www.rexygen.com/example-projects/0502_Generic_I2C_Communication/0502_Generic_I2C_Communication.html</a>.<br />
Documentation for <em>Rexlang</em> block is here: <a href="https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html">https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html</a>.<br />
Best regards,<br />
Jan</p>
]]></description><link>https://forum.rexygen.com/post/640</link><guid isPermaLink="true">https://forum.rexygen.com/post/640</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Tue, 08 Dec 2020 07:42:01 GMT</pubDate></item><item><title><![CDATA[Reply to I2C EZO component on Tue, 08 Dec 2020 00:13:21 GMT]]></title><description><![CDATA[<p dir="auto">There are a few I2C examples in Rexygen studio.</p>
]]></description><link>https://forum.rexygen.com/post/639</link><guid isPermaLink="true">https://forum.rexygen.com/post/639</guid><dc:creator><![CDATA[Scoobsalamander]]></dc:creator><pubDate>Tue, 08 Dec 2020 00:13:21 GMT</pubDate></item></channel></rss>