<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'C and embedded' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'C and embedded' posted on the 'Embedded / RTOS' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Thu, 09 Feb 2012 08:58:37 -0800</pubDate>
    <lastBuildDate>Thu, 09 Feb 2012 08:58:37 -0800</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>C and embedded</title>
      <link>http://www.programmersheaven.com/mb/embedded/408742/408742/c-and-embedded/</link>
      <description>#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;conio.h&amp;gt;&lt;br /&gt;
#define RW 0&lt;br /&gt;
#define write() RW|=1&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  printf("Before \n%d",RW);&lt;br /&gt;
 write();&lt;br /&gt;
printf("After calling WRITE \n%d",RW);&lt;br /&gt;
  getch();&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Hi all&lt;br /&gt;
&lt;br /&gt;
Iam new to embedded programming with C &lt;br /&gt;
In the above program Iam trying to modify a macro with #define  &lt;br /&gt;
Its not working &lt;br /&gt;
Please tell me where I went wrong</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/embedded/408742/408742/c-and-embedded/</guid>
      <pubDate>Tue, 03 Nov 2009 00:02:41 -0800</pubDate>
      <category>Embedded / RTOS</category>
    </item>
    <item>
      <title>Re: C and embedded</title>
      <link>http://www.programmersheaven.com/mb/embedded/408742/408876/re-c-and-embedded/#408876</link>
      <description>hi,&lt;br /&gt;
  Because RW is a macro define, its value can't be changed. In your program, define write() with RW |= 1, and when this program is compiled, write() will be replaced with 0 |= 1, it is impossible.&lt;br /&gt;
  if you want to change the value of RW, you can use this:&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
static unsigned int RW = 0;&lt;br /&gt;
&lt;br /&gt;
__inline write()&lt;br /&gt;
{&lt;br /&gt;
        RW |= 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
        printf("Before \n %d", RW);&lt;br /&gt;
        write();&lt;br /&gt;
        printf("After calling WRITE \n %d", RW);&lt;br /&gt;
        getchar();&lt;br /&gt;
&lt;br /&gt;
        return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  &lt;a href="http://www.coocox.org/CooCox_Builder.htm"&gt;http://www.coocox.org/CooCox_Builder.htm&lt;/a&gt;&lt;br /&gt;
&lt;span style="text-decoration: underline;"&gt;a completely free and highly automatical integrated development environment for the application based on ARM Cortex M3&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/embedded/408742/408876/re-c-and-embedded/#408876</guid>
      <pubDate>Thu, 05 Nov 2009 06:24:46 -0800</pubDate>
      <category>Embedded / RTOS</category>
    </item>
  </channel>
</rss>
