<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>For loop problems, two deep</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/15331/for-loop-problems-two-deep</link><description> In this program, I have a function where I have two for loops. Here&amp;#39;s an example: 
 
&amp;quot;for (j = 0; j &amp;lt; 3; j++) 
{ 
 for (i = 0; i &amp;lt; 8; i++) 
 { 
 time = 1612 - (4 * i); 
 wait (); 
 } 
 if (j &amp;lt; 2) 
 { 
 time = 1588; 
 wait (); 
 while (incoming); 
 }</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: For loop problems, two deep</title><link>https://community.arm.com/thread/121873?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2002 23:16:25 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fcdc7a33-a460-4112-a6f7-123a2fda759a</guid><dc:creator>David Goben</dc:creator><description>&lt;p&gt;I had a stack overflow that Keil does not account for.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: For loop problems, two deep</title><link>https://community.arm.com/thread/110161?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2002 23:00:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9adcd946-3ba9-457f-a821-84fba542baaf</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;What was the problem?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: For loop problems, two deep</title><link>https://community.arm.com/thread/84350?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2002 21:14:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b0e66de4-ef12-4f57-9c80-4417be8c71d9</guid><dc:creator>David Goben</dc:creator><description>&lt;p&gt;Nevermind, I got it working now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: For loop problems, two deep</title><link>https://community.arm.com/thread/54848?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2002 12:36:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:144e2306-857c-4772-90b4-2926793ce6c7</guid><dc:creator>David Goben</dc:creator><description>&lt;p&gt;The loop is suppose to gather information from P3.2 at a certain baud rate.  The wait() function uses timer0 to delay enough time so the next bit can be picked up off of the line.  I know it&amp;#39;s in this loop because I altered the code to have some LEDs turn off right before and right after this loop.  They turn off before, but if it&amp;#39;s after this loop, then they don&amp;#39;t turn off, like they&amp;#39;re getting stuck in it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: For loop problems, two deep</title><link>https://community.arm.com/thread/39463?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2002 11:38:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:db8f52d7-335f-4e02-b04b-4e93a5827e62</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;How come you know it&amp;#39;s stuck &amp;quot;somewhere in this loop&amp;quot;, but not where exactly that is?&lt;br /&gt;
&lt;br /&gt;
And what about wait()? What is it, and why do you modify &amp;quot;time&amp;quot; before each call of it? Does it use &amp;quot;time&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: For loop problems, two deep</title><link>https://community.arm.com/thread/54850?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2002 23:18:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e876f573-a9ab-49ed-a09b-ac9cc3032b64</guid><dc:creator>David Goben</dc:creator><description>&lt;p&gt;Allow me to correct myself.  I have everything initialized.  i, j, and time are all ints.  The &amp;quot;while (incoming)&amp;quot; is for a pin.  I have input coming in on P3.2 (which is incoming) and while that is high, the program waits until it is turned low again from an outside source.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: For loop problems, two deep</title><link>https://community.arm.com/thread/39461?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2002 23:15:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b79266ce-fe7a-47d0-9eed-6a0a424ea94c</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;Well, since you didn&amp;#39;t specify the data types for i and j, or the wait function, or how time is used (and its data type), and what incoming does and is set to...&lt;br /&gt;
&lt;br /&gt;
My guess is that it is hanging in &lt;b&gt;while(incoming)&lt;/b&gt;.  But, that&amp;#39;s just a WAG and is probably not correct.&lt;br /&gt;
&lt;br /&gt;
If it works under simulation then there&amp;#39;s something in your hardware that you must not be simulating.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>