<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://forum.robosavvy.com/feed.php?f=17&amp;t=7561" />

<title>RoboSavvy Forum</title>
<subtitle>Robosavvy Forum: The largest online community of Humanoid Robot Builders</subtitle>
<link href="http://forum.robosavvy.com/index.php" />
<updated>2011-11-21T07:37:26+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=17&amp;t=7561</id>
<entry>
<author><name><![CDATA[hellu]]></name></author>
<updated>2011-11-21T07:37:26+01:00</updated>
<published>2011-11-21T07:37:26+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32899#p32899</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32899#p32899"/>
<title type="html"><![CDATA[I2C]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32899#p32899"><![CDATA[
Meanwhile i have figured that out. Thanks for the support.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2529">hellu</a> — Mon Nov 21, 2011 7:37 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[roboard]]></name></author>
<updated>2011-11-21T07:06:05+01:00</updated>
<published>2011-11-21T07:06:05+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32898#p32898</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32898#p32898"/>
<title type="html"><![CDATA[I2C]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32898#p32898"><![CDATA[
Hi, hellu,<br /><br />in your code, please call i2c_Initialize() and i2c_Close() in Main():<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.Text;<br />using RoBoIO_DotNet;<br />using System.Threading;<br /><br />namespace GPS_RoBoard<br />&#123;<br />    class Program<br />    &#123;<br />        public static String d = &quot;&quot;;<br />        static void Main&#40;string&#91;&#93; args&#41;<br />        &#123;<br />            RoBoIO.roboio_SetRBVer&#40;RoBoIO.RB_110&#41;;<br /><br />            if &#40;RoBoIO.i2c_Initialize&#40;RoBoIO.I2CIRQ_DISABLE&#41;&#41;<br />            &#123;<br />                RoBoIO.i2c0_SetSpeed&#40;RoBoIO.I2CMODE_AUTO, 400000&#41;;<br /><br />            while &#40;true&#41;<br />            &#123;<br />                for &#40;int i = 1; i &lt;= 27; i++&#41; citiregps&#40;&#41;;<br />                Console.WriteLine&#40;&#41;;<br />                d = &quot;&quot;;<br />                Thread.Sleep&#40;100&#41;;<br />            &#125;<br /><br />            &#125;<br /><br />            RoBoIO.i2c_Close&#40;&#41;;<br />        &#125;<br />        static void citiregps&#40;&#41;<br />        &#123;<br />                RoBoIO.i2c0master_StartN&#40;0x4E, RoBoIO.I2C_READ,1&#41;;<br />                Console.Write&#40;&#40;char&#41;RoBoIO.i2c0master_ReadN&#40;&#41;&#41;;                <br />        &#125;<br />    &#125;<br />&#125;<br /></code></dd></dl><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1542">roboard</a> — Mon Nov 21, 2011 7:06 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hellu]]></name></author>
<updated>2011-11-08T22:37:32+01:00</updated>
<published>2011-11-08T22:37:32+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32774#p32774</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32774#p32774"/>
<title type="html"><![CDATA[I2C]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32774#p32774"><![CDATA[
Another question : my rb110 is hooked up on the i2c with an arduino which has a gps on it and i receive from my arduino a 27 length char array on i2c in like 15 seconds. Is that normal? <br /><br />Here is the code from my rb110<br /><dl class="codebox"><dt>Code: </dt><dd><code>using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.Text;<br />using RoBoIO_DotNet;<br />using System.Threading;<br /><br />namespace GPS_RoBoard<br />&#123;<br />    class Program<br />    &#123;<br />        public static String d = &quot;&quot;;<br />        static void Main&#40;string&#91;&#93; args&#41;<br />        &#123;<br />            RoBoIO.roboio_SetRBVer&#40;RoBoIO.RB_110&#41;;<br />            while &#40;true&#41;<br />            &#123;<br />                for &#40;int i = 1; i &lt;= 27; i++&#41; citiregps&#40;&#41;;<br />                Console.WriteLine&#40;&#41;;<br />                d = &quot;&quot;;<br />                Thread.Sleep&#40;100&#41;;<br />            &#125;<br /><br />        &#125;<br />        static void citiregps&#40;&#41;<br />        &#123;<br />            if &#40;RoBoIO.i2c_Initialize&#40;RoBoIO.I2CIRQ_DISABLE&#41;&#41;<br />            &#123;<br />                RoBoIO.i2c0_SetSpeed&#40;RoBoIO.I2CMODE_AUTO, 400000&#41;;<br />                RoBoIO.i2c0master_StartN&#40;0x4E, RoBoIO.I2C_READ,1&#41;;<br />                Console.Write&#40;&#40;char&#41;RoBoIO.i2c0master_ReadN&#40;&#41;&#41;;<br />                <br />            &#125;<br />            else &#123; Console.WriteLine&#40;&quot;Nu merge i2c &quot; + RoBoIO.roboio_GetErrMsg&#40;&#41;&#41;; &#125;<br />            RoBoIO.i2c_Close&#40;&#41;;<br />        &#125;<br />    &#125;<br />&#125;<br /></code></dd></dl><br /><br />and here is my arduino code <br /><dl class="codebox"><dt>Code: </dt><dd><code>#include &lt;Wire&gt;<br /><br /><br />#include &quot;LB_GPS.h&quot;<br /><br />void setup&#40;&#41;&#123;<br />  //setup for Serial port<br />  Serial.begin&#40;9600&#41;;<br />  Wire.begin&#40;0x4E&#41;;<br />  Wire.onRequest&#40;trimitere&#41;;<br />  // GPS warm-up time<br />  delay&#40;1000&#41;;<br />  <br />  // configure NMEA sentences to show only GGA sentence<br />  // it is anyway the one coming by default<br />  GPS.setSentences&#40;GPGGA&#41;;        <br />  delay&#40;100&#41;;<br />  <br />  // command initializing the GPS, by default it is preconfigured to be the <br />  // weather station at central Malmo, Sweden, April 8th, 2009, 6:56AM<br />  GPS.init&#40;&#41;;    <br /><br />  <br />  // done!<br />  Serial.println&#40;&quot; done!&quot;&#41;;<br />&#125;<br />int i=0;<br />void loop&#40;&#41;&#123;<br />char v&#91;6&#93;;<br />  // Part 1: print a GPGGA sentence raw as it comes from the GPS<br />  <br />  // print the raw data string arriving from the GPS <br />  GPS.getRaw&#40;100&#41;;<br />  GPS.getLocation&#40;&#41;;<br />  GPS.getSpeed&#40;&#41;;<br />  //fmtDouble&#40;GPS.speed, 2, v,7&#41;;<br />  //for&#40;int i=0;i&lt;=3;i++&#41;GPS.coordinates+=v&#91;i&#93;;<br />  //for&#40;int i=0;i&lt;=23;i++&#41;Serial.print&#40;GPS.coordinates&#91;i&#93;&#41;;<br />  //Serial.println&#40;&#41;;<br />  GPS.coordinates&#91;24&#93;=v&#91;0&#93;;<br />  GPS.coordinates&#91;25&#93;=v&#91;1&#93;;<br />  GPS.coordinates&#91;26&#93;=v&#91;2&#93;;<br />  GPS.coordinates&#91;27&#93;=v&#91;3&#93;;<br />  //for&#40;int i=0;i&lt;=27;i++&#41;Serial.print&#40;GPS.coordinates&#91;i&#93;&#41;;<br />  //Serial.println&#40;&#41;;<br /><br />&#125;<br /><br />void trimitere&#40;&#41;<br />&#123;<br />  if&#40;i==27&#41;i=0;<br />  Wire.send&#40;GPS.coordinates&#91;i&#93;&#41;;<br />  Serial.print&#40;GPS.coordinates&#91;i&#93;&#41;;<br />  i++;<br />  <br />&#125;</code></dd></dl><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2529">hellu</a> — Tue Nov 08, 2011 10:37 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[roboard]]></name></author>
<updated>2011-10-31T05:13:33+01:00</updated>
<published>2011-10-31T05:13:33+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32690#p32690</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32690#p32690"/>
<title type="html"><![CDATA[Re: I2C]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32690#p32690"><![CDATA[
Hi, <br /><br />in multi-threading programs, you need to sync the execution of RoBoIO functions using, e.g., mutex/semaphore:<br /><br /><!-- m --><a class="postlink" href="http://en.wikipedia.org/wiki/Mutual_exclusion">http://en.wikipedia.org/wiki/Mutual_exclusion</a><!-- m --><br /><!-- m --><a class="postlink" href="http://en.wikipedia.org/wiki/Semaphore_(programming">http://en.wikipedia.org/wiki/Semaphore_(programming</a><!-- m -->)<br /><!-- m --><a class="postlink" href="http://en.wikipedia.org/wiki/Critical_section">http://en.wikipedia.org/wiki/Critical_section</a><!-- m --><br /><br />for example, in two threads you can write:<br /><br />Thread 1 {<br /><br />    enter critical section;<br />        call RoBoIO I2C functions (i2c_Send(), i2c_SensorRead(), ...);<br />    exit critical section;<br /><br />}<br /><br />Thread 2 {<br /><br />    enter critical section;<br />        call RoBoIO I2C functions (i2c_Send(), i2c_SensorRead(), ...);<br />    exit critical section;<br /><br />}<br /><br />Note that you should always execute a complete I2C communication (START-&gt;R/W-&gt;R/W-&gt;...-&gt;STOP) within the critical section.<br /><br /><img src="http://forum.robosavvy.com/images/smilies/icon_smile.gif" alt=":)" title="Smile" /><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1542">roboard</a> — Mon Oct 31, 2011 5:13 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hellu]]></name></author>
<updated>2011-10-30T21:39:59+01:00</updated>
<published>2011-10-30T21:39:59+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32689#p32689</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32689#p32689"/>
<title type="html"><![CDATA[I2C]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7561&amp;p=32689#p32689"><![CDATA[
Hello! I am currently working on a robot which has it`s core based on the RB110 and it`s full of i2c devices and my biggest problem is gathering the data. As i observed i cannot make 2 threads and to read from 2 sensors at once on i2c. Can that be made or it`s technically impossible? <br />Best regards, Vlad !<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2529">hellu</a> — Sun Oct 30, 2011 9:39 pm</p><hr />
]]></content>
</entry>
</feed>