<?xml version="1.0" encoding="utf-8"?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rss  version="2.0">
				<channel>
				<title>8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes : Forum / topic</title>
				<link>http://www.8051projects.net/</link>
				<description>Learn to make simple microcontroller projects, pic, 8051, avr and arm projects. download 8051 projects, tutorials, libraries, sample codes. join the microcontroller discussion forum and ask doubts regarding electronics. the best source for 8051 over internet.</description>

<language>en-gb</language>
				<copyright>2008 Rickey's World</copyright>
				<managingEditor>contact@nospam.com (Ajay Bhargav)</managingEditor>
				<webMaster>contact@nospam.com (Ajay Bhargav)</webMaster>
				<pubDate>Thu, 08 Jan 2009 22:30:24 -0800</pubDate>
				<lastBuildDate>Thu, 08 Jan 2009 22:30:24 -0800</lastBuildDate>
				<docs>http://backend.userland.com/rss</docs>
				<generator>e107 (http://e107.org)</generator>
				<ttl>60</ttl>
				<textInput>
				<title>Search</title>
				<description>Search 8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes</description>
				<name>query</name>
				<link>http://www.8051projects.net/search.php</link>
				</textInput>
						<item>
						<title>return 0 vs return 1</title>
<link>http://www.8051projects.net/forum-t11647.html</link>
<description><![CDATA[Does anyone knows what does return 1 does?]]></description>
<pubDate>Mon, 11 Aug 2008 08:49:15 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t11647.html</guid>
</item>
						<item>
						<title>Re: return 0 vs return 1</title>
<link>http://www.8051projects.net/forum-t11647.html</link>
<description><![CDATA[suppose u have a fun say add<br /><br /><br />you can use return as follows..<br /><div class='code_box'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><br /><span style="color: #993333;">int</span> add<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;<br />main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br /><span style="color: #66cc66;">&#123;</span><br /><a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;sum of 2 and 3 is %d &quot;</span>,add<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #66cc66;">&#125;</span><br /><span style="color: #993333;">int</span> add<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span><br /><span style="color: #66cc66;">&#123;</span><br /><span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">5</span>;<br /><span style="color: #66cc66;">&#125;</span></div></div><br /><br /><br />thus we can say return 1 returns a 1  <img src='http://www.8051projects.net/e107_images/emotes/yahoo/1.gif' alt='' style='vertical-align:middle; border:0' />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Mon, 11 Aug 2008 12:03:18 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t11647.html</guid>
</item>
						<item>
						<title>Re: return 0 vs return 1</title>
<link>http://www.8051projects.net/forum-t11647.html</link>
<description><![CDATA[In programming language, return 0 and return 1 are used to return the status of function.<br /><br />return 0 <- return false<br />return 1 <- return true<br /><br />ex.<br /><br /><div class='code_box'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><span style="color: #993333;">int</span> greater <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> a, <span style="color: #993333;">int</span> b<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&nbsp; &nbsp;<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>a&gt;b<span style="color: #66cc66;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span>;<br />&nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;<br /><span style="color: #66cc66;">&#125;</span><br /><br /><span style="color: #993333;">void</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>greater<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;its greater&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;its smaller&quot;</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #66cc66;">&#125;</span><br />&nbsp;</div></div>]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 12 Aug 2008 04:31:28 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t11647.html</guid>
</item>
						<item>
						<title>Re: return 0 vs return 1</title>
<link>http://www.8051projects.net/forum-t11647.html</link>
<description><![CDATA[<strong class='bbcode bold'>The return statement</strong><br /><br />A return statement ends the processing of the current function and returns control to the caller of the function.<br /><br /><div class='code_box'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><br />&gt;&gt;-return--+--------------------------+--;---------------------&gt;&lt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'-+---+--expression--+---+-'</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'-(-'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'-)-'</span><br />&nbsp;</div></div> <br /><br />A value-returning function should include a return statement, containing an expression. C only If an expression is not given on a return statement in a function declared with a non-void return type, the compiler issues a warning message. C++ If an expression is not given on a return statement in a function declared with a non-void return type, the compiler issues an error message.<br /><br />If the data type of the expression is different from the function return type, conversion of the return value takes place as if the value of the expression were assigned to an object with the same function return type.<br /><br />For a function of return type void, a return statement is not strictly necessary. If the end of such a function is reached without encountering a return statement, control is passed to the caller as if a return statement without an expression were encountered. In other words, an implicit return takes place upon completion of the final statement, and control automatically returns to the calling function. C++ If a return statement is used, it must not contain an expression.<br />Examples of return statements<br /><br />The following are examples of return statements:<br /><br /><div class='code_box'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><br /><span style="color: #b1b100;">return</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">/* Returns no value &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br /><span style="color: #b1b100;">return</span> result; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Returns the value of result */</span><br /><span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">/* Returns the value 1 &nbsp; &nbsp; &nbsp; &nbsp; */</span><br /><span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span>x * x<span style="color: #66cc66;">&#41;</span>; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">/* Returns the value of x * x &nbsp;*/</span><br />&nbsp;</div></div><br /><br />The following function searches through an array of integers to determine if a match exists for the variable number. If a match exists, the function match returns the value of i. If a match does not exist, the function match returns the value -1 (negative one).<br /><br /><div class='code_box'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><br /><span style="color: #993333;">int</span> match<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> number, <span style="color: #993333;">int</span> array<span style="color: #66cc66;">&#91;</span> <span style="color: #66cc66;">&#93;</span>, <span style="color: #993333;">int</span> n<span style="color: #66cc66;">&#41;</span><br /><span style="color: #66cc66;">&#123;</span><br />&nbsp; &nbsp;<span style="color: #993333;">int</span> i;<br /><br />&nbsp; &nbsp;<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">0</span>; i &lt; n; i++<span style="color: #66cc66;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>number == array<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>;<br />&nbsp; &nbsp;<span style="color: #b1b100;">return</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #66cc66;">&#125;</span><br />&nbsp;</div></div><br /><br />A function can contain multiple return statements. For example:<br /><br /><div class='code_box'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><br /><span style="color: #993333;">void</span> copy<span style="color: #66cc66;">&#40;</span> <span style="color: #993333;">int</span> *a, <span style="color: #993333;">int</span> *b, <span style="color: #993333;">int</span> c<span style="color: #66cc66;">&#41;</span><br /><span style="color: #66cc66;">&#123;</span><br />&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">/* Copy array a into b, assuming both arrays are the same size */</span><br /><br />&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!a || !b<span style="color: #66cc66;">&#41;</span> &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* if either pointer is 0, return */</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;<br /><br />&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>a == b<span style="color: #66cc66;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* if both parameters refer */</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">/* &nbsp; &nbsp;to same array, return */</span><br /><br />&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>c == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* nothing to copy */</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;<br /><br />&nbsp; &nbsp;<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;">0</span>; i &lt; c; ++i;<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">/* do the copying */</span><br />&nbsp; &nbsp; &nbsp; b<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = a<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">/* implicit return */</span><br /><span style="color: #66cc66;">&#125;</span><br />&nbsp;</div></div><br /><br />In this example, the return statement is used to cause a premature termination of the function, similar to a break statement.<br /><br />An expression appearing in a return statement is converted to the return type of the function in which the statement appears. If no implicit conversion is possible, the return statement is invalid.<br /><br /><br /><em class='bbcode italic'>Source: XL C/C++ V8.0 IBM</em>]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 12 Aug 2008 04:54:27 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t11647.html</guid>
</item>
						<item>
						<title>Re: return 0 vs return 1</title>
<link>http://www.8051projects.net/forum-t11647.html</link>
<description><![CDATA[Another interesting application of the return function is when it is used in the main() function. Here the return (value) returns the value to the operating system which is used by the operating system for its own use (especially when unix operating system is used.)<br />but this feature is not applicable in our real time embedded system where the control never reaches the return statement.<br /><br />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 12 Aug 2008 06:42:35 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t11647.html</guid>
</item>
						<item>
						<title>Re: return 0 vs return 1</title>
<link>http://www.8051projects.net/forum-t11647.html</link>
<description><![CDATA[very clear <img src='http://www.8051projects.net/e107_images/emotes/yahoo/1.gif' alt='' style='vertical-align:middle; border:0' />  no wonder my lecturer told me India has a lot of good programmers.. Thanks]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 12 Aug 2008 09:17:56 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t11647.html</guid>
</item>
						<item>
						<title>Re: return 0 vs return 1</title>
<link>http://www.8051projects.net/forum-t11647.html</link>
<description><![CDATA[void copy( int *a, int *b, int c)<br />{<br />   /* Copy array a into b, assuming both arrays are the same size */<br /><br />   if (!a || !b)       /* if either pointer is 0, return */<br />      return;<br /><br />   if (a == b)         /* if both parameters refer */<br />      return;          /*    to same array, return */<br /><br />   if (c == 0)         /* nothing to copy */<br />      return;<br /><br />   for (int i = 0; i &lt; c; ++i;) /* do the copying */<br />      b[i]<strong class='bbcode bold'> = a[1];<br />                       /* implicit return */<br />}<br /> </strong><br /><br />Yoyo, Mr say2paul... what does the return does in this routine? Does it mean return to the main function?<br />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 12 Aug 2008 09:27:41 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t11647.html</guid>
</item>
						<item>
						<title>Re: return 0 vs return 1</title>
<link>http://www.8051projects.net/forum-t11647.html</link>
<description><![CDATA[hi nismo,<br />well, if u have called the function copy ( ) from the main function, then it will return back to the main function. but if the function was called by another function say abc() then the control will return to that function.<br /><br /><strong class='bbcode bold'>case1: calling from main function<br /></strong><br />main()<br />{<br />.<br />copy (....);<br />.   &lt;-------   control will return here<br />.<br />}<br /><br /><br /><strong class='bbcode bold'>case2: calling from another function</strong><br /><br />main()<br />{<br />.<br />.<br />abc(...);<br />.<br />.<br />}<br /><br />abc()<br />{<br />.<br />.<br />copy();<br />.       &lt;------   control will return here<br />.<br />}<br /><br />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 12 Aug 2008 12:01:51 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t11647.html</guid>
</item>
				</channel>
				</rss>